mirror of
https://github.com/langgenius/dify.git
synced 2026-02-01 16:41:58 +08:00
The backend part of the human in the loop (HITL) feature and relevant architecture / workflow engine changes. Signed-off-by: yihong0618 <zouzou0208@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: 盐粒 Yanli <yanli@dify.ai> Co-authored-by: CrabSAMA <40541269+CrabSAMA@users.noreply.github.com> Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com>
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping, Sequence
|
|
from typing import Any, TypeAlias
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from core.workflow.nodes.human_input.entities import FormInput, UserAction
|
|
from models.execution_extra_content import ExecutionContentType
|
|
|
|
|
|
class HumanInputFormDefinition(BaseModel):
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
form_id: str
|
|
node_id: str
|
|
node_title: str
|
|
form_content: str
|
|
inputs: Sequence[FormInput] = Field(default_factory=list)
|
|
actions: Sequence[UserAction] = Field(default_factory=list)
|
|
display_in_ui: bool = False
|
|
form_token: str | None = None
|
|
resolved_default_values: Mapping[str, Any] = Field(default_factory=dict)
|
|
expiration_time: int
|
|
|
|
|
|
class HumanInputFormSubmissionData(BaseModel):
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
node_id: str
|
|
node_title: str
|
|
rendered_content: str
|
|
action_id: str
|
|
action_text: str
|
|
|
|
|
|
class HumanInputContent(BaseModel):
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
workflow_run_id: str
|
|
submitted: bool
|
|
form_definition: HumanInputFormDefinition | None = None
|
|
form_submission_data: HumanInputFormSubmissionData | None = None
|
|
type: ExecutionContentType = Field(default=ExecutionContentType.HUMAN_INPUT)
|
|
|
|
|
|
ExecutionExtraContentDomainModel: TypeAlias = HumanInputContent
|
|
|
|
__all__ = [
|
|
"ExecutionExtraContentDomainModel",
|
|
"HumanInputContent",
|
|
"HumanInputFormDefinition",
|
|
"HumanInputFormSubmissionData",
|
|
]
|