NewBreaker's picture
添加了Api的调用
057dc4f
raw
history blame
431 Bytes
import requests
url = "http://127.0.0.1:8000/stream" # 替换成实际的 API 地址
data = {
"prompt": "你好", # 下面是请求体中的数据内容
"history": []
}
response = requests.get(url, json=data,stream=True)
if response.status_code == 200:
for line in response.iter_lines():
if line:
print(line.decode())
else:
print("请求失败,状态码:", response.status_code)