From 5997458aaf9576118141eb222eca8532e0953f3d Mon Sep 17 00:00:00 2001 From: Eternity <1533512157@qq.com> Date: Thu, 19 Mar 2026 11:06:01 +0800 Subject: [PATCH] fix(workflow): fix missing file in non-streaming API calls --- api/app/controllers/public_share_controller.py | 3 +-- api/app/controllers/service/app_api_controller.py | 1 + api/app/services/app_chat_service.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/app/controllers/public_share_controller.py b/api/app/controllers/public_share_controller.py index 34572964..33d7b60c 100644 --- a/api/app/controllers/public_share_controller.py +++ b/api/app/controllers/public_share_controller.py @@ -13,7 +13,6 @@ from app.core.logging_config import get_business_logger from app.core.response_utils import success, fail from app.db import get_db, get_db_read from app.dependencies import get_share_user_id, ShareTokenData -from app.models.app_model import App from app.models.app_model import AppType from app.repositories import knowledge_repository from app.repositories.end_user_repository import EndUserRepository @@ -618,11 +617,11 @@ async def chat( # 多 Agent 非流式返回 result = await app_chat_service.workflow_chat( - message=payload.message, conversation_id=conversation.id, # 使用已创建的会话 ID user_id=end_user_id, # 转换为字符串 variables=payload.variables, + files=payload.files, config=config, web_search=payload.web_search, memory=payload.memory, diff --git a/api/app/controllers/service/app_api_controller.py b/api/app/controllers/service/app_api_controller.py index 3b054d2a..32a911f9 100644 --- a/api/app/controllers/service/app_api_controller.py +++ b/api/app/controllers/service/app_api_controller.py @@ -280,6 +280,7 @@ async def chat( memory=memory, storage_type=storage_type, user_rag_memory_id=user_rag_memory_id, + files=payload.files, app_id=app.id, workspace_id=workspace_id, release_id=app.current_release.id diff --git a/api/app/services/app_chat_service.py b/api/app/services/app_chat_service.py index cd9d3e81..fd74fd29 100644 --- a/api/app/services/app_chat_service.py +++ b/api/app/services/app_chat_service.py @@ -585,6 +585,7 @@ class AppChatService: app_id: uuid.UUID, release_id: uuid.UUID, workspace_id: uuid.UUID, + files: Optional[List[FileInput]] = None, user_id: Optional[str] = None, variables: Optional[Dict[str, Any]] = None, web_search: bool = False, @@ -598,7 +599,8 @@ class AppChatService: variables=variables, conversation_id=str(conversation_id), stream=True, - user_id=user_id + user_id=user_id, + files=files ) return await self.workflow_service.run( app_id=app_id,