This commit is contained in:
非法操作 2024-11-15 15:45:33 +08:00 committed by GitHub
commit 1a02033d08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -289,5 +289,22 @@ class WorkflowEntry:
if new_value: if new_value:
input_value = 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 # append variable and value to variable pool
variable_pool.add([variable_node_id] + variable_key_list, input_value) 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.advanced_chat.app_config_manager import AdvancedChatAppConfigManager
from core.app.apps.workflow.app_config_manager import WorkflowAppConfigManager 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.model_runtime.utils.encoders import jsonable_encoder
from core.variables import Variable from core.variables import Variable
from core.workflow.entities.node_entities import NodeRunResult from core.workflow.entities.node_entities import NodeRunResult
@ -262,6 +263,9 @@ class WorkflowService:
if run_succeeded and node_run_result: if run_succeeded and node_run_result:
# create workflow node execution # 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.inputs = json.dumps(node_run_result.inputs) if node_run_result.inputs else None
workflow_node_execution.process_data = ( workflow_node_execution.process_data = (
json.dumps(node_run_result.process_data) if node_run_result.process_data else None json.dumps(node_run_result.process_data) if node_run_result.process_data else None