Skip to content
New issue

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

无法调用问答api #81

Open
17Reset opened this issue Jan 29, 2024 · 3 comments
Open

无法调用问答api #81

17Reset opened this issue Jan 29, 2024 · 3 comments

Comments

@17Reset
Copy link

17Reset commented Jan 29, 2024

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
Copy link
Collaborator

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

@17Reset
Copy link
Author

17Reset commented Jan 30, 2024

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
Copy link

lim0513 commented Feb 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants