Compare commits

...

3 Commits

Author SHA1 Message Date
非法操作
7c4bbe3275
Merge 925fc39e94 into 4b2abf8ac2 2024-11-15 10:53:24 +08:00
hejl
925fc39e94 fix CI 2024-10-28 14:53:51 +08:00
hejl
7238ad8078 transform the files from dict to File when draft run single tool node 2024-10-28 14:38:23 +08:00
2 changed files with 21 additions and 0 deletions

View File

@ -289,5 +289,22 @@ class WorkflowEntry:
if new_value:
input_value = new_value
if node_type == NodeType.TOOL and isinstance(input_value, dict) and "transferMethod" in input_value:
if input_value.get("supportFileType"):
type = FileType.value_of(input_value.get("supportFileType"))
else:
type = FileType.CUSTOM
transfer_method = FileTransferMethod.value_of(input_value.get("transferMethod"))
file = File(
tenant_id=tenant_id,
type=type,
transfer_method=transfer_method,
remote_url=input_value.get("url") if transfer_method == FileTransferMethod.REMOTE_URL else None,
related_id=input_value.get("uploadedId")
if transfer_method == FileTransferMethod.LOCAL_FILE
else None,
)
input_value = file
# append variable and value to variable pool
variable_pool.add([variable_node_id] + variable_key_list, input_value)

View File

@ -6,6 +6,7 @@ from typing import Optional
from core.app.apps.advanced_chat.app_config_manager import AdvancedChatAppConfigManager
from core.app.apps.workflow.app_config_manager import WorkflowAppConfigManager
from core.file.models import File
from core.model_runtime.utils.encoders import jsonable_encoder
from core.variables import Variable
from core.workflow.entities.node_entities import NodeRunResult
@ -262,6 +263,9 @@ class WorkflowService:
if run_succeeded and node_run_result:
# create workflow node execution
for key, value in node_run_result.inputs.items():
if isinstance(value, File):
node_run_result.inputs[key] = value.to_dict()
workflow_node_execution.inputs = json.dumps(node_run_result.inputs) if node_run_result.inputs else None
workflow_node_execution.process_data = (
json.dumps(node_run_result.process_data) if node_run_result.process_data else None