import requests url = "http://127.0.0.1:8000" # 替换成实际的 API 地址 data = { "prompt": "你好", # 下面是请求体中的数据内容 "history": [] } response = requests.post(url, json=data) if response.status_code == 200: result = response.json() print(result.get("response")) print(result.get("history")) else: print("请求失败,状态码:", response.status_code)