diff --git a/backend/main.py b/backend/main.py index 1fc292e5f..f00d6c382 100644 --- a/backend/main.py +++ b/backend/main.py @@ -526,6 +526,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware): "message_id": body.pop("id", None), "session_id": body.pop("session_id", None), "valves": body.pop("valves", None), + "tool_ids": body.pop("tool_ids", None), + "files": body.pop("files", None), } __user__ = { diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 95161bf56..c805d82fa 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -844,10 +844,8 @@ }, format: $settings.requestFormat ?? undefined, keep_alive: $settings.keepAlive ?? undefined, - metadata: { - tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, - files: files.length > 0 ? files : undefined - }, + tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, + files: files.length > 0 ? files : undefined, session_id: $socket?.id, chat_id: $chatId, id: responseMessageId @@ -1138,10 +1136,8 @@ frequency_penalty: params?.frequency_penalty ?? $settings?.params?.frequency_penalty ?? undefined, max_tokens: params?.max_tokens ?? $settings?.params?.max_tokens ?? undefined, - metadata: { - tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, - files: files.length > 0 ? files : undefined - }, + tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, + files: files.length > 0 ? files : undefined, session_id: $socket?.id, chat_id: $chatId, id: responseMessageId