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"]