mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Handle empty chat history returned by API to chat.html on web interface
This commit is contained in:
parent
721bbbe15c
commit
d02ba325aa
1 changed files with 4 additions and 1 deletions
|
@ -81,7 +81,10 @@ def chat(q: Optional[str]=None):
|
|||
|
||||
# If user query is empty, return chat history
|
||||
if not q:
|
||||
return {'status': 'ok', 'response': meta_log["chat"]}
|
||||
if meta_log.get('chat'):
|
||||
return {'status': 'ok', 'response': meta_log["chat"]}
|
||||
else:
|
||||
return {'status': 'ok', 'response': []}
|
||||
|
||||
# Converse with OpenAI GPT
|
||||
metadata = understand(q, model=model, api_key=api_key, verbose=state.verbose)
|
||||
|
|
Loading…
Add table
Reference in a new issue