mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-02 02:09:17 -05:00
fix: pass chat_id to internal task calls for consistent function context (#20585)
Ensure chat_id is reliably passed to function pipelines/manifolds during internal task invocations (web search query generation, RAG query generation, image prompt generation). This allows stateful functions to maintain per-chat state without fragmentation, as they will now receive a consistent chat_id for all chat-scoped invocations including internal tasks. Backend changes: - Pass chat_id in generate_queries call for web search - Pass chat_id in generate_queries call for RAG/retrieval - Pass chat_id in generate_image_prompt call Frontend changes: - Add optional chat_id parameter to generateQueries API function - Add optional chat_id parameter to generateAutoCompletion API function Fixes #20563
This commit is contained in:
@@ -1255,6 +1255,7 @@ async def chat_web_search_handler(
|
||||
"messages": messages,
|
||||
"prompt": user_message,
|
||||
"type": "web_search",
|
||||
"chat_id": extra_params.get("__chat_id__"),
|
||||
},
|
||||
user,
|
||||
)
|
||||
@@ -1585,6 +1586,7 @@ async def chat_image_generation_handler(
|
||||
{
|
||||
"model": form_data["model"],
|
||||
"messages": form_data["messages"],
|
||||
"chat_id": metadata.get("chat_id"),
|
||||
},
|
||||
user,
|
||||
)
|
||||
@@ -1691,6 +1693,7 @@ async def chat_completion_files_handler(
|
||||
"model": body["model"],
|
||||
"messages": body["messages"],
|
||||
"type": "retrieval",
|
||||
"chat_id": body.get("metadata", {}).get("chat_id"),
|
||||
},
|
||||
user,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user