From 62aa0726a5144b90bbae957f0e14e298e16f93b7 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 21 Sep 2025 23:51:19 +0800 Subject: [PATCH] Fix conversation history handling when history_turns is 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Check history_turns > 0 before filtering • Prevent sending all history converstion to backend when history_turns is 0 --- lightrag_webui/src/features/RetrievalTesting.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lightrag_webui/src/features/RetrievalTesting.tsx b/lightrag_webui/src/features/RetrievalTesting.tsx index c9781a41..20440332 100644 --- a/lightrag_webui/src/features/RetrievalTesting.tsx +++ b/lightrag_webui/src/features/RetrievalTesting.tsx @@ -261,10 +261,12 @@ export default function RetrievalTesting() { const queryParams = { ...state.querySettings, query: actualQuery, - conversation_history: prevMessages - .filter((m) => m.isError !== true) - .slice(-(state.querySettings.history_turns || 0) * 2) - .map((m) => ({ role: m.role, content: m.content })), + conversation_history: (state.querySettings.history_turns || 0) > 0 + ? prevMessages + .filter((m) => m.isError !== true) + .slice(-(state.querySettings.history_turns || 0) * 2) + .map((m) => ({ role: m.role, content: m.content })) + : [], ...(modeOverride ? { mode: modeOverride } : {}) }