diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index 9af00053..5b8910bb 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -114,7 +114,7 @@ def chat_history( if n > 0: meta_log["chat"] = meta_log["chat"][-n:] # Else return all messages except latest N - else: + elif n < 0: meta_log["chat"] = meta_log["chat"][:n] update_telemetry_state(