From 6d68b89ea0ff723563e4bf11f73fd594b6534c4e Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Jan 2025 15:42:47 +0000 Subject: [PATCH] fix: history bug on 2nd message --- application/retriever/brave_search.py | 2 +- application/retriever/classic_rag.py | 2 +- application/retriever/duckduck_search.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/retriever/brave_search.py b/application/retriever/brave_search.py index efcae8ab..08b16bc0 100644 --- a/application/retriever/brave_search.py +++ b/application/retriever/brave_search.py @@ -71,7 +71,7 @@ class BraveRetSearch(BaseRetriever): for doc in docs: yield {"source": doc} - if len(self.chat_history) > 1: + if len(self.chat_history) > 0: for i in self.chat_history: if "prompt" in i and "response" in i: messages_combine.append({"role": "user", "content": i["prompt"]}) diff --git a/application/retriever/classic_rag.py b/application/retriever/classic_rag.py index b3735a96..d4c7d755 100644 --- a/application/retriever/classic_rag.py +++ b/application/retriever/classic_rag.py @@ -71,7 +71,7 @@ class ClassicRAG(BaseRetriever): for doc in docs: yield {"source": doc} - if len(self.chat_history) > 1: + if len(self.chat_history) > 0: for i in self.chat_history: if "prompt" in i and "response" in i: messages_combine.append({"role": "user", "content": i["prompt"]}) diff --git a/application/retriever/duckduck_search.py b/application/retriever/duckduck_search.py index 321c6fd9..c6386410 100644 --- a/application/retriever/duckduck_search.py +++ b/application/retriever/duckduck_search.py @@ -88,7 +88,7 @@ class DuckDuckSearch(BaseRetriever): for doc in docs: yield {"source": doc} - if len(self.chat_history) > 1: + if len(self.chat_history) > 0: for i in self.chat_history: if "prompt" in i and "response" in i: messages_combine.append({"role": "user", "content": i["prompt"]})