We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
例行检查
你的版本
问题描述, 日志截图,配置文件等 我在本地安装部署了fastgpt 4.8.20(docker方式部署),并在web界面上成功和指定的知识库对话,现在我想要尝试用api的方式和指定的知识库对话,我在文档里找到了和fastgpt对话的方式( https://doc.tryfastgpt.ai/docs/development/openapi/chat/ ),但这里的对话是没有指定知识库的,请问,如何在对话的时候指定知识库呢?
复现步骤 执行以下代码:
def chat_with_fastgpt(): # 设置请求的URL url = "http://localhost:3000/api/v1/chat/completions" # 设置请求头 headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } # 设置请求体 data = { "chatId": "my_chatId", "stream": False, "detail": False, "responseChatItemId": "my_responseChatItemId", "variables": { "uid": "asdfadsfasfd2323", "name": "张三" }, "messages": [ { "role": "user", "content": "病人表 Cehr_Patient 里一共有多少个字段,详细列出每个字段的字段名和中文名" } ] } # 发送POST请求 response = requests.post(url, headers=headers, json=data) # 检查响应状态码并输出响应内容 if response.status_code == 200: # 格式化输出响应内容 formatted_json = json.dumps(response.json(), indent=4, ensure_ascii=False) print(formatted_json) else: print(f"请求失败,状态码:{response.status_code}") print(response.text) if __name__ == '__main__': chat_with_fastgpt()
预期结果 和指定的知识库对话
相关截图
The text was updated successfully, but these errors were encountered:
api_key用的是创建好的应用的key吗
Sorry, something went wrong.
是的,是app的key,不是那个通用的key,用通用的key会报错
No branches or pull requests
例行检查
你的版本
问题描述, 日志截图,配置文件等
我在本地安装部署了fastgpt 4.8.20(docker方式部署),并在web界面上成功和指定的知识库对话,现在我想要尝试用api的方式和指定的知识库对话,我在文档里找到了和fastgpt对话的方式( https://doc.tryfastgpt.ai/docs/development/openapi/chat/ ),但这里的对话是没有指定知识库的,请问,如何在对话的时候指定知识库呢?
复现步骤
执行以下代码:
预期结果
和指定的知识库对话
相关截图
The text was updated successfully, but these errors were encountered: