From 7fab8d6586f07ad1b45e7dc8889f58916f24012c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 15 Apr 2024 19:05:10 +0530 Subject: [PATCH] Only use chat messages count in history API endpoint when set by client --- src/khoj/routers/api_chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(