diff --git a/backend/open_webui/apps/webui/main.py b/backend/open_webui/apps/webui/main.py index 1210ac7c3..1d12d708e 100644 --- a/backend/open_webui/apps/webui/main.py +++ b/backend/open_webui/apps/webui/main.py @@ -287,17 +287,20 @@ async def generate_function_chat_completion(form_data, user): __event_emitter__ = None __event_call__ = None __task__ = None + __task_body__ = None if metadata: if all(k in metadata for k in ("session_id", "chat_id", "message_id")): __event_emitter__ = get_event_emitter(metadata) __event_call__ = get_event_call(metadata) __task__ = metadata.get("task", None) + __task_body__ = metadata.get("task_body", None) extra_params = { "__event_emitter__": __event_emitter__, "__event_call__": __event_call__, "__task__": __task__, + "__task_body__": __task_body__, "__files__": files, "__user__": { "id": user.id, diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 06357d52d..7086a3cc9 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1492,7 +1492,7 @@ Prompt: {{prompt:middletruncate:8000}}""" } ), "chat_id": form_data.get("chat_id", None), - "metadata": {"task": str(TASKS.TITLE_GENERATION)}, + "metadata": {"task": str(TASKS.TITLE_GENERATION), "task_body": form_data}, } log.debug(payload) @@ -1569,7 +1569,7 @@ Search Query:""" "max_completion_tokens": 30, } ), - "metadata": {"task": str(TASKS.QUERY_GENERATION)}, + "metadata": {"task": str(TASKS.QUERY_GENERATION), "task_body": form_data}, } log.debug(payload) @@ -1637,7 +1637,7 @@ Message: """{{prompt}}""" } ), "chat_id": form_data.get("chat_id", None), - "metadata": {"task": str(TASKS.EMOJI_GENERATION)}, + "metadata": {"task": str(TASKS.EMOJI_GENERATION), "task_body": form_data}, } log.debug(payload) @@ -1696,7 +1696,10 @@ Responses from models: {{responses}}""" "messages": [{"role": "user", "content": content}], "stream": form_data.get("stream", False), "chat_id": form_data.get("chat_id", None), - "metadata": {"task": str(TASKS.MOA_RESPONSE_GENERATION)}, + "metadata": { + "task": str(TASKS.MOA_RESPONSE_GENERATION), + "task_body": form_data, + }, } log.debug(payload)