mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
fix(api): fix transparent upgrade SSE channel mismatch and chat mode routing
- workflow_execute_task: add AppMode.CHAT/AGENT_CHAT/COMPLETION to the AdvancedChatAppGenerator routing branch so transparently upgraded old apps can execute through the workflow engine. - app_generate_service: use app_model.mode (not hardcoded AppMode.AGENT) for SSE event subscription channel, ensuring the subscriber and Celery publisher use the same Redis channel key. Made-with: Cursor
This commit is contained in:
parent
2de2a8fd3a
commit
e50c36526e
@ -165,10 +165,11 @@ class AppGenerateService:
|
|||||||
|
|
||||||
on_subscribe = cls._build_streaming_task_on_subscribe(on_subscribe)
|
on_subscribe = cls._build_streaming_task_on_subscribe(on_subscribe)
|
||||||
generator = AdvancedChatAppGenerator()
|
generator = AdvancedChatAppGenerator()
|
||||||
|
subscribe_mode = AppMode.value_of(app_model.mode)
|
||||||
return rate_limit.generate(
|
return rate_limit.generate(
|
||||||
generator.convert_to_event_stream(
|
generator.convert_to_event_stream(
|
||||||
generator.retrieve_events(
|
generator.retrieve_events(
|
||||||
AppMode.AGENT,
|
subscribe_mode,
|
||||||
payload.workflow_run_id,
|
payload.workflow_run_id,
|
||||||
on_subscribe=on_subscribe,
|
on_subscribe=on_subscribe,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -183,7 +183,13 @@ class _AppRunner:
|
|||||||
pause_state_config: PauseStateLayerConfig,
|
pause_state_config: PauseStateLayerConfig,
|
||||||
):
|
):
|
||||||
exec_params = self._exec_params
|
exec_params = self._exec_params
|
||||||
if exec_params.app_mode in {AppMode.ADVANCED_CHAT, AppMode.AGENT}:
|
if exec_params.app_mode in {
|
||||||
|
AppMode.ADVANCED_CHAT,
|
||||||
|
AppMode.AGENT,
|
||||||
|
AppMode.CHAT,
|
||||||
|
AppMode.AGENT_CHAT,
|
||||||
|
AppMode.COMPLETION,
|
||||||
|
}:
|
||||||
return AdvancedChatAppGenerator().generate(
|
return AdvancedChatAppGenerator().generate(
|
||||||
app_model=app,
|
app_model=app,
|
||||||
workflow=workflow,
|
workflow=workflow,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user