From 86282ba4347cc8a0a698cd27958a71a8923f92a9 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 25 Jan 2025 22:54:12 +0800 Subject: [PATCH] Fix history_context handling error in kg_query --- lightrag/operate.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index af66eee6..0469fb7e 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -633,11 +633,8 @@ async def kg_query( # Process conversation history history_context = "" if query_param.conversation_history: - recent_history = query_param.conversation_history[ - -query_param.history_window_size : - ] - history_context = "\n".join( - [f"{turn['role']}: {turn['content']}" for turn in recent_history] + history_context = get_conversation_turns( + query_param.conversation_history, query_param.history_turns ) sys_prompt_temp = PROMPTS["rag_response"]