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
fix(api): align Service API OpenAPI contract (#41248)
Stephen Zhou92016aa13967
diff --git a/api/controllers/common/controller_schemas.py b/api/controllers/common/controller_schemas.pyindex d35fd9fe1b3..feef306b5c8 100644--- a/api/controllers/common/controller_schemas.py+++ b/api/controllers/common/controller_schemas.py@@ -108,33 +108,55 @@ class SavedMessageCreatePayload(BaseModel):# --- Workflow schemas ---++def _workflow_input_file_variant(transfer_method: str, source: str) -> dict[str, object]:+ return {+ "type": "object",+ "properties": {+ "type": {+ "description": "File type.",+ "enum": ["document", "image", "audio", "video", "custom"],+ "type": "string",+ },+ "transfer_method": {+ "description": (+ "Transfer method: `remote_url` for a file URL or persisted uploaded-file reference, "+ "`local_file` for an uploaded file."+ ),+ "enum": [transfer_method],+ "type": "string",+ },+ "url": {+ "description": "File URL when `transfer_method` is `remote_url`.",+ "format": "url",+ "type": "string",+ },+ "remote_url": {+ "description": "Legacy alias of `url` when `transfer_method` is `remote_url`.",+ "format": "url",+ "type": "string",+ },+ "upload_file_id": {+ "description": (+ "Uploaded file ID obtained from the [Upload File](/api-reference/files/upload-file) API. "+ "Required for `local_file`; also accepted with `remote_url` for compatibility with persisted "+ "file references."+ ),+ "type": "string",+ },+ },+ "required": ["type", "transfer_method", source],+ }++WORKFLOW_INPUT_FILE_ITEM_SCHEMA: dict[str, object] = {"type": "object",- "required": ["type", "transfer_method"],- "properties": {- "type": {- "description": "File type.",- "enum": ["document", "image", "audio", "video", "custom"],- "type": "string",- },- "transfer_method": {- "description": "Transfer method: `remote_url` for file URL, `local_file` for uploaded file.",- "enum": ["remote_url", "local_file"],- "type": "string",- },- "url": {- "description": "File URL when `transfer_method` is `remote_url`.",- "format": "url",- "type": "string",- },- "upload_file_id": {- "description": (- "Uploaded file ID obtained from the [Upload File](/api-reference/files/upload-file) API when "- "`transfer_method` is `local_file`."- ),- "type": "string",- },- },+ "anyOf": [+ _workflow_input_file_variant("remote_url", "url"),+ _workflow_input_file_variant("remote_url", "remote_url"),+ _workflow_input_file_variant("remote_url", "upload_file_id"),+ _workflow_input_file_variant("local_file", "upload_file_id"),+ ],}WORKFLOW_INPUT_FILE_LIST_SCHEMA: dict[str, object] = {"anyOf": [{"items": WORKFLOW_INPUT_FILE_ITEM_SCHEMA, "type": "array"}, {"type": "null"}]diff --git a/api/controllers/common/fields.py b/api/controllers/common/fields.pyindex 65d547a349f..2277e91d798 100644--- a/api/controllers/common/fields.py+++ b/api/controllers/common/fields.py@@ -1,8 +1,8 @@from __future__ import annotations-from typing import Any, Literal+from typing import Annotated, Any, Literal-from pydantic import BaseModel, ConfigDict, Field, RootModel, computed_field+from pydantic import BaseModel, ConfigDict, Field, RootModel, WithJsonSchema, computed_fieldfrom fields.base import ResponseModelfrom graphon.file import helpers as file_helpers@@ -10,6 +10,125 @@ from models.model import IconTypetype JSONValue = str | int | float | bool | None | dict[str, Any] | list[Any]type JSONObject = dict[str, Any]+URLString = Annotated[str, WithJsonSchema({"format": "url", "type": "string"})]+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+FloatNumber = Annotated[float, WithJsonSchema({"format": "float", "type": "number"})]+DoubleNumber = Annotated[float, WithJsonSchema({"format": "double", "type": "number"})]+DecimalString = Annotated[str, WithJsonSchema({"format": "decimal", "type": "string"})]++FeatureToggleObject = Annotated[+ JSONObject,+ WithJsonSchema({"type": "object", "properties": {"enabled": {"type": "boolean"}}}),+]+TextToSpeechObject = Annotated[+ JSONObject,+ WithJsonSchema(+ {+ "type": "object",+ "properties": {+ "enabled": {"type": "boolean"},+ "voice": {"type": "string"},+ "language": {"type": "string"},+ "autoPlay": {"type": "string"},+ },+ }+ ),+]+FileUploadObject = Annotated[+ JSONObject,+ WithJsonSchema(+ {+ "type": "object",+ "properties": {+ "enabled": {"type": "boolean"},+ "number_limits": {"type": "integer"},+ "allowed_file_types": {+ "type": "array",+ "items": {+ "type": "string",+ "enum": ["document", "image", "audio", "video", "custom"],+ },+ },+ "allowed_file_extensions": {"type": "array", "items": {"type": "string"}},+ "allowed_file_upload_methods": {+ "type": "array",+ "items": {+ "type": "string",+ "enum": ["remote_url", "local_file"],+ },+ },+ "image": {+ "type": "object",+ "properties": {+ "enabled": {"type": "boolean"},+ "number_limits": {"type": "integer"},+ "detail": {"type": "string"},+ "transfer_methods": {"type": "array", "items": {"type": "string"}},+ },+ },+ },+ }+ ),+]+USER_INPUT_FORM_TYPES = (+ "text-input",+ "select",+ "paragraph",+ "number",+ "external_data_tool",+ "file",+ "file-list",+ "checkbox",+ "json_object",+)+USER_INPUT_FORM_ITEM_CONFIG_SCHEMA: dict[str, object] = {+ "type": "object",+ "required": ["label", "variable"],+ "properties": {+ "variable": {"type": "string"},+ "label": {"type": "string"},+ "description": {"type": "string"},+ "required": {"type": "boolean"},+ "hide": {"type": "boolean"},+ # Defaults are typed by the form kind: strings, numbers, booleans,+ # JSON objects, and file references are all valid public values.+ "default": {},+ "type": {"enum": list(USER_INPUT_FORM_TYPES), "type": "string"},+ "max_length": {"anyOf": [{"type": "integer"}, {"type": "null"}]},+ "options": {"type": "array", "items": {"type": "string"}},+ "allowed_file_types": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}]},+ "allowed_file_extensions": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}]},+ "allowed_file_upload_methods": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}]},+ "json_schema": {+ "anyOf": [+ {"type": "object", "additionalProperties": True},+ {"type": "null"},+ ]+ },+ "config": {"type": "object", "additionalProperties": True},+ },+}+UserInputFormList = Annotated[+ list[JSONObject],+ WithJsonSchema(+ {+ "type": "array",+ "items": {+ "type": "object",+ "oneOf": [+ {+ "type": "object",+ "additionalProperties": False,+ "properties": {form_type: USER_INPUT_FORM_ITEM_CONFIG_SCHEMA},+ "required": [form_type],+ }+ for form_type in USER_INPUT_FORM_TYPES+ ],+ },+ }+ ),+]class SystemParameters(BaseModel):@@ -20,6 +139,198 @@ class SystemParameters(BaseModel):workflow_file_upload_limit: int+class BlockingUsageResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ prompt_tokens: int | None = None+ prompt_unit_price: DecimalString | None = None+ prompt_price_unit: DecimalString | None = None+ prompt_price: DecimalString | None = None+ completion_tokens: int | None = None+ completion_unit_price: DecimalString | None = None+ completion_price_unit: DecimalString | None = None+ completion_price: DecimalString | None = None+ total_tokens: int | None = None+ total_price: DecimalString | None = None+ currency: str | None = None+ latency: DoubleNumber | None = None+++class BlockingRetrieverResourceResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ id: UUIDString | None = None+ message_id: UUIDString | None = None+ position: int+ dataset_id: UUIDString | None = None+ dataset_name: str | None = None+ document_id: UUIDString | None = None+ document_name: str | None = None+ data_source_type: str | None = None+ segment_id: UUIDString | None = None+ score: FloatNumber | None = None+ hit_count: int | None = None+ word_count: int | None = None+ segment_position: int | None = None+ index_node_hash: str | None = None+ content: str | None = None+ summary: str | None = None+ created_at: Int64 | None = None+++class BlockingMetadataResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ usage: BlockingUsageResponse | None = None+ retriever_resources: list[BlockingRetrieverResourceResponse] | None = None+++class ChatMessageBlockingResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ event: Literal["message"]+ task_id: UUIDString+ id: UUIDString+ message_id: UUIDString+ conversation_id: UUIDString+ mode: str+ answer: str+ metadata: BlockingMetadataResponse+ created_at: Int64+++class PauseReasonResponseBase(ResponseModel):+ model_config = ConfigDict(extra="allow")++ form_id: UUIDString | None = None+ node_id: str | None = None+ node_title: str | None = None+ form_content: str | None = None+ inputs: list[JSONObject] = Field(default_factory=list)+ actions: list[JSONObject] = Field(default_factory=list)+ display_in_ui: bool | None = None+ resolved_default_values: dict[str, Any] = Field(default_factory=dict)+ form_token: str | None = None+ approval_channels: list[str] = Field(default_factory=list)+ expiration_time: Int64 | None = None+ message: str | None = None+++class ChatPauseReasonResponse(PauseReasonResponseBase):+ """Public pause reason emitted by a blocking Chatflow execution."""++ TYPE: str+++class WorkflowPauseReasonResponse(PauseReasonResponseBase):+ """Public pause reason emitted by a blocking Workflow execution."""++ TYPE: str+++class ChatPausedBlockingDataResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ id: UUIDString+ mode: str+ conversation_id: UUIDString+ message_id: UUIDString+ workflow_run_id: UUIDString+ answer: str+ metadata: BlockingMetadataResponse+ created_at: Int64+ paused_nodes: list[str]+ reasons: list[ChatPauseReasonResponse]+ status: Literal["paused"]+ elapsed_time: FloatNumber+ total_tokens: int+ total_steps: int+++class ChatPausedBlockingResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ event: Literal["workflow_paused"]+ task_id: UUIDString+ id: UUIDString+ message_id: UUIDString+ conversation_id: UUIDString+ mode: str+ answer: str+ metadata: BlockingMetadataResponse+ created_at: Int64+ workflow_run_id: UUIDString+ data: ChatPausedBlockingDataResponse+++class ChatBlockingResponse(+ RootModel[+ Annotated[+ ChatMessageBlockingResponse | ChatPausedBlockingResponse,+ Field(discriminator="event"),+ ]+ ]+):+ """Blocking chat response for a completed message or paused Chatflow."""+++class CompletionBlockingResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ event: str+ task_id: UUIDString+ id: UUIDString+ message_id: UUIDString+ mode: str+ answer: str+ metadata: BlockingMetadataResponse+ created_at: Int64+++class WorkflowBlockingDataBase(ResponseModel):+ model_config = ConfigDict(extra="allow")++ id: UUIDString+ workflow_id: UUIDString+ outputs: dict[str, Any] | None+ error: str | None+ elapsed_time: FloatNumber+ total_tokens: int+ total_steps: int+ created_at: Int64+ finished_at: Int64 | None+++class WorkflowFinishedBlockingDataResponse(WorkflowBlockingDataBase):+ status: Literal["succeeded", "failed", "stopped", "partial-succeeded"]+++class WorkflowPausedBlockingDataResponse(WorkflowBlockingDataBase):+ status: Literal["paused"]+ paused_nodes: list[str]+ reasons: list[WorkflowPauseReasonResponse]+++class WorkflowFinishedBlockingResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ task_id: UUIDString+ workflow_run_id: UUIDString+ data: WorkflowFinishedBlockingDataResponse+++class WorkflowPausedBlockingResponse(ResponseModel):+ model_config = ConfigDict(extra="allow")++ task_id: UUIDString+ workflow_run_id: UUIDString+ data: WorkflowPausedBlockingDataResponse+++class WorkflowBlockingResponse(RootModel[WorkflowFinishedBlockingResponse | WorkflowPausedBlockingResponse]):+ """Blocking workflow response for a finished or paused execution."""++class SimpleResultResponse(ResponseModel):result: str@@ -158,15 +469,15 @@ class NewAppResponse(ResponseModel):class Parameters(BaseModel):opening_statement: str | None = Nonesuggested_questions: list[str]- suggested_questions_after_answer: JSONObject- speech_to_text: JSONObject- text_to_speech: JSONObject- retriever_resource: JSONObject- annotation_reply: JSONObject- more_like_this: JSONObject- user_input_form: list[JSONObject]- sensitive_word_avoidance: JSONObject- file_upload: JSONObject+ suggested_questions_after_answer: FeatureToggleObject+ speech_to_text: FeatureToggleObject+ text_to_speech: TextToSpeechObject+ retriever_resource: FeatureToggleObject+ annotation_reply: FeatureToggleObject+ more_like_this: FeatureToggleObject+ user_input_form: UserInputFormList+ sensitive_word_avoidance: FeatureToggleObject+ file_upload: FileUploadObjectsystem_parameters: SystemParameters@@ -188,7 +499,7 @@ class Site(BaseModel):show_workflow_steps: booluse_icon_as_answer_icon: bool- @computed_field(return_type=str | None) # type: ignore+ @computed_field(return_type=URLString | None) # type: ignore@propertydef icon_url(self) -> str | None:if self.icon and self.icon_type == IconType.IMAGE:diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.pyindex 182631e8f5b..5b44247685b 100644--- a/api/controllers/service_api/__init__.py+++ b/api/controllers/service_api/__init__.py@@ -10,6 +10,7 @@ api = ExternalApi(version="1.0",title="Service API",description="API for application services",+ register_default_root=False,)service_api_ns = Namespace("service_api", description="Service operations", path="/")diff --git a/api/controllers/service_api/app/app.py b/api/controllers/service_api/app/app.pyindex 9fd70f97917..8180111a4c1 100644--- a/api/controllers/service_api/app/app.py+++ b/api/controllers/service_api/app/app.py@@ -1,7 +1,7 @@-from typing import Any+from typing import Annotatedfrom flask_restx import Resource-from pydantic import Field+from pydantic import Field, WithJsonSchemafrom controllers.common.fields import Parametersfrom controllers.common.schema import register_response_schema_models@@ -23,8 +23,16 @@ class AppInfoResponse(ResponseModel):author_name: str | None+URLString = Annotated[str, WithJsonSchema({"format": "url", "type": "string"})]+++class ToolIcon(ResponseModel):+ background: str+ content: str++class AppMetaResponse(ResponseModel):- tool_icons: dict[str, Any] = Field(default_factory=dict)+ tool_icons: dict[str, URLString | ToolIcon] = Field(default_factory=dict)register_response_schema_models(service_api_ns, Parameters, AppMetaResponse, AppInfoResponse)diff --git a/api/controllers/service_api/app/audio.py b/api/controllers/service_api/app/audio.pyindex b2502c9772d..3441fafe034 100644--- a/api/controllers/service_api/app/audio.py+++ b/api/controllers/service_api/app/audio.py@@ -23,6 +23,7 @@ from controllers.service_api.app.error import ()from controllers.service_api.schema import binary_response, expect_with_user, multipart_file_paramsfrom controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_token+from core.base.tts.audio_mime import SUPPORTED_TTS_AUDIO_MIME_TYPESfrom core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededErrorfrom extensions.ext_database import dbfrom graphon.model_runtime.errors.invoke import InvokeError@@ -166,8 +167,7 @@ class TextApi(Resource):},)@expect_with_user(service_api_ns, TextToAudioPayload)- # OpenAPI 2 cannot express a runtime-selected response MIME type, so document the body as generic binary.- @binary_response(service_api_ns, "application/octet-stream")+ @binary_response(service_api_ns, SUPPORTED_TTS_AUDIO_MIME_TYPES)@service_api_ns.doc("text_to_audio")@service_api_ns.doc(description="Convert text to audio using text-to-speech")@service_api_ns.doc(diff --git a/api/controllers/service_api/app/completion.py b/api/controllers/service_api/app/completion.pyindex c16118f7799..e0c7953b633 100644--- a/api/controllers/service_api/app/completion.py+++ b/api/controllers/service_api/app/completion.py@@ -11,7 +11,7 @@ from werkzeug.exceptions import BadRequest, InternalServerError, NotFoundimport servicesfrom configs import dify_config-from controllers.common.fields import SimpleResultResponse+from controllers.common.fields import ChatBlockingResponse, CompletionBlockingResponse, SimpleResultResponsefrom controllers.common.schema import register_response_schema_models, register_schema_modelsfrom controllers.console.app.wraps import with_sessionfrom controllers.service_api import service_api_ns@@ -163,7 +163,12 @@ class ChatRequestPayload(BaseModel):register_schema_models(service_api_ns, CompletionRequestPayload, ChatRequestPayload)-register_response_schema_models(service_api_ns, SimpleResultResponse)+register_response_schema_models(+ service_api_ns,+ SimpleResultResponse,+ ChatBlockingResponse,+ CompletionBlockingResponse,+)@service_api_ns.route("/completion-messages")@@ -206,7 +211,11 @@ class CompletionApi(Resource):500: "Internal server error",})- @service_api_ns.response(200, "Completion created successfully")+ @service_api_ns.response(+ 200,+ "Completion created successfully",+ service_api_ns.models[CompletionBlockingResponse.__name__],+ )@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))@with_sessiondef post(self, session: Session, app_model: App, end_user: EndUser):@@ -361,7 +370,11 @@ class ChatApi(Resource):500: "Internal server error",})- @service_api_ns.response(200, "Message sent successfully")+ @service_api_ns.response(+ 200,+ "Message sent successfully",+ service_api_ns.models[ChatBlockingResponse.__name__],+ )@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))@with_sessiondef post(self, session: Session, app_model: App, end_user: EndUser):diff --git a/api/controllers/service_api/app/conversation.py b/api/controllers/service_api/app/conversation.pyindex d7f9071dc53..ac066cdf11d 100644--- a/api/controllers/service_api/app/conversation.py+++ b/api/controllers/service_api/app/conversation.py@@ -1,10 +1,10 @@from datetime import datetime-from typing import Any, Literal+from typing import Annotated, Any, Literalfrom uuid import UUIDfrom flask import requestfrom flask_restx import Resource-from pydantic import BaseModel, Field, TypeAdapter, field_validator+from pydantic import BaseModel, Field, TypeAdapter, WithJsonSchema, field_validatorfrom sqlalchemy.orm import sessionmakerfrom werkzeug.exceptions import BadRequest, NotFound@@ -29,6 +29,9 @@ from libs.helper import UUIDStrOrEmpty, dump_response, to_timestampfrom models.model import App, AppMode, EndUserfrom services.conversation_service import ConversationService+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+class ConversationListQuery(BaseModel):last_id: UUIDStrOrEmpty | None = Field(@@ -84,13 +87,13 @@ class ConversationVariableUpdatePayload(BaseModel):class ConversationVariableResponse(ResponseModel):- id: str+ id: UUIDStringname: strvalue_type: strvalue: str | None = Nonedescription: str | None = None- created_at: int | None = None- updated_at: int | None = None+ created_at: Int64 | None = None+ updated_at: Int64 | None = None@field_validator("value_type", mode="before")@classmethod@@ -219,7 +222,7 @@ class ConversationApi(Resource):raise NotFound("Last Conversation Not Exists.")-@service_api_ns.route("/conversations/<uuid:c_id>")+@service_api_ns.route("/conversations/<uuid:conversation_id>")class ConversationDetailApi(Resource):@service_api_ns.doc(summary="Delete Conversation",@@ -234,7 +237,7 @@ class ConversationDetailApi(Resource):@expect_user_json(service_api_ns)@service_api_ns.doc("delete_conversation")@service_api_ns.doc(description="Delete a specific conversation")- @service_api_ns.doc(params={"c_id": "Conversation ID."})+ @service_api_ns.doc(params={"conversation_id": "Conversation ID."})@service_api_ns.doc(responses={204: "Conversation deleted successfully",@@ -243,22 +246,22 @@ class ConversationDetailApi(Resource):})@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON))- def delete(self, app_model: App, end_user: EndUser, c_id: UUID):+ def delete(self, app_model: App, end_user: EndUser, conversation_id: UUID):"""Delete a specific conversation."""app_mode = AppMode.value_of(app_model.mode)if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT, AppMode.AGENT}:raise NotChatAppError()- conversation_id = str(c_id)+ conversation_id_str = str(conversation_id)try:- ConversationService.delete(app_model, conversation_id, end_user, session=db.session())+ ConversationService.delete(app_model, conversation_id_str, end_user, session=db.session())except services.errors.conversation.ConversationNotExistsError:raise NotFound("Conversation Not Exists.")return "", 204-@service_api_ns.route("/conversations/<uuid:c_id>/name")+@service_api_ns.route("/conversations/<uuid:conversation_id>/name")class ConversationRenameApi(Resource):@service_api_ns.doc(summary="Rename Conversation",@@ -276,7 +279,7 @@ class ConversationRenameApi(Resource):@expect_with_user(service_api_ns, ConversationRenamePayload)@service_api_ns.doc("rename_conversation")@service_api_ns.doc(description="Rename a conversation or auto-generate a name")- @service_api_ns.doc(params={"c_id": "Conversation ID."})+ @service_api_ns.doc(params={"conversation_id": "Conversation ID."})@service_api_ns.doc(responses={200: "Conversation renamed successfully",@@ -290,27 +293,27 @@ class ConversationRenameApi(Resource):service_api_ns.models[SimpleConversation.__name__],)@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON))- def post(self, app_model: App, end_user: EndUser, c_id: UUID):+ def post(self, app_model: App, end_user: EndUser, conversation_id: UUID):"""Rename a conversation or auto-generate a name."""app_mode = AppMode.value_of(app_model.mode)if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT, AppMode.AGENT}:raise NotChatAppError()- conversation_id = str(c_id)+ conversation_id_str = str(conversation_id)payload = ConversationRenamePayload.model_validate(service_api_ns.payload or {})try:session = db.session()conversation = ConversationService.rename(- app_model, conversation_id, end_user, payload.name, payload.auto_generate, session=session+ app_model, conversation_id_str, end_user, payload.name, payload.auto_generate, session=session)return dump_response(SimpleConversation, ConversationResponseSource(conversation, session=session))except services.errors.conversation.ConversationNotExistsError:raise NotFound("Conversation Not Exists.")-@service_api_ns.route("/conversations/<uuid:c_id>/variables")+@service_api_ns.route("/conversations/<uuid:conversation_id>/variables")class ConversationVariablesApi(Resource):@service_api_ns.doc(summary="List Conversation Variables",@@ -324,7 +327,9 @@ class ConversationVariablesApi(Resource):)@service_api_ns.doc("list_conversation_variables")@service_api_ns.doc(description="List all variables for a conversation")- @service_api_ns.doc(params={"c_id": "Conversation ID.", **query_params_from_model(ConversationVariablesQuery)})+ @service_api_ns.doc(+ params={"conversation_id": "Conversation ID.", **query_params_from_model(ConversationVariablesQuery)}+ )@service_api_ns.doc(responses={200: "Variables retrieved successfully",@@ -338,7 +343,7 @@ class ConversationVariablesApi(Resource):service_api_ns.models[ConversationVariableInfiniteScrollPaginationResponse.__name__],)@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.QUERY))- def get(self, app_model: App, end_user: EndUser, c_id: UUID):+ def get(self, app_model: App, end_user: EndUser, conversation_id: UUID):"""List all variables for a conversation.Conversational variables are only available for chat applications.@@ -348,7 +353,7 @@ class ConversationVariablesApi(Resource):if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}:raise NotChatAppError()- conversation_id = str(c_id)+ conversation_id_str = str(conversation_id)query_args = ConversationVariablesQuery.model_validate(request.args.to_dict())last_id = query_args.last_id or None@@ -356,7 +361,7 @@ class ConversationVariablesApi(Resource):try:pagination = ConversationService.get_conversational_variable(app_model,- conversation_id,+ conversation_id_str,end_user,query_args.limit,last_id,@@ -368,7 +373,7 @@ class ConversationVariablesApi(Resource):raise NotFound("Conversation Not Exists.")-@service_api_ns.route("/conversations/<uuid:c_id>/variables/<uuid:variable_id>")+@service_api_ns.route("/conversations/<uuid:conversation_id>/variables/<uuid:variable_id>")class ConversationVariableDetailApi(Resource):@service_api_ns.doc(summary="Update Conversation Variable",@@ -388,7 +393,7 @@ class ConversationVariableDetailApi(Resource):@expect_with_user(service_api_ns, ConversationVariableUpdatePayload)@service_api_ns.doc("update_conversation_variable")@service_api_ns.doc(description="Update a conversation variable's value")- @service_api_ns.doc(params={"c_id": "Conversation ID.", "variable_id": "Variable ID."})+ @service_api_ns.doc(params={"conversation_id": "Conversation ID.", "variable_id": "Variable ID."})@service_api_ns.doc(responses={200: "Variable updated successfully",@@ -403,7 +408,7 @@ class ConversationVariableDetailApi(Resource):service_api_ns.models[ConversationVariableResponse.__name__],)@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON))- def put(self, app_model: App, end_user: EndUser, c_id: UUID, variable_id: UUID):+ def put(self, app_model: App, end_user: EndUser, conversation_id: UUID, variable_id: UUID):"""Update a conversation variable's value.Allows updating the value of a specific conversation variable.@@ -413,14 +418,14 @@ class ConversationVariableDetailApi(Resource):if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}:raise NotChatAppError()- conversation_id = str(c_id)+ conversation_id_str = str(conversation_id)variable_id_str = str(variable_id)payload = ConversationVariableUpdatePayload.model_validate(service_api_ns.payload or {})try:variable = ConversationService.update_conversation_variable(- app_model, conversation_id, variable_id_str, end_user, payload.value, session=db.session()+ app_model, conversation_id_str, variable_id_str, end_user, payload.value, session=db.session())return dump_response(ConversationVariableResponse, variable)except services.errors.conversation.ConversationNotExistsError:diff --git a/api/controllers/service_api/app/file_preview.py b/api/controllers/service_api/app/file_preview.pyindex 3bd0db6eb54..b315e190fa3 100644--- a/api/controllers/service_api/app/file_preview.py+++ b/api/controllers/service_api/app/file_preview.py@@ -34,25 +34,7 @@ class FilePreviewQuery(BaseModel):register_schema_model(service_api_ns, FilePreviewQuery)register_response_schema_model(service_api_ns, BinaryFileResponse)-FILE_PREVIEW_RESPONSE_MEDIA_TYPES = [- "application/octet-stream",- "application/pdf",- "audio/aac",- "audio/flac",- "audio/mp4",- "audio/mpeg",- "audio/ogg",- "audio/wav",- "audio/x-m4a",- "image/gif",- "image/jpeg",- "image/png",- "image/webp",- "text/plain",- "video/mp4",- "video/quicktime",- "video/webm",-]+FILE_PREVIEW_RESPONSE_MEDIA_TYPE = "*/*"@service_api_ns.route("/files/<uuid:file_id>/preview")@@ -83,7 +65,7 @@ class FilePreviewApi(Resource):},)@service_api_ns.doc(params=query_params_from_model(FilePreviewQuery))- @binary_response(service_api_ns, FILE_PREVIEW_RESPONSE_MEDIA_TYPES)+ @binary_response(service_api_ns, FILE_PREVIEW_RESPONSE_MEDIA_TYPE)@service_api_ns.doc("preview_file")@service_api_ns.doc(description="Preview or download a file uploaded via Service API")@service_api_ns.doc(diff --git a/api/controllers/service_api/app/human_input_form.py b/api/controllers/service_api/app/human_input_form.pyindex 53069644b55..2951818e3ba 100644--- a/api/controllers/service_api/app/human_input_form.py+++ b/api/controllers/service_api/app/human_input_form.py@@ -8,11 +8,11 @@ paused human input forms in workflow/chatflow runs.import jsonimport loggingfrom collections.abc import Sequence-from typing import Any+from typing import Annotatedfrom flask import Responsefrom flask_restx import Resource-from pydantic import ConfigDict, Field+from pydantic import ConfigDict, WithJsonSchemafrom werkzeug.exceptions import BadRequest, NotFoundfrom controllers.common.human_input import HumanInputFormSubmitPayload, stringify_form_default_values@@ -21,7 +21,7 @@ from controllers.service_api import service_api_nsfrom controllers.service_api.schema import expect_with_userfrom controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_tokenfrom core.workflow.human_input_policy import HumanInputSurface, is_recipient_type_allowed_for_surface-from core.workflow.nodes.human_input.entities import FormInputConfig+from core.workflow.nodes.human_input.entities import FormInputConfig, UserActionConfigfrom extensions.ext_database import dbfrom fields.base import ResponseModelfrom libs.helper import to_timestamp@@ -31,12 +31,15 @@ from services.human_input_service import Form, FormNotFoundError, HumanInputServlogger = logging.getLogger(__name__)+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]++class HumanInputFormDefinitionResponse(ResponseModel):form_content: str- inputs: list[dict[str, Any]] = Field(default_factory=list)+ inputs: list[FormInputConfig]resolved_default_values: dict[str, str]- user_actions: list[dict[str, Any]] = Field(default_factory=list)- expiration_time: int | None = None+ user_actions: list[UserActionConfig]+ expiration_time: Int64 | None = Noneclass HumanInputFormSubmitResponse(ResponseModel):diff --git a/api/controllers/service_api/app/message.py b/api/controllers/service_api/app/message.pyindex fb0c511ffa3..59f7cc0d676 100644--- a/api/controllers/service_api/app/message.py+++ b/api/controllers/service_api/app/message.py@@ -1,9 +1,10 @@import logging+from typing import Annotatedfrom uuid import UUIDfrom flask import requestfrom flask_restx import Resource-from pydantic import BaseModel, Field, TypeAdapter+from pydantic import BaseModel, Field, TypeAdapter, WithJsonSchemafrom werkzeug.exceptions import BadRequest, InternalServerError, NotFoundimport services@@ -31,21 +32,24 @@ from services.message_service import MessageServicelogger = logging.getLogger(__name__)+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]++class FeedbackListQuery(BaseModel):page: int = Field(default=1, ge=1, description="Page number for pagination.")limit: int = Field(default=20, ge=1, le=101, description="Number of records per page.")class AppFeedbackResponse(ResponseModel):- id: str- app_id: str- conversation_id: str- message_id: str+ id: UUIDString+ app_id: UUIDString+ conversation_id: UUIDString+ message_id: UUIDStringrating: strcontent: str | None = Nonefrom_source: str- from_end_user_id: str | None = None- from_account_id: str | None = None+ from_end_user_id: UUIDString | None = None+ from_account_id: UUIDString | None = Nonecreated_at: strupdated_at: str@@ -150,6 +154,7 @@ class MessageFeedbackApi(Resource):@service_api_ns.doc(responses={200: "Feedback submitted successfully",+ 400: "Bad request - invalid feedback payload",401: "Unauthorized - invalid API token",404: "Message not found",}diff --git a/api/controllers/service_api/app/workflow.py b/api/controllers/service_api/app/workflow.pyindex 846a500adc3..93a1ff1913f 100644--- a/api/controllers/service_api/app/workflow.py+++ b/api/controllers/service_api/app/workflow.py@@ -1,19 +1,19 @@import loggingfrom collections.abc import Mappingfrom datetime import datetime-from typing import Literal+from typing import Annotated, Literalfrom dateutil.parser import isoparsefrom flask import requestfrom flask_restx import Resource-from pydantic import BaseModel, Field, field_validator, model_validator+from pydantic import BaseModel, Field, WithJsonSchema, field_validator, model_validatorfrom pydantic.json_schema import SkipJsonSchemafrom sqlalchemy.orm import Session, sessionmakerfrom werkzeug.exceptions import BadRequest, InternalServerError, NotFoundfrom configs import dify_configfrom controllers.common.controller_schemas import WorkflowRunPayload as WorkflowRunPayloadBase-from controllers.common.fields import GeneratedAppResponse, SimpleResultResponse+from controllers.common.fields import SimpleResultResponse, WorkflowBlockingResponsefrom controllers.common.schema import (query_params_from_model,query_params_from_request,@@ -66,6 +66,10 @@ from services.workflow_app_service import WorkflowAppServicelogger = logging.getLogger(__name__)+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+FloatNumber = Annotated[float, WithJsonSchema({"format": "float", "type": "number"})]+class WorkflowRunPayload(WorkflowRunPayloadBase):response_mode: Literal["blocking", "streaming"] | None = Field(@@ -106,7 +110,7 @@ class WorkflowLogQuery(BaseModel):register_schema_models(service_api_ns, WorkflowRunPayload, WorkflowLogQuery)-register_response_schema_models(service_api_ns, GeneratedAppResponse, SimpleResultResponse)+register_response_schema_models(service_api_ns, WorkflowBlockingResponse, SimpleResultResponse)def _enum_value(value):@@ -114,17 +118,17 @@ def _enum_value(value):class WorkflowRunResponse(ResponseModel):- id: str- workflow_id: str+ id: UUIDString+ workflow_id: UUIDStringstatus: strinputs: dict | list | str | int | float | bool | None = Field(default=None)outputs: dict = Field(default_factory=dict, validation_alias="outputs_dict")error: str | None = Nonetotal_steps: int | None = Nonetotal_tokens: int | None = None- created_at: int | None = None- finished_at: int | None = None- elapsed_time: float | int | None = None+ created_at: Int64 | None = None+ finished_at: Int64 | None = None+ elapsed_time: FloatNumber | int | None = None@field_validator("status", mode="before")@classmethod@@ -155,16 +159,16 @@ class WorkflowRunResponse(ResponseModel):class WorkflowRunForLogResponse(ResponseModel):- id: str+ id: UUIDStringversion: str | None = Nonestatus: str | None = Nonetriggered_from: str | None = Noneerror: str | None = None- elapsed_time: float | int | None = None+ elapsed_time: FloatNumber | int | None = Nonetotal_tokens: int | None = Nonetotal_steps: int | None = None- created_at: int | None = None- finished_at: int | None = None+ created_at: Int64 | None = None+ finished_at: Int64 | None = Noneexceptions_count: int | None = None@field_validator("status", "triggered_from", mode="before")@@ -179,14 +183,14 @@ class WorkflowRunForLogResponse(ResponseModel):class WorkflowAppLogPartialResponse(ResponseModel):- id: str+ id: UUIDStringworkflow_run: WorkflowRunForLogResponse | None = Nonedetails: dict | list | str | int | float | bool | None = Field(default=None)created_from: str | None = Nonecreated_by_role: str | None = Nonecreated_by_account: SimpleAccountResponse | None = Nonecreated_by_end_user: SimpleEndUser | None = None- created_at: int | None = None+ created_at: Int64 | None = None@field_validator("created_from", "created_by_role", mode="before")@classmethod@@ -319,7 +323,7 @@ class WorkflowRunApi(Resource):@service_api_ns.response(200,"Workflow executed successfully",- service_api_ns.models[GeneratedAppResponse.__name__],+ service_api_ns.models[WorkflowBlockingResponse.__name__],)@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))@with_session@@ -438,7 +442,7 @@ class WorkflowRunByIdApi(Resource):@service_api_ns.response(200,"Workflow executed successfully",- service_api_ns.models[GeneratedAppResponse.__name__],+ service_api_ns.models[WorkflowBlockingResponse.__name__],)@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True))@with_session@@ -565,6 +569,7 @@ class WorkflowAppLogApi(Resource):@service_api_ns.doc(responses={200: "Logs retrieved successfully",+ 400: "Bad request - invalid query parameters",401: "Unauthorized - invalid API token",})diff --git a/api/controllers/service_api/app/workflow_events.py b/api/controllers/service_api/app/workflow_events.pyindex 83a7c8227f5..2752b62d82c 100644--- a/api/controllers/service_api/app/workflow_events.py+++ b/api/controllers/service_api/app/workflow_events.py@@ -57,7 +57,7 @@ register_schema_models(service_api_ns, WorkflowEventsQuery)register_response_schema_model(service_api_ns, EventStreamResponse)-@service_api_ns.route("/workflow/<string:task_id>/events")+@service_api_ns.route("/workflow/<string:workflow_run_id>/events")class WorkflowEventsApi(Resource):"""Service API for getting workflow execution events after resume."""@@ -81,7 +81,7 @@ class WorkflowEventsApi(Resource):@event_stream_response(service_api_ns)@service_api_ns.doc("get_workflow_events")@service_api_ns.doc(description="Get workflow execution events stream after resume")- @service_api_ns.doc(params={"task_id": "Workflow run ID returned by the original workflow run request."})+ @service_api_ns.doc(params={"workflow_run_id": "Workflow run ID returned by the original workflow run request."})@service_api_ns.doc(params=query_params_from_model(WorkflowEventsQuery))@service_api_ns.doc(responses={@@ -92,7 +92,7 @@ class WorkflowEventsApi(Resource):)@service_api_ns.response(200, "SSE event stream", service_api_ns.models[EventStreamResponse.__name__])@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.QUERY, required=True))- def get(self, app_model: App, end_user: EndUser, task_id: str):+ def get(self, app_model: App, end_user: EndUser, workflow_run_id: str):app_mode = AppMode.value_of(app_model.mode)if app_mode not in {AppMode.WORKFLOW, AppMode.ADVANCED_CHAT}:raise NotWorkflowAppError()@@ -101,7 +101,7 @@ class WorkflowEventsApi(Resource):repo = DifyAPIRepositoryFactory.create_api_workflow_run_repository(session_maker)workflow_run = repo.get_workflow_run_by_id_and_tenant_id(tenant_id=app_model.tenant_id,- run_id=task_id,+ run_id=workflow_run_id,)if workflow_run is None:diff --git a/api/controllers/service_api/dataset/dataset.py b/api/controllers/service_api/dataset/dataset.pyindex 8e5f3b60d87..af4de60ba6c 100644--- a/api/controllers/service_api/dataset/dataset.py+++ b/api/controllers/service_api/dataset/dataset.py@@ -234,7 +234,10 @@ class TagDeletePayload(BaseModel):class TagBindingPayload(BaseModel):- tag_ids: list[str] = Field(description="Tag IDs to bind.")+ tag_ids: list[str] = Field(+ description="Tag IDs to bind.",+ json_schema_extra={"minItems": 1},+ )target_id: str = Field(description="Knowledge base ID to bind the tags to.")@field_validator("tag_ids")@@ -255,8 +258,12 @@ class TagUnbindingPayload(BaseModel):@classmethod@overridedef __get_pydantic_json_schema__(cls, _core_schema: object, _handler: GetJsonSchemaHandler) -> dict[str, object]:- tag_id_property = {+ tag_id_annotations = {+ "deprecated": True,"description": "Legacy single tag ID accepted by the Service API.",+ }+ tag_id_property = {+ **tag_id_annotations,"type": "string",}tag_ids_property = {@@ -279,7 +286,10 @@ class TagUnbindingPayload(BaseModel):},{"properties": {- "tag_id": {**tag_id_property, "nullable": True},+ "tag_id": {+ **tag_id_annotations,+ "anyOf": [{"type": "string"}, {"type": "null"}],+ },"tag_ids": tag_ids_property,"target_id": target_id_property,},@@ -648,6 +658,7 @@ class DatasetApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Dataset updated successfully",+ 400: "Bad request - invalid embedding or reranking model configuration",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",404: "Dataset not found",@@ -924,6 +935,7 @@ class DatasetTagsApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Tag created successfully",+ 400: "Bad request - tag name already exists",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",}@@ -960,8 +972,10 @@ class DatasetTagsApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Tag updated successfully",+ 400: "Bad request - tag name already exists",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",+ 404: "Tag not found",})@service_api_ns.response(@@ -1002,6 +1016,7 @@ class DatasetTagsApi(DatasetApiResource):204: "Tag deleted successfully",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",+ 404: "Tag not found",})@edit_permission_required@@ -1032,6 +1047,7 @@ class DatasetTagBindingApi(DatasetApiResource):204: "Tags bound successfully",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",+ 404: "Dataset not found",})@with_session@@ -1068,6 +1084,7 @@ class DatasetTagUnbindingApi(DatasetApiResource):204: "Tags unbound successfully",401: "Unauthorized - invalid API token",403: "Forbidden - insufficient permissions",+ 404: "Dataset not found",})@with_sessiondiff --git a/api/controllers/service_api/dataset/document.py b/api/controllers/service_api/dataset/document.pyindex 2047246f52d..3c766bba6f2 100644--- a/api/controllers/service_api/dataset/document.py+++ b/api/controllers/service_api/dataset/document.py@@ -903,8 +903,8 @@ def _update_document_by_file(@service_api_ns.route("/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/update_by_file",- "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/update-by-file",)+@service_api_ns.route("/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/update-by-file")class DeprecatedDocumentUpdateByFileApi(DatasetApiResource):"""Deprecated resource aliases for file document updates."""@@ -945,6 +945,7 @@ class DeprecatedDocumentUpdateByFileApi(DatasetApiResource):401: "Unauthorized - invalid API token",404: "Document not found",413: "File too large",+ 415: "Unsupported file type",})@service_api_ns.response(@@ -1425,6 +1426,7 @@ class DocumentApi(DatasetApiResource):401: "Unauthorized - invalid API token",404: "Document not found",413: "File too large",+ 415: "Unsupported file type",})@service_api_ns.response(diff --git a/api/controllers/service_api/dataset/hit_testing.py b/api/controllers/service_api/dataset/hit_testing.pyindex 1028f174d71..669c471ae8d 100644--- a/api/controllers/service_api/dataset/hit_testing.py+++ b/api/controllers/service_api/dataset/hit_testing.py@@ -14,7 +14,11 @@ register_schema_models(service_api_ns, HitTestingPayload)register_response_schema_models(service_api_ns, HitTestingResponse)-@service_api_ns.route("/datasets/<uuid:dataset_id>/hit-testing", "/datasets/<uuid:dataset_id>/retrieve")+@service_api_ns.route(+ "/datasets/<uuid:dataset_id>/hit-testing",+ doc={"post": {"deprecated": True}},+)+@service_api_ns.route("/datasets/<uuid:dataset_id>/retrieve")class HitTestingApi(DatasetApiResource, DatasetsHitTestingBase):@service_api_ns.doc(summary="Retrieve Chunks from a Knowledge Base / Test Retrieval",diff --git a/api/controllers/service_api/dataset/metadata.py b/api/controllers/service_api/dataset/metadata.pyindex 262ae176b7e..18c7d1a3692 100644--- a/api/controllers/service_api/dataset/metadata.py+++ b/api/controllers/service_api/dataset/metadata.py@@ -71,6 +71,7 @@ class DatasetMetadataCreateServiceApi(DatasetApiResource):@service_api_ns.doc(responses={201: "Metadata created successfully",+ 400: "Bad request - invalid or duplicate metadata name",401: "Unauthorized - invalid API token",404: "Dataset not found",}@@ -145,6 +146,7 @@ class DatasetMetadataServiceApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Metadata updated successfully",+ 400: "Bad request - invalid or duplicate metadata name",401: "Unauthorized - invalid API token",404: "Dataset or metadata not found",}@@ -300,6 +302,7 @@ class DocumentMetadataEditServiceApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Documents metadata updated successfully",+ 400: "Bad request - invalid or conflicting document metadata operation",401: "Unauthorized - invalid API token",404: "Dataset, document, or metadata not found",}diff --git a/api/controllers/service_api/dataset/rag_pipeline/rag_pipeline_workflow.py b/api/controllers/service_api/dataset/rag_pipeline/rag_pipeline_workflow.pyindex a2a1ae40bf1..02d7a1b958f 100644--- a/api/controllers/service_api/dataset/rag_pipeline/rag_pipeline_workflow.py+++ b/api/controllers/service_api/dataset/rag_pipeline/rag_pipeline_workflow.py@@ -16,7 +16,7 @@ from controllers.common.errors import (NoFileUploadedError,TooManyFilesError,)-from controllers.common.fields import GeneratedAppResponse+from controllers.common.fields import WorkflowBlockingResponsefrom controllers.common.schema import (query_params_from_model,query_params_from_request,@@ -30,6 +30,7 @@ from controllers.service_api.schema import event_stream_response, json_or_event_from controllers.service_api.wraps import DatasetApiResourcefrom core.app.apps.pipeline.pipeline_generator import PipelineGeneratorfrom core.app.entities.app_invoke_entities import InvokeFrom+from core.entities.knowledge_entities import PipelineDataset, PipelineDocumentfrom fields.base import ResponseModelfrom libs import helperfrom libs.helper import dump_response@@ -111,6 +112,16 @@ class PipelineUploadFileResponse(ResponseModel):return value+class PublishedPipelineRunResponse(ResponseModel):+ batch: str+ dataset: PipelineDataset+ documents: list[PipelineDocument]+++class PipelineRunJsonResponse(RootModel[PublishedPipelineRunResponse | WorkflowBlockingResponse]):+ """JSON responses returned by published and draft knowledge pipeline runs."""++register_schema_model(service_api_ns, DatasourceNodeRunPayload)register_schema_model(service_api_ns, DatasourcePluginsQuery)register_schema_model(service_api_ns, PipelineRunApiEntity)@@ -120,6 +131,9 @@ register_response_schema_models(DatasourcePluginResponse,DatasourcePluginListResponse,PipelineUploadFileResponse,+ WorkflowBlockingResponse,+ PublishedPipelineRunResponse,+ PipelineRunJsonResponse,)@@ -146,6 +160,7 @@ class DatasourcePluginsApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Datasource plugins retrieved successfully",+ 400: "Bad request - pipeline is not configured",401: "Unauthorized - invalid API token",})@@ -189,12 +204,13 @@ class DatasourceNodeRunApi(DatasetApiResource):},)@event_stream_response(service_api_ns)- @service_api_ns.doc(shortcut="pipeline_datasource_node_run")+ @service_api_ns.doc(shortcut="run_datasource_node")@service_api_ns.doc(description="Run a datasource node for a rag pipeline")@service_api_ns.doc(params={"dataset_id": "Knowledge base ID.", "node_id": "ID of the datasource node to execute."})@service_api_ns.doc(responses={200: "Datasource node run successfully",+ 400: "Bad request - invalid payload or pipeline is not configured",401: "Unauthorized - invalid API token",})@@ -242,14 +258,15 @@ class PipelineRunApi(DatasetApiResource):@service_api_ns.doc(summary="Run Pipeline",description=(- "Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response "- "modes."+ "Execute the full knowledge pipeline for a knowledge base. Published runs are queued and return batch "+ "metadata as JSON. Draft runs support blocking JSON and streaming Server-Sent Events."),tags=["Knowledge Pipeline"],responses={200: (- "Pipeline execution result. Format depends on `response_mode`: streaming returns a "- "`text/event-stream`, blocking returns a JSON object."+ "Pipeline execution result. Published runs return a JSON object containing `batch`, `dataset`, and "+ "`documents`. Draft runs return `text/event-stream` for streaming mode or a workflow result JSON "+ "object for blocking mode."),403: "`forbidden` : Forbidden.",404: "`not_found` : Dataset not found.",@@ -257,12 +274,13 @@ class PipelineRunApi(DatasetApiResource):},)@json_or_event_stream_response(service_api_ns)- @service_api_ns.doc(shortcut="pipeline_datasource_node_run")+ @service_api_ns.doc(shortcut="run_pipeline")@service_api_ns.doc(description="Run a datasource node for a rag pipeline")@service_api_ns.doc(params={"dataset_id": "Knowledge base ID."})@service_api_ns.doc(responses={200: "Pipeline run successfully",+ 400: "Bad request - invalid payload or pipeline is not configured",401: "Unauthorized - invalid API token",})@@ -270,7 +288,7 @@ class PipelineRunApi(DatasetApiResource):@service_api_ns.response(200,"Pipeline run successfully",- service_api_ns.models[GeneratedAppResponse.__name__],+ service_api_ns.models[PipelineRunJsonResponse.__name__],)@with_sessiondef post(self, session: Session, tenant_id: str, dataset_id: UUID):diff --git a/api/controllers/service_api/dataset/segment.py b/api/controllers/service_api/dataset/segment.pyindex 5ed098e94b2..d8d120eab42 100644--- a/api/controllers/service_api/dataset/segment.py+++ b/api/controllers/service_api/dataset/segment.py@@ -259,6 +259,7 @@ class SegmentApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Segments retrieved successfully",+ 400: "Bad request - embedding model is not configured",401: "Unauthorized - invalid API token",404: "Dataset or document not found",}@@ -353,6 +354,7 @@ class DatasetSegmentApi(DatasetApiResource):@service_api_ns.doc(responses={204: "Segment deleted successfully",+ 400: "Bad request - invalid dataset model state or concurrent deletion",401: "Unauthorized - invalid API token",404: "Dataset, document, or segment not found",}@@ -395,6 +397,7 @@ class DatasetSegmentApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Segment updated successfully",+ 400: "Bad request - invalid segment or embedding model configuration",401: "Unauthorized - invalid API token",404: "Dataset, document, or segment not found",}@@ -469,6 +472,7 @@ class DatasetSegmentApi(DatasetApiResource):@service_api_ns.doc(responses={200: "Segment retrieved successfully",+ 400: "Bad request - invalid dataset model configuration",401: "Unauthorized - invalid API token",404: "Dataset, document, or segment not found",}diff --git a/api/controllers/service_api/index.py b/api/controllers/service_api/index.pyindex 365a7fa252f..9e99bffcbdc 100644--- a/api/controllers/service_api/index.py+++ b/api/controllers/service_api/index.py@@ -15,10 +15,12 @@ class IndexInfoResponse(ResponseModel):register_response_schema_models(service_api_ns, IndexInfoResponse)-@service_api_ns.route("/")+@service_api_ns.route("/", endpoint="root")class IndexApi(Resource):+ @service_api_ns.doc("get_index_api", security=[])@service_api_ns.response(200, "Success", service_api_ns.models[IndexInfoResponse.__name__])def get(self) -> dict[str, str]:+ """Return public Service API metadata without requiring an API key."""return IndexInfoResponse(welcome="Dify OpenAPI",api_version="v1",diff --git a/api/controllers/service_api/schema.py b/api/controllers/service_api/schema.pyindex 87f8aa54287..9a1ddd590eb 100644--- a/api/controllers/service_api/schema.py+++ b/api/controllers/service_api/schema.py@@ -13,6 +13,8 @@ from typing import Annotated, Any, castfrom flask_restx import Namespacefrom pydantic import BaseModel, WithJsonSchema+from libs.flask_restx_compat import BINARY_RESPONSE_MEDIA_TYPES_VENDOR_KEY+USER_DESCRIPTION = ("User identifier, unique within the application. This identifier scopes data access; resources created with ""one `user` value are only visible when queried with the same `user` value."@@ -38,33 +40,55 @@ USER_FETCH_FROM_ATTR = "_dify_service_api_user_fetch_from"USER_REQUIRED_ATTR = "_dify_service_api_user_required"JSON_USER_FETCH_FROM = "JSON"++def _input_file_variant(transfer_method: str, source: str) -> dict[str, object]:+ return {+ "type": "object",+ "properties": {+ "type": {+ "description": "File type.",+ "enum": ["document", "image", "audio", "video", "custom"],+ "type": "string",+ },+ "transfer_method": {+ "description": (+ "Transfer method: `remote_url` for a file URL or persisted uploaded-file reference, "+ "`local_file` for an uploaded file."+ ),+ "enum": [transfer_method],+ "type": "string",+ },+ "url": {+ "description": "File URL when `transfer_method` is `remote_url`.",+ "format": "url",+ "type": "string",+ },+ "remote_url": {+ "description": "Legacy alias of `url` when `transfer_method` is `remote_url`.",+ "format": "url",+ "type": "string",+ },+ "upload_file_id": {+ "description": (+ "Uploaded file ID obtained from the [Upload File](/api-reference/files/upload-file) API. "+ "Required for `local_file`; also accepted with `remote_url` for compatibility with persisted "+ "file references."+ ),+ "type": "string",+ },+ },+ "required": ["type", "transfer_method", source],+ }++INPUT_FILE_ITEM_SCHEMA: dict[str, object] = {"type": "object",- "required": ["type", "transfer_method"],- "properties": {- "type": {- "description": "File type.",- "enum": ["document", "image", "audio", "video", "custom"],- "type": "string",- },- "transfer_method": {- "description": "Transfer method: `remote_url` for file URL, `local_file` for uploaded file.",- "enum": ["remote_url", "local_file"],- "type": "string",- },- "url": {- "description": "File URL when `transfer_method` is `remote_url`.",- "format": "url",- "type": "string",- },- "upload_file_id": {- "description": (- "Uploaded file ID obtained from the [Upload File](/api-reference/files/upload-file) API when "- "`transfer_method` is `local_file`."- ),- "type": "string",- },- },+ "anyOf": [+ _input_file_variant("remote_url", "url"),+ _input_file_variant("remote_url", "remote_url"),+ _input_file_variant("remote_url", "upload_file_id"),+ _input_file_variant("local_file", "upload_file_id"),+ ],}INPUT_FILE_LIST_SCHEMA: dict[str, object] = {"anyOf": [{"items": INPUT_FILE_ITEM_SCHEMA, "type": "array"}, {"type": "null"}]@@ -125,7 +149,10 @@ def event_stream_response(namespace: Namespace):def binary_response(namespace: Namespace, media_type: str | Sequence[str]):media_types = [media_type] if isinstance(media_type, str) else list(media_type)- return namespace.doc(produces=media_types)+ return namespace.doc(+ produces=media_types,+ vendor={BINARY_RESPONSE_MEDIA_TYPES_VENDOR_KEY: media_types},+ )def _json_user_required(view_func) -> bool:diff --git a/api/core/base/tts/audio_mime.py b/api/core/base/tts/audio_mime.pyindex 7e4d3cb9de6..cd2c86a6b8a 100644--- a/api/core/base/tts/audio_mime.py+++ b/api/core/base/tts/audio_mime.py@@ -37,6 +37,7 @@ _AUDIO_MIME_TYPE_ALIASES = {"webm": "audio/webm","audio/webm": "audio/webm",}+SUPPORTED_TTS_AUDIO_MIME_TYPES = tuple(sorted(set(_AUDIO_MIME_TYPE_ALIASES.values())))def normalize_audio_mime_type(audio_type: object | None) -> str | None:diff --git a/api/core/workflow/nodes/human_input/entities.py b/api/core/workflow/nodes/human_input/entities.pyindex 8fd983102c5..1d90b69e912 100644--- a/api/core/workflow/nodes/human_input/entities.py+++ b/api/core/workflow/nodes/human_input/entities.py@@ -210,7 +210,7 @@ class UserActionConfig(BaseModel):# It also serves as the identifiers of output handle.## The id must be a valid identifier (satisfy the _IDENTIFIER_PATTERN above.)- id: str = Field(max_length=20)+ id: str = Field(max_length=20, pattern=_IDENTIFIER_PATTERN.pattern)title: str = Field(max_length=100)button_style: ButtonStyle = ButtonStyle.DEFAULTdiff --git a/api/dev/generate_fastopenapi_specs.py b/api/dev/generate_fastopenapi_specs.pyindex 2a7f9450884..e29a0397097 100644--- a/api/dev/generate_fastopenapi_specs.py+++ b/api/dev/generate_fastopenapi_specs.py@@ -13,7 +13,8 @@ API_ROOT = Path(__file__).resolve().parents[1]if str(API_ROOT) not in sys.path:sys.path.insert(0, str(API_ROOT))-from dev.generate_swagger_specs import apply_runtime_defaults, drop_null_values, sort_openapi_arrays+from dev.generate_swagger_specs import apply_runtime_defaults+from libs.flask_restx_compat import sort_openapi_arrayslogger = logging.getLogger(__name__)@@ -59,7 +60,6 @@ def generate_fastopenapi_specs(output_dir: Path) -> list[Path]:payload = response.get_json()if not isinstance(payload, dict):raise RuntimeError(f"unexpected response payload for {target.route}")- payload = drop_null_values(payload)payload = sort_openapi_arrays(payload)output_path = output_dir / target.filenamediff --git a/api/dev/generate_swagger_markdown_docs.py b/api/dev/generate_swagger_markdown_docs.pyindex 04187919bc5..991a487c107 100644--- a/api/dev/generate_swagger_markdown_docs.py+++ b/api/dev/generate_swagger_markdown_docs.py@@ -177,9 +177,31 @@ def _strip_trailing_line_whitespace(markdown: str) -> str:return "\n".join(line.rstrip(" \t") for line in markdown.split("\n"))+def _patch_wildcard_media_type_markdown(markdown: str) -> str:+ """Keep swagger-markdown from interpreting the wildcard media type as emphasis."""++ return markdown.replace("***/***", "`*/*`")+++def _drop_null_values_for_markdown(value: object) -> object:+ """Remove null object members only from the converter's temporary input."""++ if isinstance(value, dict):+ return {key: _drop_null_values_for_markdown(item) for key, item in value.items() if item is not None}+ if isinstance(value, list):+ return [_drop_null_values_for_markdown(item) for item in value]+ return value++def _convert_spec_to_markdown(spec_path: Path, markdown_path: Path) -> None:markdown_path.parent.mkdir(parents=True, exist_ok=True)with tempfile.TemporaryDirectory(prefix=f"{markdown_path.stem}-") as temp_dir:+ converter_spec_path = Path(temp_dir) / spec_path.name+ converter_payload = json.loads(spec_path.read_text(encoding="utf-8"))+ converter_spec_path.write_text(+ json.dumps(_drop_null_values_for_markdown(converter_payload)),+ encoding="utf-8",+ )temp_markdown_path = Path(temp_dir) / markdown_path.nameresult = subprocess.run([@@ -187,7 +209,7 @@ def _convert_spec_to_markdown(spec_path: Path, markdown_path: Path) -> None:"--yes",SWAGGER_MARKDOWN_PACKAGE,"-i",- str(spec_path.resolve()),+ str(converter_spec_path.resolve()),"-o",str(temp_markdown_path.resolve()),],@@ -211,6 +233,7 @@ def _convert_spec_to_markdown(spec_path: Path, markdown_path: Path) -> None:temp_markdown_path.read_text(encoding="utf-8"),spec_path,)+ converted_markdown = _patch_wildcard_media_type_markdown(converted_markdown)converted_markdown = _strip_trailing_line_whitespace(converted_markdown)if not converted_markdown.strip():raise RuntimeError(f"swagger-markdown wrote an empty document for {markdown_path}")diff --git a/api/dev/generate_swagger_specs.py b/api/dev/generate_swagger_specs.pyindex 868f9e87776..a99dd3ffaf6 100644--- a/api/dev/generate_swagger_specs.py+++ b/api/dev/generate_swagger_specs.py@@ -20,6 +20,8 @@ from pathlib import Pathfrom typing import Protocol, TypeGuardfrom flask import Flask+from flask_restx import Api+from flask_restx.swagger import Swaggerlogger = logging.getLogger(__name__)@@ -27,12 +29,13 @@ API_ROOT = Path(__file__).resolve().parents[1]if str(API_ROOT) not in sys.path:sys.path.insert(0, str(API_ROOT))+from libs.flask_restx_compat import finalize_openapi_payload+@dataclass(frozen=True)class SpecTarget:route: strfilename: str- namespace: strclass RestxApi(Protocol):@@ -42,10 +45,10 @@ class RestxApi(Protocol):SPEC_TARGETS: tuple[SpecTarget, ...] = (- SpecTarget(route="/console/api/openapi.json", filename="console-openapi.json", namespace="console"),- SpecTarget(route="/api/openapi.json", filename="web-openapi.json", namespace="web"),- SpecTarget(route="/v1/openapi.json", filename="service-openapi.json", namespace="service"),- SpecTarget(route="/openapi/v1/openapi.json", filename="openapi-openapi.json", namespace="openapi"),+ SpecTarget(route="/console/api/openapi.json", filename="console-openapi.json"),+ SpecTarget(route="/api/openapi.json", filename="web-openapi.json"),+ SpecTarget(route="/v1/openapi.json", filename="service-openapi.json"),+ SpecTarget(route="/openapi/v1/openapi.json", filename="openapi-openapi.json"),)@@ -142,14 +145,13 @@ def apply_runtime_defaults() -> None:os.environ.setdefault("SECRET_KEY", "spec-export")os.environ.setdefault("STORAGE_TYPE", "local")os.environ.setdefault("STORAGE_LOCAL_PATH", "/tmp/dify-storage")- os.environ.setdefault("SWAGGER_UI_ENABLED", "true")from configs import dify_configdify_config.SECRET_KEY = os.environ["SECRET_KEY"]dify_config.STORAGE_TYPE = "local"dify_config.STORAGE_LOCAL_PATH = os.environ["STORAGE_LOCAL_PATH"]- dify_config.SWAGGER_UI_ENABLED = os.environ["SWAGGER_UI_ENABLED"].lower() == "true"+ dify_config.SWAGGER_UI_ENABLED = Truedef create_spec_app() -> Flask:@@ -184,39 +186,20 @@ def create_spec_app() -> Flask:return app-def _registered_models(namespace: str) -> dict[str, object]:- """Return the Flask-RESTX models registered for an OpenAPI namespace."""-- if namespace == "console":- from controllers.console import console_ns-- models = dict(console_ns.models)- for api in console_ns.apis:- models.update(api.models)- return models- if namespace == "web":- from controllers.web import web_ns-- models = dict(web_ns.models)- for api in web_ns.apis:- models.update(api.models)- return models- if namespace == "service":- from controllers.service_api import service_api_ns-- models = dict(service_api_ns.models)- for api in service_api_ns.apis:- models.update(api.models)- return models- if namespace == "openapi":- from controllers.openapi import openapi_ns+def _target_apis() -> dict[str, Api]:+ """Return the API instance that owns each exported OpenAPI target."""- models = dict(openapi_ns.models)- for api in openapi_ns.apis:- models.update(api.models)- return models+ from controllers.console import api as console_api+ from controllers.openapi import api as openapi_api+ from controllers.service_api import api as service_api+ from controllers.web import api as web_api- raise ValueError(f"unknown OpenAPI namespace: {namespace}")+ return {+ "/console/api/openapi.json": console_api,+ "/api/openapi.json": web_api,+ "/v1/openapi.json": service_api,+ "/openapi/v1/openapi.json": openapi_api,+ }def _materialize_inline_model_definitions(api: RestxApi) -> None:@@ -281,135 +264,23 @@ def _materialize_inline_model_definitions(api: RestxApi) -> None:materialize_field(field)-def drop_null_values(value: object) -> object:- """Remove JSON null values that make the Markdown converter crash."""-- if isinstance(value, dict):- return {key: drop_null_values(item) for key, item in value.items() if item is not None}- if isinstance(value, list):- return [drop_null_values(item) for item in value]- return value---def sort_openapi_arrays(value: object, *, parent_key: str | None = None) -> object:- """Sort order-insensitive OpenAPI arrays so generated Markdown is stable."""-- if isinstance(value, dict):- return {key: sort_openapi_arrays(item, parent_key=key) for key, item in value.items()}- if not isinstance(value, list):- return value-- sorted_items = [sort_openapi_arrays(item, parent_key=parent_key) for item in value]- if parent_key == "parameters":- return sorted(- sorted_items,- key=lambda item: (- item.get("in", "") if isinstance(item, dict) else "",- item.get("name", "") if isinstance(item, dict) else "",- json.dumps(item, sort_keys=True, default=str),- ),- )- if parent_key in {"enum", "required", "schemes", "tags"}:- string_items = [item for item in sorted_items if isinstance(item, str)]- if len(string_items) == len(sorted_items):- return sorted(string_items)- return sorted_items---def _replace_legacy_refs(value: object) -> object:- if isinstance(value, dict):- replaced: dict[object, object] = {}- for key, item in value.items():- if key == "$ref" and isinstance(item, str) and item.startswith("#/definitions/"):- replaced[key] = item.replace("#/definitions/", "#/components/schemas/", 1)- else:- replaced[key] = _replace_legacy_refs(item)- return replaced- if isinstance(value, list):- return [_replace_legacy_refs(item) for item in value]- return value---HTTP_METHODS = {"delete", "get", "head", "options", "patch", "post", "put", "trace"}---def _deduplicate_operation_ids(payload: dict[str, object]) -> dict[str, object]:- """Make operationId values unique while preserving already-unique IDs."""-- paths = payload.get("paths")- if not isinstance(paths, dict):- return payload-- operations_by_id: dict[str, list[tuple[str, str, dict[str, object]]]] = {}- for path, path_item in paths.items():- if not isinstance(path, str) or not isinstance(path_item, dict):- continue- for method, operation in path_item.items():- if method not in HTTP_METHODS or not isinstance(operation, dict):- continue- operation_id = operation.get("operationId")- if isinstance(operation_id, str):- operations_by_id.setdefault(operation_id, []).append((method, path, operation))-- for operation_id, operations in operations_by_id.items():- if len(operations) < 2:- continue- for method, path, operation in operations:- digest = hashlib.sha1(f"{method}:{path}".encode()).hexdigest()[:8]- operation["operationId"] = f"{operation_id}_{digest}"-- return payload---def _component_schemas(payload: dict[str, object]) -> dict[str, object]:- components = payload.setdefault("components", {})- if not isinstance(components, dict):- raise RuntimeError("unexpected OpenAPI components payload")-- schemas = components.setdefault("schemas", {})- if not isinstance(schemas, dict):- raise RuntimeError("unexpected OpenAPI component schemas payload")-- return schemas---def _merge_registered_schemas(payload: dict[str, object], namespace: str) -> dict[str, object]:- """Include registered but route-indirect models in exported OpenAPI schemas."""-- schemas = _component_schemas(payload)-- for name, model in _registered_models(namespace).items():- schema = getattr(model, "__schema__", None)- if isinstance(schema, dict):- schemas.setdefault(name, _replace_legacy_refs(schema))-- payload.pop("definitions", None)- payload = _replace_legacy_refs(payload) # type: ignore[assignment]-- return payload--def generate_specs(output_dir: Path) -> list[Path]:"""Write all OpenAPI specs to `output_dir` and return the written paths."""output_dir.mkdir(parents=True, exist_ok=True)app = create_spec_app()- client = app.test_client()+ target_apis = _target_apis()written_paths: list[Path] = []for target in SPEC_TARGETS:- response = client.get(target.route)- if response.status_code != 200:- raise RuntimeError(f"failed to fetch {target.route}: {response.status_code}")-- payload = response.get_json()- if not isinstance(payload, dict):- raise RuntimeError(f"unexpected response payload for {target.route}")- payload = _merge_registered_schemas(payload, target.namespace)- payload = _deduplicate_operation_ids(payload)- payload = drop_null_values(payload)- payload = sort_openapi_arrays(payload)+ # Build directly from the API instance instead of depending on the+ # optional HTTP spec route. ExternalApi decides whether to register+ # that route when controller modules are first imported, which may+ # happen before this exporter forces its generation-only defaults.+ with app.test_request_context(target.route):+ payload = Swagger(target_apis[target.route]).as_dict()+ payload = finalize_openapi_payload(payload)output_path = output_dir / target.filenameoutput_path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n", encoding="utf-8")diff --git a/api/factories/file_factory/builders.py b/api/factories/file_factory/builders.pyindex 91ae554cffe..660cd95228c 100644--- a/api/factories/file_factory/builders.py+++ b/api/factories/file_factory/builders.py@@ -404,7 +404,8 @@ def _is_valid_mapping(mapping: Mapping[str, Any]) -> bool:if mapping.get("transfer_method") == FileTransferMethod.REMOTE_URL:url = mapping.get("url") or mapping.get("remote_url")- if not url:+ upload_file_id = resolve_mapping_file_id(mapping, "upload_file_id")+ if not url and not upload_file_id:return Falsereturn Truediff --git a/api/fields/annotation_fields.py b/api/fields/annotation_fields.pyindex 86a13a32bd2..6912b382e63 100644--- a/api/fields/annotation_fields.py+++ b/api/fields/annotation_fields.py@@ -1,20 +1,23 @@from __future__ import annotationsfrom datetime import datetime-from typing import Literal+from typing import Annotated-from pydantic import Field, field_validator+from pydantic import Field, WithJsonSchema, field_validatorfrom fields.base import ResponseModelfrom libs.helper import to_timestamp+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+class Annotation(ResponseModel):- id: str+ id: UUIDStringquestion: str | None = Noneanswer: str | None = Field(default=None, validation_alias="content")hit_count: int | None = None- created_at: int | None = None+ created_at: Int64 | None = None@field_validator("created_at", mode="before")@classmethod@@ -31,8 +34,8 @@ class AnnotationList(ResponseModel):class AnnotationJobStatusResponse(ResponseModel):- job_id: str- job_status: Literal["waiting", "processing", "completed", "error"] | str+ job_id: UUIDString+ job_status: strclass AnnotationJobStatusDetailResponse(AnnotationJobStatusResponse):diff --git a/api/fields/conversation_fields.py b/api/fields/conversation_fields.pyindex 7612d09f58d..7187b4407b4 100644--- a/api/fields/conversation_fields.py+++ b/api/fields/conversation_fields.py@@ -2,9 +2,9 @@ from __future__ import annotationsfrom collections.abc import Sequencefrom datetime import datetime-from typing import Any+from typing import Annotated, Any-from pydantic import Field, field_validator, model_validator+from pydantic import Field, WithJsonSchema, field_validator, model_validatorfrom sqlalchemy.orm import Sessionfrom fields.base import ResponseModel@@ -26,6 +26,9 @@ from models.model import ()type JSONValue = Any+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+URLString = Annotated[str, WithJsonSchema({"format": "url", "type": "string"})]class _SessionResponseSource[SourceT]:@@ -141,15 +144,15 @@ class ConversationResponseSource(_SessionResponseSource[ConversationModel]):class MessageFile(ResponseModel):- id: str+ id: UUIDStringfilename: strtype: str- url: str | None = None+ url: URLString | None = Nonemime_type: str | None = Nonesize: int | None = Nonetransfer_method: strbelongs_to: str | None = None- upload_file_id: str | None = None+ upload_file_id: UUIDString | None = None@field_validator("transfer_method", mode="before")@classmethod@@ -160,13 +163,13 @@ class MessageFile(ResponseModel):class SimpleConversation(ResponseModel):- id: str+ id: UUIDStringname: strinputs: dict[str, JSONValue]status: strintroduction: str | None = None- created_at: int | None = None- updated_at: int | None = None+ created_at: Int64 | None = None+ updated_at: Int64 | None = None@field_validator("inputs", mode="before")@classmethoddiff --git a/api/fields/document_fields.py b/api/fields/document_fields.pyindex 64de3f00bb4..06a69422cf6 100644--- a/api/fields/document_fields.py+++ b/api/fields/document_fields.py@@ -30,8 +30,8 @@ class DocumentResponse(ResponseModel):id: strposition: int | None = Nonedata_source_type: str | None = None- data_source_info: Any = Field(default=None, validation_alias="data_source_info_dict")- data_source_detail_dict: Any = None+ data_source_info: dict[str, Any] | None = Field(default=None, validation_alias="data_source_info_dict")+ data_source_detail_dict: dict[str, Any]dataset_process_rule_id: str | None = Nonename: strcreated_from: str | None = Nonediff --git a/api/fields/end_user_fields.py b/api/fields/end_user_fields.pyindex a151332fe51..646004ad103 100644--- a/api/fields/end_user_fields.py+++ b/api/fields/end_user_fields.py@@ -1,11 +1,14 @@from __future__ import annotationsfrom datetime import datetime+from typing import Annotated-from pydantic import Field+from pydantic import Field, WithJsonSchemafrom fields.base import ResponseModel+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+class SimpleEndUser(ResponseModel):id: str@@ -22,9 +25,9 @@ class EndUserDetail(ResponseModel):`is_anonymous` from `_is_anonymous` to return the stored value."""- id: str- tenant_id: str- app_id: str | None = None+ id: UUIDString+ tenant_id: UUIDString+ app_id: UUIDString | None = Nonetype: strexternal_user_id: str | None = Nonename: str | None = Nonediff --git a/api/fields/file_fields.py b/api/fields/file_fields.pyindex 094f6895bec..6bb98ea9d5f 100644--- a/api/fields/file_fields.py+++ b/api/fields/file_fields.py@@ -1,12 +1,16 @@from __future__ import annotationsfrom datetime import datetime+from typing import Annotated-from pydantic import ConfigDict, field_validator+from pydantic import ConfigDict, WithJsonSchema, field_validatorfrom fields.base import ResponseModelfrom libs.helper import to_timestamp+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+class UploadConfig(ResponseModel):file_size_limit: int@@ -24,20 +28,20 @@ class UploadConfig(ResponseModel):class FileResponse(ResponseModel):- id: str+ id: UUIDStringreference: str | None = Nonename: strsize: intextension: str | None = Nonemime_type: str | None = None- created_by: str | None = None- created_at: int | None = None+ created_by: UUIDString | None = None+ created_at: Int64 | None = Nonepreview_url: str | None = Nonesource_url: str | None = Noneoriginal_url: str | None = None- user_id: str | None = None- tenant_id: str | None = None- conversation_id: str | None = None+ user_id: UUIDString | None = None+ tenant_id: UUIDString | None = None+ conversation_id: UUIDString | None = Nonefile_key: str | None = None@field_validator("created_at", mode="before")diff --git a/api/fields/message_fields.py b/api/fields/message_fields.pyindex a90c6a36e74..79bfde8f77b 100644--- a/api/fields/message_fields.py+++ b/api/fields/message_fields.py@@ -2,9 +2,10 @@ from __future__ import annotationsfrom datetime import datetimefrom decimal import Decimal+from typing import Annotatedfrom uuid import uuid4-from pydantic import Field, computed_field, field_validator+from pydantic import Field, WithJsonSchema, computed_field, field_validatorfrom core.entities.execution_extra_content import ExecutionExtraContentDomainModelfrom fields.base import ResponseModel@@ -13,6 +14,9 @@ from graphon.file import Filefrom libs.helper import to_timestamptype JSONValueType = JSONValue+UUIDString = Annotated[str, WithJsonSchema({"format": "uuid", "type": "string"})]+Int64 = Annotated[int, WithJsonSchema({"format": "int64", "type": "integer"})]+FloatNumber = Annotated[float, WithJsonSchema({"format": "float", "type": "number"})]class SimpleFeedback(ResponseModel):@@ -20,23 +24,23 @@ class SimpleFeedback(ResponseModel):class RetrieverResource(ResponseModel):- id: str = Field(default_factory=lambda: str(uuid4()))- message_id: str = Field(default_factory=lambda: str(uuid4()))+ id: UUIDString = Field(default_factory=lambda: str(uuid4()))+ message_id: UUIDString = Field(default_factory=lambda: str(uuid4()))position: int- dataset_id: str | None = None+ dataset_id: UUIDString | None = Nonedataset_name: str | None = None- document_id: str | None = None+ document_id: UUIDString | None = Nonedocument_name: str | None = Nonedata_source_type: str | None = None- segment_id: str | None = None- score: float | None = None+ segment_id: UUIDString | None = None+ score: FloatNumber | None = Nonehit_count: int | None = Noneword_count: int | None = Nonesegment_position: int | None = Noneindex_node_hash: str | None = Nonecontent: str | None = Nonesummary: str | None = None- created_at: int | None = None+ created_at: Int64 | None = None@field_validator("created_at", mode="before")@classmethod@@ -45,20 +49,20 @@ class RetrieverResource(ResponseModel):class MessageListItem(ResponseModel):- id: str- conversation_id: str- parent_message_id: str | None = None+ id: UUIDString+ conversation_id: UUIDString+ parent_message_id: UUIDString | None = Noneinputs: dict[str, JSONValueType]query: stranswer: str = Field(validation_alias="re_sign_file_url_answer")feedback: SimpleFeedback | None = Field(default=None, validation_alias="user_feedback")retriever_resources: list[RetrieverResource]- created_at: int | None = None+ created_at: Int64 | None = Noneagent_thoughts: list[AgentThought]message_files: list[MessageFile]message_tokens: int = 0answer_tokens: int = 0- provider_response_latency: float = 0+ provider_response_latency: FloatNumber = 0total_price: Decimal | None = Nonecurrency: str | None = Nonestatus: strdiff --git a/api/libs/external_api.py b/api/libs/external_api.pyindex 271023750ca..fd3c18c06a4 100644--- a/api/libs/external_api.py+++ b/api/libs/external_api.py@@ -3,6 +3,7 @@ from collections.abc import Mappingfrom typing import Any, Protocol, overridefrom flask import Blueprint, Flask, current_app, got_request_exception, request+from flask.typing import ResponseReturnValuefrom flask_restx import Apifrom werkzeug.exceptions import HTTPExceptionfrom werkzeug.http import HTTP_STATUS_CODES@@ -156,9 +157,11 @@ class ExternalApi(Api):app: Blueprint | Flask,*args,error_body_formatter: ErrorBodyFormatter | None = None,+ register_default_root: bool = True,**kwargs,):self._error_body_formatter = error_body_formatter+ self._register_default_root = register_default_rootinstall_swagger_compatibility()kwargs.setdefault("authorizations", self._authorizations)kwargs.setdefault("security", "Bearer")@@ -177,6 +180,20 @@ class ExternalApi(Api):self.init_app(app, **kwargs)register_external_error_handlers(self, body_formatter=error_body_formatter)+ @override+ def _register_doc(self, app_or_blueprint: Blueprint | Flask) -> None:+ if self._add_specs and self._doc:+ app_or_blueprint.add_url_rule(self._doc, "doc", self.render_doc)+ # Api.base_path resolves the ``root`` endpoint. A caller that disables+ # Flask-RESTX's 404 root must register its own resource with that endpoint.+ if self._register_default_root:++ def render_default_root() -> ResponseReturnValue:+ self.render_root()+ return "", 404++ app_or_blueprint.add_url_rule(self.prefix or "/", "root", render_default_root)+@overridedef _should_use_fr_error_handler(self):# catch_all_404s makes flask-restx claim NotFound for ANY app pathdiff --git a/api/libs/flask_restx_compat.py b/api/libs/flask_restx_compat.pyindex 75f1121af00..13b5b38ab4f 100644--- a/api/libs/flask_restx_compat.py+++ b/api/libs/flask_restx_compat.py@@ -8,15 +8,179 @@ spec export fail or succeed in the same way.import hashlibimport json+from collections.abc import Mappingfrom typing import TypeGuard, castfrom flask import current_appfrom flask_restx import fieldsfrom flask_restx import swagger as restx_swagger-from flask_restx.model import Model, OrderedModel, instance+from flask_restx.model import Model, ModelBase, OrderedModel, instancefrom flask_restx.swagger import Swaggerfrom flask_restx.utils import not_none+BINARY_RESPONSE_MEDIA_TYPES_VENDOR_KEY = "dify-binary-response-media-types"+_BINARY_RESPONSE_MEDIA_TYPES_EXTENSION = f"x-{BINARY_RESPONSE_MEDIA_TYPES_VENDOR_KEY}"+_HTTP_METHODS = {"delete", "get", "head", "options", "patch", "post", "put", "trace"}+++def _normalize_media_type(media_type: str) -> str:+ """Return the case-insensitive media type without optional parameters."""++ return media_type.partition(";")[0].strip().lower()+++def _add_transport_response_schemas(payload: dict[str, object]) -> None:+ """Finalize response schemas that Flask-RESTX cannot express directly."""++ paths = payload.get("paths")+ if not isinstance(paths, dict):+ return++ for path_item in paths.values():+ if not isinstance(path_item, dict):+ continue+ for method, operation in path_item.items():+ if method not in _HTTP_METHODS or not isinstance(operation, dict):+ continue++ binary_media_types = operation.pop(_BINARY_RESPONSE_MEDIA_TYPES_EXTENSION, [])+ normalized_binary_media_types = {+ _normalize_media_type(media_type) for media_type in binary_media_types if isinstance(media_type, str)+ }++ responses = operation.get("responses")+ if not isinstance(responses, dict):+ continue+ for response in responses.values():+ if not isinstance(response, dict):+ continue+ content = response.get("content")+ if not isinstance(content, dict):+ continue+ for media_type, media in content.items():+ if not isinstance(media_type, str) or not isinstance(media, dict):+ continue+ normalized_media_type = _normalize_media_type(media_type)+ if normalized_media_type == "text/event-stream":+ # Flask-RESTX attaches the status response model to every+ # produced media type. The model describes the blocking+ # JSON body; the SSE transport itself is always text.+ media["schema"] = {"type": "string"}+ elif normalized_media_type in normalized_binary_media_types:+ # Binary responses are explicitly marked by the+ # service_api.schema.binary_response decorator. Do not+ # guess from an unfamiliar non-JSON media type.+ media["schema"] = {"format": "binary", "type": "string"}+++def _deduplicate_operation_ids(payload: dict[str, object]) -> None:+ """Make operationId values unique while preserving the canonical route ID."""++ paths = payload.get("paths")+ if not isinstance(paths, dict):+ return++ operations_by_id: dict[str, list[tuple[str, str, dict[str, object]]]] = {}+ for path, path_item in paths.items():+ if not isinstance(path, str) or not isinstance(path_item, dict):+ continue+ for method, operation in path_item.items():+ if method not in _HTTP_METHODS or not isinstance(operation, dict):+ continue+ operation_id = operation.get("operationId")+ if isinstance(operation_id, str):+ operations_by_id.setdefault(operation_id, []).append((method, path, operation))++ for operation_id, operations in operations_by_id.items():+ if len(operations) < 2:+ continue+ ordered_operations = sorted(+ operations,+ key=lambda item: (+ bool(item[2].get("deprecated")),+ "_" in item[1],+ item[1],+ item[0],+ ),+ )+ for index, (method, path, operation) in enumerate(ordered_operations):+ if index == 0:+ continue+ digest = hashlib.sha1(f"{method}:{path}".encode()).hexdigest()[:8]+ operation["operationId"] = f"{operation_id}_{digest}"+++def sort_openapi_arrays(value: object, *, parent_key: str | None = None) -> object:+ """Sort order-insensitive OpenAPI arrays so every public representation is stable."""++ if isinstance(value, dict):+ return {key: sort_openapi_arrays(item, parent_key=key) for key, item in value.items()}+ if not isinstance(value, list):+ return value++ sorted_items = [sort_openapi_arrays(item, parent_key=parent_key) for item in value]+ if parent_key == "parameters":+ return sorted(+ sorted_items,+ key=lambda item: (+ item.get("in", "") if isinstance(item, dict) else "",+ item.get("name", "") if isinstance(item, dict) else "",+ json.dumps(item, sort_keys=True, default=str),+ ),+ )+ if parent_key in {"enum", "required", "schemes", "tags"}:+ string_items = [item for item in sorted_items if isinstance(item, str)]+ if len(string_items) == len(sorted_items):+ return sorted(string_items)+ return sorted_items+++def _replace_legacy_refs(value: object) -> object:+ if isinstance(value, dict):+ replaced: dict[object, object] = {}+ for key, item in value.items():+ if key == "$ref" and isinstance(item, str) and item.startswith("#/definitions/"):+ replaced[key] = item.replace("#/definitions/", "#/components/schemas/", 1)+ else:+ replaced[key] = _replace_legacy_refs(item)+ return replaced+ if isinstance(value, list):+ return [_replace_legacy_refs(item) for item in value]+ return value+++def _merge_registered_schemas(payload: dict[str, object], registered_models: Mapping[str, object]) -> dict[str, object]:+ """Include registered but route-indirect models in every public OpenAPI representation."""++ components = payload.setdefault("components", {})+ if not isinstance(components, dict):+ raise RuntimeError("unexpected OpenAPI components payload")+ schemas = components.setdefault("schemas", {})+ if not isinstance(schemas, dict):+ raise RuntimeError("unexpected OpenAPI component schemas payload")++ for name, model in registered_models.items():+ if isinstance(model, ModelBase):+ schemas.setdefault(name, _replace_legacy_refs(model.__schema__))++ payload.pop("definitions", None)+ replaced_payload = _replace_legacy_refs(payload)+ if not isinstance(replaced_payload, dict):+ raise RuntimeError("unexpected OpenAPI payload")+ return cast(dict[str, object], replaced_payload)+++def finalize_openapi_payload(+ payload: dict[str, object], *, registered_models: Mapping[str, object] | None = None+) -> dict[str, object]:+ """Apply the shared finalization used by live and exported OpenAPI specs."""++ if registered_models is not None:+ payload = _merge_registered_schemas(payload, registered_models)+ _add_transport_response_schemas(payload)+ _deduplicate_operation_ids(payload)+ return cast(dict[str, object], sort_openapi_arrays(payload))+def _is_inline_field_map(value: object) -> TypeGuard[dict[object, object]]:"""Return whether a nested field map is an anonymous inline mapping."""@@ -121,6 +285,7 @@ def install_swagger_compatibility() -> None:original_schema_from_parameter = Swagger.schema_from_parameteroriginal_description_for = Swagger.description_fororiginal_serialize_operation = Swagger.serialize_operation+ original_responses_for = Swagger.responses_fororiginal_parameters_and_request_body_for = Swagger.parameters_and_request_body_fororiginal_request_body_from_form_params = Swagger.request_body_from_form_paramsoriginal_as_dict = Swagger.as_dict@@ -187,6 +352,29 @@ def install_swagger_compatibility() -> None:return operation+ def responses_for_with_status_specific_media(self: Swagger, doc: dict[str, object], method: str):+ responses = original_responses_for(self, doc, method)+ blueprint = self.api.blueprint+ if blueprint is None or blueprint.name != "service_api":+ return responses+ method_doc = doc.get(method)+ if not isinstance(method_doc, dict):+ return responses++ for status, response in responses.items():+ if not isinstance(response, dict) or str(status).startswith("2"):+ continue+ content = response.get("content")+ if not isinstance(content, dict) or not content:+ response["content"] = {"application/json": {}}+ continue+ schemas = [media for media in content.values() if isinstance(media, dict) and "schema" in media]+ if schemas:+ response["content"] = {"application/json": schemas[0]}+ else:+ response["content"] = {"application/json": {}}+ return responses+def serialize_resource_with_explicit_operation_tags(self: Swagger, ns, resource, url, route_doc=None, **kwargs):doc = self.extract_resource_doc(resource, url, route_doc=route_doc)if doc is False:@@ -238,7 +426,8 @@ def install_swagger_compatibility() -> None:include_all_models = current_app.config.get("RESTX_INCLUDE_ALL_MODELS", False)current_app.config["RESTX_INCLUDE_ALL_MODELS"] = Falsetry:- return original_as_dict(self)+ payload = original_as_dict(self)+ return finalize_openapi_payload(payload, registered_models=self.api.models)finally:current_app.config["RESTX_INCLUDE_ALL_MODELS"] = include_all_models@@ -248,6 +437,7 @@ def install_swagger_compatibility() -> None:Swagger.schema_from_parameter = schema_from_parameter_with_descriptionSwagger.description_for = description_for_with_explicit_summarySwagger.serialize_operation = serialize_operation_with_explicit_summary_tags+ Swagger.responses_for = responses_for_with_status_specific_mediaSwagger.serialize_resource = serialize_resource_with_explicit_operation_tagsSwagger.request_body_from_form_params = request_body_from_form_params_with_file_descriptionSwagger.as_dict = as_dict_with_inline_dict_supportdiff --git a/api/openapi/markdown/console-openapi.md b/api/openapi/markdown/console-openapi.mdindex bf522b09443..f677167bd51 100644--- a/api/openapi/markdown/console-openapi.md+++ b/api/openapi/markdown/console-openapi.md@@ -15109,7 +15109,7 @@ Legacy Chat App model config used only for follow-up question generation.| answer | string | | No || created_at | integer | | No || hit_count | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || question | string | | No |#### AnnotationBatchImportResponse@@ -15173,15 +15173,15 @@ Legacy Chat App model config used only for follow-up question generation.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || error_msg | string | | No |-| job_id | string | | Yes |-| job_status | string<br>string | | Yes |+| job_id | string (uuid) | | Yes |+| job_status | string | | Yes |#### AnnotationJobStatusResponse| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| job_id | string | | Yes |-| job_status | string<br>string | | Yes |+| job_id | string (uuid) | | Yes |+| job_status | string | | Yes |#### AnnotationList@@ -17516,8 +17516,8 @@ Request payload for bulk downloading documents as a zip archive.| created_at | integer | | No || created_by | string | | No || created_from | string | | No |-| data_source_detail_dict | | | No |-| data_source_info | | | No |+| data_source_detail_dict | object | | Yes |+| data_source_info | object | | No || data_source_type | string | | No || dataset_process_rule_id | string | | No || disabled_at | integer | | No |@@ -17593,8 +17593,8 @@ Request payload for bulk downloading documents as a zip archive.| created_at | integer | | No || created_by | string | | No || created_from | string | | No |-| data_source_detail_dict | | | No |-| data_source_info | | | No |+| data_source_detail_dict | object | | Yes |+| data_source_info | object | | No || data_source_type | string | | No || dataset_process_rule_id | string | | No || disabled_at | integer | | No |@@ -18085,19 +18085,19 @@ Built-in tool icons are URL strings; API-based tool icons are provider-defined p| agent_thoughts | [ [AgentThought](#agentthought) ] | | Yes || answer | string | | Yes || answer_tokens | integer | | No |-| conversation_id | string | | Yes |+| conversation_id | string (uuid) | | Yes || created_at | integer | | No || currency | string | | No || error | string | | No || extra_contents | [ [HumanInputContent](#humaninputcontent) ] | | Yes || feedback | [SimpleFeedback](#simplefeedback) | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || message_files | [ [MessageFile](#messagefile) ] | | Yes || message_tokens | integer | | No || metadata | [JSONValueType](#jsonvaluetype) | | No || parent_message_id | string | | No |-| provider_response_latency | number | | No |+| provider_response_latency | float | | No || query | string | | Yes || retriever_resources | [ [RetrieverResource](#retrieverresource) ] | | Yes || status | string | | Yes |@@ -18301,7 +18301,7 @@ Enum class for fetch from.| created_by | string | | No || extension | string | | No || file_key | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || name | string | | Yes || original_url | string | | No |@@ -18822,12 +18822,6 @@ Input field definition for snippet parameters.| ---- | ---- | ----------- | -------- || inputs | object | | No |-#### JSONObject--| Name | Type | Description | Required |-| ---- | ---- | ----------- | -------- |-| JSONObject | object | | |-#### JSONValue| Name | Type | Description | Required |@@ -19234,7 +19228,7 @@ Enum class for large language model mode.| ---- | ---- | ----------- | -------- || belongs_to | string | | No || filename | string | | Yes |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || size | integer | | No || transfer_method | string | | Yes |@@ -19931,18 +19925,18 @@ Enum class for parameter type.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| annotation_reply | [JSONObject](#jsonobject) | | Yes |-| file_upload | [JSONObject](#jsonobject) | | Yes |-| more_like_this | [JSONObject](#jsonobject) | | Yes |+| annotation_reply | { **"enabled"**: boolean } | | Yes |+| file_upload | { **"allowed_file_extensions"**: [ string ], **"allowed_file_types"**: [ string, <br>**Available values:** "audio", "custom", "document", "image", "video" ], **"allowed_file_upload_methods"**: [ string, <br>**Available values:** "local_file", "remote_url" ], **"enabled"**: boolean, **"image"**: { **"detail"**: string, **"enabled"**: boolean, **"number_limits"**: integer, **"transfer_methods"**: [ string ] }, **"number_limits"**: integer } | | Yes |+| more_like_this | { **"enabled"**: boolean } | | Yes || opening_statement | | | No |-| retriever_resource | [JSONObject](#jsonobject) | | Yes |-| sensitive_word_avoidance | [JSONObject](#jsonobject) | | Yes |-| speech_to_text | [JSONObject](#jsonobject) | | Yes |+| retriever_resource | { **"enabled"**: boolean } | | Yes |+| sensitive_word_avoidance | { **"enabled"**: boolean } | | Yes |+| speech_to_text | { **"enabled"**: boolean } | | Yes || suggested_questions | [ string ] | | Yes |-| suggested_questions_after_answer | [JSONObject](#jsonobject) | | Yes |+| suggested_questions_after_answer | { **"enabled"**: boolean } | | Yes || system_parameters | [SystemParameters](#systemparameters) | | Yes |-| text_to_speech | [JSONObject](#jsonobject) | | Yes |-| user_input_form | [ [JSONObject](#jsonobject) ] | | Yes |+| text_to_speech | { **"autoPlay"**: string, **"enabled"**: boolean, **"language"**: string, **"voice"**: string } | | Yes |+| user_input_form | [ object ] | | Yes |#### Parser@@ -21443,9 +21437,9 @@ Whitelist scopes accepted by RBAC app and dataset access config APIs.| document_id | string | | No || document_name | string | | No || hit_count | integer | | No |-| id | string | | No |+| id | string (uuid) | | No || index_node_hash | string | | No |-| message_id | string | | No |+| message_id | string (uuid) | | No || position | integer | | Yes || score | number | | No || segment_id | string | | No |@@ -21724,7 +21718,7 @@ Whitelist scopes accepted by RBAC app and dataset access config APIs.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || created_at | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || introduction | string | | No || name | string | | Yes |@@ -24672,7 +24666,7 @@ Lifecycle state for an asynchronous archive download request.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Key-value pairs for workflow input variables. Values for file-type variables should be arrays of file objects with `type`, `transfer_method`, and either `url` or `upload_file_id`. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover the variable names and types expected by your app. | Yes |#### WorkflowRunQuerydiff --git a/api/openapi/markdown/openapi-openapi.md b/api/openapi/markdown/openapi-openapi.mdindex 75882587299..57d378dc862 100644--- a/api/openapi/markdown/openapi-openapi.md+++ b/api/openapi/markdown/openapi-openapi.md@@ -768,7 +768,7 @@ future server adds a code. Formatter tests pin emitted values to the enum.| created_by | string | | No || extension | string | | No || file_key | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || name | string | | Yes || original_url | string | | No |diff --git a/api/openapi/markdown/service-openapi.md b/api/openapi/markdown/service-openapi.mdindex de7485ec91a..63632198a1a 100644--- a/api/openapi/markdown/service-openapi.md+++ b/api/openapi/markdown/service-openapi.md@@ -13,6 +13,8 @@ Bearer format: API_KEYService operations### [GET] /+**Return public Service API metadata without requiring an API key**+#### Responses| Code | Description | Schema |@@ -119,6 +121,7 @@ Submit feedback for a message. End users can rate messages as `like` or `dislike| Code | Description | Schema || ---- | ----------- | ------ || 200 | Feedback submitted successfully | **application/json**: [ResultResponse](#resultresponse)<br> |+| 400 | Bad request - invalid feedback payload | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | || 404 | `not_found` : Message does not exist. | |@@ -298,13 +301,13 @@ Convert text to speech.#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Returns the generated audio. The `Content-Type` header reflects the provider audio container, verified from the response bytes when recognizable. The binary response can be AAC, FLAC, MP4, MP3, Ogg, WAV, or WebM. |-| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model does not support this operation. - `completion_request_error` : Text-to-speech request failed. |-| 401 | Unauthorized - invalid API token |-| 403 | Forbidden - token scope, app, dataset, or workspace access denied |-| 500 | `internal_server_error` : Internal server error. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Returns the generated audio. The `Content-Type` header reflects the provider audio container, verified from the response bytes when recognizable. The binary response can be AAC, FLAC, MP4, MP3, Ogg, WAV, or WebM. | **audio/aac**: binary<br>**audio/flac**: binary<br>**audio/mp4**: binary<br>**audio/mpeg**: binary<br>**audio/ogg**: binary<br>**audio/wav**: binary<br>**audio/webm**: binary<br> |+| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model does not support this operation. - `completion_request_error` : Text-to-speech request failed. | |+| 401 | Unauthorized - invalid API token | |+| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |+| 500 | `internal_server_error` : Internal server error. | |---## default@@ -322,15 +325,15 @@ Send a request to the chat application.#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. |-| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |-| 401 | Unauthorized - invalid API token |-| 403 | `workflow_version_execution_not_allowed` : Workflow version execution is unavailable on the current plan. Upgrade to a paid plan. |-| 404 | `not_found` : Conversation does not exist. |-| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |-| 500 | `internal_server_error` : Internal server error. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. | **application/json**: [ChatBlockingResponse](#chatblockingresponse)<br>**text/event-stream**: string<br> |+| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |+| 401 | Unauthorized - invalid API token | |+| 403 | `workflow_version_execution_not_allowed` : Workflow version execution is unavailable on the current plan. Upgrade to a paid plan. | |+| 404 | `not_found` : Conversation does not exist. | |+| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |+| 500 | `internal_server_error` : Internal server error. | |### [POST] /chat-messages/{task_id}/stop**Stop Chat Message Generation**@@ -382,7 +385,7 @@ Get next questions suggestions for the current message.| 404 | `not_found` : Message does not exist. | || 500 | `internal_server_error` : Internal server error. | |-### [GET] /workflow/{task_id}/events+### [GET] /workflow/{workflow_run_id}/events**Stream Workflow Events**Resume the Server-Sent Events stream for a workflow run after a pause or a dropped SSE connection. For runs that have already finished, the stream emits a single `workflow_finished` event and closes.@@ -391,7 +394,7 @@ Resume the Server-Sent Events stream for a workflow run after a pause or a dropp| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| task_id | path | Workflow run ID returned by the original workflow run request. | Yes | string |+| workflow_run_id | path | Workflow run ID returned by the original workflow run request. | Yes | string || continue_on_pause | query | Set to `true` to keep the stream open across multiple `workflow_paused` events, which is useful when the workflow has more than one Human Input node in sequence. By default, the stream closes after the first pause. | No | boolean || include_state_snapshot | query | When `true`, replay from the persisted state snapshot to include a status summary of already-executed nodes before streaming new events. | No | boolean || user | query | End-user identifier that originally triggered the run. Must match the creator of the run. | Yes | string |@@ -400,7 +403,7 @@ Resume the Server-Sent Events stream for a workflow run after a pause or a dropp| Code | Description | Schema || ---- | ----------- | ------ |-| 200 | Server-Sent Events stream. Each event is delivered as `data: {JSON}\\n\\n`. Event payloads follow the same schemas as the original streaming response. | **text/event-stream**: [EventStreamResponse](#eventstreamresponse)<br> |+| 200 | Server-Sent Events stream. Each event is delivered as `data: {JSON}\\n\\n`. Event payloads follow the same schemas as the original streaming response. | **text/event-stream**: string<br> || 400 | `not_workflow_app` : Please check if your app mode matches the right API route. | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | |@@ -429,6 +432,7 @@ Retrieve paginated workflow execution logs with filtering options.| Code | Description | Schema || ---- | ----------- | ------ || 200 | Successfully retrieved workflow logs. | **application/json**: [WorkflowAppLogPaginationResponse](#workflowapplogpaginationresponse)<br> |+| 400 | Bad request - invalid query parameters | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | |@@ -469,15 +473,15 @@ Send a request to the chat application.#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. |-| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |-| 401 | Unauthorized - invalid API token |-| 403 | `workflow_version_execution_not_allowed` : Workflow version execution is unavailable on the current plan. Upgrade to a paid plan. |-| 404 | `not_found` : Conversation does not exist. |-| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. |-| 500 | `internal_server_error` : Internal server error. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events. | **application/json**: [ChatBlockingResponse](#chatblockingresponse)<br>**text/event-stream**: string<br> |+| 400 | - `app_unavailable` : App unavailable or misconfigured. - `not_chat_app` : App mode does not match the API route. - `conversation_completed` : The conversation has ended. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |+| 401 | Unauthorized - invalid API token | |+| 403 | `workflow_version_execution_not_allowed` : Workflow version execution is unavailable on the current plan. Upgrade to a paid plan. | |+| 404 | `not_found` : Conversation does not exist. | |+| 429 | - `too_many_requests` : Too many concurrent requests for this app. - `rate_limit_error` : The upstream model provider rate limit was exceeded. | |+| 500 | `internal_server_error` : Internal server error. | |### [POST] /chat-messages/{task_id}/stop**Stop Chat Message Generation**@@ -545,15 +549,15 @@ Send a request to the text generation application.#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects. |-| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. |-| 401 | Unauthorized - invalid API token |-| 403 | Forbidden - token scope, app, dataset, or workspace access denied |-| 404 | Conversation not found |-| 429 | `too_many_requests` : Too many concurrent requests for this app. |-| 500 | `internal_server_error` : Internal server error. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects. | **application/json**: [CompletionBlockingResponse](#completionblockingresponse)<br>**text/event-stream**: string<br> |+| 400 | - `app_unavailable` : App unavailable or misconfigured. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Text generation failed. | |+| 401 | Unauthorized - invalid API token | |+| 403 | Forbidden - token scope, app, dataset, or workspace access denied | |+| 404 | Conversation not found | |+| 429 | `too_many_requests` : Too many concurrent requests for this app. | |+| 500 | `internal_server_error` : Internal server error. | |### [POST] /completion-messages/{task_id}/stop**Stop Completion Message Generation**@@ -609,7 +613,7 @@ Retrieve the conversation list for the current user, ordered by most recently ac| 403 | Forbidden - token scope, app, dataset, or workspace access denied | || 404 | `not_found` : Last conversation does not exist (invalid `last_id`). | |-### [DELETE] /conversations/{c_id}+### [DELETE] /conversations/{conversation_id}**Delete Conversation**Delete a conversation.@@ -618,7 +622,7 @@ Delete a conversation.| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| c_id | path | Conversation ID. | Yes | string (uuid) |+| conversation_id | path | Conversation ID. | Yes | string (uuid) |#### Request Body@@ -636,7 +640,7 @@ Delete a conversation.| 403 | Forbidden - token scope, app, dataset, or workspace access denied || 404 | `not_found` : Conversation does not exist. |-### [POST] /conversations/{c_id}/name+### [POST] /conversations/{conversation_id}/name**Rename Conversation**Rename a conversation or auto-generate a name. The conversation name is used for display on clients that support multiple conversations.@@ -645,7 +649,7 @@ Rename a conversation or auto-generate a name. The conversation name is used for| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| c_id | path | Conversation ID. | Yes | string (uuid) |+| conversation_id | path | Conversation ID. | Yes | string (uuid) |#### Request Body@@ -663,7 +667,7 @@ Rename a conversation or auto-generate a name. The conversation name is used for| 403 | Forbidden - token scope, app, dataset, or workspace access denied | || 404 | `not_found` : Conversation does not exist. | |-### [GET] /conversations/{c_id}/variables+### [GET] /conversations/{conversation_id}/variables**List Conversation Variables**Retrieve variables from a specific conversation.@@ -672,7 +676,7 @@ Retrieve variables from a specific conversation.| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| c_id | path | Conversation ID. | Yes | string (uuid) |+| conversation_id | path | Conversation ID. | Yes | string (uuid) || last_id | query | The ID of the last record on the current page. Used to fetch the next page. | No | string || limit | query | Number of records to return. | No | integer, <br>**Default:** 20 || user | query | User identifier, used for end-user context. | No | string |@@ -688,7 +692,7 @@ Retrieve variables from a specific conversation.| 403 | Forbidden - token scope, app, dataset, or workspace access denied | || 404 | `not_found` : Conversation does not exist. | |-### [PUT] /conversations/{c_id}/variables/{variable_id}+### [PUT] /conversations/{conversation_id}/variables/{variable_id}**Update Conversation Variable**Update the value of a specific conversation variable. The value must match the expected type.@@ -697,7 +701,7 @@ Update the value of a specific conversation variable. The value must match the e| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| c_id | path | Conversation ID. | Yes | string (uuid) |+| conversation_id | path | Conversation ID. | Yes | string (uuid) || variable_id | path | Variable ID. | Yes | string (uuid) |#### Request Body@@ -850,11 +854,15 @@ Update the name, description, permissions, or retrieval settings of an existing| Code | Description | Schema || ---- | ----------- | ------ || 200 | Knowledge base updated successfully. | **application/json**: [DatasetDetailWithPartialMembersResponse](#datasetdetailwithpartialmembersresponse)<br> |+| 400 | Bad request - invalid embedding or reranking model configuration | || 401 | Unauthorized - invalid API token | || 403 | `forbidden` : Insufficient permissions to access this knowledge base. | || 404 | `not_found` : Dataset not found. | |-### [POST] /datasets/{dataset_id}/hit-testing+### ~~[POST] /datasets/{dataset_id}/hit-testing~~++***DEPRECATED***+**Retrieve Chunks from a Knowledge Base / Test Retrieval**Performs a search query against a knowledge base to retrieve the most relevant chunks. This endpoint can be used for both production retrieval and test retrieval.@@ -952,6 +960,7 @@ List the datasource nodes configured in the knowledge pipeline. Each node includ| Code | Description | Schema || ---- | ----------- | ------ || 200 | List of datasource nodes configured in the pipeline. | **application/json**: [DatasourcePluginListResponse](#datasourcepluginlistresponse)<br> |+| 400 | Bad request - pipeline is not configured | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | `not_found` : Dataset not found. | |@@ -976,17 +985,18 @@ Execute a single datasource node within the knowledge pipeline. Returns a stream#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Streaming response with node execution events. |-| 401 | Unauthorized - invalid API token |-| 403 | Forbidden - dataset API access or workspace access denied |-| 404 | `not_found` : Dataset not found. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Streaming response with node execution events. | **text/event-stream**: string<br> |+| 400 | Bad request - invalid payload or pipeline is not configured | |+| 401 | Unauthorized - invalid API token | |+| 403 | Forbidden - dataset API access or workspace access denied | |+| 404 | `not_found` : Dataset not found. | |### [POST] /datasets/{dataset_id}/pipeline/run**Run Pipeline**-Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response modes.+Execute the full knowledge pipeline for a knowledge base. Published runs are queued and return batch metadata as JSON. Draft runs support blocking JSON and streaming Server-Sent Events.#### Parameters@@ -1004,7 +1014,8 @@ Execute the full knowledge pipeline for a knowledge base. Supports both streamin| Code | Description | Schema || ---- | ----------- | ------ |-| 200 | Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |+| 200 | Pipeline execution result. Published runs return a JSON object containing `batch`, `dataset`, and `documents`. Draft runs return `text/event-stream` for streaming mode or a workflow result JSON object for blocking mode. | **application/json**: [PipelineRunJsonResponse](#pipelinerunjsonresponse)<br>**text/event-stream**: string<br> |+| 400 | Bad request - invalid payload or pipeline is not configured | || 401 | Unauthorized - invalid API token | || 403 | `forbidden` : Forbidden. | || 404 | `not_found` : Dataset not found. | |@@ -1031,6 +1042,7 @@ Permanently delete a knowledge base tag. Does not delete the knowledge bases tha| 204 | Success. || 401 | Unauthorized - invalid API token || 403 | Forbidden - insufficient permissions |+| 404 | Tag not found |### [GET] /datasets/tags**List Knowledge Tags**@@ -1061,8 +1073,10 @@ Rename an existing knowledge base tag.| Code | Description | Schema || ---- | ----------- | ------ || 200 | Tag updated successfully. | **application/json**: [KnowledgeTagResponse](#knowledgetagresponse)<br> |+| 400 | Bad request - tag name already exists | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - insufficient permissions | |+| 404 | Tag not found | |### [POST] /datasets/tags**Create Knowledge Tag**@@ -1080,6 +1094,7 @@ Create a new tag for organizing knowledge bases.| Code | Description | Schema || ---- | ----------- | ------ || 200 | Tag created successfully. | **application/json**: [KnowledgeTagResponse](#knowledgetagresponse)<br> |+| 400 | Bad request - tag name already exists | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - insufficient permissions | |@@ -1101,6 +1116,7 @@ Bind one or more tags to a knowledge base. A knowledge base can have multiple ta| 204 | Success. || 401 | Unauthorized - invalid API token || 403 | Forbidden - insufficient permissions |+| 404 | Dataset not found |### [POST] /datasets/tags/unbinding**Delete Tag Binding**@@ -1120,6 +1136,7 @@ Remove one or more tags from a knowledge base.| 204 | Success. || 401 | Unauthorized - invalid API token || 403 | Forbidden - insufficient permissions |+| 404 | Dataset not found |### [GET] /datasets/{dataset_id}/tags**Get Knowledge Base Tags**@@ -1269,12 +1286,12 @@ Download multiple uploaded-file documents as a single ZIP archive. Accepts up to#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | ZIP archive containing the requested documents. |-| 401 | Unauthorized - invalid API token |-| 403 | `forbidden` : Insufficient permissions. |-| 404 | `not_found` : Document or dataset not found. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | ZIP archive containing the requested documents. | **application/zip**: binary<br> |+| 401 | Unauthorized - invalid API token | |+| 403 | `forbidden` : Insufficient permissions. | |+| 404 | `not_found` : Document or dataset not found. | |### [PATCH] /datasets/{dataset_id}/documents/status/{action}**Update Document Status in Batch**@@ -1398,6 +1415,7 @@ Update an existing document by uploading a new file. Re-triggers indexing — us| 403 | Forbidden - dataset API access or workspace access denied | || 404 | Document not found | || 413 | `file_too_large` : File size exceeded. | |+| 415 | Unsupported file type | |### [GET] /datasets/{dataset_id}/documents/{document_id}/download**Download Document**@@ -1451,6 +1469,7 @@ Update an existing document by uploading a new file. Re-triggers indexing — us| 403 | Forbidden - dataset API access or workspace access denied | || 404 | Document not found | || 413 | `file_too_large` : File size exceeded. | |+| 415 | Unsupported file type | |### [POST] /datasets/{dataset_id}/documents/{document_id}/update-by-text**Update Document by Text**@@ -1511,6 +1530,7 @@ Update an existing document by uploading a new file. Re-triggers indexing — us| 403 | Forbidden - dataset API access or workspace access denied | || 404 | Document not found | || 413 | `file_too_large` : File size exceeded. | |+| 415 | Unsupported file type | |---## default@@ -1537,6 +1557,7 @@ Update metadata values for multiple documents at once. Each document in the requ| Code | Description | Schema || ---- | ----------- | ------ || 200 | Document metadata updated successfully. | **application/json**: [DatasetMetadataActionResponse](#datasetmetadataactionresponse)<br> |+| 400 | Bad request - invalid or conflicting document metadata operation | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset, document, or metadata not found | |@@ -1583,6 +1604,7 @@ Create a custom metadata field for the knowledge base. Metadata fields can be us| Code | Description | Schema || ---- | ----------- | ------ || 201 | Metadata field created successfully. | **application/json**: [DatasetMetadataResponse](#datasetmetadataresponse)<br> |+| 400 | Bad request - invalid or duplicate metadata name | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset not found | |@@ -1671,6 +1693,7 @@ Rename a custom metadata field.| Code | Description | Schema || ---- | ----------- | ------ || 200 | Metadata field updated successfully. | **application/json**: [DatasetMetadataResponse](#datasetmetadataresponse)<br> |+| 400 | Bad request - invalid or duplicate metadata name | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset or metadata not found | |@@ -1699,6 +1722,7 @@ Returns a paginated list of chunks within a document. Supports filtering by keyw| Code | Description | Schema || ---- | ----------- | ------ || 200 | List of chunks. | **application/json**: [SegmentListResponse](#segmentlistresponse)<br> |+| 400 | Bad request - embedding model is not configured | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset or document not found | |@@ -1749,6 +1773,7 @@ Permanently delete a chunk from the document.| Code | Description || ---- | ----------- || 204 | Success. |+| 400 | Bad request - invalid dataset model state or concurrent deletion || 401 | Unauthorized - invalid API token || 403 | Forbidden - dataset API access or workspace access denied || 404 | Dataset, document, or segment not found |@@ -1771,6 +1796,7 @@ Retrieve detailed information about a specific chunk, including its content, key| Code | Description | Schema || ---- | ----------- | ------ || 200 | Chunk details. | **application/json**: [SegmentDetailResponse](#segmentdetailresponse)<br> |+| 400 | Bad request - invalid dataset model configuration | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset, document, or segment not found | |@@ -1799,6 +1825,7 @@ Update a chunk's content, keywords, or answer. Re-triggers indexing for the modi| Code | Description | Schema || ---- | ----------- | ------ || 200 | Chunk updated successfully. | **application/json**: [SegmentDetailResponse](#segmentdetailresponse)<br> |+| 400 | Bad request - invalid segment or embedding model configuration | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - dataset API access or workspace access denied | || 404 | Dataset, document, or segment not found | |@@ -1974,12 +2001,12 @@ Preview or download uploaded files previously uploaded via the [Upload File](/ap#### Responses-| Code | Description |-| ---- | ----------- |-| 200 | Returns the raw file content. The `Content-Type` header is set to the file's MIME type. If `as_attachment` is `true`, the file is returned as a download with `Content-Disposition: attachment`. |-| 401 | Unauthorized - invalid API token |-| 403 | `file_access_denied` : Access to the requested file is denied. |-| 404 | `file_not_found` : The requested file was not found. |+| Code | Description | Schema |+| ---- | ----------- | ------ |+| 200 | Returns the raw file content. The `Content-Type` header is set to the file's MIME type. If `as_attachment` is `true`, the file is returned as a download with `Content-Disposition: attachment`. | `*/*`: binary<br> |+| 401 | Unauthorized - invalid API token | |+| 403 | `file_access_denied` : Access to the requested file is denied. | |+| 404 | `file_not_found` : The requested file was not found. | |---## default@@ -2095,7 +2122,7 @@ Retrieve the WebApp settings of this application, including site configuration,---## default-### [GET] /workflow/{task_id}/events+### [GET] /workflow/{workflow_run_id}/events**Stream Workflow Events**Resume the Server-Sent Events stream for a workflow run after a pause or a dropped SSE connection. For runs that have already finished, the stream emits a single `workflow_finished` event and closes.@@ -2104,7 +2131,7 @@ Resume the Server-Sent Events stream for a workflow run after a pause or a dropp| Name | Located in | Description | Required | Schema || ---- | ---------- | ----------- | -------- | ------ |-| task_id | path | Workflow run ID returned by the original workflow run request. | Yes | string |+| workflow_run_id | path | Workflow run ID returned by the original workflow run request. | Yes | string || continue_on_pause | query | Set to `true` to keep the stream open across multiple `workflow_paused` events, which is useful when the workflow has more than one Human Input node in sequence. By default, the stream closes after the first pause. | No | boolean || include_state_snapshot | query | When `true`, replay from the persisted state snapshot to include a status summary of already-executed nodes before streaming new events. | No | boolean || user | query | End-user identifier that originally triggered the run. Must match the creator of the run. | Yes | string |@@ -2113,7 +2140,7 @@ Resume the Server-Sent Events stream for a workflow run after a pause or a dropp| Code | Description | Schema || ---- | ----------- | ------ |-| 200 | Server-Sent Events stream. Each event is delivered as `data: {JSON}\\n\\n`. Event payloads follow the same schemas as the original streaming response. | **text/event-stream**: [EventStreamResponse](#eventstreamresponse)<br> |+| 200 | Server-Sent Events stream. Each event is delivered as `data: {JSON}\\n\\n`. Event payloads follow the same schemas as the original streaming response. | **text/event-stream**: string<br> || 400 | `not_workflow_app` : Please check if your app mode matches the right API route. | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | |@@ -2142,6 +2169,7 @@ Retrieve paginated workflow execution logs with filtering options.| Code | Description | Schema || ---- | ----------- | ------ || 200 | Successfully retrieved workflow logs. | **application/json**: [WorkflowAppLogPaginationResponse](#workflowapplogpaginationresponse)<br> |+| 400 | Bad request - invalid query parameters | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | |@@ -2160,7 +2188,7 @@ Execute a workflow. Cannot be executed without a published workflow.| Code | Description | Schema || ---- | ----------- | ------ |-| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |+| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [WorkflowBlockingResponse](#workflowblockingresponse)<br>**text/event-stream**: string<br> || 400 | - `not_workflow_app` : App mode does not match the API route. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Invalid parameter value. | || 401 | Unauthorized - invalid API token | || 403 | Forbidden - token scope, app, dataset, or workspace access denied | |@@ -2237,7 +2265,7 @@ Execute a specific workflow version identified by its ID. Useful for running a p| Code | Description | Schema || ---- | ----------- | ------ |-| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [GeneratedAppResponse](#generatedappresponse)<br>**text/event-stream**: [GeneratedAppResponse](#generatedappresponse)<br> |+| 200 | Successful response. The content type and structure depend on the `response_mode` parameter in the request. - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object. - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects. | **application/json**: [WorkflowBlockingResponse](#workflowblockingresponse)<br>**text/event-stream**: string<br> || 400 | - `not_workflow_app` : App mode does not match the API route. - `bad_request` : Workflow is a draft or has an invalid ID format. - `provider_not_initialize` : No valid model provider credentials found. - `provider_quota_exceeded` : Model provider quota exhausted. - `model_currently_not_support` : Current model unavailable. - `completion_request_error` : Workflow execution request failed. - `invalid_param` : Required parameter missing or invalid. | || 401 | Unauthorized - invalid API token | || 403 | `workflow_version_execution_not_allowed` : Workflow version execution is unavailable on the current plan. Upgrade to a paid plan. | |@@ -2293,7 +2321,7 @@ Retrieve the list of available models by type. Primarily used to query `text-emb| answer | string | | No || created_at | integer | | No || hit_count | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || question | string | | No |#### AnnotationCreatePayload@@ -2308,15 +2336,15 @@ Retrieve the list of available models by type. Primarily used to query `text-emb| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || error_msg | string | | No |-| job_id | string | | Yes |-| job_status | string<br>string | | Yes |+| job_id | string (uuid) | | Yes |+| job_status | string | | Yes |#### AnnotationJobStatusResponse| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| job_id | string | | Yes |-| job_status | string<br>string | | Yes |+| job_id | string (uuid) | | Yes |+| job_status | string | | Yes |#### AnnotationList@@ -2354,15 +2382,15 @@ Retrieve the list of available models by type. Primarily used to query `text-emb| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| app_id | string | | Yes |+| app_id | string (uuid) | | Yes || content | string | | No |-| conversation_id | string | | Yes |+| conversation_id | string (uuid) | | Yes || created_at | string | | Yes || from_account_id | string | | No || from_end_user_id | string | | No || from_source | string | | Yes |-| id | string | | Yes |-| message_id | string | | Yes |+| id | string (uuid) | | Yes |+| message_id | string (uuid) | | Yes || rating | string | | Yes || updated_at | string | | Yes |@@ -2400,6 +2428,52 @@ Retrieve the list of available models by type. Primarily used to query `text-emb| ---- | ---- | ----------- | -------- || BinaryFileResponse | string | | |+#### BlockingMetadataResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| retriever_resources | [ [BlockingRetrieverResourceResponse](#blockingretrieverresourceresponse) ] | | No |+| usage | [BlockingUsageResponse](#blockingusageresponse) | | No |++#### BlockingRetrieverResourceResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| content | string | | No |+| created_at | integer | | No |+| data_source_type | string | | No |+| dataset_id | string | | No |+| dataset_name | string | | No |+| document_id | string | | No |+| document_name | string | | No |+| hit_count | integer | | No |+| id | string | | No |+| index_node_hash | string | | No |+| message_id | string | | No |+| position | integer | | Yes |+| score | number | | No |+| segment_id | string | | No |+| segment_position | integer | | No |+| summary | string | | No |+| word_count | integer | | No |++#### BlockingUsageResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| completion_price | string | | No |+| completion_price_unit | string | | No |+| completion_tokens | integer | | No |+| completion_unit_price | string | | No |+| currency | string | | No |+| latency | number | | No |+| prompt_price | string | | No |+| prompt_price_unit | string | | No |+| prompt_tokens | integer | | No |+| prompt_unit_price | string | | No |+| total_price | string | | No |+| total_tokens | integer | | No |+#### ButtonStyleButton styles for user actions.@@ -2408,13 +2482,90 @@ Button styles for user actions.| ---- | ---- | ----------- | -------- || ButtonStyle | string | Button styles for user actions. | |+#### ChatBlockingResponse++Blocking chat response for a completed message or paused Chatflow.++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| ChatBlockingResponse | [ChatMessageBlockingResponse](#chatmessageblockingresponse)<br>[ChatPausedBlockingResponse](#chatpausedblockingresponse) | Blocking chat response for a completed message or paused Chatflow. | |++#### ChatMessageBlockingResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| answer | string | | Yes |+| conversation_id | string | | Yes |+| created_at | integer | | Yes |+| event | string | | Yes |+| id | string | | Yes |+| message_id | string | | Yes |+| metadata | [BlockingMetadataResponse](#blockingmetadataresponse) | | Yes |+| mode | string | | Yes |+| task_id | string | | Yes |++#### ChatPauseReasonResponse++Public pause reason emitted by a blocking Chatflow execution.++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| TYPE | string | | Yes |+| actions | [ [JSONObject](#jsonobject) ] | | No |+| approval_channels | [ string ] | | No |+| display_in_ui | boolean | | No |+| expiration_time | integer | | No |+| form_content | string | | No |+| form_id | string | | No |+| form_token | string | | No |+| inputs | [ [JSONObject](#jsonobject) ] | | No |+| message | string | | No |+| node_id | string | | No |+| node_title | string | | No |+| resolved_default_values | object | | No |++#### ChatPausedBlockingDataResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| answer | string | | Yes |+| conversation_id | string (uuid) | | Yes |+| created_at | long | | Yes |+| elapsed_time | float | | Yes |+| id | string (uuid) | | Yes |+| message_id | string (uuid) | | Yes |+| metadata | [BlockingMetadataResponse](#blockingmetadataresponse) | | Yes |+| mode | string | | Yes |+| paused_nodes | [ string ] | | Yes |+| reasons | [ [ChatPauseReasonResponse](#chatpausereasonresponse) ] | | Yes |+| status | string | | Yes |+| total_steps | integer | | Yes |+| total_tokens | integer | | Yes |+| workflow_run_id | string (uuid) | | Yes |++#### ChatPausedBlockingResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| answer | string | | Yes |+| conversation_id | string | | Yes |+| created_at | integer | | Yes |+| data | [ChatPausedBlockingDataResponse](#chatpausedblockingdataresponse) | | Yes |+| event | string | | Yes |+| id | string | | Yes |+| message_id | string | | Yes |+| metadata | [BlockingMetadataResponse](#blockingmetadataresponse) | | Yes |+| mode | string | | Yes |+| task_id | string | | Yes |+| workflow_run_id | string | | Yes |+#### ChatRequestPayload| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || auto_generate_name | boolean, <br>**Default:** true | Auto-generate the conversation title. If `false`, use the Rename Conversation API with `auto_generate: true` to generate the title asynchronously. | No || conversation_id | string | Conversation ID to continue a conversation. Omit this field or pass an empty string to start a new conversation, then pass the returned `conversation_id` in subsequent requests. | No |-| files | [ object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Values for app-defined variables. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover expected variable names and types. | Yes || query | string | User input or question content. | Yes || response_mode | string | Response mode. `streaming` uses Server-Sent Events; `blocking` returns after completion. New Agent app mode supports streaming only. When omitted, non-Agent apps run in blocking mode and new Agent apps stream. | No |@@ -2426,7 +2577,7 @@ Button styles for user actions.| ---- | ---- | ----------- | -------- || auto_generate_name | boolean, <br>**Default:** true | Auto-generate the conversation title. If `false`, use the Rename Conversation API with `auto_generate: true` to generate the title asynchronously. | No || conversation_id | string | Conversation ID to continue a conversation. Omit this field or pass an empty string to start a new conversation, then pass the returned `conversation_id` in subsequent requests. | No |-| files | [ object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Values for app-defined variables. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover expected variable names and types. | Yes || query | string | User input or question content. | Yes || response_mode | string | Response mode. `streaming` uses Server-Sent Events; `blocking` returns after completion. New Agent app mode supports streaming only. When omitted, non-Agent apps run in blocking mode and new Agent apps stream. | No |@@ -2482,11 +2633,24 @@ Button styles for user actions.| ---- | ---- | ----------- | -------- || content | string | Child chunk text content. | Yes |+#### CompletionBlockingResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| answer | string | | Yes |+| created_at | long | | Yes |+| event | string | | Yes |+| id | string (uuid) | | Yes |+| message_id | string (uuid) | | Yes |+| metadata | [BlockingMetadataResponse](#blockingmetadataresponse) | | Yes |+| mode | string | | Yes |+| task_id | string (uuid) | | Yes |+#### CompletionRequestPayload| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Values for app-defined variables. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover expected variable names and types. | Yes || query | string | User input or prompt content. | No || response_mode | string | Response mode. `streaming` uses Server-Sent Events; `blocking` returns after completion. When omitted, the request runs in blocking mode. | No |@@ -2495,7 +2659,7 @@ Button styles for user actions.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for multimodal understanding, including images, documents, audio, and video. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Values for app-defined variables. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover expected variable names and types. | Yes || query | string | User input or prompt content. | No || response_mode | string | Response mode. `streaming` uses Server-Sent Events; `blocking` returns after completion. When omitted, the request runs in blocking mode. | No |@@ -2556,7 +2720,7 @@ Condition detail| ---- | ---- | ----------- | -------- || created_at | integer | | No || description | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || name | string | | Yes || updated_at | integer | | No || value | string | | No |@@ -3021,8 +3185,8 @@ Request payload for bulk downloading documents as a zip archive.| created_at | integer | | No || created_by | string | | No || created_from | string | | No |-| data_source_detail_dict | | | No |-| data_source_info | | | No |+| data_source_detail_dict | object | | Yes |+| data_source_info | object | | No || data_source_type | string | | No || dataset_process_rule_id | string | | No || disabled_at | integer | | No |@@ -3113,11 +3277,11 @@ Note: The SQLAlchemy model defines an `is_anonymous` property for Flask-Login se| app_id | string | | No || created_at | dateTime | | Yes || external_user_id | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || is_anonymous | boolean | | Yes || name | string | | No || session_id | string | | Yes |-| tenant_id | string | | Yes |+| tenant_id | string (uuid) | | Yes || type | string | | Yes || updated_at | dateTime | | Yes |@@ -3184,7 +3348,7 @@ Enum class for fetch from.| created_by | string | | No || extension | string | | No || file_key | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || name | string | | Yes || original_url | string | | No |@@ -3213,12 +3377,6 @@ Enum class for fetch from.| ---- | ---- | ----------- | -------- || FormInputConfig | [ParagraphInputConfig](#paragraphinputconfig)<br>[SelectInputConfig](#selectinputconfig)<br>[FileInputConfig](#fileinputconfig)<br>[FileListInputConfig](#filelistinputconfig) | | |-#### GeneratedAppResponse--| Name | Type | Description | Required |-| ---- | ---- | ----------- | -------- |-| GeneratedAppResponse | | | |-#### HitTestingChildChunk| Name | Type | Description | Required |@@ -3341,9 +3499,9 @@ Enum class for fetch from.| ---- | ---- | ----------- | -------- || expiration_time | integer | | No || form_content | string | | Yes |-| inputs | [ object ] | | No |+| inputs | [ [FormInputConfig](#forminputconfig) ] | | Yes || resolved_default_values | object | | Yes |-| user_actions | [ object ] | | No |+| user_actions | [ [UserActionConfig](#useractionconfig) ] | | Yes |#### HumanInputFormSubmissionData@@ -3403,7 +3561,7 @@ Model class for i18n object.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| JSONValue | string<br>integer<br>number<br>boolean<br>object<br>[ object ] | | |+| JSONValue | | | |#### JSONValueType@@ -3453,7 +3611,7 @@ Model class for i18n object.| ---- | ---- | ----------- | -------- || belongs_to | string | | No || filename | string | | Yes |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || size | integer | | No || transfer_method | string | | Yes |@@ -3476,18 +3634,18 @@ Model class for i18n object.| agent_thoughts | [ [AgentThought](#agentthought) ] | | Yes || answer | string | | Yes || answer_tokens | integer | | No |-| conversation_id | string | | Yes |+| conversation_id | string (uuid) | | Yes || created_at | integer | | No || currency | string | | No || error | string | | No || extra_contents | [ [HumanInputContent](#humaninputcontent) ] | | Yes || feedback | [SimpleFeedback](#simplefeedback) | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || message_files | [ [MessageFile](#messagefile) ] | | Yes || message_tokens | integer | | No || parent_message_id | string | | No |-| provider_response_latency | number | | No |+| provider_response_latency | float | | No || query | string | | Yes || retriever_resources | [ [RetrieverResource](#retrieverresource) ] | | Yes || status | string | | Yes |@@ -3592,18 +3750,18 @@ Form input definition.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| annotation_reply | [JSONObject](#jsonobject) | | Yes |-| file_upload | [JSONObject](#jsonobject) | | Yes |-| more_like_this | [JSONObject](#jsonobject) | | Yes |+| annotation_reply | { **"enabled"**: boolean } | | Yes |+| file_upload | { **"allowed_file_extensions"**: [ string ], **"allowed_file_types"**: [ string, <br>**Available values:** "audio", "custom", "document", "image", "video" ], **"allowed_file_upload_methods"**: [ string, <br>**Available values:** "local_file", "remote_url" ], **"enabled"**: boolean, **"image"**: { **"detail"**: string, **"enabled"**: boolean, **"number_limits"**: integer, **"transfer_methods"**: [ string ] }, **"number_limits"**: integer } | | Yes |+| more_like_this | { **"enabled"**: boolean } | | Yes || opening_statement | | | No |-| retriever_resource | [JSONObject](#jsonobject) | | Yes |-| sensitive_word_avoidance | [JSONObject](#jsonobject) | | Yes |-| speech_to_text | [JSONObject](#jsonobject) | | Yes |+| retriever_resource | { **"enabled"**: boolean } | | Yes |+| sensitive_word_avoidance | { **"enabled"**: boolean } | | Yes |+| speech_to_text | { **"enabled"**: boolean } | | Yes || suggested_questions | [ string ] | | Yes |-| suggested_questions_after_answer | [JSONObject](#jsonobject) | | Yes |+| suggested_questions_after_answer | { **"enabled"**: boolean } | | Yes || system_parameters | [SystemParameters](#systemparameters) | | Yes |-| text_to_speech | [JSONObject](#jsonobject) | | Yes |-| user_input_form | [ [JSONObject](#jsonobject) ] | | Yes |+| text_to_speech | { **"autoPlay"**: string, **"enabled"**: boolean, **"language"**: string, **"voice"**: string } | | Yes |+| user_input_form | [ object ] | | Yes |#### PermissionEnum@@ -3613,6 +3771,28 @@ Shared permission levels for resources (datasets, credentials, etc.)| ---- | ---- | ----------- | -------- || PermissionEnum | string | Shared permission levels for resources (datasets, credentials, etc.) | |+#### PipelineDataset++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| chunk_structure | string | | Yes |+| description | string | knowledge dataset description | No |+| id | string | | Yes |+| name | string | | Yes |++#### PipelineDocument++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| data_source_info | object | | No |+| data_source_type | string | | Yes |+| enabled | boolean | | Yes |+| error | string | | No |+| id | string | | Yes |+| indexing_status | string | | Yes |+| name | string | | Yes |+| position | integer | | Yes |+#### PipelineRunApiEntity| Name | Type | Description | Required |@@ -3621,9 +3801,17 @@ Shared permission levels for resources (datasets, credentials, etc.)| datasource_type | string, <br>**Available values:** "local_file", "online_document", "online_drive", "website_crawl" | Type of the datasource. Determines which fields are expected in `datasource_info_list` items.<br>*Enum:* `"local_file"`, `"online_document"`, `"online_drive"`, `"website_crawl"` | Yes || inputs | object | Key-value pairs for pipeline input variables defined in the workflow. Pass `{}` if the pipeline has no input variables. | Yes || is_published | boolean | Whether to run the published or draft version of the pipeline. `true` runs the latest published version; `false` runs the current draft (useful for testing unpublished changes). | Yes |-| response_mode | string, <br>**Available values:** "blocking", "streaming" | Response mode. Use `streaming` for SSE or `blocking` for JSON.<br>*Enum:* `"blocking"`, `"streaming"` | Yes |+| response_mode | string, <br>**Available values:** "blocking", "streaming" | Response mode for draft runs. Use `streaming` for SSE or `blocking` for JSON. Published runs are queued and always return batch metadata as JSON.<br>*Enum:* `"blocking"`, `"streaming"` | Yes || start_node_id | string | ID of the datasource node where the run starts. | Yes |+#### PipelineRunJsonResponse++JSON responses returned by published and draft knowledge pipeline runs.++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| PipelineRunJsonResponse | [PublishedPipelineRunResponse](#publishedpipelinerunresponse)<br>[WorkflowBlockingResponse](#workflowblockingresponse) | JSON responses returned by published and draft knowledge pipeline runs. | |+#### PipelineUploadFileResponse| Name | Type | Description | Required |@@ -3695,6 +3883,14 @@ Model class for provider with models response.| status | [CustomConfigurationStatus](#customconfigurationstatus) | | Yes || tenant_id | string | | Yes |+#### PublishedPipelineRunResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| batch | string | | Yes |+| dataset | [PipelineDataset](#pipelinedataset) | | Yes |+| documents | [ [PipelineDocument](#pipelinedocument) ] | | Yes |+#### RequiredServiceApiUserPayload| Name | Type | Description | Required |@@ -3746,9 +3942,9 @@ Model class for provider with models response.| document_id | string | | No || document_name | string | | No || hit_count | integer | | No |-| id | string | | No |+| id | string (uuid) | | No || index_node_hash | string | | No |-| message_id | string | | No |+| message_id | string (uuid) | | No || position | integer | | Yes || score | number | | No || segment_id | string | | No |@@ -3905,7 +4101,7 @@ Model class for provider with models response.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || created_at | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || introduction | string | | No || name | string | | Yes |@@ -4041,6 +4237,13 @@ Accepts either the legacy tag_id payload or the normalized tag_ids payload.| user | string | User identifier, unique within the application. This identifier scopes data access; resources created with one `user` value are only visible when queried with the same `user` value. | No || voice | string | Voice to use for text-to-speech. Available voices depend on the TTS provider configured for this app. Omit to use the app's configured voice when available; that value is exposed by [Get App Parameters](/api-reference/applications/get-app-parameters) as `text_to_speech.voice`. | No |+#### ToolIcon++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| background | string | | Yes |+| content | string | | Yes |+#### UrlResponse| Name | Type | Description | Required |@@ -4108,9 +4311,17 @@ in form definition, or a variable while the workflow is running.| created_by_role | string | | No || created_from | string | | No || details | object<br>[ object ]<br>string<br>integer<br>number<br>boolean | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || workflow_run | [WorkflowRunForLogResponse](#workflowrunforlogresponse) | | No |+#### WorkflowBlockingResponse++Blocking workflow response for a finished or paused execution.++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| WorkflowBlockingResponse | [WorkflowFinishedBlockingResponse](#workflowfinishedblockingresponse)<br>[WorkflowPausedBlockingResponse](#workflowpausedblockingresponse) | Blocking workflow response for a finished or paused execution. | |+#### WorkflowEventsQuery| Name | Type | Description | Required |@@ -4119,6 +4330,29 @@ in form definition, or a variable while the workflow is running.| include_state_snapshot | boolean | When `true`, replay from the persisted state snapshot to include a status summary of already-executed nodes before streaming new events. | No || user | string | End-user identifier that originally triggered the run. Must match the creator of the run. | Yes |+#### WorkflowFinishedBlockingDataResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| created_at | long | | Yes |+| elapsed_time | float | | Yes |+| error | string | | Yes |+| finished_at | integer | | Yes |+| id | string (uuid) | | Yes |+| outputs | object | | Yes |+| status | string, <br>**Available values:** "failed", "partial-succeeded", "stopped", "succeeded" | *Enum:* `"failed"`, `"partial-succeeded"`, `"stopped"`, `"succeeded"` | Yes |+| total_steps | integer | | Yes |+| total_tokens | integer | | Yes |+| workflow_id | string (uuid) | | Yes |++#### WorkflowFinishedBlockingResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| data | [WorkflowFinishedBlockingDataResponse](#workflowfinishedblockingdataresponse) | | Yes |+| task_id | string | | Yes |+| workflow_run_id | string | | Yes |+#### WorkflowLogQuery| Name | Type | Description | Required |@@ -4132,6 +4366,51 @@ in form definition, or a variable while the workflow is running.| page | integer, <br>**Default:** 1 | Page number for pagination. | No || status | string | Filter by execution status. | No |+#### WorkflowPauseReasonResponse++Public pause reason emitted by a blocking Workflow execution.++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| TYPE | string | | Yes |+| actions | [ [JSONObject](#jsonobject) ] | | No |+| approval_channels | [ string ] | | No |+| display_in_ui | boolean | | No |+| expiration_time | integer | | No |+| form_content | string | | No |+| form_id | string | | No |+| form_token | string | | No |+| inputs | [ [JSONObject](#jsonobject) ] | | No |+| message | string | | No |+| node_id | string | | No |+| node_title | string | | No |+| resolved_default_values | object | | No |++#### WorkflowPausedBlockingDataResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| created_at | long | | Yes |+| elapsed_time | float | | Yes |+| error | string | | Yes |+| finished_at | integer | | Yes |+| id | string (uuid) | | Yes |+| outputs | object | | Yes |+| paused_nodes | [ string ] | | Yes |+| reasons | [ [WorkflowPauseReasonResponse](#workflowpausereasonresponse) ] | | Yes |+| status | string | | Yes |+| total_steps | integer | | Yes |+| total_tokens | integer | | Yes |+| workflow_id | string (uuid) | | Yes |++#### WorkflowPausedBlockingResponse++| Name | Type | Description | Required |+| ---- | ---- | ----------- | -------- |+| data | [WorkflowPausedBlockingDataResponse](#workflowpausedblockingdataresponse) | | Yes |+| task_id | string | | Yes |+| workflow_run_id | string | | Yes |+#### WorkflowRunForLogResponse| Name | Type | Description | Required |@@ -4141,7 +4420,7 @@ in form definition, or a variable while the workflow is running.| error | string | | No || exceptions_count | integer | | No || finished_at | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || status | string | | No || total_steps | integer | | No || total_tokens | integer | | No |@@ -4152,7 +4431,7 @@ in form definition, or a variable while the workflow is running.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Key-value pairs for workflow input variables. Values for file-type variables should be arrays of file objects with `type`, `transfer_method`, and either `url` or `upload_file_id`. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover the variable names and types expected by your app. | Yes || response_mode | string | Response mode. Use `blocking` for synchronous responses or `streaming` for Server-Sent Events. When omitted, the request runs in blocking mode. | No |@@ -4160,7 +4439,7 @@ in form definition, or a variable while the workflow is running.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Key-value pairs for workflow input variables. Values for file-type variables should be arrays of file objects with `type`, `transfer_method`, and either `url` or `upload_file_id`. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover the variable names and types expected by your app. | Yes || response_mode | string | Response mode. Use `blocking` for synchronous responses or `streaming` for Server-Sent Events. When omitted, the request runs in blocking mode. | No || user | string | User identifier, unique within the application. This identifier scopes data access; resources created with one `user` value are only visible when queried with the same `user` value. | Yes |@@ -4173,10 +4452,10 @@ in form definition, or a variable while the workflow is running.| elapsed_time | number<br>integer | | No || error | string | | No || finished_at | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object<br>[ object ]<br>string<br>integer<br>number<br>boolean | | No || outputs | object | | No || status | string | | Yes || total_steps | integer | | No || total_tokens | integer | | No |-| workflow_id | string | | Yes |+| workflow_id | string (uuid) | | Yes |diff --git a/api/openapi/markdown/web-openapi.md b/api/openapi/markdown/web-openapi.mdindex c353061ed80..e00c1e30061 100644--- a/api/openapi/markdown/web-openapi.md+++ b/api/openapi/markdown/web-openapi.md@@ -1121,7 +1121,7 @@ Enum representing the deployment edition of the platform.| created_by | string | | No || extension | string | | No || file_key | string | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || name | string | | Yes || original_url | string | | No |@@ -1266,12 +1266,6 @@ Parsed multipart form fields for HITL uploads.| expires_at | integer | | Yes || upload_token | string | | Yes |-#### JSONObject--| Name | Type | Description | Required |-| ---- | ---- | ----------- | -------- |-| JSONObject | object | | |-#### JSONValue| Name | Type | Description | Required |@@ -1336,7 +1330,7 @@ Parsed multipart form fields for HITL uploads.| ---- | ---- | ----------- | -------- || belongs_to | string | | No || filename | string | | Yes |-| id | string | | Yes |+| id | string (uuid) | | Yes || mime_type | string | | No || size | integer | | No || transfer_method | string | | Yes |@@ -1372,18 +1366,18 @@ Form input definition.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| annotation_reply | [JSONObject](#jsonobject) | | Yes |-| file_upload | [JSONObject](#jsonobject) | | Yes |-| more_like_this | [JSONObject](#jsonobject) | | Yes |+| annotation_reply | { **"enabled"**: boolean } | | Yes |+| file_upload | { **"allowed_file_extensions"**: [ string ], **"allowed_file_types"**: [ string, <br>**Available values:** "audio", "custom", "document", "image", "video" ], **"allowed_file_upload_methods"**: [ string, <br>**Available values:** "local_file", "remote_url" ], **"enabled"**: boolean, **"image"**: { **"detail"**: string, **"enabled"**: boolean, **"number_limits"**: integer, **"transfer_methods"**: [ string ] }, **"number_limits"**: integer } | | Yes |+| more_like_this | { **"enabled"**: boolean } | | Yes || opening_statement | | | No |-| retriever_resource | [JSONObject](#jsonobject) | | Yes |-| sensitive_word_avoidance | [JSONObject](#jsonobject) | | Yes |-| speech_to_text | [JSONObject](#jsonobject) | | Yes |+| retriever_resource | { **"enabled"**: boolean } | | Yes |+| sensitive_word_avoidance | { **"enabled"**: boolean } | | Yes |+| speech_to_text | { **"enabled"**: boolean } | | Yes || suggested_questions | [ string ] | | Yes |-| suggested_questions_after_answer | [JSONObject](#jsonobject) | | Yes |+| suggested_questions_after_answer | { **"enabled"**: boolean } | | Yes || system_parameters | [SystemParameters](#systemparameters) | | Yes |-| text_to_speech | [JSONObject](#jsonobject) | | Yes |-| user_input_form | [ [JSONObject](#jsonobject) ] | | Yes |+| text_to_speech | { **"autoPlay"**: string, **"enabled"**: boolean, **"language"**: string, **"voice"**: string } | | Yes |+| user_input_form | [ object ] | | Yes |#### PassportAccessTokenResponse@@ -1441,9 +1435,9 @@ Form input definition.| document_id | string | | No || document_name | string | | No || hit_count | integer | | No |-| id | string | | No |+| id | string (uuid) | | No || index_node_hash | string | | No |-| message_id | string | | No |+| message_id | string (uuid) | | No || position | integer | | Yes || score | number | | No || segment_id | string | | No |@@ -1503,7 +1497,7 @@ Form input definition.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- || created_at | integer | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || introduction | string | | No || name | string | | Yes |@@ -1681,19 +1675,19 @@ in form definition, or a variable while the workflow is running.| agent_thoughts | [ [AgentThought](#agentthought) ] | | Yes || answer | string | | Yes || answer_tokens | integer | | No |-| conversation_id | string | | Yes |+| conversation_id | string (uuid) | | Yes || created_at | integer | | No || currency | string | | No || error | string | | No || extra_contents | [ [HumanInputContent](#humaninputcontent) ] | | Yes || feedback | [SimpleFeedback](#simplefeedback) | | No |-| id | string | | Yes |+| id | string (uuid) | | Yes || inputs | object | | Yes || message_files | [ [MessageFile](#messagefile) ] | | Yes || message_tokens | integer | | No || metadata | [JSONValueType](#jsonvaluetype) | | No || parent_message_id | string | | No |-| provider_response_latency | number | | No |+| provider_response_latency | float | | No || query | string | | Yes || retriever_resources | [ [RetrieverResource](#retrieverresource) ] | | Yes || status | string | | Yes |@@ -1737,5 +1731,5 @@ in form definition, or a variable while the workflow is running.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |-| files | [ object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No |+| files | [ object<br>object<br>object<br>object ] | File list for workflow system file inputs. Available when file upload is enabled for the workflow. To attach a local file, first upload it via [Upload File](/api-reference/files/upload-file) and use the returned `id` as `upload_file_id` with `transfer_method: local_file`. | No || inputs | object | Key-value pairs for workflow input variables. Values for file-type variables should be arrays of file objects with `type`, `transfer_method`, and either `url` or `upload_file_id`. Refer to the `user_input_form` field in the [Get App Parameters](/api-reference/applications/get-app-parameters) response to discover the variable names and types expected by your app. | Yes |diff --git a/api/services/rag_pipeline/entity/pipeline_service_api_entities.py b/api/services/rag_pipeline/entity/pipeline_service_api_entities.pyindex c80b7604099..737063524e8 100644--- a/api/services/rag_pipeline/entity/pipeline_service_api_entities.py+++ b/api/services/rag_pipeline/entity/pipeline_service_api_entities.py@@ -138,5 +138,8 @@ class PipelineRunApiEntity(BaseModel):))response_mode: PipelineResponseMode = Field(- description="Response mode. Use `streaming` for SSE or `blocking` for JSON."+ description=(+ "Response mode for draft runs. Use `streaming` for SSE or `blocking` for JSON. Published runs are queued "+ "and always return batch metadata as JSON."+ ))diff --git a/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py b/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.pyindex b050541434c..cff6695e414 100644--- a/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py+++ b/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py@@ -133,6 +133,7 @@ def test_patch_union_schema_markdown_fills_converter_blank_schema_types(tmp_path{"$ref": "#/components/schemas/StringSource"},{"type": "null"},],+ "default": None,},"output_variable_name": {"type": "string"},},@@ -290,6 +291,36 @@ def test_patch_union_schema_markdown_ignores_specs_without_schemas(tmp_path: Patassert module._patch_union_schema_markdown("unchanged", spec_path) == "unchanged"+def test_patch_wildcard_media_type_markdown_preserves_literal_wildcard():+ module = _load_generate_swagger_markdown_docs_module()++ patched = module._patch_wildcard_media_type_markdown("| 200 | Raw file. | ***/***: binary<br> |\n")++ assert patched == "| 200 | Raw file. | `*/*`: binary<br> |\n"+++def test_drop_null_values_for_markdown_does_not_mutate_openapi_source():+ module = _load_generate_swagger_markdown_docs_module()+ payload = {+ "schema": {+ "default": None,+ "enum": ["value", None],+ "properties": {"nullable": {"default": None}},+ }+ }++ converted = module._drop_null_values_for_markdown(payload)++ assert converted == {+ "schema": {+ "enum": ["value", None],+ "properties": {"nullable": {}},+ }+ }+ assert payload["schema"]["default"] is None+ assert payload["schema"]["properties"]["nullable"]["default"] is None++def test_patch_union_schema_markdown_ignores_unrenderable_shapes(tmp_path: Path):module = _load_generate_swagger_markdown_docs_module()spec_path = tmp_path / "console-openapi.json"@@ -357,6 +388,7 @@ def test_convert_spec_to_markdown_patches_generated_union_tables(tmp_path: Path,{"$ref": "#/components/schemas/StringSource"},{"type": "null"},],+ "default": None,},},},@@ -369,6 +401,15 @@ def test_convert_spec_to_markdown_patches_generated_union_tables(tmp_path: Path,def run_converter(args, **kwargs):assert kwargs["check"] is False+ converter_spec_path = Path(args[args.index("-i") + 1])+ assert converter_spec_path != spec_path+ converter_spec = json.loads(converter_spec_path.read_text(encoding="utf-8"))+ converter_default_property = converter_spec["components"]["schemas"]["ParagraphInputConfig"]["properties"][+ "default"+ ]+ assert "default" not in converter_default_property+ source_spec = json.loads(spec_path.read_text(encoding="utf-8"))+ assert source_spec["components"]["schemas"]["ParagraphInputConfig"]["properties"]["default"]["default"] is Nonemarkdown_path = Path(args[args.index("-o") + 1])markdown_path.write_text("Intro line"diff --git a/api/tests/unit_tests/commands/test_generate_swagger_specs.py b/api/tests/unit_tests/commands/test_generate_swagger_specs.pyindex d3005256e68..060cb2a31d1 100644--- a/api/tests/unit_tests/commands/test_generate_swagger_specs.py+++ b/api/tests/unit_tests/commands/test_generate_swagger_specs.py@@ -2,9 +2,13 @@import importlib.utilimport json+import os+import subprocessimport sysfrom pathlib import Path+from jsonschema import Draft202012Validator+def _walk_values(value):yield value@@ -60,6 +64,11 @@ def _nullable_schema_ref(schema):return next(item["$ref"] for item in schema["anyOf"] if "$ref" in item)+def _reset_schema_cache(api):+ api._schema = None+ api.__dict__.pop("__schema__", None)++def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path: Path):module = _load_generate_swagger_specs_module()@@ -74,11 +83,93 @@ def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path: Pfor path in written_paths:payload = json.loads(path.read_text(encoding="utf-8"))- assert payload["openapi"].startswith("3.")+ assert payload["openapi"] == "3.1.0"assert "paths" in payload-def test_generate_specs_writes_openapi_with_resolvable_references_and_no_nulls(tmp_path: Path):+def test_generate_specs_match_live_openapi_payloads(tmp_path: Path):+ module = _load_generate_swagger_specs_module()+ app = module.create_spec_app()+ client = app.test_client()+ target_apis = module._target_apis()+ for api in target_apis.values():+ _reset_schema_cache(api)+ live_payloads = {target.filename: client.get(target.route).get_json() for target in module.SPEC_TARGETS}++ # Poison the endpoint cache after reading the live contract. The exporter+ # must independently serialize each API instead of succeeding by reading+ # the same cached payload through the HTTP spec route.+ poison_payload = {"poison": "stale schema cache"}+ for api in target_apis.values():+ api._schema = poison_payload+ api.__dict__["__schema__"] = poison_payload+ try:+ for target in module.SPEC_TARGETS:+ response = client.get(target.route)+ assert response.status_code == 200+ assert response.get_json() == poison_payload+ written_paths = module.generate_specs(tmp_path)+ finally:+ for api in target_apis.values():+ _reset_schema_cache(api)++ assert {path.name for path in written_paths} == set(live_payloads)+ for path in written_paths:+ assert json.loads(path.read_text(encoding="utf-8")) == live_payloads[path.name]+++def test_generate_specs_after_controllers_were_imported_with_swagger_disabled(tmp_path: Path):+ api_dir = Path(__file__).resolve().parents[3]+ script = """+import sys+from pathlib import Path++from controllers.console import api as console_api+from controllers.openapi import api as openapi_api+from controllers.service_api import api as service_api+from controllers.web import api as web_api++apis = (console_api, web_api, service_api, openapi_api)+assert all(api._add_specs is False for api in apis)++from dev.generate_swagger_specs import generate_specs++written_paths = generate_specs(Path(sys.argv[1]))+assert [path.name for path in written_paths] == [+ "console-openapi.json",+ "web-openapi.json",+ "service-openapi.json",+ "openapi-openapi.json",+]+"""+ env = os.environ.copy()+ env["PYTHONPATH"] = str(api_dir)+ env["SWAGGER_UI_ENABLED"] = "false"++ result = subprocess.run(+ [sys.executable, "-c", script, str(tmp_path)],+ cwd=api_dir,+ env=env,+ capture_output=True,+ text=True,+ )++ assert result.returncode == 0, result.stderr+++def test_apply_runtime_defaults_forces_swagger_routes_on(monkeypatch):+ module = _load_generate_swagger_specs_module()+ from configs import dify_config++ monkeypatch.setenv("SWAGGER_UI_ENABLED", "false")+ monkeypatch.setattr(dify_config, "SWAGGER_UI_ENABLED", False)++ module.apply_runtime_defaults()++ assert dify_config.SWAGGER_UI_ENABLED is True+++def test_generate_specs_writes_openapi_with_resolvable_references_and_null_defaults(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -95,7 +186,12 @@ def test_generate_specs_writes_openapi_with_resolvable_references_and_no_nulls(t}assert refs <= set(schemas)- assert all(value is not None for value in _walk_values(payload))+ assert all("nullable" not in value for value in _walk_values(payload) if isinstance(value, dict))++ service_payload = json.loads((tmp_path / "service-openapi.json").read_text(encoding="utf-8"))+ conversation_id = service_payload["components"]["schemas"]["ChatRequestPayload"]["properties"]["conversation_id"]+ assert "default" in conversation_id+ assert conversation_id["default"] is Nonedef test_generate_specs_writes_unique_operation_ids(tmp_path: Path):@@ -110,6 +206,64 @@ def test_generate_specs_writes_unique_operation_ids(tmp_path: Path):assert len(operation_ids) == len(set(operation_ids))+def test_finalize_openapi_payload_preserves_canonical_operation_id():+ module = _load_generate_swagger_specs_module()+ payload = {+ "paths": {+ "/items/create-by-file": {+ "post": {"operationId": "create_item", "responses": {"200": {}}},+ },+ "/items/create_by_file": {+ "post": {"deprecated": True, "operationId": "create_item", "responses": {"200": {}}},+ },+ }+ }++ result = module.finalize_openapi_payload(payload)++ assert result["paths"]["/items/create-by-file"]["post"]["operationId"] == "create_item"+ legacy_operation_id = result["paths"]["/items/create_by_file"]["post"]["operationId"]+ assert legacy_operation_id.startswith("create_item_")+++def test_finalize_openapi_payload_only_marks_explicit_binary_responses():+ module = _load_generate_swagger_specs_module()+ payload = {+ "paths": {+ "/transport": {+ "get": {+ "operationId": "get_transport",+ "responses": {+ "200": {+ "content": {+ "application/octet-stream": {},+ "application/json; charset=utf-8": {},+ "application/problem+json": {},+ "text/event-stream; charset=utf-8": {+ "schema": {"$ref": "#/components/schemas/BlockingResponse"}+ },+ "text/plain": {},+ }+ }+ },+ "x-dify-binary-response-media-types": ["application/octet-stream"],+ }+ }+ }+ }++ result = module.finalize_openapi_payload(payload)+ operation = result["paths"]["/transport"]["get"]+ content = operation["responses"]["200"]["content"]++ assert content["application/octet-stream"]["schema"] == {"format": "binary", "type": "string"}+ assert content["text/event-stream; charset=utf-8"]["schema"] == {"type": "string"}+ assert content["application/json; charset=utf-8"] == {}+ assert content["application/problem+json"] == {}+ assert content["text/plain"] == {}+ assert "x-dify-binary-response-media-types" not in operation++def test_system_features_specs_exclude_backend_only_fields(tmp_path: Path):module = _load_generate_swagger_specs_module()@@ -153,10 +307,186 @@ def test_generate_specs_writes_service_api_reference_descriptions(tmp_path: Pathassert chat_operation["summary"] == "Send Chat Message"assert chat_operation["description"] == "Send a request to the chat application."assert chat_operation["tags"] == ["Chatflows", "Chats"]+ serialized_payload = json.dumps(payload)+ assert "](/api-reference/files/upload-file)" in serialized_payload+ assert "](/en/api-reference/" not in serialized_payload- rename_operation = payload["paths"]["/conversations/{c_id}/name"]["post"]+ rename_operation = payload["paths"]["/conversations/{conversation_id}/name"]["post"]assert rename_operation["summary"] == "Rename Conversation"+ datasource_node_operation = payload["paths"]["/datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/run"][+ "post"+ ]+ assert datasource_node_operation["operationId"] == "run_datasource_node"++ pipeline_operation = payload["paths"]["/datasets/{dataset_id}/pipeline/run"]["post"]+ assert pipeline_operation["operationId"] == "run_pipeline"++ chat_error_content = chat_operation["responses"]["401"]["content"]+ assert chat_error_content == {"application/json": {}}+ chat_success_content = chat_operation["responses"]["200"]["content"]+ assert chat_success_content["application/json"]["schema"] == {"$ref": "#/components/schemas/ChatBlockingResponse"}+ assert chat_success_content["text/event-stream"]["schema"] == {"type": "string"}++ schemas = payload["components"]["schemas"]+ chat_blocking_schema = schemas["ChatBlockingResponse"]+ assert chat_blocking_schema["discriminator"] == {+ "mapping": {+ "message": "#/components/schemas/ChatMessageBlockingResponse",+ "workflow_paused": "#/components/schemas/ChatPausedBlockingResponse",+ },+ "propertyName": "event",+ }+ assert schemas["ChatPausedBlockingDataResponse"]["properties"]["reasons"]["items"] == {+ "$ref": "#/components/schemas/ChatPauseReasonResponse"+ }+ chat_pause_reason = schemas["ChatPauseReasonResponse"]+ assert chat_pause_reason["required"] == ["TYPE"]+ assert {"form_token", "expiration_time", "inputs", "actions", "TYPE"} <= set(chat_pause_reason["properties"])++ feedback_properties = schemas["AppFeedbackResponse"]["properties"]+ assert feedback_properties["created_at"]["type"] == "string"+ assert "format" not in feedback_properties["created_at"]+ assert feedback_properties["updated_at"]["type"] == "string"+ assert "format" not in feedback_properties["updated_at"]++ completion_success_content = payload["paths"]["/completion-messages"]["post"]["responses"]["200"]["content"]+ assert completion_success_content["application/json"]["schema"] == {+ "$ref": "#/components/schemas/CompletionBlockingResponse"+ }+ assert completion_success_content["text/event-stream"]["schema"] == {"type": "string"}++ workflow_success_content = payload["paths"]["/workflows/run"]["post"]["responses"]["200"]["content"]+ assert workflow_success_content["application/json"]["schema"] == {+ "$ref": "#/components/schemas/WorkflowBlockingResponse"+ }+ assert workflow_success_content["text/event-stream"]["schema"] == {"type": "string"}+ workflow_blocking_refs = {branch["$ref"] for branch in schemas["WorkflowBlockingResponse"]["anyOf"]}+ assert workflow_blocking_refs == {+ "#/components/schemas/WorkflowFinishedBlockingResponse",+ "#/components/schemas/WorkflowPausedBlockingResponse",+ }+ workflow_paused_properties = schemas["WorkflowPausedBlockingDataResponse"]["properties"]+ assert {"paused_nodes", "reasons"} <= set(workflow_paused_properties)+ assert workflow_paused_properties["reasons"]["items"] == {+ "$ref": "#/components/schemas/WorkflowPauseReasonResponse"+ }+ workflow_pause_reason = schemas["WorkflowPauseReasonResponse"]+ assert workflow_pause_reason["required"] == ["TYPE"]+ assert {"form_token", "expiration_time", "inputs", "actions", "TYPE"} <= set(workflow_pause_reason["properties"])++ pipeline_success_content = pipeline_operation["responses"]["200"]["content"]+ assert pipeline_success_content["application/json"]["schema"] == {+ "$ref": "#/components/schemas/PipelineRunJsonResponse"+ }+ assert pipeline_success_content["text/event-stream"]["schema"] == {"type": "string"}+ pipeline_json_refs = {branch["$ref"] for branch in schemas["PipelineRunJsonResponse"]["anyOf"]}+ assert pipeline_json_refs == {+ "#/components/schemas/PublishedPipelineRunResponse",+ "#/components/schemas/WorkflowBlockingResponse",+ }+ assert schemas["PublishedPipelineRunResponse"]["required"] == ["batch", "dataset", "documents"]++ preview_content = payload["paths"]["/files/{file_id}/preview"]["get"]["responses"]["200"]["content"]+ assert preview_content == {"*/*": {"schema": {"format": "binary", "type": "string"}}}++ text_to_audio_content = payload["paths"]["/text-to-audio"]["post"]["responses"]["200"]["content"]+ assert text_to_audio_content == {+ media_type: {"schema": {"format": "binary", "type": "string"}}+ for media_type in (+ "audio/aac",+ "audio/flac",+ "audio/mp4",+ "audio/mpeg",+ "audio/ogg",+ "audio/wav",+ "audio/webm",+ )+ }++ tag_binding_schema = payload["components"]["schemas"]["TagBindingPayload"]+ assert tag_binding_schema["properties"]["tag_ids"]["minItems"] == 1++ file_item_schema = payload["components"]["schemas"]["CompletionRequestPayloadWithUser"]["properties"]["files"][+ "anyOf"+ ][0]["items"]+ file_validator = Draft202012Validator(file_item_schema)+ valid_file_values = [+ {"type": "image", "transfer_method": "remote_url", "url": "https://example.com/image.png"},+ {"type": "image", "transfer_method": "remote_url", "remote_url": "https://example.com/image.png"},+ {+ "type": "image",+ "transfer_method": "remote_url",+ "upload_file_id": "00000000-0000-0000-0000-000000000001",+ },+ {+ "type": "image",+ "transfer_method": "local_file",+ "upload_file_id": "00000000-0000-0000-0000-000000000001",+ "url": "https://example.com/signed-preview",+ },+ ]+ for value in valid_file_values:+ assert not list(file_validator.iter_errors(value)), value++ invalid_file_values = [+ {"type": "image", "transfer_method": "remote_url"},+ {"type": "image", "transfer_method": "local_file", "url": "https://example.com/image.png"},+ ]+ for value in invalid_file_values:+ assert list(file_validator.iter_errors(value)), value++ user_input_form_schema = payload["components"]["schemas"]["Parameters"]["properties"]["user_input_form"]+ validator = Draft202012Validator(user_input_form_schema)+ form_values = {+ "text-input": "hello",+ "select": "alpha",+ "paragraph": "long text",+ "number": 3.5,+ "external_data_tool": None,+ "file": {"upload_file_id": "file-id"},+ "file-list": [{"upload_file_id": "file-id"}],+ "checkbox": True,+ "json_object": {"key": "value"},+ }+ for form_type, default in form_values.items():+ value = [{form_type: {"label": "Input", "variable": "input", "required": False, "default": default}}]+ assert not list(validator.iter_errors(value)), form_type++ invalid_values = [+ [{"unknown": {"label": "Input", "variable": "input"}}],+ [+ {+ "text-input": {"label": "Text", "variable": "text"},+ "number": {"label": "Number", "variable": "number"},+ }+ ],+ ]+ for value in invalid_values:+ assert list(validator.iter_errors(value)), value++ file_upload_schema = payload["components"]["schemas"]["Parameters"]["properties"]["file_upload"]+ file_upload_properties = file_upload_schema["properties"]+ assert {+ "enabled",+ "number_limits",+ "allowed_file_types",+ "allowed_file_extensions",+ "allowed_file_upload_methods",+ "image",+ } <= set(file_upload_properties)+ assert set(file_upload_properties["allowed_file_types"]["items"]["enum"]) == {+ "document",+ "image",+ "audio",+ "video",+ "custom",+ }+ assert set(file_upload_properties["allowed_file_upload_methods"]["items"]["enum"]) == {+ "remote_url",+ "local_file",+ }+def test_standalone_inline_model_name_includes_list_constraints():module = _load_generate_swagger_specs_module()diff --git a/api/tests/unit_tests/controllers/service_api/app/test_conversation.py b/api/tests/unit_tests/controllers/service_api/app/test_conversation.pyindex ac79b565f7a..926d6835149 100644--- a/api/tests/unit_tests/controllers/service_api/app/test_conversation.py+++ b/api/tests/unit_tests/controllers/service_api/app/test_conversation.py@@ -578,7 +578,12 @@ class TestConversationDetailApiController:with app.test_request_context("/conversations/1", method="DELETE"):with pytest.raises(NotChatAppError):- handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )def test_delete_not_found(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:monkeypatch.setattr(@@ -594,7 +599,12 @@ class TestConversationDetailApiController:with app.test_request_context("/conversations/1", method="DELETE"):with pytest.raises(NotFound):- handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )class TestConversationRenameApiController:@@ -616,7 +626,12 @@ class TestConversationRenameApiController:json={"auto_generate": True},):with pytest.raises(NotFound):- handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )class TestConversationVariablesApiController:@@ -628,7 +643,12 @@ class TestConversationVariablesApiController:with app.test_request_context("/conversations/1/variables", method="GET"):with pytest.raises(NotChatAppError):- handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )def test_not_found(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:monkeypatch.setattr(@@ -647,7 +667,12 @@ class TestConversationVariablesApiController:method="GET",):with pytest.raises(NotFound):- handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )def test_success_serializes_response(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:created_at = datetime(2026, 1, 2, 3, 4, 5, tzinfo=UTC)@@ -679,7 +704,12 @@ class TestConversationVariablesApiController:"/conversations/1/variables?limit=20",method="GET",):- result = handler(api, app_model=app_model, end_user=end_user, c_id="00000000-0000-0000-0000-000000000001")+ result = handler(+ api,+ app_model=app_model,+ end_user=end_user,+ conversation_id="00000000-0000-0000-0000-000000000001",+ )assert result["limit"] == 1assert result["has_more"] is False@@ -711,7 +741,7 @@ class TestConversationVariableDetailApiController:api,app_model=app_model,end_user=end_user,- c_id="00000000-0000-0000-0000-000000000001",+ conversation_id="00000000-0000-0000-0000-000000000001",variable_id="00000000-0000-0000-0000-000000000002",)@@ -737,7 +767,7 @@ class TestConversationVariableDetailApiController:api,app_model=app_model,end_user=end_user,- c_id="00000000-0000-0000-0000-000000000001",+ conversation_id="00000000-0000-0000-0000-000000000001",variable_id="00000000-0000-0000-0000-000000000002",)@@ -770,7 +800,7 @@ class TestConversationVariableDetailApiController:api,app_model=app_model,end_user=end_user,- c_id="00000000-0000-0000-0000-000000000001",+ conversation_id="00000000-0000-0000-0000-000000000001",variable_id="00000000-0000-0000-0000-000000000002",)diff --git a/api/tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py b/api/tests/unit_tests/controllers/service_api/app/test_hitl_service_api.pyindex 549b656fa1f..55a130d8b09 100644--- a/api/tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py+++ b/api/tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py@@ -141,7 +141,7 @@ def _build_advanced_chat_paused_blocking_response() -> AdvancedChatPausedBlockinpaused_nodes=["node-1"],reasons=[{- "type": DifyHITLEventType.HUMAN_INPUT_REQUIRED.value,+ "TYPE": DifyHITLEventType.HUMAN_INPUT_REQUIRED.value,"form_id": "form-1","expiration_time": 100,}@@ -312,7 +312,7 @@ class TestHitlServiceApi:end_user = SimpleNamespace(id="end-user-1")with app.test_request_context("/workflow/run-1/events?user=u1&continue_on_pause=true", method="GET"):- response = handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ response = handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")assert response.get_data(as_text=True) == "data: streamed\n\n"msg_generator.retrieve_events.assert_called_once_with(@@ -357,7 +357,7 @@ class TestHitlServiceApi:"/workflow/run-1/events?user=u1&include_state_snapshot=true&continue_on_pause=true",method="GET",):- response = handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ response = handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")assert response.get_data(as_text=True) == "data: snapshot\n\n"msg_generator.retrieve_events.assert_not_called()@@ -433,7 +433,7 @@ class TestHitlServiceApi:assert response["event"] == "workflow_paused"assert response["workflow_run_id"] == "run-1"assert response["answer"] == "partial"- assert response["data"]["reasons"][0]["type"] == DifyHITLEventType.HUMAN_INPUT_REQUIRED+ assert response["data"]["reasons"][0]["TYPE"] == DifyHITLEventType.HUMAN_INPUT_REQUIREDassert response["data"]["reasons"][0]["expiration_time"] == 100assert "human_input_forms" not in response["data"]@@ -524,7 +524,7 @@ class TestHitlServiceApi:outputs={},reasons=[{- "type": DifyHITLEventType.HUMAN_INPUT_REQUIRED.value,+ "TYPE": DifyHITLEventType.HUMAN_INPUT_REQUIRED.value,"form_id": "form-1","node_id": "node-1","expiration_time": 123,diff --git a/api/tests/unit_tests/controllers/service_api/app/test_workflow_events.py b/api/tests/unit_tests/controllers/service_api/app/test_workflow_events.pyindex 94b7c8bca10..0e4a9db257c 100644--- a/api/tests/unit_tests/controllers/service_api/app/test_workflow_events.py+++ b/api/tests/unit_tests/controllers/service_api/app/test_workflow_events.py@@ -40,7 +40,7 @@ class TestWorkflowEventsApi:with app.test_request_context("/workflow/run-1/events?user=u1", method="GET"):with pytest.raises(NotWorkflowAppError):- handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")def test_workflow_run_not_found(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:_mock_repo_for_run(monkeypatch, workflow_run=None)@@ -51,7 +51,7 @@ class TestWorkflowEventsApi:with app.test_request_context("/workflow/run-1/events?user=u1", method="GET"):with pytest.raises(NotFound):- handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")def test_workflow_run_permission_denied(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:workflow_run = SimpleNamespace(@@ -69,7 +69,7 @@ class TestWorkflowEventsApi:with app.test_request_context("/workflow/run-1/events?user=u1", method="GET"):with pytest.raises(NotFound):- handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")def test_finished_run_returns_sse(self, app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:workflow_run = SimpleNamespace(@@ -95,7 +95,7 @@ class TestWorkflowEventsApi:end_user = SimpleNamespace(id="end-user-1")with app.test_request_context("/workflow/run-1/events?user=u1", method="GET"):- response = handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ response = handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")assert response.mimetype == "text/event-stream"body = response.get_data(as_text=True).strip()@@ -126,7 +126,7 @@ class TestWorkflowEventsApi:end_user = SimpleNamespace(id="end-user-1")with app.test_request_context("/workflow/run-1/events?user=u1", method="GET"):- response = handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ response = handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")assert response.get_data(as_text=True) == "data: streamed\n\n"msg_generator.retrieve_events.assert_called_once_with(@@ -159,7 +159,7 @@ class TestWorkflowEventsApi:end_user = SimpleNamespace(id="end-user-1")with app.test_request_context("/workflow/run-1/events?user=u1&include_state_snapshot=true", method="GET"):- response = handler(api, app_model=app_model, end_user=end_user, task_id="run-1")+ response = handler(api, app_model=app_model, end_user=end_user, workflow_run_id="run-1")assert response.get_data(as_text=True) == "data: snapshot\n\n"msg_generator.retrieve_events.assert_not_called()diff --git a/api/tests/unit_tests/controllers/service_api/test_index.py b/api/tests/unit_tests/controllers/service_api/test_index.pyindex 7202ac875db..acd6eb49a83 100644--- a/api/tests/unit_tests/controllers/service_api/test_index.py+++ b/api/tests/unit_tests/controllers/service_api/test_index.py@@ -7,6 +7,7 @@ from unittest.mock import patchimport pytestfrom flask import Flask+from controllers.service_api import bp as service_api_bpfrom controllers.service_api import index as index_modulefrom controllers.service_api.index import IndexApi@@ -52,3 +53,21 @@ class TestIndexApi:# Assertassert response["server_version"] == version++ def test_root_route_returns_public_api_info(self):+ """Exercise the registered blueprint so Flask-RESTX cannot shadow the resource."""+ app = Flask(__name__)+ app.config["TESTING"] = True+ app.register_blueprint(service_api_bp)++ with patch.object(index_module.dify_config.project, "version", "1.0.0-route-test"):+ response = app.test_client().get("/v1/")++ assert response.status_code == 200+ assert response.get_json() == {+ "welcome": "Dify OpenAPI",+ "api_version": "v1",+ "server_version": "1.0.0-route-test",+ }+ root_rules = [rule for rule in app.url_map.iter_rules() if rule.rule == "/v1/"]+ assert [rule.endpoint for rule in root_rules] == ["service_api.root"]diff --git a/api/tests/unit_tests/controllers/test_swagger.py b/api/tests/unit_tests/controllers/test_swagger.pyindex bb2fbe5dfd9..98681e0c46c 100644--- a/api/tests/unit_tests/controllers/test_swagger.py+++ b/api/tests/unit_tests/controllers/test_swagger.py@@ -180,7 +180,7 @@ def test_openapi_json_endpoints_render():assert response.status_code == 200payload = response.get_json()- assert payload["openapi"].startswith("3.")+ assert payload["openapi"] == "3.1.0"assert "paths" in payloadassert "schemas" in payload["components"]assert isinstance(payload["components"]["schemas"], dict)@@ -221,7 +221,6 @@ def test_service_document_file_routes_document_multipart_form_data():for path in ("/datasets/{dataset_id}/documents/{document_id}","/datasets/{dataset_id}/documents/{document_id}/update-by-file",- "/datasets/{dataset_id}/documents/{document_id}/update_by_file",):update_operation = paths[path]["patch" if path.endswith("{document_id}") else "post"]update_schema = _multipart_form_schema(update_operation)@@ -250,13 +249,13 @@ def test_service_openapi_merges_public_api_reference_descriptions():chat_operation = payload["paths"]["/chat-messages"]["post"]assert chat_operation["summary"] == "Send Chat Message"assert chat_operation["description"] == "Send a request to the chat application."- assert chat_operation["tags"] == ["Chats", "Chatflows"]+ assert chat_operation["tags"] == ["Chatflows", "Chats"]assert chat_operation["responses"]["200"]["description"].startswith("Successful response.")- rename_operation = payload["paths"]["/conversations/{c_id}/name"]["post"]+ rename_operation = payload["paths"]["/conversations/{conversation_id}/name"]["post"]assert rename_operation["summary"] == "Rename Conversation"assert rename_operation["tags"] == ["Conversations"]- assert _parameters_by_name(rename_operation)["c_id"]["description"] == "Conversation ID."+ assert _parameters_by_name(rename_operation)["conversation_id"]["description"] == "Conversation ID."def test_service_document_list_documents_query_params_render():@@ -304,9 +303,9 @@ def test_service_openapi_documents_decorator_user_contracts():optional_json_user_operations = (("/text-to-audio", "post"),- ("/conversations/{c_id}", "delete"),- ("/conversations/{c_id}/name", "post"),- ("/conversations/{c_id}/variables/{variable_id}", "put"),+ ("/conversations/{conversation_id}", "delete"),+ ("/conversations/{conversation_id}/name", "post"),+ ("/conversations/{conversation_id}/variables/{variable_id}", "put"),)for path, method in optional_json_user_operations:schema = _json_body_schema(payload, paths[path][method])@@ -317,7 +316,7 @@ def test_service_openapi_documents_decorator_user_contracts():assert messages_params["user"]["in"] == "query"assert messages_params["user"]["required"] is False- events_params = _parameters_by_name(paths["/workflow/{task_id}/events"]["get"])+ events_params = _parameters_by_name(paths["/workflow/{workflow_run_id}/events"]["get"])assert events_params["user"]["in"] == "query"assert events_params["user"]["required"] is True@@ -369,27 +368,17 @@ def test_service_openapi_documents_non_json_response_media_types():"application/json","text/event-stream",}- assert _response_content_types(paths["/workflow/{task_id}/events"]["get"]) == {"text/event-stream"}- assert _response_content_types(paths["/text-to-audio"]["post"]) == {"application/octet-stream"}- assert _response_content_types(paths["/files/{file_id}/preview"]["get"]) == {- "application/octet-stream",- "application/pdf",+ assert _response_content_types(paths["/workflow/{workflow_run_id}/events"]["get"]) == {"text/event-stream"}+ assert _response_content_types(paths["/text-to-audio"]["post"]) == {"audio/aac","audio/flac","audio/mp4","audio/mpeg","audio/ogg","audio/wav",- "audio/x-m4a",- "image/gif",- "image/jpeg",- "image/png",- "image/webp",- "text/plain",- "video/mp4",- "video/quicktime",- "video/webm",+ "audio/webm",}+ assert _response_content_types(paths["/files/{file_id}/preview"]["get"]) == {"*/*"}assert _response_content_types(paths["/datasets/{dataset_id}/documents/download-zip"]["post"]) == {"application/zip"}@@ -413,15 +402,25 @@ def test_service_openapi_documents_uuid_params_and_deprecated_routes():"type": "string",}- conversation_params = _parameters_by_name(paths["/conversations/{c_id}"]["delete"])- assert conversation_params["c_id"]["schema"] == {+ conversation_params = _parameters_by_name(paths["/conversations/{conversation_id}"]["delete"])+ assert conversation_params["conversation_id"]["schema"] == {"description": "Conversation ID.","format": "uuid","type": "string",}- assert paths["/datasets/{dataset_id}/document/create_by_file"]["post"]["deprecated"] is True- assert paths["/datasets/{dataset_id}/documents/{document_id}/update_by_text"]["post"]["deprecated"] is True+ compatibility_paths = {+ "/",+ "/datasets/{dataset_id}/document/create_by_file",+ "/datasets/{dataset_id}/document/create_by_text",+ "/datasets/{dataset_id}/documents/{document_id}/update_by_file",+ "/datasets/{dataset_id}/documents/{document_id}/update_by_text",+ "/datasets/{dataset_id}/hit-testing",+ }+ assert compatibility_paths <= set(paths)+ for path in compatibility_paths - {"/"}:+ operation = next(value for key, value in paths[path].items() if key in {"post", "patch"})+ assert operation["deprecated"] is Truedef test_service_openapi_documents_path_action_enums():@@ -436,13 +435,13 @@ def test_service_openapi_documents_path_action_enums():paths = payload["paths"]annotation_params = _parameters_by_name(paths["/apps/annotation-reply/{action}"]["post"])- assert annotation_params["action"]["schema"]["enum"] == ["enable", "disable"]+ assert annotation_params["action"]["schema"]["enum"] == ["disable", "enable"]document_status_params = _parameters_by_name(paths["/datasets/{dataset_id}/documents/status/{action}"]["patch"])- assert document_status_params["action"]["schema"]["enum"] == ["enable", "disable", "archive", "un_archive"]+ assert document_status_params["action"]["schema"]["enum"] == ["archive", "disable", "enable", "un_archive"]metadata_params = _parameters_by_name(paths["/datasets/{dataset_id}/metadata/built-in/{action}"]["post"])- assert metadata_params["action"]["schema"]["enum"] == ["enable", "disable"]+ assert metadata_params["action"]["schema"]["enum"] == ["disable", "enable"]def test_service_openapi_documents_conditional_payload_schemas():@@ -456,7 +455,7 @@ def test_service_openapi_documents_conditional_payload_schemas():payload = app.test_client().get("/v1/openapi.json").get_json()paths = payload["paths"]- rename_schema = _json_body_schema(payload, paths["/conversations/{c_id}/name"]["post"])+ rename_schema = _json_body_schema(payload, paths["/conversations/{conversation_id}/name"]["post"])auto_generate_branch, manual_name_branch = rename_schema["anyOf"]assert auto_generate_branch["properties"]["auto_generate"]["enum"] == [True]assert auto_generate_branch["required"] == ["auto_generate"]@@ -494,8 +493,6 @@ def test_service_openapi_does_not_encode_docs_coverage_boundaries():assert "x-dify-api-reference-visibility" not in operationassert "x-dify-api-lifecycle" not in operation- assert paths["/datasets/{dataset_id}/document/create_by_text"]["post"]["deprecated"] is True- assert paths["/datasets/{dataset_id}/document/create_by_file"]["post"]["deprecated"] is Trueassert paths["/datasets/{dataset_id}/documents/{document_id}/update-by-file"]["post"]["deprecated"] is True@@ -515,6 +512,7 @@ def test_service_openapi_documents_auth_and_compatibility_payloads():"scheme": "bearer","type": "http",}+ assert payload["paths"]["/"]["get"]["security"] == []tag_unbinding_schema = payload["components"]["schemas"]["TagUnbindingPayload"]assert tag_unbinding_schema["description"] == (@@ -523,6 +521,8 @@ def test_service_openapi_documents_auth_and_compatibility_payloads():tag_id_schema, tag_ids_schema = tag_unbinding_schema["anyOf"]assert tag_id_schema["properties"]["tag_id"]["description"] == ("Legacy single tag ID accepted by the Service API.")assert tag_id_schema["required"] == ["tag_id", "target_id"]+ assert tag_ids_schema["properties"]["tag_id"]["anyOf"] == [{"type": "string"}, {"type": "null"}]+ assert "nullable" not in tag_ids_schema["properties"]["tag_id"]assert tag_ids_schema["properties"]["tag_ids"]["minItems"] == 1assert tag_ids_schema["required"] == ["tag_ids", "target_id"]diff --git a/api/tests/unit_tests/factories/test_build_from_mapping.py b/api/tests/unit_tests/factories/test_build_from_mapping.pyindex 30d69144f45..0f30793375d 100644--- a/api/tests/unit_tests/factories/test_build_from_mapping.py+++ b/api/tests/unit_tests/factories/test_build_from_mapping.py@@ -14,6 +14,7 @@ from core.app.file_access import DatabaseFileAccessController, FileAccessScope,from core.workflow.file_reference import build_file_reference, parse_file_reference, resolve_file_record_idfrom extensions.storage.storage_type import StorageTypefrom factories.file_factory.builders import build_from_mapping as _build_from_mapping+from factories.file_factory.builders import build_from_mappings as _build_from_mappingsfrom graphon.file import File, FileTransferMethod, FileType, FileUploadConfigfrom models import CreatorUserRole, ToolFile, UploadFile@@ -44,6 +45,16 @@ def build_from_mapping(*, mapping, tenant_id, config=None, strict_type_validatio)+def build_from_mappings(*, mappings, tenant_id, config=None, strict_type_validation=False):+ return _build_from_mappings(+ mappings=mappings,+ tenant_id=tenant_id,+ config=config,+ strict_type_validation=strict_type_validation,+ access_controller=TEST_ACCESS_CONTROLLER,+ )++@dataclass(frozen=True)class FileRecords:session: Session@@ -233,6 +244,25 @@ def test_build_from_remote_url(mock_http_head):assert file.size == 2048+def test_build_from_mappings_accepts_remote_url_with_upload_file_id(monkeypatch: pytest.MonkeyPatch):+ monkeypatch.setattr(+ "factories.file_factory.builders.helpers.get_signed_file_url",+ lambda **_kwargs: "https://example.com/signed-upload-file",+ )+ mapping = {+ "transfer_method": "remote_url",+ "upload_file_id": TEST_UPLOAD_FILE_ID,+ "type": "image",+ }++ files = build_from_mappings(mappings=[mapping], tenant_id=TEST_TENANT_ID)++ assert len(files) == 1+ assert files[0].transfer_method == FileTransferMethod.REMOTE_URL+ assert resolve_file_record_id(files[0].reference) == TEST_UPLOAD_FILE_ID+ assert files[0].storage_key == "test_key"++def test_build_from_remote_url_prefers_filename_extension_over_mimetype():mapping = {"transfer_method": "remote_url",diff --git a/packages/contracts/account-profile-zod.test.ts b/packages/contracts/account-profile-zod.test.tsindex a8be14eb1e2..fcd10d0d8a1 100644--- a/packages/contracts/account-profile-zod.test.ts+++ b/packages/contracts/account-profile-zod.test.ts@@ -1,13 +1,29 @@import { describe, expect, it } from 'vite-plus/test'-import { zAccountProfilePatchPayload } from './generated/api/console/account/zod.gen'+import {+ zAccountPasswordPayload,+ zAccountProfilePatchPayload,+} from './generated/api/console/account/zod.gen'describe('generated account profile schema', () => {it('matches the server rules for partial updates', () => {expect(zAccountProfilePatchPayload.safeParse({ name: 'Jane' }).success).toBe(true)expect(zAccountProfilePatchPayload.safeParse({}).success).toBe(true)+ expect(zAccountProfilePatchPayload.parse({})).toEqual({})expect(zAccountProfilePatchPayload.safeParse({ name: null }).success).toBe(false)expect(zAccountProfilePatchPayload.safeParse({ name: 'Jane', unexpected: 'value' }).success,).toBe(false)})++ it('does not synthesize server-side null defaults in request payloads', () => {+ expect(+ zAccountPasswordPayload.parse({+ new_password: 'new-password',+ repeat_new_password: 'new-password',+ }),+ ).toEqual({+ new_password: 'new-password',+ repeat_new_password: 'new-password',+ })+ })})diff --git a/packages/contracts/generated/api/console/agent/zod.gen.ts b/packages/contracts/generated/api/console/agent/zod.gen.tsindex 92aeaa3de48..d33b96e344b 100644--- a/packages/contracts/generated/api/console/agent/zod.gen.ts+++ b/packages/contracts/generated/api/console/agent/zod.gen.ts@@ -733,12 +733,12 @@ export const zAgentThought = z.object({export const zMessageFile = z.object({belongs_to: z.string().nullish(),filename: z.string(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),size: z.int().nullish(),transfer_method: z.string(),type: z.string(),- upload_file_id: z.string().nullish(),+ upload_file_id: z.uuid().nullish(),url: z.string().nullish(),})@@ -2042,7 +2042,10 @@ export const zButtonStyle = z.enum(['accent', 'default', 'ghost', 'primary'])*/export const zUserActionConfig = z.object({button_style: zButtonStyle.optional().default('default'),- id: z.string().max(20),+ id: z+ .string()+ .max(20)+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/),title: z.string().max(100),})diff --git a/packages/contracts/generated/api/console/apps/types.gen.ts b/packages/contracts/generated/api/console/apps/types.gen.tsindex 0edb77f8ec8..ca5785729c2 100644--- a/packages/contracts/generated/api/console/apps/types.gen.ts+++ b/packages/contracts/generated/api/console/apps/types.gen.ts@@ -272,13 +272,13 @@ export type AnnotationReplyPayload = {export type AnnotationJobStatusResponse = {job_id: string- job_status: 'completed' | 'error' | 'processing' | 'waiting' | string+ job_status: string}export type AnnotationJobStatusDetailResponse = {error_msg?: stringjob_id: string- job_status: 'completed' | 'error' | 'processing' | 'waiting' | string+ job_status: string}export type AnnotationSettingResponse = {diff --git a/packages/contracts/generated/api/console/apps/zod.gen.ts b/packages/contracts/generated/api/console/apps/zod.gen.tsindex 91074f82e8b..92fff50d56f 100644--- a/packages/contracts/generated/api/console/apps/zod.gen.ts+++ b/packages/contracts/generated/api/console/apps/zod.gen.ts@@ -155,8 +155,8 @@ export const zAnnotationReplyPayload = z.object({* AnnotationJobStatusResponse*/export const zAnnotationJobStatusResponse = z.object({- job_id: z.string(),- job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),+ job_id: z.uuid(),+ job_status: z.string(),})/**@@ -164,8 +164,8 @@ export const zAnnotationJobStatusResponse = z.object({*/export const zAnnotationJobStatusDetailResponse = z.object({error_msg: z.string().optional().default(''),- job_id: z.string(),- job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),+ job_id: z.uuid(),+ job_status: z.string(),})/**@@ -193,7 +193,7 @@ export const zAnnotation = z.object({answer: z.string().nullish(),created_at: z.int().nullish(),hit_count: z.int().nullish(),- id: z.string(),+ id: z.uuid(),question: z.string().nullish(),})@@ -1317,12 +1317,12 @@ export const zAgentThought = z.object({export const zMessageFile = z.object({belongs_to: z.string().nullish(),filename: z.string(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),size: z.int().nullish(),transfer_method: z.string(),type: z.string(),- upload_file_id: z.string().nullish(),+ upload_file_id: z.uuid().nullish(),url: z.string().nullish(),})@@ -3320,7 +3320,10 @@ export const zButtonStyle = z.enum(['accent', 'default', 'ghost', 'primary'])*/export const zUserActionConfig = z.object({button_style: zButtonStyle.optional().default('default'),- id: z.string().max(20),+ id: z+ .string()+ .max(20)+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/),title: z.string().max(100),})diff --git a/packages/contracts/generated/api/console/datasets/types.gen.ts b/packages/contracts/generated/api/console/datasets/types.gen.tsindex 41b885bf98f..b197f567efe 100644--- a/packages/contracts/generated/api/console/datasets/types.gen.ts+++ b/packages/contracts/generated/api/console/datasets/types.gen.ts@@ -392,8 +392,12 @@ export type DocumentResponse = {created_at?: number | nullcreated_by?: string | nullcreated_from?: string | null- data_source_detail_dict?: unknown- data_source_info?: unknown+ data_source_detail_dict: {+ [key: string]: unknown+ }+ data_source_info?: {+ [key: string]: unknown+ } | nulldata_source_type?: string | nulldataset_process_rule_id?: string | nulldisabled_at?: number | null@@ -719,8 +723,12 @@ export type DocumentWithSegmentsResponse = {created_at?: number | nullcreated_by?: string | nullcreated_from?: string | null- data_source_detail_dict?: unknown- data_source_info?: unknown+ data_source_detail_dict: {+ [key: string]: unknown+ }+ data_source_info?: {+ [key: string]: unknown+ } | nulldata_source_type?: string | nulldataset_process_rule_id?: string | nulldisabled_at?: number | nulldiff --git a/packages/contracts/generated/api/console/datasets/zod.gen.ts b/packages/contracts/generated/api/console/datasets/zod.gen.tsindex 8f617205b5b..f7dedfb1d87 100644--- a/packages/contracts/generated/api/console/datasets/zod.gen.ts+++ b/packages/contracts/generated/api/console/datasets/zod.gen.ts@@ -548,8 +548,8 @@ export const zDocumentResponse = z.object({created_at: z.int().nullish(),created_by: z.string().nullish(),created_from: z.string().nullish(),- data_source_detail_dict: z.unknown().optional(),- data_source_info: z.unknown().optional(),+ data_source_detail_dict: z.record(z.string(), z.unknown()),+ data_source_info: z.record(z.string(), z.unknown()).nullish(),data_source_type: z.string().nullish(),dataset_process_rule_id: z.string().nullish(),disabled_at: z.int().nullish(),@@ -588,8 +588,8 @@ export const zDocumentWithSegmentsResponse = z.object({created_at: z.int().nullish(),created_by: z.string().nullish(),created_from: z.string().nullish(),- data_source_detail_dict: z.unknown().optional(),- data_source_info: z.unknown().optional(),+ data_source_detail_dict: z.record(z.string(), z.unknown()),+ data_source_info: z.record(z.string(), z.unknown()).nullish(),data_source_type: z.string().nullish(),dataset_process_rule_id: z.string().nullish(),disabled_at: z.int().nullish(),diff --git a/packages/contracts/generated/api/console/files/zod.gen.ts b/packages/contracts/generated/api/console/files/zod.gen.tsindex ac4400b777e..e70f3a81435 100644--- a/packages/contracts/generated/api/console/files/zod.gen.ts+++ b/packages/contracts/generated/api/console/files/zod.gen.ts@@ -31,12 +31,12 @@ export const zUploadConfig = z.object({* FileResponse*/export const zFileResponse = z.object({- conversation_id: z.string().nullish(),+ conversation_id: z.uuid().nullish(),created_at: z.int().nullish(),- created_by: z.string().nullish(),+ created_by: z.uuid().nullish(),extension: z.string().nullish(),file_key: z.string().nullish(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),name: z.string(),original_url: z.string().nullish(),@@ -44,8 +44,8 @@ export const zFileResponse = z.object({reference: z.string().nullish(),size: z.int(),source_url: z.string().nullish(),- tenant_id: z.string().nullish(),- user_id: z.string().nullish(),+ tenant_id: z.uuid().nullish(),+ user_id: z.uuid().nullish(),})/**diff --git a/packages/contracts/generated/api/console/installed-apps/types.gen.ts b/packages/contracts/generated/api/console/installed-apps/types.gen.tsindex d2b2bc01f0a..0c87032f3f2 100644--- a/packages/contracts/generated/api/console/installed-apps/types.gen.ts+++ b/packages/contracts/generated/api/console/installed-apps/types.gen.ts@@ -136,18 +136,327 @@ export type ExploreAppMetaResponse = {}export type Parameters = {- annotation_reply: JsonObject- file_upload: JsonObject- more_like_this: JsonObject+ annotation_reply: {+ enabled?: boolean+ }+ file_upload: {+ allowed_file_extensions?: Array<string>+ allowed_file_types?: Array<'audio' | 'custom' | 'document' | 'image' | 'video'>+ allowed_file_upload_methods?: Array<'local_file' | 'remote_url'>+ enabled?: boolean+ image?: {+ detail?: string+ enabled?: boolean+ number_limits?: number+ transfer_methods?: Array<string>+ }+ number_limits?: number+ }+ more_like_this: {+ enabled?: boolean+ }opening_statement?: string | null- retriever_resource: JsonObject- sensitive_word_avoidance: JsonObject- speech_to_text: JsonObject+ retriever_resource: {+ enabled?: boolean+ }+ sensitive_word_avoidance: {+ enabled?: boolean+ }+ speech_to_text: {+ enabled?: boolean+ }suggested_questions: Array<string>- suggested_questions_after_answer: JsonObject+ suggested_questions_after_answer: {+ enabled?: boolean+ }system_parameters: SystemParameters- text_to_speech: JsonObject- user_input_form: Array<JsonObject>+ text_to_speech: {+ autoPlay?: string+ enabled?: boolean+ language?: string+ voice?: string+ }+ user_input_form: Array<+ | {+ 'text-input': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ select: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ paragraph: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ number: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ external_data_tool: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ file: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ 'file-list': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ checkbox: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ json_object: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ >}export type SavedMessageInfiniteScrollPagination = {@@ -170,12 +479,36 @@ export type TextToAudioPayload = {export type AudioBinaryResponse = Blob | Fileexport type WorkflowRunPayload = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -230,10 +563,6 @@ export type ExploreMessageListItem = {readonly total_tokens: number}-export type JsonObject = {- [key: string]: unknown-}-export type SystemParameters = {audio_file_size_limit: numberfile_size_limit: numberdiff --git a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts b/packages/contracts/generated/api/console/installed-apps/zod.gen.tsindex 753aa7d0160..fdc49e41844 100644--- a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts+++ b/packages/contracts/generated/api/console/installed-apps/zod.gen.ts@@ -154,12 +154,36 @@ export const zAudioBinaryResponse = z.custom<Blob | File>(export const zWorkflowRunPayload = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -181,7 +205,7 @@ export const zJsonValue = z*/export const zSimpleConversation = z.object({created_at: z.int().nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValue),introduction: z.string().nullish(),name: z.string(),@@ -198,8 +222,6 @@ export const zConversationInfiniteScrollPagination = z.object({limit: z.int(),})-export const zJsonObject = z.record(z.string(), z.unknown())-/*** SystemParameters*/@@ -215,18 +237,342 @@ export const zSystemParameters = z.object({* Parameters*/export const zParameters = z.object({- annotation_reply: zJsonObject,- file_upload: zJsonObject,- more_like_this: zJsonObject,+ annotation_reply: z.object({+ enabled: z.boolean().optional(),+ }),+ file_upload: z.object({+ allowed_file_extensions: z.array(z.string()).optional(),+ allowed_file_types: z+ .array(z.enum(['audio', 'custom', 'document', 'image', 'video']))+ .optional(),+ allowed_file_upload_methods: z.array(z.enum(['local_file', 'remote_url'])).optional(),+ enabled: z.boolean().optional(),+ image: z+ .object({+ detail: z.string().optional(),+ enabled: z.boolean().optional(),+ number_limits: z.int().optional(),+ transfer_methods: z.array(z.string()).optional(),+ })+ .optional(),+ number_limits: z.int().optional(),+ }),+ more_like_this: z.object({+ enabled: z.boolean().optional(),+ }),opening_statement: z.string().nullish(),- retriever_resource: zJsonObject,- sensitive_word_avoidance: zJsonObject,- speech_to_text: zJsonObject,+ retriever_resource: z.object({+ enabled: z.boolean().optional(),+ }),+ sensitive_word_avoidance: z.object({+ enabled: z.boolean().optional(),+ }),+ speech_to_text: z.object({+ enabled: z.boolean().optional(),+ }),suggested_questions: z.array(z.string()),- suggested_questions_after_answer: zJsonObject,+ suggested_questions_after_answer: z.object({+ enabled: z.boolean().optional(),+ }),system_parameters: zSystemParameters,- text_to_speech: zJsonObject,- user_input_form: z.array(zJsonObject),+ text_to_speech: z.object({+ autoPlay: z.string().optional(),+ enabled: z.boolean().optional(),+ language: z.string().optional(),+ voice: z.string().optional(),+ }),+ user_input_form: z.array(+ z.union([+ z+ .object({+ 'text-input': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ select: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ paragraph: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ number: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ external_data_tool: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ file: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ 'file-list': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ checkbox: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ json_object: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ ]),+ ),})/**@@ -318,12 +664,12 @@ export const zJsonValueType = z.unknown()export const zMessageFile = z.object({belongs_to: z.string().nullish(),filename: z.string(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),size: z.int().nullish(),transfer_method: z.string(),type: z.string(),- upload_file_id: z.string().nullish(),+ upload_file_id: z.uuid().nullish(),url: z.string().nullish(),})@@ -356,17 +702,17 @@ export const zRetrieverResource = z.object({content: z.string().nullish(),created_at: z.int().nullish(),data_source_type: z.string().nullish(),- dataset_id: z.string().nullish(),+ dataset_id: z.uuid().nullish(),dataset_name: z.string().nullish(),- document_id: z.string().nullish(),+ document_id: z.uuid().nullish(),document_name: z.string().nullish(),hit_count: z.int().nullish(),- id: z.string().optional(),+ id: z.uuid().optional(),index_node_hash: z.string().nullish(),- message_id: z.string().optional(),+ message_id: z.uuid().optional(),position: z.int(),score: z.number().nullish(),- segment_id: z.string().nullish(),+ segment_id: z.uuid().nullish(),segment_position: z.int().nullish(),summary: z.string().nullish(),word_count: z.int().nullish(),@@ -405,7 +751,10 @@ export const zButtonStyle = z.enum(['accent', 'default', 'ghost', 'primary'])*/export const zUserActionConfig = z.object({button_style: zButtonStyle.optional().default('default'),- id: z.string().max(20),+ id: z+ .string()+ .max(20)+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/),title: z.string().max(100),})@@ -536,18 +885,18 @@ export const zExploreMessageListItem = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),metadata: zJsonValueType.nullish(),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),@@ -611,18 +960,18 @@ export const zExploreMessageListItemWritable = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),metadata: zJsonValueType.nullish(),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),diff --git a/packages/contracts/generated/api/console/trial-apps/types.gen.ts b/packages/contracts/generated/api/console/trial-apps/types.gen.tsindex 07505c849ee..2f7be17e436 100644--- a/packages/contracts/generated/api/console/trial-apps/types.gen.ts+++ b/packages/contracts/generated/api/console/trial-apps/types.gen.ts@@ -87,18 +87,327 @@ export type SuggestedQuestionsResponse = {}export type Parameters = {- annotation_reply: JsonObject- file_upload: JsonObject- more_like_this: JsonObject+ annotation_reply: {+ enabled?: boolean+ }+ file_upload: {+ allowed_file_extensions?: Array<string>+ allowed_file_types?: Array<'audio' | 'custom' | 'document' | 'image' | 'video'>+ allowed_file_upload_methods?: Array<'local_file' | 'remote_url'>+ enabled?: boolean+ image?: {+ detail?: string+ enabled?: boolean+ number_limits?: number+ transfer_methods?: Array<string>+ }+ number_limits?: number+ }+ more_like_this: {+ enabled?: boolean+ }opening_statement?: string | null- retriever_resource: JsonObject- sensitive_word_avoidance: JsonObject- speech_to_text: JsonObject+ retriever_resource: {+ enabled?: boolean+ }+ sensitive_word_avoidance: {+ enabled?: boolean+ }+ speech_to_text: {+ enabled?: boolean+ }suggested_questions: Array<string>- suggested_questions_after_answer: JsonObject+ suggested_questions_after_answer: {+ enabled?: boolean+ }system_parameters: SystemParameters- text_to_speech: JsonObject- user_input_form: Array<JsonObject>+ text_to_speech: {+ autoPlay?: string+ enabled?: boolean+ language?: string+ voice?: string+ }+ user_input_form: Array<+ | {+ 'text-input': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ select: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ paragraph: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ number: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ external_data_tool: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ file: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ 'file-list': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ checkbox: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ json_object: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ >}export type RemoteFileUploadPayload = {@@ -147,14 +456,14 @@ export type TrialWorkflowResponse = {conversation_variables?: Array<WorkflowConversationVariableResponse>created_at?: number | nullcreated_by?: TrialSimpleAccount | null- environment_variables?: Array<JsonObject2>- features?: JsonObject2- graph: JsonObject2+ environment_variables?: Array<JsonObject>+ features?: JsonObject+ graph: JsonObjecthash?: string | nullid: stringmarked_comment?: string | nullmarked_name?: string | null- rag_pipeline_variables?: Array<JsonObject2>+ rag_pipeline_variables?: Array<JsonObject>tool_published?: boolean | nullupdated_at?: number | nullupdated_by?: TrialSimpleAccount | null@@ -184,29 +493,29 @@ export type TrialAppMode = 'advanced-chat' | 'agent-chat' | 'chat' | 'completionexport type TrialAppModelConfigResponse = {agent_mode?: TrialAppAgentMode | null- annotation_reply?: JsonObject2 | null- chat_prompt_config?: JsonObject2 | null- completion_prompt_config?: JsonObject2 | null+ annotation_reply?: JsonObject | null+ chat_prompt_config?: JsonObject | null+ completion_prompt_config?: JsonObject | nullcreated_at?: number | nullcreated_by?: string | null- dataset_configs?: JsonObject2 | null+ dataset_configs?: JsonObject | nulldataset_query_variable?: string | null- external_data_tools?: Array<JsonObject2>- file_upload?: JsonObject2 | null+ external_data_tools?: Array<JsonObject>+ file_upload?: JsonObject | nullmodel?: TrialAppModel | null- more_like_this?: JsonObject2 | null+ more_like_this?: JsonObject | nullopening_statement?: string | nullpre_prompt?: string | nullprompt_type?: string | null- retriever_resource?: JsonObject2 | null- sensitive_word_avoidance?: JsonObject2 | null- speech_to_text?: JsonObject2 | null+ retriever_resource?: JsonObject | null+ sensitive_word_avoidance?: JsonObject | null+ speech_to_text?: JsonObject | nullsuggested_questions?: Array<string>- suggested_questions_after_answer?: JsonObject2 | null- text_to_speech?: JsonObject2 | null+ suggested_questions_after_answer?: JsonObject | null+ text_to_speech?: JsonObject | nullupdated_at?: number | nullupdated_by?: string | null- user_input_form?: Array<JsonObject2>+ user_input_form?: Array<JsonObject>}export type TrialSiteResponse = {@@ -263,10 +572,6 @@ export type TrialDatasetResponse = {permission_keys?: Array<string>}-export type JsonObject = {- [key: string]: unknown-}-export type SystemParameters = {audio_file_size_limit: numberfile_size_limit: number@@ -289,18 +594,18 @@ export type TrialSimpleAccount = {name?: string | null}-export type JsonObject2 = {+export type JsonObject = {[key: string]: unknown}export type TrialAppAgentMode = {enabled?: boolean | nullstrategy?: string | null- tools?: Array<JsonObject2>+ tools?: Array<JsonObject>}export type TrialAppModel = {- completion_params?: JsonObject2+ completion_params?: JsonObjectmode?: string | nullname: stringprovider: stringdiff --git a/packages/contracts/generated/api/console/trial-apps/zod.gen.ts b/packages/contracts/generated/api/console/trial-apps/zod.gen.tsindex 9f6536e5190..395446a2002 100644--- a/packages/contracts/generated/api/console/trial-apps/zod.gen.ts+++ b/packages/contracts/generated/api/console/trial-apps/zod.gen.ts@@ -36,12 +36,12 @@ export const zCompletionRequest = z.object({* FileResponse*/export const zFileResponse = z.object({- conversation_id: z.string().nullish(),+ conversation_id: z.uuid().nullish(),created_at: z.int().nullish(),- created_by: z.string().nullish(),+ created_by: z.uuid().nullish(),extension: z.string().nullish(),file_key: z.string().nullish(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),name: z.string(),original_url: z.string().nullish(),@@ -49,8 +49,8 @@ export const zFileResponse = z.object({reference: z.string().nullish(),size: z.int(),source_url: z.string().nullish(),- tenant_id: z.string().nullish(),- user_id: z.string().nullish(),+ tenant_id: z.uuid().nullish(),+ user_id: z.uuid().nullish(),})/**@@ -230,8 +230,6 @@ export const zTrialDatasetListResponse = z.object({total: z.int(),})-export const zJsonObject = z.record(z.string(), z.unknown())-/*** SystemParameters*/@@ -247,18 +245,342 @@ export const zSystemParameters = z.object({* Parameters*/export const zParameters = z.object({- annotation_reply: zJsonObject,- file_upload: zJsonObject,- more_like_this: zJsonObject,+ annotation_reply: z.object({+ enabled: z.boolean().optional(),+ }),+ file_upload: z.object({+ allowed_file_extensions: z.array(z.string()).optional(),+ allowed_file_types: z+ .array(z.enum(['audio', 'custom', 'document', 'image', 'video']))+ .optional(),+ allowed_file_upload_methods: z.array(z.enum(['local_file', 'remote_url'])).optional(),+ enabled: z.boolean().optional(),+ image: z+ .object({+ detail: z.string().optional(),+ enabled: z.boolean().optional(),+ number_limits: z.int().optional(),+ transfer_methods: z.array(z.string()).optional(),+ })+ .optional(),+ number_limits: z.int().optional(),+ }),+ more_like_this: z.object({+ enabled: z.boolean().optional(),+ }),opening_statement: z.string().nullish(),- retriever_resource: zJsonObject,- sensitive_word_avoidance: zJsonObject,- speech_to_text: zJsonObject,+ retriever_resource: z.object({+ enabled: z.boolean().optional(),+ }),+ sensitive_word_avoidance: z.object({+ enabled: z.boolean().optional(),+ }),+ speech_to_text: z.object({+ enabled: z.boolean().optional(),+ }),suggested_questions: z.array(z.string()),- suggested_questions_after_answer: zJsonObject,+ suggested_questions_after_answer: z.object({+ enabled: z.boolean().optional(),+ }),system_parameters: zSystemParameters,- text_to_speech: zJsonObject,- user_input_form: z.array(zJsonObject),+ text_to_speech: z.object({+ autoPlay: z.string().optional(),+ enabled: z.boolean().optional(),+ language: z.string().optional(),+ voice: z.string().optional(),+ }),+ user_input_form: z.array(+ z.union([+ z+ .object({+ 'text-input': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ select: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ paragraph: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ number: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ external_data_tool: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ file: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ 'file-list': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ checkbox: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ json_object: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ ]),+ ),})/**@@ -281,7 +603,7 @@ export const zTrialSimpleAccount = z.object({name: z.string().nullish(),})-export const zJsonObject2 = z.record(z.string(), z.unknown())+export const zJsonObject = z.record(z.string(), z.unknown())/*** TrialWorkflowResponse@@ -290,14 +612,14 @@ export const zTrialWorkflowResponse = z.object({conversation_variables: z.array(zWorkflowConversationVariableResponse).optional(),created_at: z.int().nullish(),created_by: zTrialSimpleAccount.nullish(),- environment_variables: z.array(zJsonObject2).optional(),- features: zJsonObject2.optional(),- graph: zJsonObject2,+ environment_variables: z.array(zJsonObject).optional(),+ features: zJsonObject.optional(),+ graph: zJsonObject,hash: z.string().nullish(),id: z.string(),marked_comment: z.string().nullish(),marked_name: z.string().nullish(),- rag_pipeline_variables: z.array(zJsonObject2).optional(),+ rag_pipeline_variables: z.array(zJsonObject).optional(),tool_published: z.boolean().nullish(),updated_at: z.int().nullish(),updated_by: zTrialSimpleAccount.nullish(),@@ -310,14 +632,14 @@ export const zTrialWorkflowResponse = z.object({export const zTrialAppAgentMode = z.object({enabled: z.boolean().nullish(),strategy: z.string().nullish(),- tools: z.array(zJsonObject2).optional(),+ tools: z.array(zJsonObject).optional(),})/*** TrialAppModel*/export const zTrialAppModel = z.object({- completion_params: zJsonObject2.optional(),+ completion_params: zJsonObject.optional(),mode: z.string().nullish(),name: z.string(),provider: z.string(),@@ -328,29 +650,29 @@ export const zTrialAppModel = z.object({*/export const zTrialAppModelConfigResponse = z.object({agent_mode: zTrialAppAgentMode.nullish(),- annotation_reply: zJsonObject2.nullish(),- chat_prompt_config: zJsonObject2.nullish(),- completion_prompt_config: zJsonObject2.nullish(),+ annotation_reply: zJsonObject.nullish(),+ chat_prompt_config: zJsonObject.nullish(),+ completion_prompt_config: zJsonObject.nullish(),created_at: z.int().nullish(),created_by: z.string().nullish(),- dataset_configs: zJsonObject2.nullish(),+ dataset_configs: zJsonObject.nullish(),dataset_query_variable: z.string().nullish(),- external_data_tools: z.array(zJsonObject2).optional(),- file_upload: zJsonObject2.nullish(),+ external_data_tools: z.array(zJsonObject).optional(),+ file_upload: zJsonObject.nullish(),model: zTrialAppModel.nullish(),- more_like_this: zJsonObject2.nullish(),+ more_like_this: zJsonObject.nullish(),opening_statement: z.string().nullish(),pre_prompt: z.string().nullish(),prompt_type: z.string().nullish(),- retriever_resource: zJsonObject2.nullish(),- sensitive_word_avoidance: zJsonObject2.nullish(),- speech_to_text: zJsonObject2.nullish(),+ retriever_resource: zJsonObject.nullish(),+ sensitive_word_avoidance: zJsonObject.nullish(),+ speech_to_text: zJsonObject.nullish(),suggested_questions: z.array(z.string()).optional(),- suggested_questions_after_answer: zJsonObject2.nullish(),- text_to_speech: zJsonObject2.nullish(),+ suggested_questions_after_answer: zJsonObject.nullish(),+ text_to_speech: zJsonObject.nullish(),updated_at: z.int().nullish(),updated_by: z.string().nullish(),- user_input_form: z.array(zJsonObject2).optional(),+ user_input_form: z.array(zJsonObject).optional(),})/**diff --git a/packages/contracts/generated/api/openapi/zod.gen.ts b/packages/contracts/generated/api/openapi/zod.gen.tsindex fb584d54e9d..47ae8d31995 100644--- a/packages/contracts/generated/api/openapi/zod.gen.ts+++ b/packages/contracts/generated/api/openapi/zod.gen.ts@@ -253,12 +253,12 @@ export const zEventStreamResponse = z.string()* FileResponse*/export const zFileResponse = z.object({- conversation_id: z.string().nullish(),+ conversation_id: z.uuid().nullish(),created_at: z.int().nullish(),- created_by: z.string().nullish(),+ created_by: z.uuid().nullish(),extension: z.string().nullish(),file_key: z.string().nullish(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),name: z.string(),original_url: z.string().nullish(),@@ -266,8 +266,8 @@ export const zFileResponse = z.object({reference: z.string().nullish(),size: z.int(),source_url: z.string().nullish(),- tenant_id: z.string().nullish(),- user_id: z.string().nullish(),+ tenant_id: z.uuid().nullish(),+ user_id: z.uuid().nullish(),})/**diff --git a/packages/contracts/generated/api/service/orpc.gen.ts b/packages/contracts/generated/api/service/orpc.gen.tsindex ce9f4bc9f0b..1534333116b 100644--- a/packages/contracts/generated/api/service/orpc.gen.ts+++ b/packages/contracts/generated/api/service/orpc.gen.ts@@ -5,9 +5,9 @@ import * as z from 'zod'import {zDeleteAppsAnnotationsByAnnotationIdPath,zDeleteAppsAnnotationsByAnnotationIdResponse,- zDeleteConversationsByCIdBody,- zDeleteConversationsByCIdPath,- zDeleteConversationsByCIdResponse,+ zDeleteConversationsByConversationIdBody,+ zDeleteConversationsByConversationIdPath,+ zDeleteConversationsByConversationIdResponse,zDeleteDatasetsByDatasetIdDocumentsByDocumentIdPath,zDeleteDatasetsByDatasetIdDocumentsByDocumentIdResponse,zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdPath,@@ -26,9 +26,9 @@ import {zGetAppsAnnotationReplyByActionStatusByJobIdResponse,zGetAppsAnnotationsQuery,zGetAppsAnnotationsResponse,- zGetConversationsByCIdVariablesPath,- zGetConversationsByCIdVariablesQuery,- zGetConversationsByCIdVariablesResponse,+ zGetConversationsByConversationIdVariablesPath,+ zGetConversationsByConversationIdVariablesQuery,+ zGetConversationsByConversationIdVariablesResponse,zGetConversationsQuery,zGetConversationsResponse,zGetDatasetsByDatasetIdDocumentsByBatchIndexingStatusPath,@@ -80,9 +80,9 @@ import {zGetParametersResponse,zGetRootResponse,zGetSiteResponse,- zGetWorkflowByTaskIdEventsPath,- zGetWorkflowByTaskIdEventsQuery,- zGetWorkflowByTaskIdEventsResponse,+ zGetWorkflowByWorkflowRunIdEventsPath,+ zGetWorkflowByWorkflowRunIdEventsQuery,+ zGetWorkflowByWorkflowRunIdEventsResponse,zGetWorkflowsLogsQuery,zGetWorkflowsLogsResponse,zGetWorkflowsRunByWorkflowRunIdPath,@@ -123,9 +123,9 @@ import {zPostCompletionMessagesByTaskIdStopPath,zPostCompletionMessagesByTaskIdStopResponse,zPostCompletionMessagesResponse,- zPostConversationsByCIdNameBody,- zPostConversationsByCIdNamePath,- zPostConversationsByCIdNameResponse,+ zPostConversationsByConversationIdNameBody,+ zPostConversationsByConversationIdNamePath,+ zPostConversationsByConversationIdNameResponse,zPostDatasetsBody,zPostDatasetsByDatasetIdDocumentCreateByFile2Body,zPostDatasetsByDatasetIdDocumentCreateByFile2Path,@@ -213,17 +213,21 @@ import {zPutAppsAnnotationsByAnnotationIdBody,zPutAppsAnnotationsByAnnotationIdPath,zPutAppsAnnotationsByAnnotationIdResponse,- zPutConversationsByCIdVariablesByVariableIdBody,- zPutConversationsByCIdVariablesByVariableIdPath,- zPutConversationsByCIdVariablesByVariableIdResponse,+ zPutConversationsByConversationIdVariablesByVariableIdBody,+ zPutConversationsByConversationIdVariablesByVariableIdPath,+ zPutConversationsByConversationIdVariablesByVariableIdResponse,} from './zod.gen'+/**+ * Return public Service API metadata without requiring an API key+ */export const get = oc.route({inputStructure: 'detailed',method: 'GET',operationId: 'getRoot',path: '/',+ summary: 'Return public Service API metadata without requiring an API key',tags: ['service_api'],}).output(zGetRootResponse)@@ -558,15 +562,18 @@ export const post8 = oc'Rename a conversation or auto-generate a name. The conversation name is used for display on clients that support multiple conversations.',inputStructure: 'detailed',method: 'POST',- operationId: 'postConversationsByCIdName',- path: '/conversations/{c_id}/name',+ operationId: 'postConversationsByConversationIdName',+ path: '/conversations/{conversation_id}/name',summary: 'Rename Conversation',tags: ['Conversations'],}).input(- z.object({ body: zPostConversationsByCIdNameBody, params: zPostConversationsByCIdNamePath }),+ z.object({+ body: zPostConversationsByConversationIdNameBody,+ params: zPostConversationsByConversationIdNamePath,+ }),)- .output(zPostConversationsByCIdNameResponse)+ .output(zPostConversationsByConversationIdNameResponse)export const name = {post: post8,@@ -583,18 +590,18 @@ export const put2 = oc'Update the value of a specific conversation variable. The value must match the expected type.',inputStructure: 'detailed',method: 'PUT',- operationId: 'putConversationsByCIdVariablesByVariableId',- path: '/conversations/{c_id}/variables/{variable_id}',+ operationId: 'putConversationsByConversationIdVariablesByVariableId',+ path: '/conversations/{conversation_id}/variables/{variable_id}',summary: 'Update Conversation Variable',tags: ['Conversations'],}).input(z.object({- body: zPutConversationsByCIdVariablesByVariableIdBody,- params: zPutConversationsByCIdVariablesByVariableIdPath,+ body: zPutConversationsByConversationIdVariablesByVariableIdBody,+ params: zPutConversationsByConversationIdVariablesByVariableIdPath,}),)- .output(zPutConversationsByCIdVariablesByVariableIdResponse)+ .output(zPutConversationsByConversationIdVariablesByVariableIdResponse)export const byVariableId = {put: put2,@@ -610,18 +617,18 @@ export const get5 = ocdescription: 'Retrieve variables from a specific conversation.',inputStructure: 'detailed',method: 'GET',- operationId: 'getConversationsByCIdVariables',- path: '/conversations/{c_id}/variables',+ operationId: 'getConversationsByConversationIdVariables',+ path: '/conversations/{conversation_id}/variables',summary: 'List Conversation Variables',tags: ['Conversations'],}).input(z.object({- params: zGetConversationsByCIdVariablesPath,- query: zGetConversationsByCIdVariablesQuery.optional(),+ params: zGetConversationsByConversationIdVariablesPath,+ query: zGetConversationsByConversationIdVariablesQuery.optional(),}),)- .output(zGetConversationsByCIdVariablesResponse)+ .output(zGetConversationsByConversationIdVariablesResponse)export const variables = {get: get5,@@ -638,16 +645,21 @@ export const delete2 = ocdescription: 'Delete a conversation.',inputStructure: 'detailed',method: 'DELETE',- operationId: 'deleteConversationsByCId',- path: '/conversations/{c_id}',+ operationId: 'deleteConversationsByConversationId',+ path: '/conversations/{conversation_id}',successStatus: 204,summary: 'Delete Conversation',tags: ['Conversations'],})- .input(z.object({ body: zDeleteConversationsByCIdBody, params: zDeleteConversationsByCIdPath }))- .output(zDeleteConversationsByCIdResponse)+ .input(+ z.object({+ body: zDeleteConversationsByConversationIdBody,+ params: zDeleteConversationsByConversationIdPath,+ }),+ )+ .output(zDeleteConversationsByConversationIdResponse)-export const byCId = {+export const byConversationId = {delete: delete2,name,variables,@@ -674,7 +686,7 @@ export const get6 = ocexport const conversations = {get: get6,- byCId,+ byConversationId,}/**@@ -1543,9 +1555,12 @@ export const documents = {* Retrieve Chunks from a Knowledge Base / Test Retrieval** Performs a search query against a knowledge base to retrieve the most relevant chunks. This endpoint can be used for both production retrieval and test retrieval.+ *+ * @deprecated*/export const post26 = oc.route({+ deprecated: true,description:'Performs a search query against a knowledge base to retrieve the most relevant chunks. This endpoint can be used for both production retrieval and test retrieval.',inputStructure: 'detailed',@@ -1783,12 +1798,12 @@ export const datasource = {/*** Run Pipeline*- * Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response modes.+ * Execute the full knowledge pipeline for a knowledge base. Published runs are queued and return batch metadata as JSON. Draft runs support blocking JSON and streaming Server-Sent Events.*/export const post30 = oc.route({description:- 'Execute the full knowledge pipeline for a knowledge base. Supports both streaming and blocking response modes.',+ 'Execute the full knowledge pipeline for a knowledge base. Published runs are queued and return batch metadata as JSON. Draft runs support blocking JSON and streaming Server-Sent Events.',inputStructure: 'detailed',method: 'POST',operationId: 'postDatasetsByDatasetIdPipelineRun',@@ -2330,26 +2345,29 @@ export const get30 = oc'Resume the Server-Sent Events stream for a workflow run after a pause or a dropped SSE connection. For runs that have already finished, the stream emits a single `workflow_finished` event and closes.',inputStructure: 'detailed',method: 'GET',- operationId: 'getWorkflowByTaskIdEvents',- path: '/workflow/{task_id}/events',+ operationId: 'getWorkflowByWorkflowRunIdEvents',+ path: '/workflow/{workflow_run_id}/events',summary: 'Stream Workflow Events',tags: ['Chatflows', 'Workflows'],}).input(- z.object({ params: zGetWorkflowByTaskIdEventsPath, query: zGetWorkflowByTaskIdEventsQuery }),+ z.object({+ params: zGetWorkflowByWorkflowRunIdEventsPath,+ query: zGetWorkflowByWorkflowRunIdEventsQuery,+ }),)- .output(zGetWorkflowByTaskIdEventsResponse)+ .output(zGetWorkflowByWorkflowRunIdEventsResponse)export const events = {get: get30,}-export const byTaskId3 = {+export const byWorkflowRunId = {events,}export const workflow = {- byTaskId: byTaskId3,+ byWorkflowRunId,}/**@@ -2393,7 +2411,7 @@ export const get32 = oc.input(z.object({ params: zGetWorkflowsRunByWorkflowRunIdPath })).output(zGetWorkflowsRunByWorkflowRunIdResponse)-export const byWorkflowRunId = {+export const byWorkflowRunId2 = {get: get32,}@@ -2417,7 +2435,7 @@ export const post37 = ocexport const run3 = {post: post37,- byWorkflowRunId,+ byWorkflowRunId: byWorkflowRunId2,}/**@@ -2447,12 +2465,12 @@ export const stop3 = {post: post38,}-export const byTaskId4 = {+export const byTaskId3 = {stop: stop3,}export const tasks = {- byTaskId: byTaskId4,+ byTaskId: byTaskId3,}/**diff --git a/packages/contracts/generated/api/service/types.gen.ts b/packages/contracts/generated/api/service/types.gen.tsindex ca880a75653..37850aa95ea 100644--- a/packages/contracts/generated/api/service/types.gen.ts+++ b/packages/contracts/generated/api/service/types.gen.ts@@ -35,12 +35,12 @@ export type AnnotationCreatePayload = {export type AnnotationJobStatusDetailResponse = {error_msg?: stringjob_id: string- job_status: 'completed' | 'error' | 'processing' | 'waiting' | string+ job_status: string}export type AnnotationJobStatusResponse = {job_id: string- job_status: 'completed' | 'error' | 'processing' | 'waiting' | string+ job_status: string}export type AnnotationList = {@@ -91,7 +91,7 @@ export type AppInfoResponse = {export type AppMetaResponse = {tool_icons?: {- [key: string]: unknown+ [key: string]: string | ToolIcon}}@@ -103,17 +103,157 @@ export type AudioTranscriptResponse = {export type BinaryFileResponse = Blob | File+export type BlockingMetadataResponse = {+ retriever_resources?: Array<BlockingRetrieverResourceResponse> | null+ usage?: BlockingUsageResponse | null+ [key: string]: unknown+}++export type BlockingRetrieverResourceResponse = {+ content?: string | null+ created_at?: number | null+ data_source_type?: string | null+ dataset_id?: string | null+ dataset_name?: string | null+ document_id?: string | null+ document_name?: string | null+ hit_count?: number | null+ id?: string | null+ index_node_hash?: string | null+ message_id?: string | null+ position: number+ score?: number | null+ segment_id?: string | null+ segment_position?: number | null+ summary?: string | null+ word_count?: number | null+ [key: string]: unknown+}++export type BlockingUsageResponse = {+ completion_price?: string | null+ completion_price_unit?: string | null+ completion_tokens?: number | null+ completion_unit_price?: string | null+ currency?: string | null+ latency?: number | null+ prompt_price?: string | null+ prompt_price_unit?: string | null+ prompt_tokens?: number | null+ prompt_unit_price?: string | null+ total_price?: string | null+ total_tokens?: number | null+ [key: string]: unknown+}+export type ButtonStyle = 'accent' | 'default' | 'ghost' | 'primary'+export type ChatBlockingResponse =+ | ({+ event: 'message'+ } & ChatMessageBlockingResponse)+ | ({+ event: 'workflow_paused'+ } & ChatPausedBlockingResponse)++export type ChatMessageBlockingResponse = {+ answer: string+ conversation_id: string+ created_at: number+ event: 'message'+ id: string+ message_id: string+ metadata: BlockingMetadataResponse+ mode: string+ task_id: string+ [key: string]: unknown+}++export type ChatPauseReasonResponse = {+ TYPE: string+ actions?: Array<JsonObject>+ approval_channels?: Array<string>+ display_in_ui?: boolean | null+ expiration_time?: number | null+ form_content?: string | null+ form_id?: string | null+ form_token?: string | null+ inputs?: Array<JsonObject>+ message?: string | null+ node_id?: string | null+ node_title?: string | null+ resolved_default_values?: {+ [key: string]: unknown+ }+ [key: string]: unknown+}++export type ChatPausedBlockingDataResponse = {+ answer: string+ conversation_id: string+ created_at: number+ elapsed_time: number+ id: string+ message_id: string+ metadata: BlockingMetadataResponse+ mode: string+ paused_nodes: Array<string>+ reasons: Array<ChatPauseReasonResponse>+ status: 'paused'+ total_steps: number+ total_tokens: number+ workflow_run_id: string+ [key: string]: unknown+}++export type ChatPausedBlockingResponse = {+ answer: string+ conversation_id: string+ created_at: number+ data: ChatPausedBlockingDataResponse+ event: 'workflow_paused'+ id: string+ message_id: string+ metadata: BlockingMetadataResponse+ mode: string+ task_id: string+ workflow_run_id: string+ [key: string]: unknown+}+export type ChatRequestPayload = {auto_generate_name?: booleanconversation_id?: string | null- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -125,12 +265,36 @@ export type ChatRequestPayload = {export type ChatRequestPayloadWithUser = {auto_generate_name?: booleanconversation_id?: string | null- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -177,13 +341,49 @@ export type ChildChunkUpdatePayload = {content: string}+export type CompletionBlockingResponse = {+ answer: string+ created_at: number+ event: string+ id: string+ message_id: string+ metadata: BlockingMetadataResponse+ mode: string+ task_id: string+ [key: string]: unknown+}+export type CompletionRequestPayload = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -192,12 +392,36 @@ export type CompletionRequestPayload = {}export type CompletionRequestPayloadWithUser = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -687,8 +911,12 @@ export type DocumentResponse = {created_at?: number | nullcreated_by?: string | nullcreated_from?: string | null- data_source_detail_dict?: unknown- data_source_info?: unknown+ data_source_detail_dict: {+ [key: string]: unknown+ }+ data_source_info?: {+ [key: string]: unknown+ } | nulldata_source_type?: string | nulldataset_process_rule_id?: string | nulldisabled_at?: number | null@@ -855,8 +1083,6 @@ export type FormInputConfig =type: 'file-list'} & FileListInputConfig)-export type GeneratedAppResponse = JsonValue-export type HitTestingChildChunk = {content: stringid: string@@ -962,15 +1188,11 @@ export type HumanInputFormDefinition = {export type HumanInputFormDefinitionResponse = {expiration_time?: number | nullform_content: string- inputs?: Array<{- [key: string]: unknown- }>+ inputs: Array<FormInputConfig>resolved_default_values: {[key: string]: string}- user_actions?: Array<{- [key: string]: unknown- }>+ user_actions: Array<UserActionConfig>}export type HumanInputFormSubmissionData = {@@ -1018,16 +1240,7 @@ export type JsonObject = {[key: string]: unknown}-export type JsonValue =- | string- | number- | number- | boolean- | {- [key: string]: unknown- }- | Array<unknown>- | null+export type JsonValue = unknownexport type JsonValueType = unknown@@ -1172,22 +1385,351 @@ export type ParagraphInputConfig = {}export type Parameters = {- annotation_reply: JsonObject- file_upload: JsonObject- more_like_this: JsonObject+ annotation_reply: {+ enabled?: boolean+ }+ file_upload: {+ allowed_file_extensions?: Array<string>+ allowed_file_types?: Array<'audio' | 'custom' | 'document' | 'image' | 'video'>+ allowed_file_upload_methods?: Array<'local_file' | 'remote_url'>+ enabled?: boolean+ image?: {+ detail?: string+ enabled?: boolean+ number_limits?: number+ transfer_methods?: Array<string>+ }+ number_limits?: number+ }+ more_like_this: {+ enabled?: boolean+ }opening_statement?: string | null- retriever_resource: JsonObject- sensitive_word_avoidance: JsonObject- speech_to_text: JsonObject+ retriever_resource: {+ enabled?: boolean+ }+ sensitive_word_avoidance: {+ enabled?: boolean+ }+ speech_to_text: {+ enabled?: boolean+ }suggested_questions: Array<string>- suggested_questions_after_answer: JsonObject+ suggested_questions_after_answer: {+ enabled?: boolean+ }system_parameters: SystemParameters- text_to_speech: JsonObject- user_input_form: Array<JsonObject>+ text_to_speech: {+ autoPlay?: string+ enabled?: boolean+ language?: string+ voice?: string+ }+ user_input_form: Array<+ | {+ 'text-input': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ select: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ paragraph: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ number: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ external_data_tool: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ file: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ 'file-list': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ checkbox: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ json_object: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ >}export type PermissionEnum = 'all_team_members' | 'only_me' | 'partial_members'+export type PipelineDataset = {+ chunk_structure: string+ description?: string+ id: string+ name: string+}++export type PipelineDocument = {+ data_source_info?: {+ [key: string]: unknown+ } | null+ data_source_type: string+ enabled: boolean+ error?: string | null+ id: string+ indexing_status: string+ name: string+ position: number+}+export type PipelineRunApiEntity = {datasource_info_list: Array<| {@@ -1223,6 +1765,8 @@ export type PipelineRunApiEntity = {start_node_id: string}+export type PipelineRunJsonResponse = PublishedPipelineRunResponse | WorkflowBlockingResponse+export type PipelineUploadFileResponse = {created_at?: string | nullcreated_by: string@@ -1274,6 +1818,12 @@ export type ProviderWithModelsResponse = {tenant_id: string}+export type PublishedPipelineRunResponse = {+ batch: string+ dataset: PipelineDataset+ documents: Array<PipelineDocument>+}+export type RequiredServiceApiUserPayload = {user: string}@@ -1530,7 +2080,7 @@ export type TagUnbindingPayload =target_id: string}| {- tag_id?: string+ tag_id?: string | nulltag_ids: Array<string>target_id: string}@@ -1555,6 +2105,11 @@ export type TextToAudioPayloadWithUser = {voice?: string | null}+export type ToolIcon = {+ background: string+ content: string+}+export type UrlResponse = {url: string}@@ -1611,12 +2166,39 @@ export type WorkflowAppLogPartialResponse = {workflow_run?: WorkflowRunForLogResponse | null}+export type WorkflowBlockingResponse =+ | WorkflowFinishedBlockingResponse+ | WorkflowPausedBlockingResponse+export type WorkflowEventsQuery = {continue_on_pause?: booleaninclude_state_snapshot?: booleanuser: string}+export type WorkflowFinishedBlockingDataResponse = {+ created_at: number+ elapsed_time: number+ error: string | null+ finished_at: number | null+ id: string+ outputs: {+ [key: string]: unknown+ } | null+ status: 'failed' | 'partial-succeeded' | 'stopped' | 'succeeded'+ total_steps: number+ total_tokens: number+ workflow_id: string+ [key: string]: unknown+}++export type WorkflowFinishedBlockingResponse = {+ data: WorkflowFinishedBlockingDataResponse+ task_id: string+ workflow_run_id: string+ [key: string]: unknown+}+export type WorkflowLogQuery = {created_at__after?: string | nullcreated_at__before?: string | null@@ -1628,6 +2210,50 @@ export type WorkflowLogQuery = {status?: 'failed' | 'stopped' | 'succeeded' | null}+export type WorkflowPauseReasonResponse = {+ TYPE: string+ actions?: Array<JsonObject>+ approval_channels?: Array<string>+ display_in_ui?: boolean | null+ expiration_time?: number | null+ form_content?: string | null+ form_id?: string | null+ form_token?: string | null+ inputs?: Array<JsonObject>+ message?: string | null+ node_id?: string | null+ node_title?: string | null+ resolved_default_values?: {+ [key: string]: unknown+ }+ [key: string]: unknown+}++export type WorkflowPausedBlockingDataResponse = {+ created_at: number+ elapsed_time: number+ error: string | null+ finished_at: number | null+ id: string+ outputs: {+ [key: string]: unknown+ } | null+ paused_nodes: Array<string>+ reasons: Array<WorkflowPauseReasonResponse>+ status: 'paused'+ total_steps: number+ total_tokens: number+ workflow_id: string+ [key: string]: unknown+}++export type WorkflowPausedBlockingResponse = {+ data: WorkflowPausedBlockingDataResponse+ task_id: string+ workflow_run_id: string+ [key: string]: unknown+}+export type WorkflowRunForLogResponse = {created_at?: number | nullelapsed_time?: number | number | null@@ -1643,12 +2269,36 @@ export type WorkflowRunForLogResponse = {}export type WorkflowRunPayload = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -1656,12 +2306,36 @@ export type WorkflowRunPayload = {}export type WorkflowRunPayloadWithUser = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}@@ -1694,8 +2368,6 @@ export type WorkflowRunResponse = {workflow_id: string}-export type GeneratedAppResponseWritable = JsonValue-export type HumanInputFormSubmitResponseWritable = {[key: string]: never}@@ -1954,9 +2626,7 @@ export type PostChatMessagesErrors = {}export type PostChatMessagesResponses = {- 200: {- [key: string]: unknown- }+ 200: ChatBlockingResponse | string}export type PostChatMessagesResponse = PostChatMessagesResponses[keyof PostChatMessagesResponses]@@ -2001,9 +2671,7 @@ export type PostCompletionMessagesErrors = {}export type PostCompletionMessagesResponses = {- 200: {- [key: string]: unknown- }+ 200: CompletionBlockingResponse | string}export type PostCompletionMessagesResponse =@@ -2057,56 +2725,56 @@ export type GetConversationsResponses = {export type GetConversationsResponse = GetConversationsResponses[keyof GetConversationsResponses]-export type DeleteConversationsByCIdData = {+export type DeleteConversationsByConversationIdData = {body: OptionalServiceApiUserPayloadpath: {- c_id: string+ conversation_id: string}query?: never- url: '/conversations/{c_id}'+ url: '/conversations/{conversation_id}'}-export type DeleteConversationsByCIdErrors = {+export type DeleteConversationsByConversationIdErrors = {400: unknown401: unknown403: unknown404: unknown}-export type DeleteConversationsByCIdResponses = {+export type DeleteConversationsByConversationIdResponses = {204: void}-export type DeleteConversationsByCIdResponse =- DeleteConversationsByCIdResponses[keyof DeleteConversationsByCIdResponses]+export type DeleteConversationsByConversationIdResponse =+ DeleteConversationsByConversationIdResponses[keyof DeleteConversationsByConversationIdResponses]-export type PostConversationsByCIdNameData = {+export type PostConversationsByConversationIdNameData = {body: ConversationRenamePayloadWithUserpath: {- c_id: string+ conversation_id: string}query?: never- url: '/conversations/{c_id}/name'+ url: '/conversations/{conversation_id}/name'}-export type PostConversationsByCIdNameErrors = {+export type PostConversationsByConversationIdNameErrors = {400: unknown401: unknown403: unknown404: unknown}-export type PostConversationsByCIdNameResponses = {+export type PostConversationsByConversationIdNameResponses = {200: SimpleConversation}-export type PostConversationsByCIdNameResponse =- PostConversationsByCIdNameResponses[keyof PostConversationsByCIdNameResponses]+export type PostConversationsByConversationIdNameResponse =+ PostConversationsByConversationIdNameResponses[keyof PostConversationsByConversationIdNameResponses]-export type GetConversationsByCIdVariablesData = {+export type GetConversationsByConversationIdVariablesData = {body?: neverpath: {- c_id: string+ conversation_id: string}query?: {last_id?: string@@ -2114,46 +2782,46 @@ export type GetConversationsByCIdVariablesData = {user?: stringvariable_name?: string}- url: '/conversations/{c_id}/variables'+ url: '/conversations/{conversation_id}/variables'}-export type GetConversationsByCIdVariablesErrors = {+export type GetConversationsByConversationIdVariablesErrors = {400: unknown401: unknown403: unknown404: unknown}-export type GetConversationsByCIdVariablesResponses = {+export type GetConversationsByConversationIdVariablesResponses = {200: ConversationVariableInfiniteScrollPaginationResponse}-export type GetConversationsByCIdVariablesResponse =- GetConversationsByCIdVariablesResponses[keyof GetConversationsByCIdVariablesResponses]+export type GetConversationsByConversationIdVariablesResponse =+ GetConversationsByConversationIdVariablesResponses[keyof GetConversationsByConversationIdVariablesResponses]-export type PutConversationsByCIdVariablesByVariableIdData = {+export type PutConversationsByConversationIdVariablesByVariableIdData = {body: ConversationVariableUpdatePayloadWithUserpath: {- c_id: string+ conversation_id: stringvariable_id: string}query?: never- url: '/conversations/{c_id}/variables/{variable_id}'+ url: '/conversations/{conversation_id}/variables/{variable_id}'}-export type PutConversationsByCIdVariablesByVariableIdErrors = {+export type PutConversationsByConversationIdVariablesByVariableIdErrors = {400: unknown401: unknown403: unknown404: unknown}-export type PutConversationsByCIdVariablesByVariableIdResponses = {+export type PutConversationsByConversationIdVariablesByVariableIdResponses = {200: ConversationVariableResponse}-export type PutConversationsByCIdVariablesByVariableIdResponse =- PutConversationsByCIdVariablesByVariableIdResponses[keyof PutConversationsByCIdVariablesByVariableIdResponses]+export type PutConversationsByConversationIdVariablesByVariableIdResponse =+ PutConversationsByConversationIdVariablesByVariableIdResponses[keyof PutConversationsByConversationIdVariablesByVariableIdResponses]export type GetDatasetsData = {body?: never@@ -2233,6 +2901,7 @@ export type DeleteDatasetsTagsData = {export type DeleteDatasetsTagsErrors = {401: unknown403: unknown+ 404: unknown}export type DeleteDatasetsTagsResponses = {@@ -2268,8 +2937,10 @@ export type PatchDatasetsTagsData = {}export type PatchDatasetsTagsErrors = {+ 400: unknown401: unknown403: unknown+ 404: unknown}export type PatchDatasetsTagsResponses = {@@ -2286,6 +2957,7 @@ export type PostDatasetsTagsData = {}export type PostDatasetsTagsErrors = {+ 400: unknown401: unknown403: unknown}@@ -2306,6 +2978,7 @@ export type PostDatasetsTagsBindingData = {export type PostDatasetsTagsBindingErrors = {401: unknown403: unknown+ 404: unknown}export type PostDatasetsTagsBindingResponses = {@@ -2325,6 +2998,7 @@ export type PostDatasetsTagsUnbindingData = {export type PostDatasetsTagsUnbindingErrors = {401: unknown403: unknown+ 404: unknown}export type PostDatasetsTagsUnbindingResponses = {@@ -2389,6 +3063,7 @@ export type PatchDatasetsByDatasetIdData = {}export type PatchDatasetsByDatasetIdErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2534,14 +3209,11 @@ export type PostDatasetsByDatasetIdDocumentsDownloadZipData = {}export type PostDatasetsByDatasetIdDocumentsDownloadZipErrors = {- 401: Blob | File- 403: Blob | File- 404: Blob | File+ 401: unknown+ 403: unknown+ 404: unknown}-export type PostDatasetsByDatasetIdDocumentsDownloadZipError =- PostDatasetsByDatasetIdDocumentsDownloadZipErrors[keyof PostDatasetsByDatasetIdDocumentsDownloadZipErrors]-export type PostDatasetsByDatasetIdDocumentsDownloadZipResponses = {200: Blob | File}@@ -2559,6 +3231,7 @@ export type PostDatasetsByDatasetIdDocumentsMetadataData = {}export type PostDatasetsByDatasetIdDocumentsMetadataErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2687,6 +3360,7 @@ export type PatchDatasetsByDatasetIdDocumentsByDocumentIdErrors = {403: unknown404: unknown413: unknown+ 415: unknown}export type PatchDatasetsByDatasetIdDocumentsByDocumentIdResponses = {@@ -2735,6 +3409,7 @@ export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsData = {}export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2783,6 +3458,7 @@ export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdDat}export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2807,6 +3483,7 @@ export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdData =}export type GetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2831,6 +3508,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdData}export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -2973,6 +3651,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileErrors = {403: unknown404: unknown413: unknown+ 415: unknown}export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponses = {@@ -3025,6 +3704,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Errors = {403: unknown404: unknown413: unknown+ 415: unknown}export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Responses = {@@ -3113,6 +3793,7 @@ export type PostDatasetsByDatasetIdMetadataData = {}export type PostDatasetsByDatasetIdMetadataErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -3203,6 +3884,7 @@ export type PatchDatasetsByDatasetIdMetadataByMetadataIdData = {}export type PatchDatasetsByDatasetIdMetadataByMetadataIdErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -3227,6 +3909,7 @@ export type GetDatasetsByDatasetIdPipelineDatasourcePluginsData = {}export type GetDatasetsByDatasetIdPipelineDatasourcePluginsErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -3250,15 +3933,14 @@ export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunData = {}export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors = {+ 400: unknown401: unknown403: unknown404: unknown}export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses = {- 200: {- [key: string]: unknown- }+ 200: string}export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse =@@ -3274,6 +3956,7 @@ export type PostDatasetsByDatasetIdPipelineRunData = {}export type PostDatasetsByDatasetIdPipelineRunErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -3281,7 +3964,7 @@ export type PostDatasetsByDatasetIdPipelineRunErrors = {}export type PostDatasetsByDatasetIdPipelineRunResponses = {- 200: GeneratedAppResponse+ 200: PipelineRunJsonResponse | string}export type PostDatasetsByDatasetIdPipelineRunResponse =@@ -3391,14 +4074,11 @@ export type GetFilesByFileIdPreviewData = {}export type GetFilesByFileIdPreviewErrors = {- 401: Blob | File- 403: Blob | File- 404: Blob | File+ 401: unknown+ 403: unknown+ 404: unknown}-export type GetFilesByFileIdPreviewError =- GetFilesByFileIdPreviewErrors[keyof GetFilesByFileIdPreviewErrors]-export type GetFilesByFileIdPreviewResponses = {200: Blob | File}@@ -3507,6 +4187,7 @@ export type PostMessagesByMessageIdFeedbacksData = {}export type PostMessagesByMessageIdFeedbacksErrors = {+ 400: unknown401: unknown403: unknown404: unknown@@ -3610,46 +4291,44 @@ export type PostTextToAudioData = {}export type PostTextToAudioErrors = {- 400: Blob | File- 401: Blob | File- 403: Blob | File- 500: Blob | File+ 400: unknown+ 401: unknown+ 403: unknown+ 500: unknown}-export type PostTextToAudioError = PostTextToAudioErrors[keyof PostTextToAudioErrors]-export type PostTextToAudioResponses = {200: Blob | File}export type PostTextToAudioResponse = PostTextToAudioResponses[keyof PostTextToAudioResponses]-export type GetWorkflowByTaskIdEventsData = {+export type GetWorkflowByWorkflowRunIdEventsData = {body?: neverpath: {- task_id: string+ workflow_run_id: string}query: {continue_on_pause?: booleaninclude_state_snapshot?: booleanuser: string}- url: '/workflow/{task_id}/events'+ url: '/workflow/{workflow_run_id}/events'}-export type GetWorkflowByTaskIdEventsErrors = {+export type GetWorkflowByWorkflowRunIdEventsErrors = {400: unknown401: unknown403: unknown404: unknown}-export type GetWorkflowByTaskIdEventsResponses = {- 200: EventStreamResponse+export type GetWorkflowByWorkflowRunIdEventsResponses = {+ 200: string}-export type GetWorkflowByTaskIdEventsResponse =- GetWorkflowByTaskIdEventsResponses[keyof GetWorkflowByTaskIdEventsResponses]+export type GetWorkflowByWorkflowRunIdEventsResponse =+ GetWorkflowByWorkflowRunIdEventsResponses[keyof GetWorkflowByWorkflowRunIdEventsResponses]export type GetWorkflowsLogsData = {body?: never@@ -3668,6 +4347,7 @@ export type GetWorkflowsLogsData = {}export type GetWorkflowsLogsErrors = {+ 400: unknown401: unknown403: unknown}@@ -3695,7 +4375,7 @@ export type PostWorkflowsRunErrors = {}export type PostWorkflowsRunResponses = {- 200: GeneratedAppResponse+ 200: WorkflowBlockingResponse | string}export type PostWorkflowsRunResponse = PostWorkflowsRunResponses[keyof PostWorkflowsRunResponses]@@ -3765,7 +4445,7 @@ export type PostWorkflowsByWorkflowIdRunErrors = {}export type PostWorkflowsByWorkflowIdRunResponses = {- 200: GeneratedAppResponse+ 200: WorkflowBlockingResponse | string}export type PostWorkflowsByWorkflowIdRunResponse =diff --git a/packages/contracts/generated/api/service/zod.gen.ts b/packages/contracts/generated/api/service/zod.gen.tsindex c754356dd94..b3733120e85 100644--- a/packages/contracts/generated/api/service/zod.gen.ts+++ b/packages/contracts/generated/api/service/zod.gen.ts@@ -9,7 +9,7 @@ export const zAnnotation = z.object({answer: z.string().nullish(),created_at: z.int().nullish(),hit_count: z.int().nullish(),- id: z.string(),+ id: z.uuid(),question: z.string().nullish(),})@@ -26,16 +26,16 @@ export const zAnnotationCreatePayload = z.object({*/export const zAnnotationJobStatusDetailResponse = z.object({error_msg: z.string().optional().default(''),- job_id: z.string(),- job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),+ job_id: z.uuid(),+ job_status: z.string(),})/*** AnnotationJobStatusResponse*/export const zAnnotationJobStatusResponse = z.object({- job_id: z.string(),- job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),+ job_id: z.uuid(),+ job_status: z.string(),})/**@@ -71,15 +71,15 @@ export const zAnnotationReplyActionPayload = z.object({* AppFeedbackResponse*/export const zAppFeedbackResponse = z.object({- app_id: z.string(),+ app_id: z.uuid(),content: z.string().nullish(),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.string(),- from_account_id: z.string().nullish(),- from_end_user_id: z.string().nullish(),+ from_account_id: z.uuid().nullish(),+ from_end_user_id: z.uuid().nullish(),from_source: z.string(),- id: z.string(),- message_id: z.string(),+ id: z.uuid(),+ message_id: z.uuid(),rating: z.string(),updated_at: z.string(),})@@ -102,13 +102,6 @@ export const zAppInfoResponse = z.object({tags: z.array(z.string()),})-/**- * AppMetaResponse- */-export const zAppMetaResponse = z.object({- tool_icons: z.record(z.string(), z.unknown()).optional(),-})-/*** AudioBinaryResponse*/@@ -130,6 +123,55 @@ export const zBinaryFileResponse = z.custom<Blob | File>((value) => value instanceof Blob || value instanceof File,)+/**+ * BlockingRetrieverResourceResponse+ */+export const zBlockingRetrieverResourceResponse = z.object({+ content: z.string().nullish(),+ created_at: z.int().nullish(),+ data_source_type: z.string().nullish(),+ dataset_id: z.uuid().nullish(),+ dataset_name: z.string().nullish(),+ document_id: z.uuid().nullish(),+ document_name: z.string().nullish(),+ hit_count: z.int().nullish(),+ id: z.uuid().nullish(),+ index_node_hash: z.string().nullish(),+ message_id: z.uuid().nullish(),+ position: z.int(),+ score: z.number().nullish(),+ segment_id: z.uuid().nullish(),+ segment_position: z.int().nullish(),+ summary: z.string().nullish(),+ word_count: z.int().nullish(),+})++/**+ * BlockingUsageResponse+ */+export const zBlockingUsageResponse = z.object({+ completion_price: z.string().nullish(),+ completion_price_unit: z.string().nullish(),+ completion_tokens: z.int().nullish(),+ completion_unit_price: z.string().nullish(),+ currency: z.string().nullish(),+ latency: z.number().nullish(),+ prompt_price: z.string().nullish(),+ prompt_price_unit: z.string().nullish(),+ prompt_tokens: z.int().nullish(),+ prompt_unit_price: z.string().nullish(),+ total_price: z.string().nullish(),+ total_tokens: z.int().nullish(),+})++/**+ * BlockingMetadataResponse+ */+export const zBlockingMetadataResponse = z.object({+ retriever_resources: z.array(zBlockingRetrieverResourceResponse).nullish(),+ usage: zBlockingUsageResponse.nullish(),+})+/*** ButtonStyle*@@ -137,6 +179,21 @@ export const zBinaryFileResponse = z.custom<Blob | File>(*/export const zButtonStyle = z.enum(['accent', 'default', 'ghost', 'primary'])+/**+ * ChatMessageBlockingResponse+ */+export const zChatMessageBlockingResponse = z.object({+ answer: z.string(),+ conversation_id: z.uuid(),+ created_at: z.int(),+ event: z.literal('message'),+ id: z.uuid(),+ message_id: z.uuid(),+ metadata: zBlockingMetadataResponse,+ mode: z.string(),+ task_id: z.uuid(),+})+/*** ChatRequestPayload*/@@ -145,12 +202,36 @@ export const zChatRequestPayload = z.object({conversation_id: z.string().nullish(),files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -167,12 +248,36 @@ export const zChatRequestPayloadWithUser = z.object({conversation_id: z.string().nullish(),files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -237,18 +342,56 @@ export const zChildChunkUpdatePayload = z.object({content: z.string(),})+/**+ * CompletionBlockingResponse+ */+export const zCompletionBlockingResponse = z.object({+ answer: z.string(),+ created_at: z.int(),+ event: z.string(),+ id: z.uuid(),+ message_id: z.uuid(),+ metadata: zBlockingMetadataResponse,+ mode: z.string(),+ task_id: z.uuid(),+})+/*** CompletionRequestPayload*/export const zCompletionRequestPayload = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -262,12 +405,36 @@ export const zCompletionRequestPayload = z.object({export const zCompletionRequestPayloadWithUser = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -361,7 +528,7 @@ export const zConversationRenamePayloadWithUser = z.intersection(export const zConversationVariableResponse = z.object({created_at: z.int().nullish(),description: z.string().nullish(),- id: z.string(),+ id: z.uuid(),name: z.string(),updated_at: z.int().nullish(),value: z.string().nullish(),@@ -816,8 +983,8 @@ export const zDocumentResponse = z.object({created_at: z.int().nullish(),created_by: z.string().nullish(),created_from: z.string().nullish(),- data_source_detail_dict: z.unknown().optional(),- data_source_info: z.unknown().optional(),+ data_source_detail_dict: z.record(z.string(), z.unknown()),+ data_source_info: z.record(z.string(), z.unknown()).nullish(),data_source_type: z.string().nullish(),dataset_process_rule_id: z.string().nullish(),disabled_at: z.int().nullish(),@@ -902,14 +1069,14 @@ export const zDocumentStatusListResponse = z.object({* `is_anonymous` from `_is_anonymous` to return the stored value.*/export const zEndUserDetail = z.object({- app_id: z.string().nullish(),+ app_id: z.uuid().nullish(),created_at: z.iso.datetime(),external_user_id: z.string().nullish(),- id: z.string(),+ id: z.uuid(),is_anonymous: z.boolean(),name: z.string().nullish(),session_id: z.string(),- tenant_id: z.string(),+ tenant_id: z.uuid(),type: z.string(),updated_at: z.iso.datetime(),})@@ -950,12 +1117,12 @@ export const zFilePreviewQuery = z.object({* FileResponse*/export const zFileResponse = z.object({- conversation_id: z.string().nullish(),+ conversation_id: z.uuid().nullish(),created_at: z.int().nullish(),- created_by: z.string().nullish(),+ created_by: z.uuid().nullish(),extension: z.string().nullish(),file_key: z.string().nullish(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),name: z.string(),original_url: z.string().nullish(),@@ -963,8 +1130,8 @@ export const zFileResponse = z.object({reference: z.string().nullish(),size: z.int(),source_url: z.string().nullish(),- tenant_id: z.string().nullish(),- user_id: z.string().nullish(),+ tenant_id: z.uuid().nullish(),+ user_id: z.uuid().nullish(),})/**@@ -1094,17 +1261,6 @@ export const zHitTestingResponse = z.object({records: z.array(zHitTestingRecord),})-/**- * HumanInputFormDefinitionResponse- */-export const zHumanInputFormDefinitionResponse = z.object({- expiration_time: z.int().nullish(),- form_content: z.string(),- inputs: z.array(z.record(z.string(), z.unknown())).optional(),- resolved_default_values: z.record(z.string(), z.string()),- user_actions: z.array(z.record(z.string(), z.unknown())).optional(),-})-/*** HumanInputFormSubmitResponse*/@@ -1131,16 +1287,75 @@ export const zIndexInfoResponse = z.object({export const zJsonObject = z.record(z.string(), z.unknown())-export const zJsonValue = z- .union([- z.string(),- z.int(),- z.number(),- z.boolean(),- z.record(z.string(), z.unknown()),- z.array(z.unknown()),- ])- .nullable()+/**+ * ChatPauseReasonResponse+ *+ * Public pause reason emitted by a blocking Chatflow execution.+ */+export const zChatPauseReasonResponse = z.object({+ TYPE: z.string(),+ actions: z.array(zJsonObject).optional(),+ approval_channels: z.array(z.string()).optional(),+ display_in_ui: z.boolean().nullish(),+ expiration_time: z.int().nullish(),+ form_content: z.string().nullish(),+ form_id: z.uuid().nullish(),+ form_token: z.string().nullish(),+ inputs: z.array(zJsonObject).optional(),+ message: z.string().nullish(),+ node_id: z.string().nullish(),+ node_title: z.string().nullish(),+ resolved_default_values: z.record(z.string(), z.unknown()).optional(),+})++/**+ * ChatPausedBlockingDataResponse+ */+export const zChatPausedBlockingDataResponse = z.object({+ answer: z.string(),+ conversation_id: z.uuid(),+ created_at: z.int(),+ elapsed_time: z.number(),+ id: z.uuid(),+ message_id: z.uuid(),+ metadata: zBlockingMetadataResponse,+ mode: z.string(),+ paused_nodes: z.array(z.string()),+ reasons: z.array(zChatPauseReasonResponse),+ status: z.literal('paused'),+ total_steps: z.int(),+ total_tokens: z.int(),+ workflow_run_id: z.uuid(),+})++/**+ * ChatPausedBlockingResponse+ */+export const zChatPausedBlockingResponse = z.object({+ answer: z.string(),+ conversation_id: z.uuid(),+ created_at: z.int(),+ data: zChatPausedBlockingDataResponse,+ event: z.literal('workflow_paused'),+ id: z.uuid(),+ message_id: z.uuid(),+ metadata: zBlockingMetadataResponse,+ mode: z.string(),+ task_id: z.uuid(),+ workflow_run_id: z.uuid(),+})++/**+ * ChatBlockingResponse+ *+ * Blocking chat response for a completed message or paused Chatflow.+ */+export const zChatBlockingResponse = z.discriminatedUnion('event', [+ zChatMessageBlockingResponse.extend({ event: z.literal('message') }),+ zChatPausedBlockingResponse.extend({ event: z.literal('workflow_paused') }),+])++export const zJsonValue = z.unknown()/*** AgentThought@@ -1160,11 +1375,6 @@ export const zAgentThought = z.object({tool_labels: zJsonValue,})-/**- * GeneratedAppResponse- */-export const zGeneratedAppResponse = zJsonValue-export const zJsonValueType = z.unknown()export const zJsonValue2 = z.unknown()@@ -1236,12 +1446,12 @@ export const zMessageFeedbackPayloadWithUser = z.object({export const zMessageFile = z.object({belongs_to: z.string().nullish(),filename: z.string(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),size: z.int().nullish(),transfer_method: z.string(),type: z.string(),- upload_file_id: z.string().nullish(),+ upload_file_id: z.uuid().nullish(),url: z.string().nullish(),})@@ -1385,6 +1595,30 @@ export const zOptionalServiceApiUserPayload = z.object({*/export const zPermissionEnum = z.enum(['all_team_members', 'only_me', 'partial_members'])+/**+ * PipelineDataset+ */+export const zPipelineDataset = z.object({+ chunk_structure: z.string(),+ description: z.string().optional().default(''),+ id: z.string(),+ name: z.string(),+})++/**+ * PipelineDocument+ */+export const zPipelineDocument = z.object({+ data_source_info: z.record(z.string(), z.unknown()).nullish(),+ data_source_type: z.string(),+ enabled: z.boolean(),+ error: z.string().nullish(),+ id: z.string(),+ indexing_status: z.string(),+ name: z.string(),+ position: z.int(),+})+/*** PipelineRunApiEntity*/@@ -1491,6 +1725,15 @@ export const zProviderWithModelsListResponse = z.object({data: z.array(zProviderWithModelsResponse),})+/**+ * PublishedPipelineRunResponse+ */+export const zPublishedPipelineRunResponse = z.object({+ batch: z.string(),+ dataset: zPipelineDataset,+ documents: z.array(zPipelineDocument),+})+/*** ServiceApiUserPayload*/@@ -1530,17 +1773,17 @@ export const zRetrieverResource = z.object({content: z.string().nullish(),created_at: z.int().nullish(),data_source_type: z.string().nullish(),- dataset_id: z.string().nullish(),+ dataset_id: z.uuid().nullish(),dataset_name: z.string().nullish(),- document_id: z.string().nullish(),+ document_id: z.uuid().nullish(),document_name: z.string().nullish(),hit_count: z.int().nullish(),- id: z.string().optional(),+ id: z.uuid().optional(),index_node_hash: z.string().nullish(),- message_id: z.string().optional(),+ message_id: z.uuid().optional(),position: z.int(),score: z.number().nullish(),- segment_id: z.string().nullish(),+ segment_id: z.uuid().nullish(),segment_position: z.int().nullish(),summary: z.string().nullish(),word_count: z.int().nullish(),@@ -1707,7 +1950,7 @@ export const zSimpleAccountResponse = z.object({*/export const zSimpleConversation = z.object({created_at: z.int().nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValue),introduction: z.string().nullish(),name: z.string(),@@ -1792,25 +2035,349 @@ export const zSystemParameters = z.object({* Parameters*/export const zParameters = z.object({- annotation_reply: zJsonObject,- file_upload: zJsonObject,- more_like_this: zJsonObject,+ annotation_reply: z.object({+ enabled: z.boolean().optional(),+ }),+ file_upload: z.object({+ allowed_file_extensions: z.array(z.string()).optional(),+ allowed_file_types: z+ .array(z.enum(['audio', 'custom', 'document', 'image', 'video']))+ .optional(),+ allowed_file_upload_methods: z.array(z.enum(['local_file', 'remote_url'])).optional(),+ enabled: z.boolean().optional(),+ image: z+ .object({+ detail: z.string().optional(),+ enabled: z.boolean().optional(),+ number_limits: z.int().optional(),+ transfer_methods: z.array(z.string()).optional(),+ })+ .optional(),+ number_limits: z.int().optional(),+ }),+ more_like_this: z.object({+ enabled: z.boolean().optional(),+ }),opening_statement: z.string().nullish(),- retriever_resource: zJsonObject,- sensitive_word_avoidance: zJsonObject,- speech_to_text: zJsonObject,+ retriever_resource: z.object({+ enabled: z.boolean().optional(),+ }),+ sensitive_word_avoidance: z.object({+ enabled: z.boolean().optional(),+ }),+ speech_to_text: z.object({+ enabled: z.boolean().optional(),+ }),suggested_questions: z.array(z.string()),- suggested_questions_after_answer: zJsonObject,+ suggested_questions_after_answer: z.object({+ enabled: z.boolean().optional(),+ }),system_parameters: zSystemParameters,- text_to_speech: zJsonObject,- user_input_form: z.array(zJsonObject),+ text_to_speech: z.object({+ autoPlay: z.string().optional(),+ enabled: z.boolean().optional(),+ language: z.string().optional(),+ voice: z.string().optional(),+ }),+ user_input_form: z.array(+ z.union([+ z+ .object({+ 'text-input': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ select: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ paragraph: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ number: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ external_data_tool: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ file: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ 'file-list': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ checkbox: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ json_object: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ ]),+ ),})/*** TagBindingPayload*/export const zTagBindingPayload = z.object({- tag_ids: z.array(z.string()),+ tag_ids: z.array(z.string()).min(1),target_id: z.string(),})@@ -1840,7 +2407,7 @@ export const zTagUnbindingPayload = z.union([target_id: z.string(),}),z.object({- tag_id: z.string().optional(),+ tag_id: z.string().nullish(),tag_ids: z.array(z.string()).min(1),target_id: z.string(),}),@@ -1875,6 +2442,21 @@ export const zTextToAudioPayloadWithUser = z.object({voice: z.string().nullish(),})+/**+ * ToolIcon+ */+export const zToolIcon = z.object({+ background: z.string(),+ content: z.string(),+})++/**+ * AppMetaResponse+ */+export const zAppMetaResponse = z.object({+ tool_icons: z.record(z.string(), z.union([z.string(), zToolIcon])).optional(),+})+/*** UrlResponse*/@@ -1889,7 +2471,10 @@ export const zUrlResponse = z.object({*/export const zUserActionConfig = z.object({button_style: zButtonStyle.optional().default('default'),- id: z.string().max(20),+ id: z+ .string()+ .max(20)+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/),title: z.string().max(100),})@@ -1975,6 +2560,17 @@ export const zHumanInputContent = z.object({workflow_run_id: z.string(),})+/**+ * HumanInputFormDefinitionResponse+ */+export const zHumanInputFormDefinitionResponse = z.object({+ expiration_time: z.int().nullish(),+ form_content: z.string(),+ inputs: z.array(zFormInputConfig),+ resolved_default_values: z.record(z.string(), z.string()),+ user_actions: z.array(zUserActionConfig),+})+/*** MessageListItem*/@@ -1982,17 +2578,17 @@ export const zMessageListItem = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),@@ -2188,6 +2784,31 @@ export const zWorkflowEventsQuery = z.object({user: z.string(),})+/**+ * WorkflowFinishedBlockingDataResponse+ */+export const zWorkflowFinishedBlockingDataResponse = z.object({+ created_at: z.int(),+ elapsed_time: z.number(),+ error: z.string().nullable(),+ finished_at: z.int().nullable(),+ id: z.uuid(),+ outputs: z.record(z.string(), z.unknown()).nullable(),+ status: z.enum(['failed', 'partial-succeeded', 'stopped', 'succeeded']),+ total_steps: z.int(),+ total_tokens: z.int(),+ workflow_id: z.uuid(),+})++/**+ * WorkflowFinishedBlockingResponse+ */+export const zWorkflowFinishedBlockingResponse = z.object({+ data: zWorkflowFinishedBlockingDataResponse,+ task_id: z.uuid(),+ workflow_run_id: z.uuid(),+})+/*** WorkflowLogQuery*/@@ -2202,6 +2823,74 @@ export const zWorkflowLogQuery = z.object({status: z.enum(['failed', 'stopped', 'succeeded']).nullish(),})+/**+ * WorkflowPauseReasonResponse+ *+ * Public pause reason emitted by a blocking Workflow execution.+ */+export const zWorkflowPauseReasonResponse = z.object({+ TYPE: z.string(),+ actions: z.array(zJsonObject).optional(),+ approval_channels: z.array(z.string()).optional(),+ display_in_ui: z.boolean().nullish(),+ expiration_time: z.int().nullish(),+ form_content: z.string().nullish(),+ form_id: z.uuid().nullish(),+ form_token: z.string().nullish(),+ inputs: z.array(zJsonObject).optional(),+ message: z.string().nullish(),+ node_id: z.string().nullish(),+ node_title: z.string().nullish(),+ resolved_default_values: z.record(z.string(), z.unknown()).optional(),+})++/**+ * WorkflowPausedBlockingDataResponse+ */+export const zWorkflowPausedBlockingDataResponse = z.object({+ created_at: z.int(),+ elapsed_time: z.number(),+ error: z.string().nullable(),+ finished_at: z.int().nullable(),+ id: z.uuid(),+ outputs: z.record(z.string(), z.unknown()).nullable(),+ paused_nodes: z.array(z.string()),+ reasons: z.array(zWorkflowPauseReasonResponse),+ status: z.literal('paused'),+ total_steps: z.int(),+ total_tokens: z.int(),+ workflow_id: z.uuid(),+})++/**+ * WorkflowPausedBlockingResponse+ */+export const zWorkflowPausedBlockingResponse = z.object({+ data: zWorkflowPausedBlockingDataResponse,+ task_id: z.uuid(),+ workflow_run_id: z.uuid(),+})++/**+ * WorkflowBlockingResponse+ *+ * Blocking workflow response for a finished or paused execution.+ */+export const zWorkflowBlockingResponse = z.union([+ zWorkflowFinishedBlockingResponse,+ zWorkflowPausedBlockingResponse,+])++/**+ * PipelineRunJsonResponse+ *+ * JSON responses returned by published and draft knowledge pipeline runs.+ */+export const zPipelineRunJsonResponse = z.union([+ zPublishedPipelineRunResponse,+ zWorkflowBlockingResponse,+])+/*** WorkflowRunForLogResponse*/@@ -2211,7 +2900,7 @@ export const zWorkflowRunForLogResponse = z.object({error: z.string().nullish(),exceptions_count: z.int().nullish(),finished_at: z.int().nullish(),- id: z.string(),+ id: z.uuid(),status: z.string().nullish(),total_steps: z.int().nullish(),total_tokens: z.int().nullish(),@@ -2238,7 +2927,7 @@ export const zWorkflowAppLogPartialResponse = z.object({z.boolean(),]).nullish(),- id: z.string(),+ id: z.uuid(),workflow_run: zWorkflowRunForLogResponse.nullish(),})@@ -2259,12 +2948,36 @@ export const zWorkflowAppLogPaginationResponse = z.object({export const zWorkflowRunPayload = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -2277,12 +2990,36 @@ export const zWorkflowRunPayload = z.object({export const zWorkflowRunPayloadWithUser = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -2298,7 +3035,7 @@ export const zWorkflowRunResponse = z.object({elapsed_time: z.union([z.number(), z.int()]).nullish(),error: z.string().nullish(),finished_at: z.int().nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.union([z.record(z.string(), z.unknown()),@@ -2313,14 +3050,9 @@ export const zWorkflowRunResponse = z.object({status: z.string(),total_steps: z.int().nullish(),total_tokens: z.int().nullish(),- workflow_id: z.string(),+ workflow_id: z.uuid(),})-/**- * GeneratedAppResponse- */-export const zGeneratedAppResponseWritable = zJsonValue-/*** HumanInputFormSubmitResponse*/@@ -2333,17 +3065,17 @@ export const zMessageListItemWritable = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),@@ -2476,7 +3208,7 @@ export const zPostChatMessagesBody = zChatRequestPayloadWithUser* - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object.* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events.*/-export const zPostChatMessagesResponse = z.record(z.string(), z.unknown())+export const zPostChatMessagesResponse = z.union([zChatBlockingResponse, z.string()])export const zPostChatMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload@@ -2497,7 +3229,7 @@ export const zPostCompletionMessagesBody = zCompletionRequestPayloadWithUser* - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object.* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects.*/-export const zPostCompletionMessagesResponse = z.record(z.string(), z.unknown())+export const zPostCompletionMessagesResponse = z.union([zCompletionBlockingResponse, z.string()])export const zPostCompletionMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload@@ -2525,33 +3257,33 @@ export const zGetConversationsQuery = z.object({*/export const zGetConversationsResponse = zConversationInfiniteScrollPagination-export const zDeleteConversationsByCIdBody = zOptionalServiceApiUserPayload+export const zDeleteConversationsByConversationIdBody = zOptionalServiceApiUserPayload-export const zDeleteConversationsByCIdPath = z.object({- c_id: z.uuid(),+export const zDeleteConversationsByConversationIdPath = z.object({+ conversation_id: z.uuid(),})/*** Conversation deleted successfully.*/-export const zDeleteConversationsByCIdResponse = z.void()+export const zDeleteConversationsByConversationIdResponse = z.void()-export const zPostConversationsByCIdNameBody = zConversationRenamePayloadWithUser+export const zPostConversationsByConversationIdNameBody = zConversationRenamePayloadWithUser-export const zPostConversationsByCIdNamePath = z.object({- c_id: z.uuid(),+export const zPostConversationsByConversationIdNamePath = z.object({+ conversation_id: z.uuid(),})/*** Conversation renamed successfully.*/-export const zPostConversationsByCIdNameResponse = zSimpleConversation+export const zPostConversationsByConversationIdNameResponse = zSimpleConversation-export const zGetConversationsByCIdVariablesPath = z.object({- c_id: z.uuid(),+export const zGetConversationsByConversationIdVariablesPath = z.object({+ conversation_id: z.uuid(),})-export const zGetConversationsByCIdVariablesQuery = z.object({+export const zGetConversationsByConversationIdVariablesQuery = z.object({last_id: z.string().optional(),limit: z.int().gte(1).lte(100).optional().default(20),user: z.string().optional(),@@ -2561,21 +3293,22 @@ export const zGetConversationsByCIdVariablesQuery = z.object({/*** Successfully retrieved conversation variables.*/-export const zGetConversationsByCIdVariablesResponse =+export const zGetConversationsByConversationIdVariablesResponse =zConversationVariableInfiniteScrollPaginationResponse-export const zPutConversationsByCIdVariablesByVariableIdBody =+export const zPutConversationsByConversationIdVariablesByVariableIdBody =zConversationVariableUpdatePayloadWithUser-export const zPutConversationsByCIdVariablesByVariableIdPath = z.object({- c_id: z.uuid(),+export const zPutConversationsByConversationIdVariablesByVariableIdPath = z.object({+ conversation_id: z.uuid(),variable_id: z.uuid(),})/*** Variable updated successfully.*/-export const zPutConversationsByCIdVariablesByVariableIdResponse = zConversationVariableResponse+export const zPutConversationsByConversationIdVariablesByVariableIdResponse =+ zConversationVariableResponseexport const zGetDatasetsQuery = z.object({include_all: z.boolean().optional().default(false),@@ -3130,10 +3863,7 @@ export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunPath = z./*** Streaming response with node execution events.*/-export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse = z.record(- z.string(),- z.unknown(),-)+export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse = z.string()export const zPostDatasetsByDatasetIdPipelineRunBody = zPipelineRunApiEntity@@ -3142,9 +3872,12 @@ export const zPostDatasetsByDatasetIdPipelineRunPath = z.object({})/**- * Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object.+ * Pipeline execution result. Published runs return a JSON object containing `batch`, `dataset`, and `documents`. Draft runs return `text/event-stream` for streaming mode or a workflow result JSON object for blocking mode.*/-export const zPostDatasetsByDatasetIdPipelineRunResponse = zGeneratedAppResponse+export const zPostDatasetsByDatasetIdPipelineRunResponse = z.union([+ zPipelineRunJsonResponse,+ z.string(),+])export const zPostDatasetsByDatasetIdRetrieveBody = zHitTestingPayload@@ -3286,11 +4019,11 @@ export const zPostTextToAudioResponse = z.custom<Blob | File>((value) => value instanceof Blob || value instanceof File,)-export const zGetWorkflowByTaskIdEventsPath = z.object({- task_id: z.string(),+export const zGetWorkflowByWorkflowRunIdEventsPath = z.object({+ workflow_run_id: z.string(),})-export const zGetWorkflowByTaskIdEventsQuery = z.object({+export const zGetWorkflowByWorkflowRunIdEventsQuery = z.object({continue_on_pause: z.boolean().optional().default(false),include_state_snapshot: z.boolean().optional().default(false),user: z.string(),@@ -3299,7 +4032,7 @@ export const zGetWorkflowByTaskIdEventsQuery = z.object({/*** Server-Sent Events stream. Each event is delivered as `data: {JSON}\n\n`. Event payloads follow the same schemas as the original streaming response.*/-export const zGetWorkflowByTaskIdEventsResponse = zEventStreamResponse+export const zGetWorkflowByWorkflowRunIdEventsResponse = z.string()export const zGetWorkflowsLogsQuery = z.object({created_at__after: z.iso.datetime().optional(),@@ -3325,7 +4058,7 @@ export const zPostWorkflowsRunBody = zWorkflowRunPayloadWithUser* - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object.* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects.*/-export const zPostWorkflowsRunResponse = zGeneratedAppResponse+export const zPostWorkflowsRunResponse = z.union([zWorkflowBlockingResponse, z.string()])export const zGetWorkflowsRunByWorkflowRunIdPath = z.object({workflow_run_id: z.string(),@@ -3359,7 +4092,10 @@ export const zPostWorkflowsByWorkflowIdRunPath = z.object({* - If `response_mode` is `blocking`, returns `application/json` with a `WorkflowBlockingResponse` object.* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkWorkflowEvent` objects.*/-export const zPostWorkflowsByWorkflowIdRunResponse = zGeneratedAppResponse+export const zPostWorkflowsByWorkflowIdRunResponse = z.union([+ zWorkflowBlockingResponse,+ z.string(),+])export const zGetWorkspacesCurrentModelsModelTypesByModelTypePath = z.object({model_type: z.enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts']),diff --git a/packages/contracts/generated/api/web/types.gen.ts b/packages/contracts/generated/api/web/types.gen.tsindex 990a9187512..8db116c5fef 100644--- a/packages/contracts/generated/api/web/types.gen.ts+++ b/packages/contracts/generated/api/web/types.gen.ts@@ -293,10 +293,6 @@ export type HumanInputUploadTokenResponse = {upload_token: string}-export type JsonObject = {- [key: string]: unknown-}-export type JsonValue =| string| number@@ -367,18 +363,327 @@ export type ParagraphInputConfig = {}export type Parameters = {- annotation_reply: JsonObject- file_upload: JsonObject- more_like_this: JsonObject+ annotation_reply: {+ enabled?: boolean+ }+ file_upload: {+ allowed_file_extensions?: Array<string>+ allowed_file_types?: Array<'audio' | 'custom' | 'document' | 'image' | 'video'>+ allowed_file_upload_methods?: Array<'local_file' | 'remote_url'>+ enabled?: boolean+ image?: {+ detail?: string+ enabled?: boolean+ number_limits?: number+ transfer_methods?: Array<string>+ }+ number_limits?: number+ }+ more_like_this: {+ enabled?: boolean+ }opening_statement?: string | null- retriever_resource: JsonObject- sensitive_word_avoidance: JsonObject- speech_to_text: JsonObject+ retriever_resource: {+ enabled?: boolean+ }+ sensitive_word_avoidance: {+ enabled?: boolean+ }+ speech_to_text: {+ enabled?: boolean+ }suggested_questions: Array<string>- suggested_questions_after_answer: JsonObject+ suggested_questions_after_answer: {+ enabled?: boolean+ }system_parameters: SystemParameters- text_to_speech: JsonObject- user_input_form: Array<JsonObject>+ text_to_speech: {+ autoPlay?: string+ enabled?: boolean+ language?: string+ voice?: string+ }+ user_input_form: Array<+ | {+ 'text-input': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ select: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ paragraph: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ number: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ external_data_tool: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ file: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ 'file-list': {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ checkbox: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ | {+ json_object: {+ allowed_file_extensions?: Array<string> | null+ allowed_file_types?: Array<string> | null+ allowed_file_upload_methods?: Array<string> | null+ config?: {+ [key: string]: unknown+ }+ default?: unknown+ description?: string+ hide?: boolean+ json_schema?: {+ [key: string]: unknown+ } | null+ label: string+ max_length?: number | null+ options?: Array<string>+ required?: boolean+ type?:+ | 'checkbox'+ | 'external_data_tool'+ | 'file'+ | 'file-list'+ | 'json_object'+ | 'number'+ | 'paragraph'+ | 'select'+ | 'text-input'+ variable: string+ }+ }+ >}export type PassportAccessTokenResponse = {@@ -655,12 +960,36 @@ export type WebSiteResponse = {}export type WorkflowRunPayload = {- files?: Array<{- transfer_method: 'local_file' | 'remote_url'- type: 'audio' | 'custom' | 'document' | 'image' | 'video'- upload_file_id?: string- url?: string- }> | null+ files?: Array<+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url: string+ }+ | {+ remote_url: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id?: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'remote_url'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ | {+ remote_url?: string+ transfer_method: 'local_file'+ type: 'audio' | 'custom' | 'document' | 'image' | 'video'+ upload_file_id: string+ url?: string+ }+ > | nullinputs: {[key: string]: unknown}diff --git a/packages/contracts/generated/api/web/zod.gen.ts b/packages/contracts/generated/api/web/zod.gen.tsindex 36ebdd700fc..7b6aed9e8b3 100644--- a/packages/contracts/generated/api/web/zod.gen.ts+++ b/packages/contracts/generated/api/web/zod.gen.ts@@ -184,12 +184,12 @@ export const zExecutionContentType = z.enum(['human_input'])* FileResponse*/export const zFileResponse = z.object({- conversation_id: z.string().nullish(),+ conversation_id: z.uuid().nullish(),created_at: z.int().nullish(),- created_by: z.string().nullish(),+ created_by: z.uuid().nullish(),extension: z.string().nullish(),file_key: z.string().nullish(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),name: z.string(),original_url: z.string().nullish(),@@ -197,8 +197,8 @@ export const zFileResponse = z.object({reference: z.string().nullish(),size: z.int(),source_url: z.string().nullish(),- tenant_id: z.string().nullish(),- user_id: z.string().nullish(),+ tenant_id: z.uuid().nullish(),+ user_id: z.uuid().nullish(),})/**@@ -301,8 +301,6 @@ export const zHumanInputUploadTokenResponse = z.object({upload_token: z.string(),})-export const zJsonObject = z.record(z.string(), z.unknown())-export const zJsonValue = z.union([z.string(),@@ -411,12 +409,12 @@ export const zMessageFeedbackPayload = z.object({export const zMessageFile = z.object({belongs_to: z.string().nullish(),filename: z.string(),- id: z.string(),+ id: z.uuid(),mime_type: z.string().nullish(),size: z.int().nullish(),transfer_method: z.string(),type: z.string(),- upload_file_id: z.string().nullish(),+ upload_file_id: z.uuid().nullish(),url: z.string().nullish(),})@@ -497,17 +495,17 @@ export const zRetrieverResource = z.object({content: z.string().nullish(),created_at: z.int().nullish(),data_source_type: z.string().nullish(),- dataset_id: z.string().nullish(),+ dataset_id: z.uuid().nullish(),dataset_name: z.string().nullish(),- document_id: z.string().nullish(),+ document_id: z.uuid().nullish(),document_name: z.string().nullish(),hit_count: z.int().nullish(),- id: z.string().optional(),+ id: z.uuid().optional(),index_node_hash: z.string().nullish(),- message_id: z.string().optional(),+ message_id: z.uuid().optional(),position: z.int(),score: z.number().nullish(),- segment_id: z.string().nullish(),+ segment_id: z.uuid().nullish(),segment_position: z.int().nullish(),summary: z.string().nullish(),word_count: z.int().nullish(),@@ -538,7 +536,7 @@ export const zSavedMessageListQuery = z.object({*/export const zSimpleConversation = z.object({created_at: z.int().nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValue),introduction: z.string().nullish(),name: z.string(),@@ -621,18 +619,342 @@ export const zSystemParameters = z.object({* Parameters*/export const zParameters = z.object({- annotation_reply: zJsonObject,- file_upload: zJsonObject,- more_like_this: zJsonObject,+ annotation_reply: z.object({+ enabled: z.boolean().optional(),+ }),+ file_upload: z.object({+ allowed_file_extensions: z.array(z.string()).optional(),+ allowed_file_types: z+ .array(z.enum(['audio', 'custom', 'document', 'image', 'video']))+ .optional(),+ allowed_file_upload_methods: z.array(z.enum(['local_file', 'remote_url'])).optional(),+ enabled: z.boolean().optional(),+ image: z+ .object({+ detail: z.string().optional(),+ enabled: z.boolean().optional(),+ number_limits: z.int().optional(),+ transfer_methods: z.array(z.string()).optional(),+ })+ .optional(),+ number_limits: z.int().optional(),+ }),+ more_like_this: z.object({+ enabled: z.boolean().optional(),+ }),opening_statement: z.string().nullish(),- retriever_resource: zJsonObject,- sensitive_word_avoidance: zJsonObject,- speech_to_text: zJsonObject,+ retriever_resource: z.object({+ enabled: z.boolean().optional(),+ }),+ sensitive_word_avoidance: z.object({+ enabled: z.boolean().optional(),+ }),+ speech_to_text: z.object({+ enabled: z.boolean().optional(),+ }),suggested_questions: z.array(z.string()),- suggested_questions_after_answer: zJsonObject,+ suggested_questions_after_answer: z.object({+ enabled: z.boolean().optional(),+ }),system_parameters: zSystemParameters,- text_to_speech: zJsonObject,- user_input_form: z.array(zJsonObject),+ text_to_speech: z.object({+ autoPlay: z.string().optional(),+ enabled: z.boolean().optional(),+ language: z.string().optional(),+ voice: z.string().optional(),+ }),+ user_input_form: z.array(+ z.union([+ z+ .object({+ 'text-input': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ select: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ paragraph: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ number: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ external_data_tool: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ file: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ 'file-list': z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ checkbox: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ z+ .object({+ json_object: z.object({+ allowed_file_extensions: z.array(z.string()).nullish(),+ allowed_file_types: z.array(z.string()).nullish(),+ allowed_file_upload_methods: z.array(z.string()).nullish(),+ config: z.record(z.string(), z.unknown()).optional(),+ default: z.unknown().optional(),+ description: z.string().optional(),+ hide: z.boolean().optional(),+ json_schema: z.record(z.string(), z.unknown()).nullish(),+ label: z.string(),+ max_length: z.int().nullish(),+ options: z.array(z.string()).optional(),+ required: z.boolean().optional(),+ type: z+ .enum([+ 'checkbox',+ 'external_data_tool',+ 'file',+ 'file-list',+ 'json_object',+ 'number',+ 'paragraph',+ 'select',+ 'text-input',+ ])+ .optional(),+ variable: z.string(),+ }),+ })+ .strict(),+ ]),+ ),})/**@@ -652,7 +974,10 @@ export const zTextToAudioPayload = z.object({*/export const zUserActionConfig = z.object({button_style: zButtonStyle.optional().default('default'),- id: z.string().max(20),+ id: z+ .string()+ .max(20)+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/),title: z.string().max(100),})@@ -820,18 +1145,18 @@ export const zWebMessageListItem = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),metadata: zJsonValueType.nullish(),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),@@ -920,12 +1245,36 @@ export const zHumanInputFormDefinitionResponse = z.object({export const zWorkflowRunPayload = z.object({files: z.array(- z.object({- transfer_method: z.enum(['local_file', 'remote_url']),- type: z.enum(['audio', 'custom', 'document', 'image', 'video']),- upload_file_id: z.string().optional(),- url: z.string().optional(),- }),+ z.union([+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string(),+ }),+ z.object({+ remote_url: z.string(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string().optional(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['remote_url']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ z.object({+ remote_url: z.string().optional(),+ transfer_method: z.enum(['local_file']),+ type: z.enum(['audio', 'custom', 'document', 'image', 'video']),+ upload_file_id: z.string(),+ url: z.string().optional(),+ }),+ ]),).nullish(),inputs: z.record(z.string(), z.unknown()),@@ -948,18 +1297,18 @@ export const zWebMessageListItemWritable = z.object({agent_thoughts: z.array(zAgentThought),answer: z.string(),answer_tokens: z.int().optional().default(0),- conversation_id: z.string(),+ conversation_id: z.uuid(),created_at: z.int().nullish(),currency: z.string().nullish(),error: z.string().nullish(),extra_contents: z.array(zHumanInputContent),feedback: zSimpleFeedback.nullish(),- id: z.string(),+ id: z.uuid(),inputs: z.record(z.string(), zJsonValueType),message_files: z.array(zMessageFile),message_tokens: z.int().optional().default(0),metadata: zJsonValueType.nullish(),- parent_message_id: z.string().nullish(),+ parent_message_id: z.uuid().nullish(),provider_response_latency: z.number().optional().default(0),query: z.string(),retriever_resources: z.array(zRetrieverResource),diff --git a/packages/contracts/openapi-ts.api.config.ts b/packages/contracts/openapi-ts.api.config.tsindex d34cdd99080..1feab712fcb 100644--- a/packages/contracts/openapi-ts.api.config.ts+++ b/packages/contracts/openapi-ts.api.config.ts@@ -61,7 +61,7 @@ const currentDir = path.dirname(fileURLToPath(import.meta.url))const apiOpenApiDir = path.resolve(currentDir, 'openapi')const operationMethods = new Set(['delete', 'get', 'patch', 'post', 'put'])-const strictZodSchemaNames = new Set(['AccountProfilePatchPayload'])+const strictZodSchemaNames = new Set(['AccountProfilePatchPayload', 'Parameters'])const pydanticDecimalStringPattern = '^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$'const codegenSafeDecimalStringPattern = '^(?![-+.]*$)[+-]?0*\\d*\\.?\\d*$'const fastOpenApiConsoleSpecFilename = 'fastopenapi-console-openapi.json'@@ -262,10 +262,120 @@ const filterContractOperations = (document: SwaggerDocument) => {}}+const includeEventStreamInJsonResponseSchemas = (document: SwaggerDocument) => {+ for (const pathItem of Object.values(document.paths ?? {})) {+ for (const [method, operation] of Object.entries(pathItem)) {+ if (!operationMethods.has(method) || !isObject(operation)) continue++ for (const [status, response] of Object.entries(+ (operation as SwaggerOperation).responses ?? {},+ )) {+ if (!/^2\d\d$/.test(status) || !isObject(response) || !isObject(response.content)) continue++ const jsonMedia = response.content['application/json']+ const eventStreamMedia = response.content['text/event-stream']+ if (+ !isObject(jsonMedia) ||+ !isObject(jsonMedia.schema) ||+ !isObject(eventStreamMedia) ||+ !isObject(eventStreamMedia.schema)+ ) {+ continue+ }++ // hey-api selects the JSON schema when one status advertises multiple+ // response media types. Preserve the SSE transport in the generated+ // TypeScript and Zod contracts by making that selected schema a union.+ jsonMedia.schema = {+ anyOf: [jsonMedia.schema, eventStreamMedia.schema],+ }+ }+ }+ }+}++const normalizeCodegenSchemas = (document: SwaggerDocument) => {+ const visitedSchemas = new WeakSet<object>()++ const visitSchema = (value: unknown) => {+ if (!isObject(value) || visitedSchemas.has(value)) return++ visitedSchemas.add(value)+ if (value.default === null) delete value.default+ // Dify serializes int64 fields as JSON numbers. hey-api maps int64 to+ // bigint in Zod, which disagrees with both the wire value and its own+ // generated TypeScript type. Keep int64 in the published OpenAPI specs,+ // but generate number-based client validators from this in-memory copy.+ if (value.type === 'integer' && value.format === 'int64') delete value.format++ for (const key of [+ 'additionalProperties',+ 'contains',+ 'else',+ 'if',+ 'items',+ 'not',+ 'propertyNames',+ 'then',+ 'unevaluatedItems',+ 'unevaluatedProperties',+ ]) {+ visitSchema(value[key])+ }++ for (const key of ['allOf', 'anyOf', 'oneOf', 'prefixItems']) {+ const schemas = value[key]+ if (Array.isArray(schemas)) schemas.forEach(visitSchema)+ }++ for (const key of [+ '$defs',+ 'definitions',+ 'dependentSchemas',+ 'patternProperties',+ 'properties',+ ]) {+ const schemas = value[key]+ if (isObject(schemas)) Object.values(schemas).forEach(visitSchema)+ }+ }++ const visitedDocumentObjects = new WeakSet<object>()+ const findSchemas = (value: unknown, parentKey?: string) => {+ if (!value || typeof value !== 'object' || visitedDocumentObjects.has(value)) return++ visitedDocumentObjects.add(value)+ if (parentKey === 'schema') {+ visitSchema(value)+ return+ }+ if (parentKey === 'schemas' && isObject(value)) {+ Object.values(value).forEach(visitSchema)+ return+ }+ if (parentKey === 'example' || parentKey === 'examples') return++ if (Array.isArray(value)) {+ value.forEach((item) => findSchemas(item))+ return+ }++ Object.entries(value).forEach(([key, item]) => findSchemas(item, key))+ }++ findSchemas(document)+}+const normalizeApiSwagger = (document: SwaggerDocument) => {normalizeOpaqueContractResponses(document)filterContractOperations(document)addOperationIds(document)+ includeEventStreamInJsonResponseSchemas(document)+ // OpenAPI defaults describe server behavior. Keep them in the exported specs,+ // but do not let Zod synthesize omitted transport fields during client-side+ // request or response validation. Non-null defaults remain useful for query+ // parameter ergonomics and preserve the existing generated contract behavior.+ normalizeCodegenSchemas(document)return document}diff --git a/packages/contracts/service-api-contract.test.ts b/packages/contracts/service-api-contract.test.tsnew file mode 100644index 00000000000..70225faf193--- /dev/null+++ b/packages/contracts/service-api-contract.test.ts@@ -0,0 +1,135 @@+import { describe, expect, it } from 'vite-plus/test'+import { zFileResponse } from './generated/api/console/files/zod.gen'+import {+ zCompletionRequestPayloadWithUser,+ zParameters,+ zPostChatMessagesResponse,+ zPostCompletionMessagesResponse,+ zPostDatasetsByDatasetIdPipelineRunResponse,+ zPostWorkflowsByWorkflowIdRunResponse,+ zPostWorkflowsRunResponse,+} from './generated/api/service/zod.gen'++describe('generated Service API schemas', () => {+ it('keeps JSON int64 values as numbers', () => {+ const result = zFileResponse.parse({+ created_at: 1_700_000_000,+ id: '00000000-0000-4000-8000-000000000001',+ name: 'example.txt',+ size: 42,+ })++ expect(result.created_at).toBe(1_700_000_000)+ expect(typeof result.created_at).toBe('number')+ })++ it('requires a source for every file transfer method', () => {+ const request = {+ inputs: {},+ query: 'hello',+ response_mode: 'blocking' as const,+ user: 'user-1',+ }++ expect(+ zCompletionRequestPayloadWithUser.safeParse({+ ...request,+ files: [+ {+ transfer_method: 'remote_url',+ type: 'image',+ url: 'https://example.com/image.png',+ },+ ],+ }).success,+ ).toBe(true)+ expect(+ zCompletionRequestPayloadWithUser.safeParse({+ ...request,+ files: [{ transfer_method: 'remote_url', type: 'image' }],+ }).success,+ ).toBe(false)+ expect(+ zCompletionRequestPayloadWithUser.safeParse({+ ...request,+ files: [+ {+ transfer_method: 'local_file',+ type: 'image',+ url: 'https://example.com/image.png',+ },+ ],+ }).success,+ ).toBe(false)+ })++ it('rejects malformed user input form items', () => {+ const parameters = {+ annotation_reply: { enabled: false },+ file_upload: { enabled: false },+ more_like_this: { enabled: false },+ opening_statement: null,+ retriever_resource: { enabled: false },+ sensitive_word_avoidance: { enabled: false },+ speech_to_text: { enabled: false },+ suggested_questions: [],+ suggested_questions_after_answer: { enabled: false },+ system_parameters: {+ audio_file_size_limit: 15,+ file_size_limit: 15,+ image_file_size_limit: 10,+ video_file_size_limit: 100,+ workflow_file_upload_limit: 10,+ },+ text_to_speech: { enabled: false },+ }++ expect(+ zParameters.safeParse({+ ...parameters,+ user_input_form: [{ 'text-input': { label: 'Topic', required: true, variable: 'topic' } }],+ }).success,+ ).toBe(true)+ expect(zParameters.safeParse({ ...parameters, user_input_form: [42] }).success).toBe(false)+ expect(+ zParameters.safeParse({+ ...parameters,+ user_input_form: [+ {+ number: { label: 'Count', variable: 'count' },+ 'text-input': { label: 'Topic', variable: 'topic' },+ },+ ],+ }).success,+ ).toBe(false)+ })++ it('accepts SSE text for mixed JSON and event-stream responses', () => {+ const eventStream = 'data: {"event":"ping"}\n\n'++ for (const responseSchema of [+ zPostChatMessagesResponse,+ zPostCompletionMessagesResponse,+ zPostDatasetsByDatasetIdPipelineRunResponse,+ zPostWorkflowsByWorkflowIdRunResponse,+ zPostWorkflowsRunResponse,+ ]) {+ expect(responseSchema.safeParse(eventStream).success).toBe(true)+ }+ })++ it('accepts the published knowledge pipeline JSON response', () => {+ expect(+ zPostDatasetsByDatasetIdPipelineRunResponse.safeParse({+ batch: '20260825123456123456',+ dataset: {+ chunk_structure: 'text_model',+ description: '',+ id: 'dataset-1',+ name: 'Knowledge Base',+ },+ documents: [],+ }).success,+ ).toBe(true)+ })+})diff --git a/web/app/components/explore/installed-app/runtime.ts b/web/app/components/explore/installed-app/runtime.tsindex a58080f1df2..db670a38be2 100644--- a/web/app/components/explore/installed-app/runtime.ts+++ b/web/app/components/explore/installed-app/runtime.ts@@ -44,6 +44,9 @@ const isUserInputFormItem = (value: unknown): value is ChatConfig['user_input_fo].some((key) => isRecord(getValue(value, key)))}+const normalizeUserInputForm = (items: readonly unknown[]): ChatConfig['user_input_form'] =>+ items.filter(isUserInputFormItem)+const isModel = (value: unknown,): value is NonNullable<ChatConfig['suggested_questions_after_answer']['model']> => isRecord(value)@@ -121,7 +124,7 @@ export const toInstalledAppParameters = (response: InstalledAppParametersResponssuggested_questions: response.suggested_questions,pre_prompt: '',prompt_type: PromptMode.simple,- user_input_form: response.user_input_form.filter(isUserInputFormItem),+ user_input_form: normalizeUserInputForm(response.user_input_form),more_like_this: normalizeEnabledConfig(response.more_like_this),suggested_questions_after_answer: normalizeSuggestedQuestionsAfterAnswer(response.suggested_questions_after_answer,diff --git a/web/app/components/explore/try-app/preview/flow-app-preview.tsx b/web/app/components/explore/try-app/preview/flow-app-preview.tsxindex 5d51b1933a3..bb132171db8 100644--- a/web/app/components/explore/try-app/preview/flow-app-preview.tsx+++ b/web/app/components/explore/try-app/preview/flow-app-preview.tsx@@ -1,5 +1,5 @@'use client'-import type { JsonObject2 } from '@dify/contracts/api/console/trial-apps/types.gen'+import type { JsonObject } from '@dify/contracts/api/console/trial-apps/types.gen'import type { FC } from 'react'import type { Edge, Node } from '@/app/components/workflow/types'import { cn } from '@langgenius/dify-ui/cn'@@ -90,7 +90,7 @@ const getBlockType = (value: unknown) => {return blockTypeMap[value] || null}-const normalizeWorkflowPreviewGraph = (graph: JsonObject2) => {+const normalizeWorkflowPreviewGraph = (graph: JsonObject) => {const nodesData = Array.isArray(graph.nodes) ? graph.nodes : []const edgesData = Array.isArray(graph.edges) ? graph.edges : []