Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: migrate web human_input_form from reqparse to Pydantic BaseModel (#34859)
NVIDIANab3b30568299
diff --git a/api/controllers/web/human_input_form.py b/api/controllers/web/human_input_form.pyindex 36728a47d10..aff0b42d956 100644--- a/api/controllers/web/human_input_form.py+++ b/api/controllers/web/human_input_form.py@@ -7,7 +7,8 @@ import loggingfrom datetime import datetimefrom flask import Response, request-from flask_restx import Resource, reqparse+from flask_restx import Resource+from pydantic import BaseModelfrom sqlalchemy import selectfrom werkzeug.exceptions import Forbidden@@ -23,6 +24,12 @@ from services.human_input_service import Form, FormNotFoundError, HumanInputServlogger = logging.getLogger(__name__)++class HumanInputFormSubmitPayload(BaseModel):+ inputs: dict+ action: str++_FORM_SUBMIT_RATE_LIMITER = RateLimiter(prefix="web_form_submit_rate_limit",max_attempts=dify_config.WEB_FORM_SUBMIT_RATE_LIMIT_MAX_ATTEMPTS,@@ -112,10 +119,7 @@ class HumanInputFormApi(Resource):"action": "Approve"}"""- parser = reqparse.RequestParser()- parser.add_argument("inputs", type=dict, required=True, location="json")- parser.add_argument("action", type=str, required=True, location="json")- args = parser.parse_args()+ payload = HumanInputFormSubmitPayload.model_validate(request.get_json())ip_address = extract_remote_ip(request)if _FORM_SUBMIT_RATE_LIMITER.is_rate_limited(ip_address):@@ -135,8 +139,8 @@ class HumanInputFormApi(Resource):service.submit_form_by_token(recipient_type=recipient_type,form_token=form_token,- selected_action_id=args["action"],- form_data=args["inputs"],+ selected_action_id=payload.action,+ form_data=payload.inputs,submission_end_user_id=None,# submission_end_user_id=_end_user.id,)