first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import httpx
|
||||
|
||||
content = "简单讲解一下mvc模型上下文"
|
||||
key = "sk-mepewzmlykchrjosberepdvvbnrjbhoamewefnckokitveqf"
|
||||
model = "THUDM/GLM-4.1V-9B-Thinking"
|
||||
url = "https://api.siliconflow.cn/v1/chat/completions"
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = {
|
||||
"model": model,
|
||||
"messages": [{"role": "user", "content": content}]
|
||||
}
|
||||
|
||||
with httpx.Client(timeout=999) as client:
|
||||
response = client.post(url, headers=headers, json=payload)
|
||||
if response.json()["choices"][0]["message"]["content"]:
|
||||
content = response.json()["choices"][0]["message"]["content"]
|
||||
content = content.split("\n")
|
||||
for i in content:
|
||||
print(i)
|
||||
else:
|
||||
print(response.json())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user