mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 05:29:12 +00:00
Handle empty chat history returned by API to chat.html on web interface
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user