feat(api): adjust HumanInput single stepping endpoints

This commit is contained in:
QuantumGhost
2026-01-13 08:38:38 +08:00
parent 7b2e5383be
commit 5523df6023
2 changed files with 15 additions and 13 deletions

View File

@ -537,8 +537,8 @@ class HumanInputDeliveryTestPayload(BaseModel):
delivery_method_id: str
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/human-input/nodes/<string:node_id>/form")
class AdvancedChatDraftHumanInputFormApi(Resource):
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/human-input/nodes/<string:node_id>/form/preview")
class AdvancedChatDraftHumanInputFormPreviewApi(Resource):
@console_ns.doc("get_advanced_chat_draft_human_input_form")
@console_ns.doc(description="Get human input form preview for advanced chat workflow")
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
@ -547,7 +547,7 @@ class AdvancedChatDraftHumanInputFormApi(Resource):
@account_initialization_required
@get_app_model(mode=[AppMode.ADVANCED_CHAT])
@edit_permission_required
def get(self, app_model: App, node_id: str):
def post(self, app_model: App, node_id: str):
"""
Preview human input form content and placeholders
"""
@ -568,6 +568,9 @@ class AdvancedChatDraftHumanInputFormApi(Resource):
)
return jsonable_encoder(preview)
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/human-input/nodes/<string:node_id>/form/run")
class AdvancedChatDraftHumanInputFormRunApi(Resource):
@console_ns.doc("submit_advanced_chat_draft_human_input_form")
@console_ns.doc(description="Submit human input form preview for advanced chat workflow")
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
@ -602,8 +605,8 @@ class AdvancedChatDraftHumanInputFormApi(Resource):
return jsonable_encoder(result)
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/human-input/nodes/<string:node_id>/form")
class WorkflowDraftHumanInputFormApi(Resource):
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/human-input/nodes/<string:node_id>/form/preview")
class WorkflowDraftHumanInputFormPreviewApi(Resource):
@console_ns.doc("get_workflow_draft_human_input_form")
@console_ns.doc(description="Get human input form preview for workflow")
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
@ -612,7 +615,7 @@ class WorkflowDraftHumanInputFormApi(Resource):
@account_initialization_required
@get_app_model(mode=[AppMode.WORKFLOW])
@edit_permission_required
def get(self, app_model: App, node_id: str):
def post(self, app_model: App, node_id: str):
"""
Preview human input form content and placeholders
"""
@ -633,6 +636,9 @@ class WorkflowDraftHumanInputFormApi(Resource):
)
return jsonable_encoder(preview)
@console_ns.route("/apps/<uuid:app_id>/workflows/draft/human-input/nodes/<string:node_id>/form/run")
class WorkflowDraftHumanInputFormRunApi(Resource):
@console_ns.doc("submit_workflow_draft_human_input_form")
@console_ns.doc(description="Submit human input form preview for workflow")
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
@ -1380,8 +1386,3 @@ class DraftWorkflowTriggerRunAllApi(Resource):
"status": "error",
}
), 400
@console_ns.route("/events")
class WorkflowEventAPI(Resource):
pass

View File

@ -11,6 +11,7 @@ from configs import dify_config
from core.app.app_config.entities import VariableEntityType
from core.app.apps.advanced_chat.app_config_manager import AdvancedChatAppConfigManager
from core.app.apps.workflow.app_config_manager import WorkflowAppConfigManager
from core.app.entities.app_invoke_entities import InvokeFrom
from core.file import File
from core.repositories import DifyCoreRepositoryFactory
from core.variables import Variable
@ -38,6 +39,7 @@ from extensions.ext_storage import storage
from factories.file_factory import build_from_mapping, build_from_mappings
from libs.datetime_utils import naive_utc_now
from models import Account
from models.enums import UserFrom
from models.model import App, AppMode
from models.tools import WorkflowToolProvider
from models.workflow import Workflow, WorkflowNodeExecutionModel, WorkflowNodeExecutionTriggeredFrom, WorkflowType
@ -786,7 +788,7 @@ class WorkflowService:
rendered_content = node._render_form_content_before_submission()
resolved_placeholder_values = node._resolve_inputs()
node_data = cast(HumanInputNodeData, node.get_base_node_data())
node_data = node.node_data
human_input_required = HumanInputRequired(
form_id=node_id,
form_content=rendered_content,
@ -974,7 +976,6 @@ class WorkflowService:
graph_init_params=graph_init_params,
graph_runtime_state=graph_runtime_state,
)
node.init_node_data(node_config.get("data", {}))
return node
def _build_human_input_variable_pool(