mirror of
https://github.com/langgenius/dify.git
synced 2026-04-20 02:37:20 +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:
@ -165,10 +165,11 @@ class AppGenerateService:
|
||||
|
||||
on_subscribe = cls._build_streaming_task_on_subscribe(on_subscribe)
|
||||
generator = AdvancedChatAppGenerator()
|
||||
subscribe_mode = AppMode.value_of(app_model.mode)
|
||||
return rate_limit.generate(
|
||||
generator.convert_to_event_stream(
|
||||
generator.retrieve_events(
|
||||
AppMode.AGENT,
|
||||
subscribe_mode,
|
||||
payload.workflow_run_id,
|
||||
on_subscribe=on_subscribe,
|
||||
),
|
||||
|
||||
@ -183,7 +183,13 @@ class _AppRunner:
|
||||
pause_state_config: PauseStateLayerConfig,
|
||||
):
|
||||
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(
|
||||
app_model=app,
|
||||
workflow=workflow,
|
||||
|
||||
Reference in New Issue
Block a user