diff --git a/api/app/core/workflow/nodes/llm/node.py b/api/app/core/workflow/nodes/llm/node.py index 14bcb8ed..761a2e22 100644 --- a/api/app/core/workflow/nodes/llm/node.py +++ b/api/app/core/workflow/nodes/llm/node.py @@ -68,12 +68,13 @@ class LLMNode(BaseNode): - ai/assistant: AI 消息(AIMessage) """ - def _output_types(self) -> dict[str, VariableType]: - return {"output": VariableType.STRING} - def __init__(self, node_config: dict[str, Any], workflow_config: dict[str, Any]): super().__init__(node_config, workflow_config) self.typed_config: LLMNodeConfig | None = None + self.messages = [] + + def _output_types(self) -> dict[str, VariableType]: + return {"output": VariableType.STRING} def _render_context(self, message: str, variable_pool: VariablePool): context = f"{self._render_template(self.typed_config.context, variable_pool)}" diff --git a/api/app/services/workflow_service.py b/api/app/services/workflow_service.py index db50ce88..fb88f804 100644 --- a/api/app/services/workflow_service.py +++ b/api/app/services/workflow_service.py @@ -2,7 +2,6 @@ 工作流服务层 """ import datetime -import json import logging import uuid from typing import Any, Annotated, Optional @@ -448,13 +447,9 @@ class WorkflowService: message=f"工作流配置不存在: app_id={app_id}" ) - json_files = [] - for file in payload.files: - file_json = json.loads(file.model_dump_json()) - json_files.append(file_json) input_data = {"message": payload.message, "variables": payload.variables, "conversation_id": payload.conversation_id, - "files": json_files + "files": [file.model_dump(mode='json') for file in payload.files] } # 转换 conversation_id 为 UUID @@ -642,13 +637,9 @@ class WorkflowService: message=f"工作流配置不存在: app_id={app_id}" ) - json_files = [] - for file in payload.files: - file_json = json.loads(file.model_dump_json()) - json_files.append(file_json) input_data = {"message": payload.message, "variables": payload.variables, "conversation_id": payload.conversation_id, - "files": json_files + "files": [file.model_dump(mode='json') for file in payload.files] } # 转换 conversation_id 为 UUID