mirror of
https://github.com/langgenius/dify.git
synced 2026-06-22 19:21:13 +08:00
fix: add service api openapi descriptions (#37595)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
bc825f94b5
commit
19838972dc
@ -141,4 +141,7 @@ class TextToAudioPayload(BaseModel):
|
||||
message_id: str | None = Field(default=None, description="Message ID")
|
||||
voice: str | None = Field(default=None, description="Voice to use for TTS")
|
||||
text: str | None = Field(default=None, description="Text to convert to audio")
|
||||
streaming: bool | None = Field(default=None, description="Enable streaming response")
|
||||
streaming: bool | None = Field(
|
||||
default=None,
|
||||
description="Reserved for compatibility; TTS response streaming is determined by the provider output.",
|
||||
)
|
||||
|
||||
@ -65,6 +65,18 @@ register_response_schema_models(service_api_ns, AnnotationJobStatusResponse)
|
||||
|
||||
@service_api_ns.route("/apps/annotation-reply/<string:action>")
|
||||
class AnnotationReplyActionApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Configure Annotation Reply",
|
||||
description=(
|
||||
"Enables or disables the annotation reply feature. Requires embedding model configuration "
|
||||
"when enabling. Executes asynchronously — use [Get Annotation Reply Job "
|
||||
"Status](/api-reference/annotations/get-annotation-reply-job-status) to track progress."
|
||||
),
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
200: "Annotation reply settings task initiated.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[AnnotationReplyActionPayload.__name__])
|
||||
@service_api_ns.doc("annotation_reply_action")
|
||||
@service_api_ns.doc(description="Enable or disable annotation reply feature")
|
||||
@ -99,6 +111,18 @@ class AnnotationReplyActionApi(Resource):
|
||||
|
||||
@service_api_ns.route("/apps/annotation-reply/<string:action>/status/<uuid:job_id>")
|
||||
class AnnotationReplyActionStatusApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Annotation Reply Job Status",
|
||||
description=(
|
||||
"Retrieves the status of an asynchronous annotation reply configuration job started by "
|
||||
"[Configure Annotation Reply](/api-reference/annotations/configure-annotation-reply)."
|
||||
),
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
200: "Successfully retrieved task status.",
|
||||
400: "`invalid_param` : The specified job does not exist.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_annotation_reply_action_status")
|
||||
@service_api_ns.doc(description="Get the status of an annotation reply action job")
|
||||
@service_api_ns.doc(params={"action": "Action type", "job_id": "Job ID"})
|
||||
@ -134,6 +158,14 @@ class AnnotationReplyActionStatusApi(Resource):
|
||||
|
||||
@service_api_ns.route("/apps/annotations")
|
||||
class AnnotationListApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Annotations",
|
||||
description="Retrieves a paginated list of annotations for the application. Supports keyword search filtering.",
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
200: "Successfully retrieved annotation list.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_annotations")
|
||||
@service_api_ns.doc(description="List annotations for the application")
|
||||
@service_api_ns.doc(params=query_params_from_model(AnnotationListQuery))
|
||||
@ -166,6 +198,17 @@ class AnnotationListApi(Resource):
|
||||
)
|
||||
return response.model_dump(mode="json")
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Annotation",
|
||||
description=(
|
||||
"Creates a new annotation. Annotations provide predefined question-answer pairs that the app "
|
||||
"can match and return directly instead of generating a response."
|
||||
),
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
201: "Annotation created successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[AnnotationCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_annotation")
|
||||
@service_api_ns.doc(description="Create a new annotation")
|
||||
@ -192,6 +235,16 @@ class AnnotationListApi(Resource):
|
||||
|
||||
@service_api_ns.route("/apps/annotations/<uuid:annotation_id>")
|
||||
class AnnotationUpdateDeleteApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Update Annotation",
|
||||
description="Updates the question and answer of an existing annotation.",
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
200: "Annotation updated successfully.",
|
||||
403: "`forbidden` : Insufficient permissions to edit annotations.",
|
||||
404: "`not_found` : Annotation does not exist.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[AnnotationCreatePayload.__name__])
|
||||
@service_api_ns.doc("update_annotation")
|
||||
@service_api_ns.doc(description="Update an existing annotation")
|
||||
@ -219,6 +272,16 @@ class AnnotationUpdateDeleteApi(Resource):
|
||||
response = Annotation.model_validate(annotation, from_attributes=True)
|
||||
return response.model_dump(mode="json")
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Annotation",
|
||||
description="Deletes an annotation and its associated hit history.",
|
||||
tags=["Annotations"],
|
||||
responses={
|
||||
204: "Annotation deleted successfully.",
|
||||
403: "`forbidden` : Insufficient permissions to edit annotations.",
|
||||
404: "`not_found` : Annotation does not exist.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_annotation")
|
||||
@service_api_ns.doc(description="Delete an annotation")
|
||||
@service_api_ns.doc(params={"annotation_id": "Annotation ID"})
|
||||
|
||||
@ -33,6 +33,18 @@ register_response_schema_models(service_api_ns, Parameters, AppMetaResponse, App
|
||||
class AppParameterApi(Resource):
|
||||
"""Resource for app variables."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get App Parameters",
|
||||
description=(
|
||||
"Retrieve the application's input form configuration, including feature switches, input "
|
||||
"parameter names, types, and default values."
|
||||
),
|
||||
tags=["Applications"],
|
||||
responses={
|
||||
200: "Application parameters information.",
|
||||
400: "`app_unavailable` : App unavailable or misconfigured.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_app_parameters")
|
||||
@service_api_ns.doc(description="Retrieve application input parameters and configuration")
|
||||
@service_api_ns.doc(
|
||||
@ -71,6 +83,14 @@ class AppParameterApi(Resource):
|
||||
|
||||
@service_api_ns.route("/meta")
|
||||
class AppMetaApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get App Meta",
|
||||
description="Retrieve metadata about this application, including tool icons and other configuration details.",
|
||||
tags=["Applications"],
|
||||
responses={
|
||||
200: "Successfully retrieved application meta information.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_app_meta")
|
||||
@service_api_ns.doc(description="Get application metadata")
|
||||
@service_api_ns.doc(
|
||||
@ -92,6 +112,14 @@ class AppMetaApi(Resource):
|
||||
|
||||
@service_api_ns.route("/info")
|
||||
class AppInfoApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get App Info",
|
||||
description="Retrieve basic information about this application, including name, description, tags, and mode.",
|
||||
tags=["Applications"],
|
||||
responses={
|
||||
200: "Basic information of the application.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_app_info")
|
||||
@service_api_ns.doc(description="Get basic application information")
|
||||
@service_api_ns.doc(
|
||||
|
||||
@ -40,6 +40,28 @@ register_response_schema_models(service_api_ns, AudioBinaryResponse, AudioTransc
|
||||
|
||||
@service_api_ns.route("/audio-to-text")
|
||||
class AudioApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Convert Audio to Text",
|
||||
description=(
|
||||
"Convert audio file to text. Supported MIME types: `audio/mp3`, `audio/mpga`, `audio/m4a`, "
|
||||
"`audio/wav`, and `audio/amr`. File size limit is `30 MB`."
|
||||
),
|
||||
tags=["TTS"],
|
||||
responses={
|
||||
200: "Successfully converted audio to text.",
|
||||
400: (
|
||||
"- `app_unavailable` : App unavailable or misconfigured.\n"
|
||||
"- `provider_not_support_speech_to_text` : Model provider does not support speech-to-text.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model does not support this operation.\n"
|
||||
"- `completion_request_error` : Speech recognition request failed."
|
||||
),
|
||||
413: "`audio_too_large` : Audio file size exceeded the limit.",
|
||||
415: "`unsupported_audio_type` : Audio type is not allowed.",
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("audio_to_text")
|
||||
@service_api_ns.doc(description="Convert audio to text using speech-to-text")
|
||||
@service_api_ns.doc(consumes=["multipart/form-data"], params=multipart_file_params(include_user=True))
|
||||
@ -101,6 +123,25 @@ register_schema_model(service_api_ns, TextToAudioPayload)
|
||||
|
||||
@service_api_ns.route("/text-to-audio")
|
||||
class TextApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Convert Text to Audio",
|
||||
description="Convert text to speech.",
|
||||
tags=["TTS"],
|
||||
responses={
|
||||
200: (
|
||||
"Returns the generated audio. Generator responses are streamed by the service as `audio/mpeg`; "
|
||||
"otherwise the provider output is returned directly."
|
||||
),
|
||||
400: (
|
||||
"- `app_unavailable` : App unavailable or misconfigured.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model does not support this operation.\n"
|
||||
"- `completion_request_error` : Text-to-speech request failed."
|
||||
),
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, TextToAudioPayload)
|
||||
@binary_response(service_api_ns, "audio/mpeg")
|
||||
@service_api_ns.doc("text_to_audio")
|
||||
|
||||
@ -93,6 +93,31 @@ register_response_schema_models(service_api_ns, GeneratedAppResponse, SimpleResu
|
||||
|
||||
@service_api_ns.route("/completion-messages")
|
||||
class CompletionApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Send Completion Message",
|
||||
description="Send a request to the text generation application.",
|
||||
tags=["Completions"],
|
||||
responses={
|
||||
200: (
|
||||
"Successful response. The content type and structure depend on the `response_mode` parameter "
|
||||
"in the request.\n"
|
||||
"\n"
|
||||
"- If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` "
|
||||
"object.\n"
|
||||
"- If `response_mode` is `streaming`, returns `text/event-stream` with a stream of "
|
||||
"`ChunkCompletionEvent` objects."
|
||||
),
|
||||
400: (
|
||||
"- `app_unavailable` : App unavailable or misconfigured.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model unavailable.\n"
|
||||
"- `completion_request_error` : Text generation failed."
|
||||
),
|
||||
429: "`too_many_requests` : Too many concurrent requests for this app.",
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, CompletionRequestPayload)
|
||||
@json_or_event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc("create_completion")
|
||||
@ -170,6 +195,14 @@ class CompletionApi(Resource):
|
||||
|
||||
@service_api_ns.route("/completion-messages/<string:task_id>/stop")
|
||||
class CompletionStopApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Stop Completion Message Generation",
|
||||
description="Stops a completion message generation task. Only supported in `streaming` mode.",
|
||||
tags=["Completions"],
|
||||
responses={
|
||||
400: "`app_unavailable` : App unavailable or misconfigured.",
|
||||
},
|
||||
)
|
||||
@expect_user_json(service_api_ns)
|
||||
@service_api_ns.doc("stop_completion")
|
||||
@service_api_ns.doc(description="Stop a running completion task")
|
||||
@ -200,6 +233,37 @@ class CompletionStopApi(Resource):
|
||||
|
||||
@service_api_ns.route("/chat-messages")
|
||||
class ChatApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Send Chat Message",
|
||||
description="Send a request to the chat application.",
|
||||
tags=["Chats", "Chatflows"],
|
||||
responses={
|
||||
200: (
|
||||
"Successful response. The content type and structure depend on the `response_mode` parameter "
|
||||
"in the request.\n"
|
||||
"\n"
|
||||
"- If `response_mode` is `blocking`, returns `application/json` with a "
|
||||
"`ChatCompletionResponse` object.\n"
|
||||
"- If `response_mode` is `streaming`, returns `text/event-stream` with a stream of "
|
||||
"Server-Sent Events."
|
||||
),
|
||||
400: (
|
||||
"- `app_unavailable` : App unavailable or misconfigured.\n"
|
||||
"- `not_chat_app` : App mode does not match the API route.\n"
|
||||
"- `conversation_completed` : The conversation has ended.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model unavailable.\n"
|
||||
"- `completion_request_error` : Text generation failed."
|
||||
),
|
||||
404: "`not_found` : Conversation does not exist.",
|
||||
429: (
|
||||
"- `too_many_requests` : Too many concurrent requests for this app.\n"
|
||||
"- `rate_limit_error` : The upstream model provider rate limit was exceeded."
|
||||
),
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, ChatRequestPayload)
|
||||
@json_or_event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc("create_chat_message")
|
||||
@ -280,6 +344,14 @@ class ChatApi(Resource):
|
||||
|
||||
@service_api_ns.route("/chat-messages/<string:task_id>/stop")
|
||||
class ChatStopApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Stop Chat Message Generation",
|
||||
description="Stops a chat message generation task. Only supported in `streaming` mode.",
|
||||
tags=["Chats", "Chatflows"],
|
||||
responses={
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
},
|
||||
)
|
||||
@expect_user_json(service_api_ns)
|
||||
@service_api_ns.doc("stop_chat_message")
|
||||
@service_api_ns.doc(description="Stop a running chat message generation")
|
||||
|
||||
@ -146,6 +146,16 @@ register_response_schema_models(
|
||||
|
||||
@service_api_ns.route("/conversations")
|
||||
class ConversationApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Conversations",
|
||||
description="Retrieve the conversation list for the current user, ordered by most recently active.",
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
200: "Successfully retrieved conversations list.",
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
404: "`not_found` : Last conversation does not exist (invalid `last_id`).",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(ConversationListQuery))
|
||||
@service_api_ns.doc("list_conversations")
|
||||
@service_api_ns.doc(description="List all conversations for the current user")
|
||||
@ -198,6 +208,16 @@ class ConversationApi(Resource):
|
||||
|
||||
@service_api_ns.route("/conversations/<uuid:c_id>")
|
||||
class ConversationDetailApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Conversation",
|
||||
description="Delete a conversation.",
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
204: "Conversation deleted successfully.",
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
404: "`not_found` : Conversation does not exist.",
|
||||
},
|
||||
)
|
||||
@expect_user_json(service_api_ns)
|
||||
@service_api_ns.doc("delete_conversation")
|
||||
@service_api_ns.doc(description="Delete a specific conversation")
|
||||
@ -227,6 +247,19 @@ class ConversationDetailApi(Resource):
|
||||
|
||||
@service_api_ns.route("/conversations/<uuid:c_id>/name")
|
||||
class ConversationRenameApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Rename Conversation",
|
||||
description=(
|
||||
"Rename a conversation or auto-generate a name. The conversation name is used for display on "
|
||||
"clients that support multiple conversations."
|
||||
),
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
200: "Conversation renamed successfully.",
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
404: "`not_found` : Conversation does not exist.",
|
||||
},
|
||||
)
|
||||
@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")
|
||||
@ -269,6 +302,16 @@ class ConversationRenameApi(Resource):
|
||||
|
||||
@service_api_ns.route("/conversations/<uuid:c_id>/variables")
|
||||
class ConversationVariablesApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Conversation Variables",
|
||||
description="Retrieve variables from a specific conversation.",
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
200: "Successfully retrieved conversation variables.",
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
404: "`not_found` : Conversation does not exist.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(ConversationVariablesQuery))
|
||||
@service_api_ns.doc("list_conversation_variables")
|
||||
@service_api_ns.doc(description="List all variables for a conversation")
|
||||
@ -314,6 +357,21 @@ class ConversationVariablesApi(Resource):
|
||||
|
||||
@service_api_ns.route("/conversations/<uuid:c_id>/variables/<uuid:variable_id>")
|
||||
class ConversationVariableDetailApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Update Conversation Variable",
|
||||
description="Update the value of a specific conversation variable. The value must match the expected type.",
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
200: "Variable updated successfully.",
|
||||
400: (
|
||||
"- `not_chat_app` : App mode does not match the API route.\n"
|
||||
"- `bad_request` : Variable value type mismatch."
|
||||
),
|
||||
404: (
|
||||
"- `not_found` : Conversation does not exist.\n- `not_found` : Conversation variable does not exist."
|
||||
),
|
||||
},
|
||||
)
|
||||
@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")
|
||||
|
||||
@ -24,6 +24,24 @@ register_schema_models(service_api_ns, FileResponse)
|
||||
|
||||
@service_api_ns.route("/files/upload")
|
||||
class FileApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Upload File",
|
||||
description=(
|
||||
"Upload a file for use when sending messages, enabling multimodal understanding of images, "
|
||||
"documents, audio, and video. Uploaded files are for use by the current end-user only."
|
||||
),
|
||||
tags=["Files"],
|
||||
responses={
|
||||
201: "File uploaded successfully.",
|
||||
400: (
|
||||
"- `no_file_uploaded` : No file was provided in the request.\n"
|
||||
"- `too_many_files` : Only one file is allowed per request.\n"
|
||||
"- `filename_not_exists_error` : The uploaded file has no filename."
|
||||
),
|
||||
413: "`file_too_large` : File size exceeded.",
|
||||
415: "`unsupported_file_type` : File type not allowed.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("upload_file")
|
||||
@service_api_ns.doc(description="Upload a file for use in conversations")
|
||||
@service_api_ns.doc(consumes=["multipart/form-data"], params=multipart_file_params(include_user=True))
|
||||
|
||||
@ -61,6 +61,24 @@ class FilePreviewApi(Resource):
|
||||
Files can only be accessed if they belong to messages within the requesting app's context.
|
||||
"""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Download File",
|
||||
description=(
|
||||
"Preview or download uploaded files previously uploaded via the [Upload "
|
||||
"File](/api-reference/files/upload-file) API. Files can only be accessed if they belong to "
|
||||
"messages within the requesting application."
|
||||
),
|
||||
tags=["Files"],
|
||||
responses={
|
||||
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`."
|
||||
),
|
||||
403: "`file_access_denied` : Access to the requested file is denied.",
|
||||
404: "`file_not_found` : The requested file was not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(FilePreviewQuery))
|
||||
@binary_response(service_api_ns, FILE_PREVIEW_RESPONSE_MEDIA_TYPES)
|
||||
@service_api_ns.doc("preview_file")
|
||||
|
||||
@ -73,6 +73,23 @@ def _ensure_form_is_allowed_for_service_api(form: Form) -> None:
|
||||
|
||||
@service_api_ns.route("/form/human_input/<string:form_token>")
|
||||
class WorkflowHumanInputFormApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Human Input Form",
|
||||
description=(
|
||||
"Retrieve a paused Human Input form's contents using the `form_token` from a "
|
||||
"`human_input_required` event. Requires **WebApp** delivery."
|
||||
),
|
||||
tags=["Human Input"],
|
||||
responses={
|
||||
200: "Form contents retrieved successfully.",
|
||||
404: "`not_found` : Form not found.",
|
||||
412: (
|
||||
"- `human_input_form_submitted` : Form already submitted. Forms are one-shot; the first "
|
||||
"response wins regardless of which user submits it.\n"
|
||||
"- `human_input_form_expired` : The form's expiration time passed before submission arrived."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_human_input_form")
|
||||
@service_api_ns.doc(description="Get a paused human input form by token")
|
||||
@service_api_ns.doc(params={"form_token": "Human input form token"})
|
||||
@ -102,6 +119,28 @@ class WorkflowHumanInputFormApi(Resource):
|
||||
inputs = service.resolve_form_inputs(form)
|
||||
return _jsonify_form_definition(form, inputs=inputs)
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Submit Human Input Form",
|
||||
description=(
|
||||
"Submit the recipient's response to a paused Human Input form. The workflow resumes on "
|
||||
"acceptance; use [Stream Workflow Events](/api-reference/chatflows/stream-workflow-events) "
|
||||
"to follow subsequent events. Requires **WebApp** delivery."
|
||||
),
|
||||
tags=["Human Input"],
|
||||
responses={
|
||||
200: "Form submitted successfully. The response body is an empty object.",
|
||||
400: (
|
||||
"- `bad_request` : Form recipient type is invalid.\n"
|
||||
"- `invalid_form_data` : Submission failed validation against the form definition."
|
||||
),
|
||||
404: "`not_found` : Form not found.",
|
||||
412: (
|
||||
"- `human_input_form_submitted` : Form already submitted. Forms are one-shot; the first "
|
||||
"response wins regardless of which user submits it.\n"
|
||||
"- `human_input_form_expired` : The form's expiration time passed before submission arrived."
|
||||
),
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, HumanInputFormSubmitPayload)
|
||||
@service_api_ns.doc("submit_human_input_form")
|
||||
@service_api_ns.doc(description="Submit a paused human input form by token")
|
||||
|
||||
@ -65,6 +65,19 @@ register_response_schema_models(
|
||||
|
||||
@service_api_ns.route("/messages")
|
||||
class MessageListApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Conversation Messages",
|
||||
description=(
|
||||
"Returns historical chat records in a scrolling load format, with the first page returning "
|
||||
"the latest `limit` messages, i.e., in reverse order."
|
||||
),
|
||||
tags=["Conversations"],
|
||||
responses={
|
||||
200: "Successfully retrieved conversation history.",
|
||||
400: "`not_chat_app` : App mode does not match the API route.",
|
||||
404: ("- `not_found` : Conversation does not exist.\n- `not_found` : First message does not exist."),
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(MessageListQuery))
|
||||
@service_api_ns.doc("list_messages")
|
||||
@service_api_ns.doc(description="List messages in a conversation")
|
||||
@ -113,6 +126,18 @@ class MessageListApi(Resource):
|
||||
|
||||
@service_api_ns.route("/messages/<uuid:message_id>/feedbacks")
|
||||
class MessageFeedbackApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Submit Message Feedback",
|
||||
description=(
|
||||
"Submit feedback for a message. End users can rate messages as `like` or `dislike`, and "
|
||||
"optionally provide text feedback. Pass `null` for `rating` to revoke previously submitted "
|
||||
"feedback."
|
||||
),
|
||||
tags=["Feedback"],
|
||||
responses={
|
||||
404: "`not_found` : Message does not exist.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, MessageFeedbackPayload)
|
||||
@service_api_ns.response(200, "Feedback submitted successfully", service_api_ns.models[ResultResponse.__name__])
|
||||
@service_api_ns.doc("create_message_feedback")
|
||||
@ -151,6 +176,17 @@ class MessageFeedbackApi(Resource):
|
||||
|
||||
@service_api_ns.route("/app/feedbacks")
|
||||
class AppGetFeedbacksApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List App Feedbacks",
|
||||
description=(
|
||||
"Retrieve a paginated list of all feedback submitted for messages in this application, "
|
||||
"including both end-user and admin feedback."
|
||||
),
|
||||
tags=["Feedback"],
|
||||
responses={
|
||||
200: "A list of application feedbacks.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(FeedbackListQuery))
|
||||
@service_api_ns.doc("get_app_feedbacks")
|
||||
@service_api_ns.doc(description="Get all feedbacks for the application")
|
||||
@ -178,6 +214,20 @@ class AppGetFeedbacksApi(Resource):
|
||||
|
||||
@service_api_ns.route("/messages/<uuid:message_id>/suggested")
|
||||
class MessageSuggestedApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Next Suggested Questions",
|
||||
description="Get next questions suggestions for the current message.",
|
||||
tags=["Chats", "Chatflows"],
|
||||
responses={
|
||||
200: "Successfully retrieved suggested questions.",
|
||||
400: (
|
||||
"- `not_chat_app` : App mode does not match the API route.\n"
|
||||
"- `bad_request` : Suggested questions feature is disabled."
|
||||
),
|
||||
404: "`not_found` : Message does not exist.",
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Suggested questions retrieved successfully",
|
||||
|
||||
@ -17,6 +17,18 @@ register_response_schema_models(service_api_ns, SiteResponse)
|
||||
class AppSiteApi(Resource):
|
||||
"""Resource for app sites."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get App WebApp Settings",
|
||||
description=(
|
||||
"Retrieve the WebApp settings of this application, including site configuration, theme, and "
|
||||
"customization options."
|
||||
),
|
||||
tags=["Applications"],
|
||||
responses={
|
||||
200: "WebApp settings of the application.",
|
||||
403: "`forbidden` : Site not found for this application or the workspace has been archived.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_app_site")
|
||||
@service_api_ns.doc(description="Get application site configuration")
|
||||
@service_api_ns.doc(
|
||||
|
||||
@ -213,6 +213,16 @@ def _serialize_workflow_log_pagination(pagination) -> dict:
|
||||
|
||||
@service_api_ns.route("/workflows/run/<string:workflow_run_id>")
|
||||
class WorkflowRunDetailApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Workflow Run Detail",
|
||||
description="Retrieve the current execution results of a workflow task based on the workflow execution ID.",
|
||||
tags=["Chatflows", "Workflows"],
|
||||
responses={
|
||||
200: "Successfully retrieved workflow run details.",
|
||||
400: "`not_workflow_app` : App mode does not match the API route.",
|
||||
404: "`not_found` : Workflow run not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_workflow_run_detail")
|
||||
@service_api_ns.doc(description="Get workflow run details")
|
||||
@service_api_ns.doc(params={"workflow_run_id": "Workflow run ID"})
|
||||
@ -254,6 +264,35 @@ class WorkflowRunDetailApi(Resource):
|
||||
|
||||
@service_api_ns.route("/workflows/run")
|
||||
class WorkflowRunApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Run Workflow",
|
||||
description="Execute a workflow. Cannot be executed without a published workflow.",
|
||||
tags=["Workflows"],
|
||||
responses={
|
||||
200: (
|
||||
"Successful response. The content type and structure depend on the `response_mode` parameter "
|
||||
"in the request.\n"
|
||||
"\n"
|
||||
"- If `response_mode` is `blocking`, returns `application/json` with a "
|
||||
"`WorkflowBlockingResponse` object.\n"
|
||||
"- If `response_mode` is `streaming`, returns `text/event-stream` with a stream of "
|
||||
"`ChunkWorkflowEvent` objects."
|
||||
),
|
||||
400: (
|
||||
"- `not_workflow_app` : App mode does not match the API route.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model unavailable.\n"
|
||||
"- `completion_request_error` : Workflow execution request failed.\n"
|
||||
"- `invalid_param` : Invalid parameter value."
|
||||
),
|
||||
429: (
|
||||
"- `too_many_requests` : Too many concurrent requests for this app.\n"
|
||||
"- `rate_limit_error` : The upstream model provider rate limit was exceeded."
|
||||
),
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, WorkflowRunPayload)
|
||||
@json_or_event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc("run_workflow")
|
||||
@ -319,6 +358,40 @@ class WorkflowRunApi(Resource):
|
||||
|
||||
@service_api_ns.route("/workflows/<string:workflow_id>/run")
|
||||
class WorkflowRunByIdApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Run Workflow by ID",
|
||||
description=(
|
||||
"Execute a specific workflow version identified by its ID. Useful for running a particular "
|
||||
"published version of the workflow."
|
||||
),
|
||||
tags=["Workflows"],
|
||||
responses={
|
||||
200: (
|
||||
"Successful response. The content type and structure depend on the `response_mode` parameter "
|
||||
"in the request.\n"
|
||||
"\n"
|
||||
"- If `response_mode` is `blocking`, returns `application/json` with a "
|
||||
"`WorkflowBlockingResponse` object.\n"
|
||||
"- If `response_mode` is `streaming`, returns `text/event-stream` with a stream of "
|
||||
"`ChunkWorkflowEvent` objects."
|
||||
),
|
||||
400: (
|
||||
"- `not_workflow_app` : App mode does not match the API route.\n"
|
||||
"- `bad_request` : Workflow is a draft or has an invalid ID format.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found.\n"
|
||||
"- `provider_quota_exceeded` : Model provider quota exhausted.\n"
|
||||
"- `model_currently_not_support` : Current model unavailable.\n"
|
||||
"- `completion_request_error` : Workflow execution request failed.\n"
|
||||
"- `invalid_param` : Required parameter missing or invalid."
|
||||
),
|
||||
404: "`not_found` : Workflow not found.",
|
||||
429: (
|
||||
"- `too_many_requests` : Too many concurrent requests for this app.\n"
|
||||
"- `rate_limit_error` : The upstream model provider rate limit was exceeded."
|
||||
),
|
||||
500: "`internal_server_error` : Internal server error.",
|
||||
},
|
||||
)
|
||||
@expect_with_user(service_api_ns, WorkflowRunPayload)
|
||||
@json_or_event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc("run_workflow_by_id")
|
||||
@ -394,6 +467,17 @@ class WorkflowRunByIdApi(Resource):
|
||||
|
||||
@service_api_ns.route("/workflows/tasks/<string:task_id>/stop")
|
||||
class WorkflowTaskStopApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Stop Workflow Task",
|
||||
description="Stop a running workflow task. Only supported in `streaming` mode.",
|
||||
tags=["Workflows"],
|
||||
responses={
|
||||
400: (
|
||||
"- `not_workflow_app` : App mode does not match the API route.\n"
|
||||
"- `invalid_param` : Required parameter missing or invalid."
|
||||
),
|
||||
},
|
||||
)
|
||||
@expect_user_json(service_api_ns)
|
||||
@service_api_ns.doc("stop_workflow_task")
|
||||
@service_api_ns.doc(description="Stop a running workflow task")
|
||||
@ -425,6 +509,14 @@ class WorkflowTaskStopApi(Resource):
|
||||
|
||||
@service_api_ns.route("/workflows/logs")
|
||||
class WorkflowAppLogApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Workflow Logs",
|
||||
description="Retrieve paginated workflow execution logs with filtering options.",
|
||||
tags=["Chatflows", "Workflows"],
|
||||
responses={
|
||||
200: "Successfully retrieved workflow logs.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(params=query_params_from_model(WorkflowLogQuery))
|
||||
@service_api_ns.doc("get_workflow_logs")
|
||||
@service_api_ns.doc(description="Get workflow execution logs")
|
||||
|
||||
@ -45,6 +45,23 @@ register_response_schema_model(service_api_ns, EventStreamResponse)
|
||||
class WorkflowEventsApi(Resource):
|
||||
"""Service API for getting workflow execution events after resume."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Stream Workflow Events",
|
||||
description=(
|
||||
"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."
|
||||
),
|
||||
tags=["Chatflows", "Workflows"],
|
||||
responses={
|
||||
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."
|
||||
),
|
||||
400: "`not_workflow_app` : Please check if your app mode matches the right API route.",
|
||||
404: "`not_found` : Workflow run not found.",
|
||||
},
|
||||
)
|
||||
@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")
|
||||
|
||||
@ -250,6 +250,14 @@ register_response_schema_models(
|
||||
class DatasetListApi(DatasetApiResource):
|
||||
"""Resource for datasets."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="List Knowledge Bases",
|
||||
description="Returns a paginated list of knowledge bases. Supports filtering by keyword and tags.",
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
200: "List of knowledge bases.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_datasets")
|
||||
@service_api_ns.doc(description="List all datasets")
|
||||
@service_api_ns.doc(
|
||||
@ -308,6 +316,19 @@ class DatasetListApi(DatasetApiResource):
|
||||
}
|
||||
return dump_response(DatasetListResponse, response), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create an Empty Knowledge Base",
|
||||
description=(
|
||||
"Create a new empty knowledge base. After creation, use [Create Document by "
|
||||
"Text](/api-reference/documents/create-document-by-text) or [Create Document by "
|
||||
"File](/api-reference/documents/create-document-by-file) to add documents."
|
||||
),
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
200: "Knowledge base created successfully.",
|
||||
409: "`dataset_name_duplicate` : The dataset name already exists. Please modify your dataset name.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[DatasetCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_dataset")
|
||||
@service_api_ns.doc(description="Create a new dataset")
|
||||
@ -373,6 +394,19 @@ class DatasetListApi(DatasetApiResource):
|
||||
class DatasetApi(DatasetApiResource):
|
||||
"""Resource for dataset."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get Knowledge Base",
|
||||
description=(
|
||||
"Retrieve detailed information about a specific knowledge base, including its embedding "
|
||||
"model, retrieval configuration, and document statistics."
|
||||
),
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
200: "Knowledge base details.",
|
||||
403: "`forbidden` : Insufficient permissions to access this knowledge base.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_dataset")
|
||||
@service_api_ns.doc(description="Get a specific dataset by ID")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID"})
|
||||
@ -438,6 +472,19 @@ class DatasetApi(DatasetApiResource):
|
||||
200,
|
||||
)
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Knowledge Base",
|
||||
description=(
|
||||
"Update the name, description, permissions, or retrieval settings of an existing knowledge "
|
||||
"base. Only the fields provided in the request body are updated."
|
||||
),
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
200: "Knowledge base updated successfully.",
|
||||
403: "`forbidden` : Insufficient permissions to access this knowledge base.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[DatasetUpdatePayload.__name__])
|
||||
@service_api_ns.doc("update_dataset")
|
||||
@service_api_ns.doc(description="Update an existing dataset")
|
||||
@ -520,6 +567,22 @@ class DatasetApi(DatasetApiResource):
|
||||
|
||||
return DatasetDetailWithPartialMembersResponse.model_validate(result_data).model_dump(mode="json"), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Knowledge Base",
|
||||
description=(
|
||||
"Permanently delete a knowledge base and all its documents. The knowledge base must not be "
|
||||
"in use by any application."
|
||||
),
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
409: (
|
||||
"`dataset_in_use` : The knowledge base is being used by some apps. Please remove it from the "
|
||||
"apps before deleting."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_dataset")
|
||||
@service_api_ns.doc(description="Delete a dataset")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID"})
|
||||
@ -565,6 +628,17 @@ class DatasetApi(DatasetApiResource):
|
||||
class DocumentStatusApi(DatasetApiResource):
|
||||
"""Resource for batch document status operations."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Document Status in Batch",
|
||||
description="Enable, disable, archive, or unarchive multiple documents at once.",
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Documents updated successfully.",
|
||||
400: "`invalid_action` : Invalid action.",
|
||||
403: "`forbidden` : Insufficient permissions.",
|
||||
404: "`not_found` : Knowledge base not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.response(
|
||||
200,
|
||||
"Document status updated successfully",
|
||||
@ -637,6 +711,14 @@ class DocumentStatusApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/tags")
|
||||
class DatasetTagsApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Knowledge Tags",
|
||||
description="Returns the list of all knowledge base tags in the workspace.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
200: "List of tags.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_dataset_tags")
|
||||
@service_api_ns.doc(description="Get all knowledge type tags")
|
||||
@service_api_ns.doc(
|
||||
@ -658,6 +740,14 @@ class DatasetTagsApi(DatasetApiResource):
|
||||
tags = TagService.get_tags(db.session(), "knowledge", cid)
|
||||
return dump_response(KnowledgeTagListResponse, tags), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Knowledge Tag",
|
||||
description="Create a new tag for organizing knowledge bases.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
200: "Tag created successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[TagCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_dataset_tag")
|
||||
@service_api_ns.doc(description="Add a knowledge type tag")
|
||||
@ -688,6 +778,14 @@ class DatasetTagsApi(DatasetApiResource):
|
||||
)
|
||||
return response, 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Knowledge Tag",
|
||||
description="Rename an existing knowledge base tag.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
200: "Tag updated successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[TagUpdatePayload.__name__])
|
||||
@service_api_ns.doc("update_dataset_tag")
|
||||
@service_api_ns.doc(description="Update a knowledge type tag")
|
||||
@ -720,6 +818,14 @@ class DatasetTagsApi(DatasetApiResource):
|
||||
)
|
||||
return response, 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Knowledge Tag",
|
||||
description="Permanently delete a knowledge base tag. Does not delete the knowledge bases that were tagged.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[TagDeletePayload.__name__])
|
||||
@service_api_ns.doc("delete_dataset_tag")
|
||||
@service_api_ns.doc(description="Delete a knowledge type tag")
|
||||
@ -741,6 +847,14 @@ class DatasetTagsApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/tags/binding")
|
||||
class DatasetTagBindingApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Create Tag Binding",
|
||||
description="Bind one or more tags to a knowledge base. A knowledge base can have multiple tags.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[TagBindingPayload.__name__])
|
||||
@service_api_ns.doc("bind_dataset_tags")
|
||||
@service_api_ns.doc(description="Bind tags to a dataset")
|
||||
@ -767,6 +881,14 @@ class DatasetTagBindingApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/tags/unbinding")
|
||||
class DatasetTagUnbindingApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Tag Binding",
|
||||
description="Remove one or more tags from a knowledge base.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[TagUnbindingPayload.__name__])
|
||||
@service_api_ns.doc("unbind_dataset_tags")
|
||||
@service_api_ns.doc(description="Unbind tags from a dataset")
|
||||
@ -793,6 +915,14 @@ class DatasetTagUnbindingApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/tags")
|
||||
class DatasetTagsBindingStatusApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Knowledge Base Tags",
|
||||
description="Returns the list of tags bound to a specific knowledge base.",
|
||||
tags=["Tags"],
|
||||
responses={
|
||||
200: "Tags bound to the knowledge base.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_dataset_tags_binding_status")
|
||||
@service_api_ns.doc(description="Get tags bound to a specific dataset")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID"})
|
||||
|
||||
@ -401,6 +401,24 @@ def _update_document_by_text(tenant_id: str, dataset_id: UUID, document_id: UUID
|
||||
class DocumentAddByTextApi(DatasetApiResource):
|
||||
"""Resource for the canonical text document creation route."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Document by Text",
|
||||
description=(
|
||||
"Create a document from raw text content. The document is processed asynchronously — use the "
|
||||
"returned `batch` ID with [Get Document Indexing Status](/api-reference/documents/"
|
||||
"get-document-indexing-status) to track progress."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Document created successfully.",
|
||||
400: (
|
||||
"- `provider_not_initialize` : No valid model provider credentials found. Please go to "
|
||||
"Settings -> Model Provider to complete your provider credentials.\n"
|
||||
"- `invalid_param` : Knowledge base does not exist. / indexing_technique is required. / "
|
||||
"Invalid doc_form (must be `text_model`, `hierarchical_model`, or `qa_model`)."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[DocumentTextCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_document_by_text")
|
||||
@service_api_ns.doc(description="Create a new document by providing text content")
|
||||
@ -459,6 +477,25 @@ class DeprecatedDocumentAddByTextApi(DatasetApiResource):
|
||||
class DocumentUpdateByTextApi(DatasetApiResource):
|
||||
"""Resource for the canonical text document update route."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Document by Text",
|
||||
description=(
|
||||
"Update an existing document's text content, name, or processing configuration. Re-triggers "
|
||||
"indexing if content changes — use the returned `batch` ID with [Get Document Indexing "
|
||||
"Status](/api-reference/documents/get-document-indexing-status) to track progress."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Document updated successfully.",
|
||||
400: (
|
||||
"- `provider_not_initialize` : No valid model provider credentials found. Please go to "
|
||||
"Settings -> Model Provider to complete your provider credentials.\n"
|
||||
"- `invalid_param` : Knowledge base does not exist, name is required when text is "
|
||||
"provided, or invalid doc_form (must be `text_model`, `hierarchical_model`, or "
|
||||
"`qa_model`)."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[DocumentTextUpdate.__name__])
|
||||
@service_api_ns.doc("update_document_by_text")
|
||||
@service_api_ns.doc(description="Update an existing document by providing text content")
|
||||
@ -527,6 +564,28 @@ class DeprecatedDocumentUpdateByTextApi(DatasetApiResource):
|
||||
class DocumentAddByFileApi(DatasetApiResource):
|
||||
"""Resource for documents."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Document by File",
|
||||
description=(
|
||||
"Create a document by uploading a file. Supports common document formats (PDF, TXT, DOCX, "
|
||||
"etc.). Processing is asynchronous — use the returned `batch` ID with [Get Document "
|
||||
"Indexing Status](/api-reference/documents/get-document-indexing-status) to track progress."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Document created successfully.",
|
||||
400: (
|
||||
"- `no_file_uploaded` : Please upload your file.\n"
|
||||
"- `too_many_files` : Only one file is allowed.\n"
|
||||
"- `filename_not_exists_error` : The specified filename does not exist.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found. Please go to "
|
||||
"Settings -> Model Provider to complete your provider credentials.\n"
|
||||
"- `invalid_param` : Knowledge base does not exist, external datasets not supported, "
|
||||
"file too large, unsupported file type, missing required fields, or invalid doc_form "
|
||||
"(must be `text_model`, `hierarchical_model`, or `qa_model`)."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("create_document_by_file")
|
||||
@service_api_ns.doc(description="Create a new document by uploading a file")
|
||||
@service_api_ns.doc(consumes=["multipart/form-data"], params=DOCUMENT_CREATE_BY_FILE_PARAMS)
|
||||
@ -717,6 +776,27 @@ def _update_document_by_file(tenant_id: str, dataset_id: UUID, document_id: UUID
|
||||
class DeprecatedDocumentUpdateByFileApi(DatasetApiResource):
|
||||
"""Deprecated resource aliases for file document updates."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Document by File",
|
||||
description=(
|
||||
"Update an existing document by uploading a new file. Re-triggers indexing — use the returned "
|
||||
"`batch` ID with [Get Document Indexing Status](/api-reference/documents/"
|
||||
"get-document-indexing-status) to track progress."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Document updated successfully.",
|
||||
400: (
|
||||
"- `too_many_files` : Only one file is allowed.\n"
|
||||
"- `filename_not_exists_error` : The specified filename does not exist.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found. Please go to "
|
||||
"Settings -> Model Provider to complete your provider credentials.\n"
|
||||
"- `invalid_param` : Knowledge base does not exist, external datasets not supported, "
|
||||
"file too large, unsupported file type, or invalid doc_form (must be `text_model`, "
|
||||
"`hierarchical_model`, or `qa_model`)."
|
||||
),
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("update_document_by_file_deprecated")
|
||||
@service_api_ns.doc(deprecated=True)
|
||||
@service_api_ns.doc(
|
||||
@ -745,6 +825,18 @@ class DeprecatedDocumentUpdateByFileApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/documents")
|
||||
class DocumentListApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="List Documents",
|
||||
description=(
|
||||
"Returns a paginated list of documents in the knowledge base. Supports filtering by keyword "
|
||||
"and indexing status."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "List of documents.",
|
||||
404: "`not_found` : Knowledge base not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_documents")
|
||||
@service_api_ns.doc(description="List all documents in a dataset")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", **query_params_from_model(DocumentListQuery)})
|
||||
@ -805,6 +897,18 @@ class DocumentListApi(DatasetApiResource):
|
||||
class DocumentBatchDownloadZipApi(DatasetApiResource):
|
||||
"""Download multiple uploaded-file documents as a single ZIP archive."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Download Documents as ZIP",
|
||||
description=(
|
||||
"Download multiple uploaded-file documents as a single ZIP archive. Accepts up to `100` document IDs."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "ZIP archive containing the requested documents.",
|
||||
403: "`forbidden` : Insufficient permissions.",
|
||||
404: "`not_found` : Document or dataset not found.",
|
||||
},
|
||||
)
|
||||
@binary_response(service_api_ns, "application/zip")
|
||||
@service_api_ns.expect(service_api_ns.models[DocumentBatchDownloadZipPayload.__name__])
|
||||
@service_api_ns.doc("download_documents_as_zip")
|
||||
@ -845,6 +949,20 @@ class DocumentBatchDownloadZipApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/documents/<string:batch>/indexing-status")
|
||||
class DocumentIndexingStatusApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Document Indexing Status",
|
||||
description=(
|
||||
"Check the indexing progress of documents in a batch. Returns the current processing stage "
|
||||
"and chunk completion counts for each document. Poll this endpoint until `indexing_status` "
|
||||
"reaches `completed` or `error`. The status progresses through: `waiting` → `parsing` → "
|
||||
"`cleaning` → `splitting` → `indexing` → `completed`."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Indexing status for documents in the batch.",
|
||||
404: "`not_found` : Knowledge base not found. / Documents not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_document_indexing_status")
|
||||
@service_api_ns.doc(description="Get indexing status for documents in a batch")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "batch": "Batch ID"})
|
||||
@ -917,6 +1035,16 @@ class DocumentIndexingStatusApi(DatasetApiResource):
|
||||
class DocumentDownloadApi(DatasetApiResource):
|
||||
"""Return a signed download URL for a document's original uploaded file."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Download Document",
|
||||
description="Get a signed download URL for a document's original uploaded file.",
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: "Download URL generated successfully.",
|
||||
403: "`forbidden` : No permission to access this document.",
|
||||
404: "`not_found` : Document not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_document_download_url")
|
||||
@service_api_ns.doc(description="Get a signed download URL for a document's original uploaded file")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "document_id": "Document ID"})
|
||||
@ -951,6 +1079,24 @@ class DocumentDownloadApi(DatasetApiResource):
|
||||
class DocumentApi(DatasetApiResource):
|
||||
METADATA_CHOICES = {"all", "only", "without"}
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get Document",
|
||||
description=(
|
||||
"Retrieve detailed information about a specific document, including its indexing status, "
|
||||
"metadata, and processing statistics."
|
||||
),
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
200: (
|
||||
"Document details. The response shape varies based on the `metadata` query parameter. When "
|
||||
"`metadata` is `only`, only `id`, `doc_type`, and `doc_metadata` are returned. When "
|
||||
"`metadata` is `without`, `doc_type` and `doc_metadata` are omitted."
|
||||
),
|
||||
400: "`invalid_metadata` : Invalid metadata value for the specified key.",
|
||||
403: "`forbidden` : No permission.",
|
||||
404: "`not_found` : Document not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_document")
|
||||
@service_api_ns.doc(description="Get a specific document by ID")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "document_id": "Document ID"})
|
||||
@ -1092,6 +1238,17 @@ class DocumentApi(DatasetApiResource):
|
||||
"""Update document by file on the canonical document resource."""
|
||||
return _update_document_by_file(tenant_id=tenant_id, dataset_id=dataset_id, document_id=document_id)
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Document",
|
||||
description="Permanently delete a document and all its chunks from the knowledge base.",
|
||||
tags=["Documents"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
400: "`document_indexing` : Cannot delete document during indexing.",
|
||||
403: "`archived_document_immutable` : The archived document is not editable.",
|
||||
404: "`not_found` : Document Not Exists.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_document")
|
||||
@service_api_ns.doc(description="Delete a document")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "document_id": "Document ID"})
|
||||
|
||||
@ -13,6 +13,32 @@ register_response_schema_models(service_api_ns, HitTestingResponse)
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/hit-testing", "/datasets/<uuid:dataset_id>/retrieve")
|
||||
class HitTestingApi(DatasetApiResource, DatasetsHitTestingBase):
|
||||
@service_api_ns.doc(
|
||||
summary="Retrieve Chunks from a Knowledge Base / Test Retrieval",
|
||||
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."
|
||||
),
|
||||
tags=["Knowledge Bases"],
|
||||
responses={
|
||||
200: "Retrieval results.",
|
||||
400: (
|
||||
"- `dataset_not_initialized` : The dataset is still being initialized or indexing. Please "
|
||||
"wait a moment.\n"
|
||||
"- `provider_not_initialize` : No valid model provider credentials found. Please go to "
|
||||
"Settings -> Model Provider to complete your provider credentials.\n"
|
||||
"- `provider_quota_exceeded` : Your quota for Dify Hosted OpenAI has been exhausted. Please "
|
||||
"go to Settings -> Model Provider to complete your own provider credentials.\n"
|
||||
"- `model_currently_not_support` : Dify Hosted OpenAI trial currently not support the GPT-4 "
|
||||
"model.\n"
|
||||
"- `completion_request_error` : Completion request failed.\n"
|
||||
"- `invalid_param` : Invalid parameter value."
|
||||
),
|
||||
403: "`forbidden` : Insufficient permissions.",
|
||||
404: "`not_found` : Knowledge base not found.",
|
||||
500: "`internal_server_error` : An internal error occurred during retrieval.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("dataset_hit_testing")
|
||||
@service_api_ns.doc(description="Perform hit testing on a dataset")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID"})
|
||||
|
||||
@ -49,6 +49,17 @@ register_response_schema_models(
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/metadata")
|
||||
class DatasetMetadataCreateServiceApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Create Metadata Field",
|
||||
description=(
|
||||
"Create a custom metadata field for the knowledge base. Metadata fields can be used to "
|
||||
"annotate documents with structured information."
|
||||
),
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
201: "Metadata field created successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[MetadataArgs.__name__])
|
||||
@service_api_ns.doc("create_dataset_metadata")
|
||||
@service_api_ns.doc(description="Create metadata for a dataset")
|
||||
@ -77,6 +88,17 @@ class DatasetMetadataCreateServiceApi(DatasetApiResource):
|
||||
metadata = MetadataService.create_metadata(dataset_id_str, metadata_args)
|
||||
return dump_response(DatasetMetadataResponse, metadata), 201
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="List Metadata Fields",
|
||||
description=(
|
||||
"Returns the list of all metadata fields (both custom and built-in) for the knowledge base, "
|
||||
"along with the count of documents using each field."
|
||||
),
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
200: "Metadata fields for the knowledge base.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_dataset_metadata")
|
||||
@service_api_ns.doc(description="Get all metadata for a dataset")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID"})
|
||||
@ -102,6 +124,14 @@ class DatasetMetadataCreateServiceApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/metadata/<uuid:metadata_id>")
|
||||
class DatasetMetadataServiceApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Update Metadata Field",
|
||||
description="Rename a custom metadata field.",
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
200: "Metadata field updated successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[MetadataUpdatePayload.__name__])
|
||||
@service_api_ns.doc("update_dataset_metadata")
|
||||
@service_api_ns.doc(description="Update metadata name")
|
||||
@ -131,6 +161,17 @@ class DatasetMetadataServiceApi(DatasetApiResource):
|
||||
metadata = MetadataService.update_metadata_name(dataset_id_str, metadata_id_str, payload.name)
|
||||
return dump_response(DatasetMetadataResponse, metadata), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Metadata Field",
|
||||
description=(
|
||||
"Permanently delete a custom metadata field. Documents using this field will lose their "
|
||||
"metadata values for it."
|
||||
),
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_dataset_metadata")
|
||||
@service_api_ns.doc(description="Delete metadata")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "metadata_id": "Metadata ID"})
|
||||
@ -158,6 +199,16 @@ class DatasetMetadataServiceApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/metadata/built-in")
|
||||
class DatasetMetadataBuiltInFieldServiceApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Built-in Metadata Fields",
|
||||
description=(
|
||||
"Returns the list of built-in metadata fields provided by the system (e.g., document type, source URL)."
|
||||
),
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
200: "Built-in metadata fields.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_built_in_fields")
|
||||
@service_api_ns.doc(description="Get all built-in metadata fields")
|
||||
@service_api_ns.doc(
|
||||
@ -179,6 +230,14 @@ class DatasetMetadataBuiltInFieldServiceApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/metadata/built-in/<string:action>")
|
||||
class DatasetMetadataBuiltInFieldActionServiceApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Update Built-in Metadata Field",
|
||||
description="Enable or disable built-in metadata fields for the knowledge base.",
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
200: "Built-in metadata field toggled successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("toggle_built_in_field")
|
||||
@service_api_ns.doc(description="Enable or disable built-in metadata field")
|
||||
@service_api_ns.doc(params={"dataset_id": "Dataset ID", "action": BUILT_IN_METADATA_ACTION_PARAM})
|
||||
@ -211,6 +270,17 @@ class DatasetMetadataBuiltInFieldActionServiceApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/documents/metadata")
|
||||
class DocumentMetadataEditServiceApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Update Document Metadata in Batch",
|
||||
description=(
|
||||
"Update metadata values for multiple documents at once. Each document in the request "
|
||||
"receives the specified metadata key-value pairs."
|
||||
),
|
||||
tags=["Metadata"],
|
||||
responses={
|
||||
200: "Document metadata updated successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[MetadataOperationData.__name__])
|
||||
@service_api_ns.doc("update_documents_metadata")
|
||||
@service_api_ns.doc(description="Update metadata for multiple documents")
|
||||
|
||||
@ -100,6 +100,18 @@ register_response_schema_models(
|
||||
class DatasourcePluginsApi(DatasetApiResource):
|
||||
"""Resource for datasource plugins."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="List Datasource Plugins",
|
||||
description=(
|
||||
"List the datasource nodes configured in the knowledge pipeline. Each node includes the "
|
||||
"plugin it uses plus the metadata needed to run it."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
200: "List of datasource nodes configured in the pipeline.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(shortcut="list_rag_pipeline_datasource_plugins")
|
||||
@service_api_ns.doc(description="List all datasource plugins for a rag pipeline")
|
||||
@service_api_ns.doc(
|
||||
@ -142,6 +154,18 @@ class DatasourcePluginsApi(DatasetApiResource):
|
||||
class DatasourceNodeRunApi(DatasetApiResource):
|
||||
"""Resource for datasource node run."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Run Datasource Node",
|
||||
description=(
|
||||
"Execute a single datasource node within the knowledge pipeline. Returns a streaming "
|
||||
"response with the node execution results."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
200: "Streaming response with node execution events.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
},
|
||||
)
|
||||
@event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc(shortcut="pipeline_datasource_node_run")
|
||||
@service_api_ns.doc(description="Run a datasource node for a rag pipeline")
|
||||
@ -201,6 +225,23 @@ class DatasourceNodeRunApi(DatasetApiResource):
|
||||
class PipelineRunApi(DatasetApiResource):
|
||||
"""Resource for datasource node run."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Run Pipeline",
|
||||
description=(
|
||||
"Execute the full knowledge pipeline for a knowledge base. Supports both streaming and "
|
||||
"blocking response modes."
|
||||
),
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
200: (
|
||||
"Pipeline execution result. Format depends on `response_mode`: streaming returns a "
|
||||
"`text/event-stream`, blocking returns a JSON object."
|
||||
),
|
||||
403: "`forbidden` : Forbidden.",
|
||||
404: "`not_found` : Dataset not found.",
|
||||
500: "`pipeline_run_error` : Pipeline execution failed.",
|
||||
},
|
||||
)
|
||||
@json_or_event_stream_response(service_api_ns)
|
||||
@service_api_ns.doc(shortcut="pipeline_datasource_node_run")
|
||||
@service_api_ns.doc(description="Run a datasource node for a rag pipeline")
|
||||
@ -255,6 +296,21 @@ class PipelineRunApi(DatasetApiResource):
|
||||
class KnowledgebasePipelineFileUploadApi(DatasetApiResource):
|
||||
"""Resource for uploading a file to a knowledgebase pipeline."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Upload Pipeline File",
|
||||
description="Upload a file for use in a knowledge pipeline. Accepts a single file via `multipart/form-data`.",
|
||||
tags=["Knowledge Pipeline"],
|
||||
responses={
|
||||
201: "File uploaded successfully.",
|
||||
400: (
|
||||
"- `no_file_uploaded` : Please upload your file.\n"
|
||||
"- `filename_not_exists_error` : The specified filename does not exist.\n"
|
||||
"- `too_many_files` : Only one file is allowed."
|
||||
),
|
||||
413: "`file_too_large` : File size exceeded.",
|
||||
415: "`unsupported_file_type` : File type not allowed.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc(shortcut="knowledgebase_pipeline_file_upload")
|
||||
@service_api_ns.doc(description="Upload a file to a knowledgebase pipeline")
|
||||
@service_api_ns.doc(consumes=["multipart/form-data"], params=multipart_file_params(include_user=False))
|
||||
|
||||
@ -128,6 +128,18 @@ register_response_schema_models(
|
||||
class SegmentApi(DatasetApiResource):
|
||||
"""Resource for segments."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Chunks",
|
||||
description=(
|
||||
"Create one or more chunks within a document. Each chunk can include optional keywords and an "
|
||||
"answer field (for QA-mode documents)."
|
||||
),
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "Chunks created successfully.",
|
||||
404: "`not_found` : Document is not completed or is disabled.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[SegmentCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_segments")
|
||||
@service_api_ns.doc(description="Create segments in a document")
|
||||
@ -209,6 +221,14 @@ class SegmentApi(DatasetApiResource):
|
||||
}
|
||||
return dump_response(SegmentCreateListResponse, response), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="List Chunks",
|
||||
description="Returns a paginated list of chunks within a document. Supports filtering by keyword and status.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "List of chunks.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_segments")
|
||||
@service_api_ns.doc(description="List segments in a document")
|
||||
@service_api_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT)
|
||||
@ -294,6 +314,14 @@ class SegmentApi(DatasetApiResource):
|
||||
|
||||
@service_api_ns.route("/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/segments/<uuid:segment_id>")
|
||||
class DatasetSegmentApi(DatasetApiResource):
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Chunk",
|
||||
description="Permanently delete a chunk from the document.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_segment")
|
||||
@service_api_ns.doc(description="Delete a specific segment")
|
||||
@service_api_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_SEGMENT)
|
||||
@ -329,6 +357,14 @@ class DatasetSegmentApi(DatasetApiResource):
|
||||
SegmentService.delete_segment(segment, document, dataset)
|
||||
return "", 204
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Chunk",
|
||||
description="Update a chunk's content, keywords, or answer. Re-triggers indexing for the modified chunk.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "Chunk updated successfully.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[SegmentUpdatePayload.__name__])
|
||||
@service_api_ns.doc("update_segment")
|
||||
@service_api_ns.doc(description="Update a specific segment")
|
||||
@ -391,6 +427,17 @@ class DatasetSegmentApi(DatasetApiResource):
|
||||
}
|
||||
return dump_response(SegmentDetailResponse, response), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get Chunk",
|
||||
description=(
|
||||
"Retrieve detailed information about a specific chunk, including its content, keywords, and "
|
||||
"indexing status."
|
||||
),
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "Chunk details.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_segment")
|
||||
@service_api_ns.doc(description="Get a specific segment by ID")
|
||||
@service_api_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_SEGMENT)
|
||||
@ -442,6 +489,15 @@ class DatasetSegmentApi(DatasetApiResource):
|
||||
class ChildChunkApi(DatasetApiResource):
|
||||
"""Resource for child chunks."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Create Child Chunk",
|
||||
description="Create a child chunk under the specified segment.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "Child chunk created successfully.",
|
||||
400: "`invalid_param` : Create child chunk index failed.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[ChildChunkCreatePayload.__name__])
|
||||
@service_api_ns.doc("create_child_chunk")
|
||||
@service_api_ns.doc(description="Create a new child chunk for a segment")
|
||||
@ -511,6 +567,14 @@ class ChildChunkApi(DatasetApiResource):
|
||||
|
||||
return dump_response(ChildChunkDetailResponse, {"data": child_chunk}), 200
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="List Child Chunks",
|
||||
description="Returns a paginated list of child chunks under a specific parent chunk.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "List of child chunks.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("list_child_chunks")
|
||||
@service_api_ns.doc(description="List child chunks for a segment")
|
||||
@service_api_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_PARENT_SEGMENT)
|
||||
@ -576,6 +640,15 @@ class ChildChunkApi(DatasetApiResource):
|
||||
class DatasetChildChunkApi(DatasetApiResource):
|
||||
"""Resource for updating child chunks."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Delete Child Chunk",
|
||||
description="Permanently delete a child chunk from its parent chunk.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
204: "Success.",
|
||||
400: "`invalid_param` : Delete child chunk index failed.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("delete_child_chunk")
|
||||
@service_api_ns.doc(description="Delete a specific child chunk")
|
||||
@service_api_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_CHILD_CHUNK)
|
||||
@ -634,6 +707,15 @@ class DatasetChildChunkApi(DatasetApiResource):
|
||||
|
||||
return "", 204
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Update Child Chunk",
|
||||
description="Update the content of an existing child chunk.",
|
||||
tags=["Chunks"],
|
||||
responses={
|
||||
200: "Child chunk updated successfully.",
|
||||
400: "`invalid_param` : Update child chunk index failed.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.expect(service_api_ns.models[ChildChunkUpdatePayload.__name__])
|
||||
@service_api_ns.doc("update_child_chunk")
|
||||
@service_api_ns.doc(description="Update a specific child chunk")
|
||||
|
||||
@ -17,6 +17,18 @@ register_response_schema_models(service_api_ns, EndUserDetail)
|
||||
class EndUserApi(Resource):
|
||||
"""Resource for retrieving end user details by ID."""
|
||||
|
||||
@service_api_ns.doc(
|
||||
summary="Get End User Info",
|
||||
description=(
|
||||
"Retrieve an end user by ID. Useful when other APIs return an end-user ID (e.g., "
|
||||
"`created_by` from [Upload File](/api-reference/files/upload-file))."
|
||||
),
|
||||
tags=["End Users"],
|
||||
responses={
|
||||
200: "End user retrieved successfully.",
|
||||
404: "`end_user_not_found` : End user not found.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_end_user")
|
||||
@service_api_ns.doc(description="Get an end user by ID")
|
||||
@service_api_ns.doc(
|
||||
|
||||
@ -19,6 +19,17 @@ register_response_schema_models(service_api_ns, ProviderWithModelsListResponse)
|
||||
|
||||
@service_api_ns.route("/workspaces/current/models/model-types/<string:model_type>")
|
||||
class ModelProviderAvailableModelApi(Resource):
|
||||
@service_api_ns.doc(
|
||||
summary="Get Available Models",
|
||||
description=(
|
||||
"Retrieve the list of available models by type. Primarily used to query `text-embedding` and "
|
||||
"`rerank` models for knowledge base configuration."
|
||||
),
|
||||
tags=["Models"],
|
||||
responses={
|
||||
200: "Available models for the specified type.",
|
||||
},
|
||||
)
|
||||
@service_api_ns.doc("get_available_models")
|
||||
@service_api_ns.doc(description="Get available models by model type")
|
||||
@service_api_ns.doc(params={"model_type": "Type of model to retrieve"})
|
||||
|
||||
@ -15,6 +15,7 @@ from flask_restx import fields
|
||||
from flask_restx import swagger as restx_swagger
|
||||
from flask_restx.model import Model, OrderedModel, instance
|
||||
from flask_restx.swagger import Swagger
|
||||
from flask_restx.utils import not_none
|
||||
|
||||
|
||||
def _is_inline_field_map(value: object) -> TypeGuard[dict[object, object]]:
|
||||
@ -118,6 +119,9 @@ def install_swagger_compatibility() -> None:
|
||||
original_register_field = Swagger.register_field
|
||||
original_extract_path_params = restx_swagger.extract_path_params
|
||||
original_schema_from_parameter = Swagger.schema_from_parameter
|
||||
original_description_for = Swagger.description_for
|
||||
original_serialize_operation = Swagger.serialize_operation
|
||||
original_parameters_and_request_body_for = Swagger.parameters_and_request_body_for
|
||||
original_as_dict = Swagger.as_dict
|
||||
|
||||
def get_or_create_inline_model(self: Swagger, nested_fields: dict[object, object]) -> object:
|
||||
@ -154,6 +158,51 @@ def install_swagger_compatibility() -> None:
|
||||
params[variable]["format"] = "uuid"
|
||||
return params
|
||||
|
||||
def description_for_with_explicit_summary(self: Swagger, doc: dict[str, object], method: str):
|
||||
method_doc = doc.get(method)
|
||||
if (
|
||||
isinstance(method_doc, dict)
|
||||
and isinstance(method_doc.get("summary"), str)
|
||||
and isinstance(method_doc.get("description"), str)
|
||||
):
|
||||
return method_doc["description"]
|
||||
return original_description_for(self, doc, method)
|
||||
|
||||
def serialize_operation_with_explicit_summary_tags(
|
||||
self: Swagger, doc: dict[str, object], method: str, inherited_request_body=None
|
||||
):
|
||||
operation = original_serialize_operation(self, doc, method, inherited_request_body)
|
||||
method_doc = doc.get(method)
|
||||
if not isinstance(method_doc, dict):
|
||||
return operation
|
||||
|
||||
summary = method_doc.get("summary")
|
||||
if isinstance(summary, str):
|
||||
operation["summary"] = summary
|
||||
|
||||
tags = method_doc.get("tags")
|
||||
if isinstance(tags, list) and all(isinstance(tag, str) for tag in tags):
|
||||
operation["tags"] = tags
|
||||
|
||||
return operation
|
||||
|
||||
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:
|
||||
return None
|
||||
|
||||
path_params, path_request_body = original_parameters_and_request_body_for(self, doc)
|
||||
path: dict[str, object] = {"parameters": path_params or None}
|
||||
methods = [method.lower() for method in resource.methods or []]
|
||||
requested_methods = [method.lower() for method in kwargs.get("methods", [])]
|
||||
for method in methods:
|
||||
if doc[method] is False or requested_methods and method not in requested_methods:
|
||||
continue
|
||||
operation = self.serialize_operation(doc, method, path_request_body)
|
||||
operation.setdefault("tags", [ns.name])
|
||||
path[method] = operation
|
||||
return not_none(path)
|
||||
|
||||
def as_dict_with_inline_dict_support(self: Swagger):
|
||||
# Temporary set RESTX_INCLUDE_ALL_MODELS = false to prevent "length changed while iterating" error
|
||||
include_all_models = current_app.config.get("RESTX_INCLUDE_ALL_MODELS", False)
|
||||
@ -167,5 +216,8 @@ def install_swagger_compatibility() -> None:
|
||||
Swagger.register_field = register_field_with_inline_dict_support
|
||||
restx_swagger.extract_path_params = extract_path_params_with_uuid_format
|
||||
Swagger.schema_from_parameter = schema_from_parameter_with_description
|
||||
Swagger.description_for = description_for_with_explicit_summary
|
||||
Swagger.serialize_operation = serialize_operation_with_explicit_summary_tags
|
||||
Swagger.serialize_resource = serialize_resource_with_explicit_operation_tags
|
||||
Swagger.as_dict = as_dict_with_inline_dict_support
|
||||
Swagger._dify_swagger_compatibility_installed = True
|
||||
|
||||
@ -18690,7 +18690,7 @@ Tag type
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| message_id | string | Message ID | No |
|
||||
| streaming | boolean | Enable streaming response | No |
|
||||
| streaming | boolean | Reserved for compatibility; TTS response streaming is determined by the provider output. | No |
|
||||
| text | string | Text to convert to audio | No |
|
||||
| voice | string | Voice to use for TTS | No |
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1632,7 +1632,7 @@ Default configuration for form inputs.
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| message_id | string | Message ID | No |
|
||||
| streaming | boolean | Enable streaming response | No |
|
||||
| streaming | boolean | Reserved for compatibility; TTS response streaming is determined by the provider output. | No |
|
||||
| text | string | Text to convert to audio | No |
|
||||
| voice | string | Voice to use for TTS | No |
|
||||
|
||||
|
||||
@ -106,6 +106,22 @@ def test_generate_specs_writes_get_operations_without_request_bodies(tmp_path):
|
||||
assert all("requestBody" not in operation for operation in _get_operations(payload))
|
||||
|
||||
|
||||
def test_generate_specs_writes_service_api_reference_descriptions(tmp_path):
|
||||
module = _load_generate_swagger_specs_module()
|
||||
|
||||
written_paths = module.generate_specs(tmp_path)
|
||||
service_path = next(path for path in written_paths if path.name == "service-openapi.json")
|
||||
payload = json.loads(service_path.read_text(encoding="utf-8"))
|
||||
|
||||
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"] == ["Chatflows", "Chats"]
|
||||
|
||||
rename_operation = payload["paths"]["/conversations/{c_id}/name"]["post"]
|
||||
assert rename_operation["summary"] == "Rename Conversation"
|
||||
|
||||
|
||||
def test_standalone_inline_model_name_includes_list_constraints():
|
||||
module = _load_generate_swagger_specs_module()
|
||||
|
||||
|
||||
@ -206,6 +206,31 @@ def test_service_document_file_routes_document_multipart_form_data(monkeypatch:
|
||||
assert update_operation["requestBody"]["required"] is False
|
||||
|
||||
|
||||
def test_service_openapi_merges_public_api_reference_descriptions(monkeypatch: pytest.MonkeyPatch):
|
||||
from configs import dify_config
|
||||
from controllers.service_api import bp as service_api_bp
|
||||
|
||||
monkeypatch.setattr(dify_config, "SWAGGER_UI_ENABLED", True)
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config["TESTING"] = True
|
||||
app.config["RESTX_INCLUDE_ALL_MODELS"] = True
|
||||
app.register_blueprint(service_api_bp)
|
||||
|
||||
payload = app.test_client().get("/v1/openapi.json").get_json()
|
||||
|
||||
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["responses"]["200"]["description"].startswith("Successful response.")
|
||||
|
||||
rename_operation = payload["paths"]["/conversations/{c_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"
|
||||
|
||||
|
||||
def test_service_document_list_documents_query_params_render(monkeypatch: pytest.MonkeyPatch):
|
||||
from configs import dify_config
|
||||
from controllers.service_api import bp as service_api_bp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1712,6 +1712,7 @@ export type GetAppsAnnotationReplyByActionStatusByJobIdData = {
|
||||
}
|
||||
|
||||
export type GetAppsAnnotationReplyByActionStatusByJobIdErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -1867,6 +1868,7 @@ export type PostChatMessagesByTaskIdStopData = {
|
||||
}
|
||||
|
||||
export type PostChatMessagesByTaskIdStopErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -1891,6 +1893,7 @@ export type PostCompletionMessagesErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
429: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
@ -1911,6 +1914,7 @@ export type PostCompletionMessagesByTaskIdStopData = {
|
||||
}
|
||||
|
||||
export type PostCompletionMessagesByTaskIdStopErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -1936,6 +1940,7 @@ export type GetConversationsData = {
|
||||
}
|
||||
|
||||
export type GetConversationsErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -1957,6 +1962,7 @@ export type DeleteConversationsByCIdData = {
|
||||
}
|
||||
|
||||
export type DeleteConversationsByCIdErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -1979,6 +1985,7 @@ export type PostConversationsByCIdNameData = {
|
||||
}
|
||||
|
||||
export type PostConversationsByCIdNameErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2006,6 +2013,7 @@ export type GetConversationsByCIdVariablesData = {
|
||||
}
|
||||
|
||||
export type GetConversationsByCIdVariablesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2077,6 +2085,7 @@ export type PostDatasetsErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
409: unknown
|
||||
}
|
||||
|
||||
export type PostDatasetsResponses = {
|
||||
@ -2513,6 +2522,7 @@ export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdData = {
|
||||
}
|
||||
|
||||
export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2538,6 +2548,7 @@ export type GetDatasetsByDatasetIdDocumentsByDocumentIdData = {
|
||||
}
|
||||
|
||||
export type GetDatasetsByDatasetIdDocumentsByDocumentIdErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2763,6 +2774,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChild
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2790,6 +2802,7 @@ export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChi
|
||||
|
||||
export type DeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdErrors
|
||||
= {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2818,6 +2831,7 @@ export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChil
|
||||
|
||||
export type PatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdErrors
|
||||
= {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2845,6 +2859,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2868,6 +2883,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2894,6 +2910,7 @@ export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Data = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Errors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -2939,9 +2956,11 @@ export type PostDatasetsByDatasetIdHitTestingData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdHitTestingErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdHitTestingResponses = {
|
||||
@ -3099,6 +3118,7 @@ export type GetDatasetsByDatasetIdPipelineDatasourcePluginsData = {
|
||||
export type GetDatasetsByDatasetIdPipelineDatasourcePluginsErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type GetDatasetsByDatasetIdPipelineDatasourcePluginsResponses = {
|
||||
@ -3121,6 +3141,7 @@ export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunData = {
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponses = {
|
||||
@ -3142,6 +3163,8 @@ export type PostDatasetsByDatasetIdPipelineRunData = {
|
||||
export type PostDatasetsByDatasetIdPipelineRunErrors = {
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdPipelineRunResponses = {
|
||||
@ -3161,9 +3184,11 @@ export type PostDatasetsByDatasetIdRetrieveData = {
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdRetrieveErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
500: unknown
|
||||
}
|
||||
|
||||
export type PostDatasetsByDatasetIdRetrieveResponses = {
|
||||
@ -3347,6 +3372,7 @@ export type GetMessagesData = {
|
||||
}
|
||||
|
||||
export type GetMessagesErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -3433,6 +3459,7 @@ export type GetParametersData = {
|
||||
}
|
||||
|
||||
export type GetParametersErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -3498,6 +3525,7 @@ export type GetWorkflowByTaskIdEventsData = {
|
||||
}
|
||||
|
||||
export type GetWorkflowByTaskIdEventsErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -3569,6 +3597,7 @@ export type GetWorkflowsRunByWorkflowRunIdData = {
|
||||
}
|
||||
|
||||
export type GetWorkflowsRunByWorkflowRunIdErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
@ -3591,6 +3620,7 @@ export type PostWorkflowsTasksByTaskIdStopData = {
|
||||
}
|
||||
|
||||
export type PostWorkflowsTasksByTaskIdStopErrors = {
|
||||
400: unknown
|
||||
401: unknown
|
||||
403: unknown
|
||||
404: unknown
|
||||
|
||||
@ -2215,7 +2215,7 @@ export const zGetAppFeedbacksQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Feedbacks retrieved successfully
|
||||
* A list of application feedbacks.
|
||||
*/
|
||||
export const zGetAppFeedbacksResponse = zAppFeedbackListResponse
|
||||
|
||||
@ -2226,7 +2226,7 @@ export const zPostAppsAnnotationReplyByActionPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Action completed successfully
|
||||
* Annotation reply settings task initiated.
|
||||
*/
|
||||
export const zPostAppsAnnotationReplyByActionResponse = zAnnotationJobStatusResponse
|
||||
|
||||
@ -2236,7 +2236,7 @@ export const zGetAppsAnnotationReplyByActionStatusByJobIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Job status retrieved successfully
|
||||
* Successfully retrieved task status.
|
||||
*/
|
||||
export const zGetAppsAnnotationReplyByActionStatusByJobIdResponse = zAnnotationJobStatusResponse
|
||||
|
||||
@ -2247,14 +2247,14 @@ export const zGetAppsAnnotationsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Annotations retrieved successfully
|
||||
* Successfully retrieved annotation list.
|
||||
*/
|
||||
export const zGetAppsAnnotationsResponse = zAnnotationList
|
||||
|
||||
export const zPostAppsAnnotationsBody = zAnnotationCreatePayload
|
||||
|
||||
/**
|
||||
* Annotation created successfully
|
||||
* Annotation created successfully.
|
||||
*/
|
||||
export const zPostAppsAnnotationsResponse = zAnnotation
|
||||
|
||||
@ -2263,7 +2263,7 @@ export const zDeleteAppsAnnotationsByAnnotationIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Annotation deleted successfully
|
||||
* Annotation deleted successfully.
|
||||
*/
|
||||
export const zDeleteAppsAnnotationsByAnnotationIdResponse = z.void()
|
||||
|
||||
@ -2274,7 +2274,7 @@ export const zPutAppsAnnotationsByAnnotationIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Annotation updated successfully
|
||||
* Annotation updated successfully.
|
||||
*/
|
||||
export const zPutAppsAnnotationsByAnnotationIdResponse = zAnnotation
|
||||
|
||||
@ -2284,14 +2284,17 @@ export const zPostAudioToTextBody = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Audio successfully transcribed
|
||||
* Successfully converted audio to text.
|
||||
*/
|
||||
export const zPostAudioToTextResponse = zAudioTranscriptResponse
|
||||
|
||||
export const zPostChatMessagesBody = zChatRequestPayloadWithUser
|
||||
|
||||
/**
|
||||
* Message sent successfully
|
||||
* 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.
|
||||
*/
|
||||
export const zPostChatMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
@ -2309,7 +2312,10 @@ export const zPostChatMessagesByTaskIdStopResponse = zSimpleResultResponse
|
||||
export const zPostCompletionMessagesBody = zCompletionRequestPayloadWithUser
|
||||
|
||||
/**
|
||||
* Completion created successfully
|
||||
* 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.
|
||||
*/
|
||||
export const zPostCompletionMessagesResponse = zGeneratedAppResponse
|
||||
|
||||
@ -2335,7 +2341,7 @@ export const zGetConversationsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Conversations retrieved successfully
|
||||
* Successfully retrieved conversations list.
|
||||
*/
|
||||
export const zGetConversationsResponse = zConversationInfiniteScrollPagination
|
||||
|
||||
@ -2346,7 +2352,7 @@ export const zDeleteConversationsByCIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Conversation deleted successfully
|
||||
* Conversation deleted successfully.
|
||||
*/
|
||||
export const zDeleteConversationsByCIdResponse = z.void()
|
||||
|
||||
@ -2357,7 +2363,7 @@ export const zPostConversationsByCIdNamePath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Conversation renamed successfully
|
||||
* Conversation renamed successfully.
|
||||
*/
|
||||
export const zPostConversationsByCIdNameResponse = zSimpleConversation
|
||||
|
||||
@ -2373,7 +2379,7 @@ export const zGetConversationsByCIdVariablesQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Variables retrieved successfully
|
||||
* Successfully retrieved conversation variables.
|
||||
*/
|
||||
export const zGetConversationsByCIdVariablesResponse
|
||||
= zConversationVariableInfiniteScrollPaginationResponse
|
||||
@ -2387,7 +2393,7 @@ export const zPutConversationsByCIdVariablesByVariableIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Variable updated successfully
|
||||
* Variable updated successfully.
|
||||
*/
|
||||
export const zPutConversationsByCIdVariablesByVariableIdResponse = zConversationVariableResponse
|
||||
|
||||
@ -2400,14 +2406,14 @@ export const zGetDatasetsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Datasets retrieved successfully
|
||||
* List of knowledge bases.
|
||||
*/
|
||||
export const zGetDatasetsResponse = zDatasetListResponse
|
||||
|
||||
export const zPostDatasetsBody = zDatasetCreatePayload
|
||||
|
||||
/**
|
||||
* Dataset created successfully
|
||||
* Knowledge base created successfully.
|
||||
*/
|
||||
export const zPostDatasetsResponse = zDatasetDetailResponse
|
||||
|
||||
@ -2416,47 +2422,47 @@ export const zPostDatasetsPipelineFileUploadBody = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* File uploaded successfully
|
||||
* File uploaded successfully.
|
||||
*/
|
||||
export const zPostDatasetsPipelineFileUploadResponse = zPipelineUploadFileResponse
|
||||
|
||||
export const zDeleteDatasetsTagsBody = zTagDeletePayload
|
||||
|
||||
/**
|
||||
* Tag deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsTagsResponse = z.void()
|
||||
|
||||
/**
|
||||
* Tags retrieved successfully
|
||||
* List of tags.
|
||||
*/
|
||||
export const zGetDatasetsTagsResponse = zKnowledgeTagListResponse
|
||||
|
||||
export const zPatchDatasetsTagsBody = zTagUpdatePayload
|
||||
|
||||
/**
|
||||
* Tag updated successfully
|
||||
* Tag updated successfully.
|
||||
*/
|
||||
export const zPatchDatasetsTagsResponse = zKnowledgeTagResponse
|
||||
|
||||
export const zPostDatasetsTagsBody = zTagCreatePayload
|
||||
|
||||
/**
|
||||
* Tag created successfully
|
||||
* Tag created successfully.
|
||||
*/
|
||||
export const zPostDatasetsTagsResponse = zKnowledgeTagResponse
|
||||
|
||||
export const zPostDatasetsTagsBindingBody = zTagBindingPayload
|
||||
|
||||
/**
|
||||
* Tags bound successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zPostDatasetsTagsBindingResponse = z.void()
|
||||
|
||||
export const zPostDatasetsTagsUnbindingBody = zTagUnbindingPayload
|
||||
|
||||
/**
|
||||
* Tags unbound successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zPostDatasetsTagsUnbindingResponse = z.void()
|
||||
|
||||
@ -2465,7 +2471,7 @@ export const zDeleteDatasetsByDatasetIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Dataset deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsByDatasetIdResponse = z.void()
|
||||
|
||||
@ -2474,7 +2480,7 @@ export const zGetDatasetsByDatasetIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Dataset retrieved successfully
|
||||
* Knowledge base details.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdResponse = zDatasetDetailWithPartialMembersResponse
|
||||
|
||||
@ -2485,7 +2491,7 @@ export const zPatchDatasetsByDatasetIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Dataset updated successfully
|
||||
* Knowledge base updated successfully.
|
||||
*/
|
||||
export const zPatchDatasetsByDatasetIdResponse = zDatasetDetailWithPartialMembersResponse
|
||||
|
||||
@ -2499,7 +2505,7 @@ export const zPostDatasetsByDatasetIdDocumentCreateByFilePath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Document created successfully
|
||||
* Document created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentCreateByFileResponse = zDocumentAndBatchResponse
|
||||
|
||||
@ -2510,7 +2516,7 @@ export const zPostDatasetsByDatasetIdDocumentCreateByTextPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Document created successfully
|
||||
* Document created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentCreateByTextResponse = zDocumentAndBatchResponse
|
||||
|
||||
@ -2524,7 +2530,7 @@ export const zPostDatasetsByDatasetIdDocumentCreateByFile2Path = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Document created successfully
|
||||
* Document created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentCreateByFile2Response = zDocumentAndBatchResponse
|
||||
|
||||
@ -2551,7 +2557,7 @@ export const zGetDatasetsByDatasetIdDocumentsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Documents retrieved successfully
|
||||
* List of documents.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsResponse = zDocumentListResponse
|
||||
|
||||
@ -2562,7 +2568,7 @@ export const zPostDatasetsByDatasetIdDocumentsDownloadZipPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* ZIP archive generated successfully
|
||||
* ZIP archive containing the requested documents.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsDownloadZipResponse = z.custom<Blob | File>()
|
||||
|
||||
@ -2573,7 +2579,7 @@ export const zPostDatasetsByDatasetIdDocumentsMetadataPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Documents metadata updated successfully
|
||||
* Document metadata updated successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsMetadataResponse = zDatasetMetadataActionResponse
|
||||
|
||||
@ -2595,7 +2601,7 @@ export const zGetDatasetsByDatasetIdDocumentsByBatchIndexingStatusPath = z.objec
|
||||
})
|
||||
|
||||
/**
|
||||
* Indexing status retrieved successfully
|
||||
* Indexing status for documents in the batch.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByBatchIndexingStatusResponse
|
||||
= zDocumentStatusListResponse
|
||||
@ -2606,7 +2612,7 @@ export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Document deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdResponse = z.void()
|
||||
|
||||
@ -2620,7 +2626,7 @@ export const zGetDatasetsByDatasetIdDocumentsByDocumentIdQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Document retrieved successfully
|
||||
* Document details. The response shape varies based on the `metadata` query parameter. When `metadata` is `only`, only `id`, `doc_type`, and `doc_metadata` are returned. When `metadata` is `without`, `doc_type` and `doc_metadata` are omitted.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdResponse = zDocumentDetailResponse
|
||||
|
||||
@ -2645,7 +2651,7 @@ export const zGetDatasetsByDatasetIdDocumentsByDocumentIdDownloadPath = z.object
|
||||
})
|
||||
|
||||
/**
|
||||
* Download URL generated successfully
|
||||
* Download URL generated successfully.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponse = zUrlResponse
|
||||
|
||||
@ -2662,7 +2668,7 @@ export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsQuery = z.objec
|
||||
})
|
||||
|
||||
/**
|
||||
* Segments retrieved successfully
|
||||
* List of chunks.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse = zSegmentListResponse
|
||||
|
||||
@ -2674,7 +2680,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsPath = z.objec
|
||||
})
|
||||
|
||||
/**
|
||||
* Segments created successfully
|
||||
* Chunks created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse
|
||||
= zSegmentCreateListResponse
|
||||
@ -2686,7 +2692,7 @@ export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdP
|
||||
})
|
||||
|
||||
/**
|
||||
* Segment deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse = z.void()
|
||||
|
||||
@ -2697,7 +2703,7 @@ export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdPath
|
||||
})
|
||||
|
||||
/**
|
||||
* Segment retrieved successfully
|
||||
* Chunk details.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse
|
||||
= zSegmentDetailResponse
|
||||
@ -2712,7 +2718,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdPat
|
||||
})
|
||||
|
||||
/**
|
||||
* Segment updated successfully
|
||||
* Chunk updated successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse
|
||||
= zSegmentDetailResponse
|
||||
@ -2732,7 +2738,7 @@ export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChil
|
||||
})
|
||||
|
||||
/**
|
||||
* Child chunks retrieved successfully
|
||||
* List of child chunks.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
|
||||
= zChildChunkListResponse
|
||||
@ -2748,7 +2754,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChi
|
||||
})
|
||||
|
||||
/**
|
||||
* Child chunk created successfully
|
||||
* Child chunk created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
|
||||
= zChildChunkDetailResponse
|
||||
@ -2762,7 +2768,7 @@ export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdC
|
||||
})
|
||||
|
||||
/**
|
||||
* Child chunk deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse
|
||||
= z.void()
|
||||
@ -2779,7 +2785,7 @@ export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdCh
|
||||
})
|
||||
|
||||
/**
|
||||
* Child chunk updated successfully
|
||||
* Child chunk updated successfully.
|
||||
*/
|
||||
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse
|
||||
= zChildChunkDetailResponse
|
||||
@ -2795,7 +2801,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFilePath = z.o
|
||||
})
|
||||
|
||||
/**
|
||||
* Document updated successfully
|
||||
* Document updated successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFileResponse
|
||||
= zDocumentAndBatchResponse
|
||||
@ -2808,7 +2814,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextPath = z.o
|
||||
})
|
||||
|
||||
/**
|
||||
* Document updated successfully
|
||||
* Document updated successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByTextResponse
|
||||
= zDocumentAndBatchResponse
|
||||
@ -2824,7 +2830,7 @@ export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Path = z.
|
||||
})
|
||||
|
||||
/**
|
||||
* Document updated successfully
|
||||
* Document updated successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdUpdateByFile2Response
|
||||
= zDocumentAndBatchResponse
|
||||
@ -2849,7 +2855,7 @@ export const zPostDatasetsByDatasetIdHitTestingPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Hit testing results
|
||||
* Retrieval results.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdHitTestingResponse = zHitTestingResponse
|
||||
|
||||
@ -2858,7 +2864,7 @@ export const zGetDatasetsByDatasetIdMetadataPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Metadata retrieved successfully
|
||||
* Metadata fields for the knowledge base.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdMetadataResponse = zDatasetMetadataListResponse
|
||||
|
||||
@ -2869,7 +2875,7 @@ export const zPostDatasetsByDatasetIdMetadataPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Metadata created successfully
|
||||
* Metadata field created successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdMetadataResponse = zDatasetMetadataResponse
|
||||
|
||||
@ -2878,7 +2884,7 @@ export const zGetDatasetsByDatasetIdMetadataBuiltInPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Built-in fields retrieved successfully
|
||||
* Built-in metadata fields.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdMetadataBuiltInResponse = zDatasetMetadataBuiltInFieldsResponse
|
||||
|
||||
@ -2888,7 +2894,7 @@ export const zPostDatasetsByDatasetIdMetadataBuiltInByActionPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Action completed successfully
|
||||
* Built-in metadata field toggled successfully.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdMetadataBuiltInByActionResponse
|
||||
= zDatasetMetadataActionResponse
|
||||
@ -2899,7 +2905,7 @@ export const zDeleteDatasetsByDatasetIdMetadataByMetadataIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Metadata deleted successfully
|
||||
* Success.
|
||||
*/
|
||||
export const zDeleteDatasetsByDatasetIdMetadataByMetadataIdResponse = z.void()
|
||||
|
||||
@ -2911,7 +2917,7 @@ export const zPatchDatasetsByDatasetIdMetadataByMetadataIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Metadata updated successfully
|
||||
* Metadata field updated successfully.
|
||||
*/
|
||||
export const zPatchDatasetsByDatasetIdMetadataByMetadataIdResponse = zDatasetMetadataResponse
|
||||
|
||||
@ -2924,7 +2930,7 @@ export const zGetDatasetsByDatasetIdPipelineDatasourcePluginsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Datasource plugins retrieved successfully
|
||||
* List of datasource nodes configured in the pipeline.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdPipelineDatasourcePluginsResponse
|
||||
= zDatasourcePluginListResponse
|
||||
@ -2938,7 +2944,7 @@ export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunPath = z.
|
||||
})
|
||||
|
||||
/**
|
||||
* Datasource node run successfully
|
||||
* Streaming response with node execution events.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdPipelineDatasourceNodesByNodeIdRunResponse
|
||||
= zGeneratedAppResponse
|
||||
@ -2950,7 +2956,7 @@ export const zPostDatasetsByDatasetIdPipelineRunPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Pipeline run successfully
|
||||
* Pipeline execution result. Format depends on `response_mode`: streaming returns a `text/event-stream`, blocking returns a JSON object.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdPipelineRunResponse = zGeneratedAppResponse
|
||||
|
||||
@ -2961,7 +2967,7 @@ export const zPostDatasetsByDatasetIdRetrievePath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Hit testing results
|
||||
* Retrieval results.
|
||||
*/
|
||||
export const zPostDatasetsByDatasetIdRetrieveResponse = zHitTestingResponse
|
||||
|
||||
@ -2970,7 +2976,7 @@ export const zGetDatasetsByDatasetIdTagsPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Tags retrieved successfully
|
||||
* Tags bound to the knowledge base.
|
||||
*/
|
||||
export const zGetDatasetsByDatasetIdTagsResponse = zDatasetBoundTagListResponse
|
||||
|
||||
@ -2979,7 +2985,7 @@ export const zGetEndUsersByEndUserIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* End user retrieved successfully
|
||||
* End user retrieved successfully.
|
||||
*/
|
||||
export const zGetEndUsersByEndUserIdResponse = zEndUserDetail
|
||||
|
||||
@ -2989,7 +2995,7 @@ export const zPostFilesUploadBody = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* File uploaded successfully
|
||||
* File uploaded successfully.
|
||||
*/
|
||||
export const zPostFilesUploadResponse = zFileResponse
|
||||
|
||||
@ -3003,7 +3009,7 @@ export const zGetFilesByFileIdPreviewQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* File retrieved successfully
|
||||
* 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`.
|
||||
*/
|
||||
export const zGetFilesByFileIdPreviewResponse = z.custom<Blob | File>()
|
||||
|
||||
@ -3012,7 +3018,7 @@ export const zGetFormHumanInputByFormTokenPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Form retrieved successfully
|
||||
* Form contents retrieved successfully.
|
||||
*/
|
||||
export const zGetFormHumanInputByFormTokenResponse = zHumanInputFormDefinitionResponse
|
||||
|
||||
@ -3023,12 +3029,12 @@ export const zPostFormHumanInputByFormTokenPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Form submitted successfully
|
||||
* Form submitted successfully. The response body is an empty object.
|
||||
*/
|
||||
export const zPostFormHumanInputByFormTokenResponse = zHumanInputFormSubmitResponse
|
||||
|
||||
/**
|
||||
* Application info retrieved successfully
|
||||
* Basic information of the application.
|
||||
*/
|
||||
export const zGetInfoResponse = zAppInfoResponse
|
||||
|
||||
@ -3040,7 +3046,7 @@ export const zGetMessagesQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Messages retrieved successfully
|
||||
* Successfully retrieved conversation history.
|
||||
*/
|
||||
export const zGetMessagesResponse = zMessageInfiniteScrollPagination
|
||||
|
||||
@ -3069,24 +3075,24 @@ export const zGetMessagesByMessageIdSuggestedQuery = z.object({
|
||||
export const zGetMessagesByMessageIdSuggestedResponse = zSimpleResultStringListResponse
|
||||
|
||||
/**
|
||||
* Metadata retrieved successfully
|
||||
* Successfully retrieved application meta information.
|
||||
*/
|
||||
export const zGetMetaResponse = zAppMetaResponse
|
||||
|
||||
/**
|
||||
* Parameters retrieved successfully
|
||||
* Application parameters information.
|
||||
*/
|
||||
export const zGetParametersResponse = zParameters
|
||||
|
||||
/**
|
||||
* Site configuration retrieved successfully
|
||||
* WebApp settings of the application.
|
||||
*/
|
||||
export const zGetSiteResponse = zSite
|
||||
|
||||
export const zPostTextToAudioBody = zTextToAudioPayloadWithUser
|
||||
|
||||
/**
|
||||
* Text successfully converted to audio
|
||||
* Returns the generated audio. Generator responses are streamed by the service as `audio/mpeg`; otherwise the provider output is returned directly.
|
||||
*/
|
||||
export const zPostTextToAudioResponse = z.custom<Blob | File>()
|
||||
|
||||
@ -3101,7 +3107,7 @@ export const zGetWorkflowByTaskIdEventsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* SSE event stream
|
||||
* 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
|
||||
|
||||
@ -3117,14 +3123,17 @@ export const zGetWorkflowsLogsQuery = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Logs retrieved successfully
|
||||
* Successfully retrieved workflow logs.
|
||||
*/
|
||||
export const zGetWorkflowsLogsResponse = zWorkflowAppLogPaginationResponse
|
||||
|
||||
export const zPostWorkflowsRunBody = zWorkflowRunPayloadWithUser
|
||||
|
||||
/**
|
||||
* Workflow executed successfully
|
||||
* 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.
|
||||
*/
|
||||
export const zPostWorkflowsRunResponse = zGeneratedAppResponse
|
||||
|
||||
@ -3133,7 +3142,7 @@ export const zGetWorkflowsRunByWorkflowRunIdPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Workflow run details retrieved successfully
|
||||
* Successfully retrieved workflow run details.
|
||||
*/
|
||||
export const zGetWorkflowsRunByWorkflowRunIdResponse = zWorkflowRunResponse
|
||||
|
||||
@ -3155,7 +3164,10 @@ export const zPostWorkflowsByWorkflowIdRunPath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Workflow executed successfully
|
||||
* 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.
|
||||
*/
|
||||
export const zPostWorkflowsByWorkflowIdRunResponse = zGeneratedAppResponse
|
||||
|
||||
@ -3164,7 +3176,7 @@ export const zGetWorkspacesCurrentModelsModelTypesByModelTypePath = z.object({
|
||||
})
|
||||
|
||||
/**
|
||||
* Models retrieved successfully
|
||||
* Available models for the specified type.
|
||||
*/
|
||||
export const zGetWorkspacesCurrentModelsModelTypesByModelTypeResponse
|
||||
= zProviderWithModelsListResponse
|
||||
|
||||
Loading…
Reference in New Issue
Block a user