refac
This commit is contained in:
1 parent
e6f38f52c8
commit
378673408e
2 files changed
+7
-5
No files matched your search
@@ -1882,6 +1882,10 @@ async def chat_completion(
|
|||||||
generate_chat_completions = chat_completion
|
generate_chat_completions = chat_completion
|
||||||
generate_chat_completion = chat_completion
|
generate_chat_completion = chat_completion
|
||||||
|
|
||||||
|
# Expose as app.state so internal callers (e.g. automations) can
|
||||||
|
# use the full pipeline without importing from main.py (avoids circular deps).
|
||||||
|
app.state.CHAT_COMPLETION_HANDLER = chat_completion
|
||||||
|
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -292,12 +292,10 @@ async def execute_automation(app, automation: AutomationModel) -> None:
|
|||||||
if filter_ids:
|
if filter_ids:
|
||||||
form_data["filter_ids"] = filter_ids
|
form_data["filter_ids"] = filter_ids
|
||||||
|
|
||||||
# Call chat_completion — returns {'status': True, 'task_id': '...'}
|
# Call the full chat completion pipeline (same as POST /api/chat/completions).
|
||||||
# The background task handles everything: LLM, tools, DB, webhooks.
|
# The handler reference is stored on app.state to avoid circular imports.
|
||||||
from open_webui.main import chat_completion as main_chat_completion
|
|
||||||
|
|
||||||
request = _build_request(app)
|
request = _build_request(app)
|
||||||
await main_chat_completion(request, form_data, user=user)
|
await app.state.CHAT_COMPLETION_HANDLER(request, form_data, user=user)
|
||||||
|
|
||||||
# Notify user
|
# Notify user
|
||||||
from open_webui.socket.main import sio
|
from open_webui.socket.main import sio
|
||||||
|
|||||||
Reference in new issue
Block a user