duck2api / call_demo /hg_fd.py
sanbo
update sth. at 2024-12-07 23:55:22
d86a84e
raw
history blame contribute delete
699 Bytes
import requests
import json
# url = 'https://p.till.us.kg/till/https/sanbo1200-duck2api.hf.space/completions'
url = 'https://2.897653.xyz/aaabbbccc/https/sanbo1200-duck2api.hf.space/completions'
headers = {
'Content-Type': 'application/json'
}
data = {
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "你是一个辅助机器人"},
{"role": "user", "content": "你的知识库最后什么日期"}
],
"stream": False
}
response = requests.post(url, headers=headers, data=json.dumps(data), stream=True)
response.encoding = 'utf-8'
# 打印返回的数据流
for line in response.iter_lines():
if line:
print(line.decode('utf-8'))