netease-youdao / QAnything

Question and Answer based on Anything.
https://qanything.ai
GNU Affero General Public License v3.0
11.72k stars 1.13k forks source link

无法调用问答api #81

Open 17Reset opened 8 months ago

17Reset commented 8 months ago

def chat(prompt): """ 问答(POST) """ url = 'http://192.168.18.165:8777/api/local_doc_qa/local_doc_chat' data = { 'user_id': 'zzp', 'kb_ids': ["KB87a14388cc37435694376d038820b1b7"], 'question': f'{prompt}', 'history': [] } response = requests.post(url, data=data) print(response.text)

⚠️ 500 — Internal Server Error

============================== The application encountered an unexpected error and could not continue.

successren commented 8 months ago

Please paste the content of api.log here, I will help you debug.

17Reset commented 8 months ago

INFO:debug_logger:local_doc_chat zzp WARNING:root:missing rerank in request INFO:debug_logger:rerank True WARNING:root:missing history in request INFO:debug_logger:history: [] INFO:debug_logger:question: git命令如何生成公钥 INFO:debug_logger:kb_ids: KB87a14388cc37435694376d038820b1b7 INFO:debug_logger:user_id: zzp [2024-01-29 17:09:45 +0800] [1785] [ERROR] Exception occurred while handling uri: 'http://192.168.18.165:8777/api/local_doc_qa/local_doc_chat' Traceback (most recent call last): File "handle_request", line 97, in handle_request File "/workspace/qanything_local/qanything_kernel/qanything_server/handler.py", line 335, in local_doc_chat not_exist_kb_ids = local_doc_qa.milvus_summary.check_kb_exist(user_id, kb_ids) File "/workspace/qanything_local/qanything_kernel/connector/database/mysql/mysql_client.py", line 138, in check_kb_exist query_params = kb_ids + [user_id] TypeError: can only concatenate str (not "list") to str ERROR:sanic.error:Exception occurred while handling uri: 'http://192.168.18.165:8777/api/local_doc_qa/local_doc_chat' Traceback (most recent call last): File "handle_request", line 97, in handle_request File "/workspace/qanything_local/qanything_kernel/qanything_server/handler.py", line 335, in local_doc_chat not_exist_kb_ids = local_doc_qa.milvus_summary.check_kb_exist(user_id, kb_ids) File "/workspace/qanything_local/qanything_kernel/connector/database/mysql/mysql_client.py", line 138, in check_kb_exist query_params = kb_ids + [user_id] TypeError: can only concatenate str (not "list") to str

lim0513 commented 8 months ago

response = requests.post(url, data=data) 这里改改:requests.post(url,data=json.dumps(data))