fix: count history tokens from chunks, remove old UI setting limit (#2196)

This commit is contained in:
Alex
2025-12-17 01:34:17 +00:00
committed by GitHub
parent aacf281222
commit af3e16c4fc
12 changed files with 3 additions and 77 deletions

View File

@@ -11,7 +11,6 @@ export function handleFetchAnswer(
conversationId: string | null,
promptId: string | null,
chunks: string,
token_limit: number,
agentId?: string,
attachments?: string[],
save_conversation = true,
@@ -42,7 +41,6 @@ export function handleFetchAnswer(
conversation_id: conversationId,
prompt_id: promptId,
chunks: chunks,
token_limit: token_limit,
isNoneDoc: selectedDocs.length === 0,
agent_id: agentId,
save_conversation: save_conversation,
@@ -100,7 +98,6 @@ export function handleFetchAnswerSteaming(
conversationId: string | null,
promptId: string | null,
chunks: string,
token_limit: number,
onEvent: (event: MessageEvent) => void,
indx?: number,
agentId?: string,
@@ -113,7 +110,6 @@ export function handleFetchAnswerSteaming(
conversation_id: conversationId,
prompt_id: promptId,
chunks: chunks,
token_limit: token_limit,
isNoneDoc: selectedDocs.length === 0,
index: indx,
agent_id: agentId,
@@ -198,13 +194,11 @@ export function handleSearch(
selectedDocs: Doc[],
conversation_id: string | null,
chunks: string,
token_limit: number,
) {
const payload: RetrievalPayload = {
question: question,
conversation_id: conversation_id,
chunks: chunks,
token_limit: token_limit,
isNoneDoc: selectedDocs.length === 0,
};
if (selectedDocs.length > 0) {

View File

@@ -59,7 +59,6 @@ export interface RetrievalPayload {
conversation_id: string | null;
prompt_id?: string | null;
chunks: string;
token_limit: number;
isNoneDoc: boolean;
index?: number;
agent_id?: string;

View File

@@ -63,7 +63,6 @@ export const fetchAnswer = createAsyncThunk<
currentConversationId,
state.preference.prompt.id,
state.preference.chunks,
state.preference.token_limit,
(event) => {
const data = JSON.parse(event.data);
const targetIndex = indx ?? state.conversation.queries.length - 1;
@@ -171,7 +170,6 @@ export const fetchAnswer = createAsyncThunk<
state.conversation.conversationId,
state.preference.prompt.id,
state.preference.chunks,
state.preference.token_limit,
state.preference.selectedAgent?.id,
attachmentIds,
true,