mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Check before updating "chat" key in meta_log in chat history API endpoint
This commit is contained in:
parent
4e7812fe55
commit
6707ccc463
1 changed files with 2 additions and 2 deletions
|
@ -111,10 +111,10 @@ def chat_history(
|
|||
)
|
||||
|
||||
# Get latest N messages if N > 0
|
||||
if n > 0:
|
||||
if n > 0 and meta_log.get("chat"):
|
||||
meta_log["chat"] = meta_log["chat"][-n:]
|
||||
# Else return all messages except latest N
|
||||
elif n < 0:
|
||||
elif n < 0 and meta_log.get("chat"):
|
||||
meta_log["chat"] = meta_log["chat"][:n]
|
||||
|
||||
update_telemetry_state(
|
||||
|
|
Loading…
Reference in a new issue