QAnything
QAnything copied to clipboard
调用删除知识库的API 系统出错
是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?
- [X] 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions
该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?
- [X] 我已经搜索过FAQ | I have searched FAQ
当前行为 | Current Behavior
通过API 创建的知识库,然后通过API删除。删除API时,返回:request fail[500]: {"description":"Internal Server Error","status":500,"message":"The application encountered an unexpected error and could not continue."}
期望行为 | Expected Behavior
删除成功
运行环境 | Environment
- OS:
- NVIDIA Driver:
- CUDA:
- docker:
- docker-compose:
- NVIDIA GPU:
- NVIDIA GPU Memory:
QAnything日志 | QAnything logs
INFO:debug_logger:delete_knowledge_base hstest [2024-04-18 16:40:26 +0800] [1124] [ERROR] Exception occurred while handling uri: 'http://172.32.0.3:8777/api/local_doc_qa/delete_knowledge_base' Traceback (most recent call last): File "handle_request", line 97, in handle_request File "/workspace/qanything_local/qanything_kernel/qanything_server/handler.py", line 200, in delete_knowledge_base 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 135, in check_kb_exist placeholders = ','.join(['%s'] * len(kb_ids)) TypeError: object of type 'NoneType' has no len() ERROR:sanic.error:Exception occurred while handling uri: 'http://172.32.0.3:8777/api/local_doc_qa/delete_knowledge_base' Traceback (most recent call last): File "handle_request", line 97, in handle_request File "/workspace/qanything_local/qanything_kernel/qanything_server/handler.py", line 200, in delete_knowledge_base 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 135, in check_kb_exist placeholders = ','.join(['%s'] * len(kb_ids)) TypeError: object of type 'NoneType' has no len()
复现方法 | Steps To Reproduce
1、调用API创建知识库。 2、调用API上传文件到知识库。 3、删除知识库中的文件。 4、删除知识库。
备注 | Anything else?
我也需到同样情况,后来是在发现是kb_ids类型的问题 你debug一下,看有没有取到知识库ID,也就是kb_ids的值 如果它是字串,就转为list if isinstance(kb_ids, str): kb_ids = eval(kb_ids)
local_doc_chat时也遇到这个情况,kb_ids需要是array,不能是string