Fix conversation history handling when history_turns is 0
• Check history_turns > 0 before filtering • Prevent sending all history converstion to backend when history_turns is 0
This commit is contained in:
parent
6e2eab5c23
commit
62aa0726a5
1 changed files with 6 additions and 4 deletions
|
|
@ -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 } : {})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue