Handle empty chat history returned by API to chat.html on web interface

This commit is contained in:
Debanjum Singh Solanky 2023-01-14 15:15:36 -03:00
parent 721bbbe15c
commit d02ba325aa

View file

@ -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)