diff --git a/docs.json b/docs.json
index d159be1f..4fc282aa 100644
--- a/docs.json
+++ b/docs.json
@@ -603,6 +603,16 @@
}
]
},
+ {
+ "tab": "API Access",
+ "groups": [
+ {"group": "Chat and Agent","openapi": "en/openapi_chat.json"},
+ {"group": "Chatflow","openapi": "en/openapi_chatflow.json"},
+ {"group": "Workflow","openapi": "en/openapi_workflow.json"},
+ {"group": "Completion","openapi": "en/openapi_completion.json"}
+
+ ]
+ },
{
"tab": "Resources",
"pages": [
@@ -644,7 +654,8 @@
]
},
"zh-hans/getting-started/dify-premium",
- "zh-hans/getting-started/dify-for-education"
+ "zh-hans/getting-started/dify-for-education",
+ "zh-hans/openapi-api-access-readme"
]
},
{
@@ -1240,6 +1251,17 @@
}
]
},
+ {
+ "tab": "访问 API",
+ "groups": [
+ {"group": "聊天助手和Agent","openapi":"zh-hans/openapi_chat.json"
+ },
+ {"group": "Chatflow","openapi": "zh-hans/openapi_chatflow.json"
+ },
+ {"group": "工作流","openapi": "zh-hans/openapi_workflow.json"},
+ {"group": "文本生成","openapi": "zh-hans/openapi_completion.json"}
+ ]
+ },
{
"tab": "资源",
"pages": [
@@ -1840,6 +1862,15 @@
}
]
},
+ {
+ "tab": "APIアクセス",
+ "groups": [
+ {"group": "Chatbot and エージェント","openapi":"ja-jp/openapi_chat.json"},
+ {"group": "チャットフロー","openapi": "ja-jp/openapi_chatflow.json"},
+ {"group": "ワークフロー","openapi": "ja-jp/openapi_workflow.json"},
+ {"group": "テキスト ジェネレーター","openapi": "ja-jp/openapi_completion.json"}
+ ]
+ },
{
"tab": "用語ベース",
"pages": [
diff --git a/en/openapi_chat.json b/en/openapi_chat.json
new file mode 100644
index 00000000..7fba81d3
--- /dev/null
+++ b/en/openapi_chat.json
@@ -0,0 +1,1769 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Chat App API",
+ "description": "Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbot, customer service AI, etc.",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "The base URL for the Chat App API. Replace {api_base_url} with the actual API base URL provided for your application (e.g., from props.appDetail.api_base_url).",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "Actual base URL of the API"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "Send Chat Message",
+ "description": "Send a request to the chat application.",
+ "operationId": "sendChatMessage",
+ "tags": ["Chat"],
+ "requestBody": {
+ "description": "Request body to send a chat message.",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatRequest"
+ },
+ "examples": {
+ "streaming_example": {
+ "summary": "Streaming mode example with file",
+ "value": {
+ "inputs": {},
+ "query": "What are the specs of the iPhone 13 Pro Max?",
+ "response_mode": "streaming",
+ "conversation_id": "",
+ "user": "abc-123",
+ "files": [
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://cloud.dify.ai/logo/logo-site.png"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful response. The content type and structure depend on the `response_mode` parameter in the request.\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 `ChunkChatEvent` objects.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponse"
+ },
+ "examples": {
+ "blockingResponse": {
+ "summary": "Example of a blocking mode response",
+ "value": {
+ "event": "message",
+ "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
+ "id": "9da23599-e713-473b-982c-4328d4f5c78a",
+ "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
+ "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
+ "mode": "chat",
+ "answer": "iPhone 13 Pro Max specs are listed here:...",
+ "metadata": {
+ "usage": {
+ "prompt_tokens": 1033,
+ "prompt_unit_price": "0.001",
+ "prompt_price_unit": "0.001",
+ "prompt_price": "0.0010330",
+ "completion_tokens": 128,
+ "completion_unit_price": "0.002",
+ "completion_price_unit": "0.001",
+ "completion_price": "0.0002560",
+ "total_tokens": 1161,
+ "total_price": "0.0012890",
+ "currency": "USD",
+ "latency": 0.7682376249867957
+ },
+ "retriever_resources": [
+ {
+ "position": 1,
+ "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
+ "dataset_name": "iPhone",
+ "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
+ "document_name": "iPhone List",
+ "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
+ "score": 0.98457545,
+ "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
+ }
+ ]
+ },
+ "created_at": 1705407629
+ }
+ }
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "A stream of Server-Sent Events. Each event is a JSON object prefixed with 'data: ' and suffixed with '\\n\\n'. See `ChunkChatEvent` for possible event structures."
+ },
+ "examples": {
+ "streamingResponseBasic": {
+ "summary": "Example of a streaming mode response (Basic Assistant)",
+ "value": "data: {\"event\": \"message\", \"task_id\":\"mock_task_id\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"conversation_id\": \"45701982-8118-4bc5-8e9b-64562b4555f2\", \"answer\": \" I\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message_end\", \"task_id\":\"mock_task_id\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"conversation_id\": \"45701982-8118-4bc5-8e9b-64562b4555f2\", \"metadata\": {\"usage\": {\"total_tokens\": 10, \"latency\": 1.0}}}\n\n"
+ },
+ "streamingResponseAgent": {
+ "summary": "Example of a streaming mode response (Agent Assistant with agent_thought and message_file)",
+ "value": "data: {\"event\": \"agent_thought\", \"id\": \"agent_thought_id_1\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"position\": 1, \"thought\": \"Thinking about calling a tool...\", \"tool\": \"dalle3\", \"tool_input\": \"{\\\"dalle3\\\": {\\\"prompt\\\": \\\"a cute cat\\\"}}\", \"created_at\": 1705395332}\n\ndata: {\"event\": \"message_file\", \"id\": \"file_id_1\", \"type\": \"image\", \"belongs_to\": \"assistant\", \"url\": \"https://example.com/cat.png\", \"conversation_id\": \"conv123\"}\n\ndata: {\"event\": \"agent_message\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"answer\": \"Here is the image: \", \"created_at\": 1705395333}\n\ndata: {\"event\": \"message_end\", \"task_id\":\"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"metadata\": {\"usage\": {\"total_tokens\": 50, \"latency\": 2.5}}}\n\n"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request. Possible error codes:\n- `invalid_param`: Abnormal parameter input.\n- `app_unavailable`: App configuration unavailable.\n- `provider_not_initialize`: No available model credential configuration.\n- `provider_quota_exceeded`: Model invocation quota insufficient.\n- `model_currently_not_support`: Current model unavailable.\n- `completion_request_error`: Text generation failed.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "404": {
+ "description": "Conversation does not exist.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "File Upload",
+ "description": "Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text. Supports png, jpg, jpeg, webp, gif formats. Uploaded files are for use by the current end-user only.",
+ "operationId": "uploadChatFile",
+ "tags": ["Files"],
+ "requestBody": {
+ "description": "File upload request. Requires multipart/form-data.",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, defined by the developer's rules, must be unique within the application."
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "File uploaded successfully.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponse"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFile" },
+ "413": { "$ref": "#/components/responses/FileTooLarge" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFile" },
+ "503": { "$ref": "#/components/responses/S3ErrorFile" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "Stop Chat Message Generation",
+ "description": "Stops a chat message generation task. Only supported in streaming mode.",
+ "operationId": "stopChatMessageGeneration",
+ "tags": ["Chat"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "Task ID, can be obtained from the streaming chunk return of a `/chat-messages` request.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "User identifier, must be consistent with the user passed in the send message interface."
+ }
+ }
+ },
+ "examples": {
+ "example":{
+ "value": {
+ "user": "abc-123"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "Message Feedback",
+ "description": "End-users can provide feedback messages, facilitating application developers to optimize expected outputs.",
+ "operationId": "postChatMessageFeedback",
+ "tags": ["Feedback"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "Message ID for which feedback is being provided.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MessageFeedbackRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "Get feedbacks of application",
+ "description": "Get application's feedbacks.",
+ "operationId": "getChatAppFeedbacks",
+ "tags": ["Feedback"],
+ "parameters": [
+ {
+ "name": "page",
+ "in": "query",
+ "description": "(optional) Pagination page number. Default: 1",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "default": 1
+ }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "description": "(optional) Records per page. Default: 20",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "default": 20
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of application feedbacks.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppFeedbacksResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "Next Suggested Questions",
+ "description": "Get next questions suggestions for the current message.",
+ "operationId": "getSuggestedQuestions",
+ "tags": ["Chat"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "Message ID.",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "user",
+ "in": "query",
+ "required": true,
+ "description": "User identifier.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved suggested questions.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SuggestedQuestionsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "Get Conversation History 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.",
+ "operationId": "getConversationHistory",
+ "tags": ["Conversations"],
+ "parameters": [
+ {
+ "name": "conversation_id",
+ "in": "query",
+ "required": true,
+ "description": "Conversation ID.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "user",
+ "in": "query",
+ "required": true,
+ "description": "User identifier.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "first_id",
+ "in": "query",
+ "required": false,
+ "description": "The ID of the first chat record on the current page, default is null (for fetching the latest). For subsequent pages, use the ID of the first message from the current list to get older messages.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "description": "How many chat history messages to return in one request, default is 20.",
+ "schema": { "type": "integer", "default": 20 }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversation history.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConversationHistoryResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "Get Conversations",
+ "description": "Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.",
+ "operationId": "getConversationsList",
+ "tags": ["Conversations"],
+ "parameters": [
+ {
+ "name": "user",
+ "in": "query",
+ "required": true,
+ "description": "User identifier.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "last_id",
+ "in": "query",
+ "required": false,
+ "description": "(Optional) The ID of the last record on the current page (for pagination).",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "description": "(Optional) How many records to return. Default 20, Min 1, Max 100.",
+ "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 }
+ },
+ {
+ "name": "sort_by",
+ "in": "query",
+ "required": false,
+ "description": "Sorting Field. Default: -updated_at. '-' prefix for descending.",
+ "schema": {
+ "type": "string",
+ "enum": ["created_at", "-created_at", "updated_at", "-updated_at"],
+ "default": "-updated_at"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversations list.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConversationsListResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "Delete Conversation",
+ "description": "Delete a conversation.",
+ "operationId": "deleteConversation",
+ "tags": ["Conversations"],
+ "parameters": [
+ {
+ "name": "conversation_id",
+ "in": "path",
+ "required": true,
+ "description": "Conversation ID.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "The user identifier."
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "204": { "description": "Conversation deleted successfully. No Content." }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "Conversation Rename",
+ "description": "Rename the session. The session name is used for display on clients that support multiple sessions.",
+ "operationId": "renameConversation",
+ "tags": ["Conversations"],
+ "parameters": [
+ {
+ "name": "conversation_id",
+ "in": "path",
+ "required": true,
+ "description": "Conversation ID.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConversationRenameRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Conversation renamed successfully.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConversationRenameResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "Get Conversation Variables",
+ "description": "Retrieve variables from a specific conversation.",
+ "operationId": "getConversationVariables",
+ "tags": ["Conversations"],
+ "parameters": [
+ {
+ "name": "conversation_id",
+ "in": "path",
+ "required": true,
+ "description": "The ID of the conversation to retrieve variables from.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "user",
+ "in": "query",
+ "required": true,
+ "description": "The user identifier.",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "last_id",
+ "in": "query",
+ "required": false,
+ "description": "(Optional) The ID of the last record on the current page (for pagination).",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "description": "(Optional) How many records to return. Default 20, Min 1, Max 100.",
+ "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 }
+ },
+ {
+ "name": "variable_name",
+ "in": "query",
+ "required": false,
+ "description": "(Optional) Filter variables by a specific name.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversation variables.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationVariablesResponse" }
+ }
+ }
+ },
+ "404": { "$ref": "#/components/responses/ConversationNotFound" }
+ }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "Speech to Text",
+ "description": "Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB.",
+ "operationId": "audioToText",
+ "tags": ["TTS"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "$ref": "#/components/schemas/AudioToTextRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successfully converted audio to text.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AudioToTextResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "Text to Audio",
+ "description": "Convert text to speech.",
+ "operationId": "textToAudioChat",
+ "tags": ["TTS"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "$ref": "#/components/schemas/TextToAudioFormRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Audio file generated successfully.",
+ "content": {
+ "audio/wav": {
+ "schema": {
+ "type": "string",
+ "format": "binary",
+ "description": "The generated audio file."
+ }
+ }
+ },
+ "headers": {
+ "Content-Type": {
+ "description": "The content type of the response, typically `audio/wav` or `audio/mp3`.",
+ "schema": {
+ "type": "string",
+ "example": "audio/wav"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "Get Application Basic Information",
+ "description": "Used to get basic information about this application.",
+ "operationId": "getChatAppInfo",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Basic information of the application.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppInfoResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "Get Application Parameters Information",
+ "description": "Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.",
+ "operationId": "getChatAppParameters",
+ "tags": ["Application"],
+ "parameters": [
+ {
+ "name": "user",
+ "in": "query",
+ "required": true,
+ "description": "User identifier, defined by the developer's rules, must be unique within the application.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Application parameters information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatAppParametersResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "Get Application Meta Information",
+ "description": "Used to get icons of tools in this application.",
+ "operationId": "getChatAppMeta",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved application meta information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppMetaResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "Get Application WebApp Settings",
+ "description": "Used to get the WebApp settings of the application.",
+ "operationId": "getChatWebAppSettings",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "WebApp settings of the application.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WebAppSettingsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/apps/annotations": {
+ "get": {
+ "summary": "Get Annotation List",
+ "description": "Retrieves a list of annotations for the application.",
+ "operationId": "getAnnotationList",
+ "tags": ["Annotations"],
+ "parameters": [
+ {
+ "name": "page",
+ "in": "query",
+ "description": "Page number.",
+ "required": false,
+ "schema": { "type": "integer", "default": 1 }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "description": "Number of items returned, default 20, range 1-100.",
+ "required": false,
+ "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved annotation list.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AnnotationListResponse" }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create Annotation",
+ "description": "Creates a new annotation.",
+ "operationId": "createAnnotation",
+ "tags": ["Annotations"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/CreateAnnotationRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Annotation created successfully.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AnnotationItem" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/apps/annotations/{annotation_id}": {
+ "put": {
+ "summary": "Update Annotation",
+ "description": "Updates an existing annotation.",
+ "operationId": "updateAnnotation",
+ "tags": ["Annotations"],
+ "parameters": [
+ {
+ "name": "annotation_id",
+ "in": "path",
+ "required": true,
+ "description": "Annotation ID.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/UpdateAnnotationRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Annotation updated successfully.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AnnotationItem" }
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "summary": "Delete Annotation",
+ "description": "Deletes an annotation.",
+ "operationId": "deleteAnnotation",
+ "tags": ["Annotations"],
+ "parameters": [
+ {
+ "name": "annotation_id",
+ "in": "path",
+ "required": true,
+ "description": "Annotation ID.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "204": { "description": "Annotation deleted successfully. No Content." }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}": {
+ "post": {
+ "summary": "Initial Annotation Reply Settings",
+ "description": "Enable or disable annotation reply settings and configure embedding models. This interface is executed asynchronously.",
+ "operationId": "initialAnnotationReplySettings",
+ "tags": ["Annotations"],
+ "parameters": [
+ {
+ "name": "action",
+ "in": "path",
+ "required": true,
+ "description": "Action, can only be 'enable' or 'disable'.",
+ "schema": { "type": "string", "enum": ["enable", "disable"] }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Annotation reply settings task initiated.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}/status/{job_id}": {
+ "get": {
+ "summary": "Query Initial Annotation Reply Settings Task Status",
+ "description": "Queries the status of an asynchronously executed annotation reply settings task.",
+ "operationId": "getInitialAnnotationReplySettingsStatus",
+ "tags": ["Annotations"],
+ "parameters": [
+ {
+ "name": "action",
+ "in": "path",
+ "required": true,
+ "description": "Action, must be the same as in the initial settings call ('enable' or 'disable').",
+ "schema": { "type": "string", "enum": ["enable", "disable"] }
+ },
+ {
+ "name": "job_id",
+ "in": "path",
+ "required": true,
+ "description": "Job ID obtained from the initial settings call.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved task status.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "API_KEY",
+ "description": "API Key authentication. For all API requests, include your API Key in the `Authorization` HTTP Header, prefixed with 'Bearer '. Example: `Authorization: Bearer {API_KEY}`. **Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.**"
+ }
+ },
+ "responses": {
+ "BadRequestFile": {
+ "description": "Bad Request for file operations. Possible error codes:\n- `no_file_uploaded`: A file must be provided.\n- `too_many_files`: Currently only one file is accepted.\n- `unsupported_preview`: The file does not support preview.\n- `unsupported_estimate`: The file does not support estimation.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ },
+ "FileTooLarge": {
+ "description": "`file_too_large`: The file is too large.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ },
+ "UnsupportedFileTypeFile": {
+ "description": "`unsupported_file_type`: Unsupported extension. (Note: The description for `/files/upload` lists image types, while this generic error mentions document files. This might indicate a context-specific message from the backend).",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ },
+ "S3ErrorFile": {
+ "description": "Service Unavailable for S3 operations. Possible error codes:\n- `s3_connection_failed`: Unable to connect to S3 service.\n- `s3_permission_denied`: No permission to upload files to S3.\n- `s3_file_too_large`: File exceeds S3 size limit.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ },
+ "InternalServerError": {
+ "description": "Internal server error.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ },
+ "SuccessResult": {
+ "description": "Operation successful.",
+ "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } }
+ },
+ "ConversationNotFound": {
+ "description": "Conversation not found. Error code: `conversation_not_exists`",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
+ }
+ },
+ "schemas": {
+ "ChatRequest": {
+ "type": "object",
+ "required": ["query", "user"],
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "User Input/Question content."
+ },
+ "inputs": {
+ "type": "object",
+ "description": "Allows the entry of various variable values defined by the App. Contains key/value pairs. Default {}.",
+ "additionalProperties": true,
+ "default": {}
+ },
+ "response_mode": {
+ "type": "string",
+ "enum": ["streaming", "blocking"],
+ "description": "Mode of response return. `streaming` (recommended) uses SSE. `blocking` returns after completion (may be interrupted for long processes; not supported in Agent Assistant mode). Cloudflare timeout is 100s.",
+ "default": "streaming"
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, unique within the application."
+ },
+ "conversation_id": {
+ "type": "string",
+ "description": "Conversation ID to continue a conversation. Pass the previous message's conversation_id."
+ },
+ "files": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InputFileObject"
+ },
+ "description": "File list (images) for Vision-capable models."
+ },
+ "auto_generate_name": {
+ "type": "boolean",
+ "description": "Auto-generate conversation title. Default `true`. If `false`, use conversation rename API with `auto_generate: true` for async title generation.",
+ "default": true
+ }
+ }
+ },
+ "InputFileObject": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["image"],
+ "description": "Supported type: `image`."
+ },
+ "transfer_method": {
+ "type": "string",
+ "enum": ["remote_url", "local_file"],
+ "description": "`remote_url` for image URL / `local_file` for uploaded file ID."
+ },
+ "url": {
+ "type": "string",
+ "format": "url",
+ "description": "Image URL (if `transfer_method` is `remote_url`)."
+ },
+ "upload_file_id": {
+ "type": "string",
+ "description": "Uploaded file ID via File Upload API (if `transfer_method` is `local_file`)."
+ }
+ },
+ "oneOf": [
+ {"required": ["type", "transfer_method", "url"]},
+ {"required": ["type", "transfer_method", "upload_file_id"]}
+ ]
+ },
+ "ChatCompletionResponse": {
+ "type": "object",
+ "description": "Response object for blocking mode chat completion.",
+ "properties": {
+ "event": {
+ "type": "string",
+ "description": "Event type, fixed as `message`.",
+ "example": "message"
+ },
+ "task_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Task ID for request tracking and stop response API."
+ },
+ "id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Unique ID of this response/message event."
+ },
+ "message_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Unique message ID."
+ },
+ "conversation_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Conversation ID."
+ },
+ "mode": {
+ "type": "string",
+ "description": "App mode, fixed as `chat`.",
+ "example": "chat"
+ },
+ "answer": {
+ "type": "string",
+ "description": "Complete response content."
+ },
+ "metadata": {
+ "type": "object",
+ "properties": {
+ "usage": { "$ref": "#/components/schemas/Usage" },
+ "retriever_resources": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/RetrieverResource" }
+ }
+ }
+ },
+ "created_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Message creation timestamp (Unix epoch seconds)."
+ }
+ }
+ },
+ "ChunkChatEvent": {
+ "type": "object",
+ "description": "Base schema for Server-Sent Event chunks in streaming mode.",
+ "required": ["event"],
+ "properties": {
+ "event": {
+ "type": "string",
+ "description": "The type of event.",
+ "enum": ["message", "agent_message", "tts_message", "tts_message_end", "agent_thought", "message_file", "message_end", "message_replace", "error", "ping"]
+ }
+ },
+ "discriminator": {
+ "propertyName": "event",
+ "mapping": {
+ "message": "#/components/schemas/StreamEventChatMessage",
+ "agent_message": "#/components/schemas/StreamEventChatAgentMessage",
+ "tts_message": "#/components/schemas/StreamEventChatTtsMessage",
+ "tts_message_end": "#/components/schemas/StreamEventChatTtsMessageEnd",
+ "agent_thought": "#/components/schemas/StreamEventChatAgentThought",
+ "message_file": "#/components/schemas/StreamEventChatMessageFile",
+ "message_end": "#/components/schemas/StreamEventChatMessageEnd",
+ "message_replace": "#/components/schemas/StreamEventChatMessageReplace",
+ "error": "#/components/schemas/StreamEventChatError",
+ "ping": "#/components/schemas/StreamEventChatPing"
+ }
+ }
+ },
+ "StreamEventBase": {
+ "type": "object",
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "Task ID." },
+ "message_id": { "type": "string", "format": "uuid", "description": "Unique message ID." },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "Conversation ID." },
+ "created_at": { "type": "integer", "format": "int64", "description": "Creation timestamp." }
+ }
+ },
+ "StreamEventChatMessage": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "required": ["answer"],
+ "properties": {
+ "answer": { "type": "string", "description": "LLM returned text chunk." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatAgentMessage": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "required": ["answer"],
+ "properties": {
+ "answer": { "type": "string", "description": "LLM returned text chunk (Agent mode)." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatTtsMessage": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "TTS audio stream event (base64 encoded Mp3). Available if auto-play enabled.",
+ "required": ["audio"],
+ "properties": {
+ "audio": { "type": "string", "format": "byte", "description": "Base64 encoded audio chunk." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatTtsMessageEnd": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "TTS audio stream end event.",
+ "required": ["audio"],
+ "properties": {
+ "audio": { "type": "string", "description": "Empty string for end event." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatAgentThought": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "Agent thought, LLM thinking, tool call details (Agent mode).",
+ "required": ["id", "position"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "Agent thought ID." },
+ "position": { "type": "integer", "description": "Position of this thought in the sequence for the message." },
+ "thought": { "type": "string", "description": "What LLM is thinking." },
+ "observation": { "type": "string", "description": "Response from tool calls." },
+ "tool": { "type": "string", "description": "List of tools called, split by ';'." },
+ "tool_input": { "type": "string", "description": "Input of tools in JSON format. Example: {\"dalle3\": {\"prompt\": \"a cute cat\"}}." },
+ "message_files": {
+ "type": "array",
+ "items": { "type": "string", "format": "uuid" },
+ "description": "File IDs of files related to this thought (e.g., generated by a tool)."
+ }
+ }
+ }
+ ]
+ },
+ "StreamEventChatMessageFile": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ {
+ "type": "object",
+ "description": "Message file event, a new file created by a tool.",
+ "required": ["id", "type", "belongs_to", "url", "conversation_id"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "File unique ID." },
+ "type": { "type": "string", "enum": ["image"], "description": "File type, currently only 'image'." },
+ "belongs_to": { "type": "string", "enum": ["assistant"], "description": "Who this file belongs to, always 'assistant' here." },
+ "url": { "type": "string", "format": "url", "description": "Remote URL of the file." },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "Conversation ID." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatMessageEnd": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "Message end event, streaming has ended.",
+ "required": ["metadata"],
+ "properties": {
+ "metadata": {
+ "type": "object",
+ "properties": {
+ "usage": { "$ref": "#/components/schemas/Usage" },
+ "retriever_resources": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/RetrieverResource" }
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "StreamEventChatMessageReplace": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "Message content replacement event (e.g., due to content moderation).",
+ "required": ["answer"],
+ "properties": {
+ "answer": { "type": "string", "description": "Replacement content." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatError": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ { "$ref": "#/components/schemas/StreamEventBase" },
+ {
+ "type": "object",
+ "description": "Error event during streaming.",
+ "required": ["status", "code", "message"],
+ "properties": {
+ "status": { "type": "integer", "description": "HTTP status code." },
+ "code": { "type": "string", "description": "Error code." },
+ "message": { "type": "string", "description": "Error message." }
+ }
+ }
+ ]
+ },
+ "StreamEventChatPing": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkChatEvent" },
+ {
+ "type": "object",
+ "description": "Ping event to keep connection alive."
+ }
+ ]
+ },
+ "Usage": {
+ "type": "object",
+ "description": "Model usage information.",
+ "properties": {
+ "prompt_tokens": { "type": "integer" },
+ "prompt_unit_price": { "type": "string", "format": "decimal" },
+ "prompt_price_unit": { "type": "string", "format": "decimal" },
+ "prompt_price": { "type": "string", "format": "decimal" },
+ "completion_tokens": { "type": "integer" },
+ "completion_unit_price": { "type": "string", "format": "decimal" },
+ "completion_price_unit": { "type": "string", "format": "decimal" },
+ "completion_price": { "type": "string", "format": "decimal" },
+ "total_tokens": { "type": "integer" },
+ "total_price": { "type": "string", "format": "decimal" },
+ "currency": { "type": "string", "example": "USD" },
+ "latency": { "type": "number", "format": "double" }
+ }
+ },
+ "RetrieverResource": {
+ "type": "object",
+ "description": "Citation and Attribution information for a resource.",
+ "properties": {
+ "position": { "type": "integer", "description": "Position of the resource in the list." },
+ "dataset_id": { "type": "string", "format": "uuid", "description": "ID of the dataset." },
+ "dataset_name": { "type": "string", "description": "Name of the dataset." },
+ "document_id": { "type": "string", "format": "uuid", "description": "ID of the document." },
+ "document_name": { "type": "string", "description": "Name of the document." },
+ "segment_id": { "type": "string", "format": "uuid", "description": "ID of the specific segment within the document." },
+ "score": { "type": "number", "format": "float", "description": "Relevance score of the resource." },
+ "content": { "type": "string", "description": "Content snippet from the resource." }
+ }
+ },
+ "FileUploadResponse": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "name": { "type": "string" },
+ "size": { "type": "integer" },
+ "extension": { "type": "string" },
+ "mime_type": { "type": "string" },
+ "created_by": { "type": "string", "format": "uuid" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "MessageFeedbackRequest": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "rating": {
+ "type": "string",
+ "enum": ["like", "dislike", null],
+ "nullable": true
+ },
+ "user": { "type": "string" },
+ "content": { "type": "string" }
+ }
+ },
+ "AppFeedbacksResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/FeedbackItem" }
+ }
+ }
+ },
+ "FeedbackItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "app_id": { "type": "string", "format": "uuid" },
+ "conversation_id": { "type": "string", "format": "uuid" },
+ "message_id": { "type": "string", "format": "uuid" },
+ "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true },
+ "content": { "type": "string" },
+ "from_source": { "type": "string" },
+ "from_end_user_id": { "type": "string", "format": "uuid" },
+ "from_account_id": { "type": "string", "format": "uuid", "nullable": true },
+ "created_at": { "type": "string", "format": "date-time" },
+ "updated_at": { "type": "string", "format": "date-time" }
+ }
+ },
+ "SuggestedQuestionsResponse": {
+ "type": "object",
+ "properties": {
+ "result": { "type": "string", "example": "success" },
+ "data": {
+ "type": "array",
+ "items": { "type": "string" },
+ "example": ["a", "b", "c"]
+ }
+ }
+ },
+ "ConversationHistoryResponse": {
+ "type": "object",
+ "properties": {
+ "limit": { "type": "integer" },
+ "has_more": { "type": "boolean" },
+ "data": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/ConversationMessageItem" }
+ }
+ }
+ },
+ "ConversationMessageItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "conversation_id": { "type": "string", "format": "uuid" },
+ "inputs": { "type": "object", "additionalProperties": true },
+ "query": { "type": "string" },
+ "answer": { "type": "string" },
+ "message_files": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/MessageFileItem" }
+ },
+ "feedback": {
+ "type": "object",
+ "nullable": true,
+ "properties": {
+ "rating": { "type": "string", "enum": ["like", "dislike"] }
+ }
+ },
+ "retriever_resources": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/RetrieverResource" }
+ },
+ "agent_thoughts": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/AgentThoughtItem" }
+ },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "MessageFileItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "type": { "type": "string", "description": "File type, e.g., 'image'." },
+ "url": { "type": "string", "format": "url", "description": "Preview image URL." },
+ "belongs_to": { "type": "string", "enum": ["user", "assistant"], "description": "Who this file belongs to." }
+ }
+ },
+ "AgentThoughtItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "Agent thought ID." },
+ "message_id": { "type": "string", "format": "uuid", "description": "Unique message ID this thought belongs to." },
+ "position": { "type": "integer", "description": "Position of this thought." },
+ "thought": { "type": "string", "description": "What LLM is thinking." },
+ "tool": { "type": "string", "description": "Tools called, split by ';'." },
+ "tool_input": { "type": "string", "description": "Input of tools in JSON format." },
+ "observation": { "type": "string", "description": "Response from tool calls." },
+ "files": {
+ "type": "array",
+ "items": { "type": "string", "format": "uuid" },
+ "description": "File IDs related to this thought (from example, Markdown text says 'message_files')."
+ },
+ "created_at": { "type": "integer", "format": "int64", "description": "Creation timestamp." }
+ }
+ },
+ "ConversationsListResponse": {
+ "type": "object",
+ "properties": {
+ "limit": { "type": "integer" },
+ "has_more": { "type": "boolean" },
+ "data": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/ConversationListItem" }
+ }
+ }
+ },
+ "ConversationListItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "name": { "type": "string" },
+ "inputs": { "type": "object", "additionalProperties": true },
+ "status": { "type": "string" },
+ "introduction": { "type": "string" },
+ "created_at": { "type": "integer", "format": "int64" },
+ "updated_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "ConversationRenameRequest": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "name": { "type": "string", "description": "(Optional) The name of the conversation. Omit if auto_generate is true." },
+ "auto_generate": { "type": "boolean", "default": false, "description": "(Optional) Automatically generate the title. Default false." },
+ "user": { "type": "string", "description": "The user identifier." }
+ }
+ },
+ "ConversationRenameResponse": {
+ "$ref": "#/components/schemas/ConversationListItem"
+ },
+ "ConversationVariablesResponse": {
+ "type": "object",
+ "properties": {
+ "limit": { "type": "integer", "description": "Number of items per page." },
+ "has_more": { "type": "boolean", "description": "Whether there is a next page." },
+ "data": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/ConversationVariableItem" }
+ }
+ }
+ },
+ "ConversationVariableItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "Variable ID." },
+ "name": { "type": "string", "description": "Variable name." },
+ "value_type": { "type": "string", "description": "Variable type (string, number, object, json, etc.)." },
+ "value": { "type": "string", "description": "Variable value (can be a JSON string for complex types)." },
+ "description": { "type": "string", "description": "Variable description." },
+ "created_at": { "type": "integer", "format": "int64", "description": "Creation timestamp." },
+ "updated_at": { "type": "integer", "format": "int64", "description": "Last update timestamp." }
+ }
+ },
+ "AudioToTextRequest": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "Audio file. Supported: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier."
+ }
+ }
+ },
+ "AudioToTextResponse": {
+ "type": "object",
+ "properties": {
+ "text": { "type": "string", "description": "Output text from speech recognition." }
+ }
+ },
+ "TextToAudioFormRequest": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "message_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Message ID (priority if both text and message_id provided)."
+ },
+ "text": {
+ "type": "string",
+ "description": "Speech content."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier."
+ }
+ },
+ "description": "Requires `user`. Provide either `message_id` or `text`."
+ },
+ "AppInfoResponse": {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "description": { "type": "string" },
+ "tags": { "type": "array", "items": { "type": "string" } }
+ }
+ },
+ "ChatAppParametersResponse": {
+ "type": "object",
+ "properties": {
+ "opening_statement": { "type": "string" },
+ "suggested_questions": { "type": "array", "items": { "type": "string" } },
+ "suggested_questions_after_answer": {
+ "type": "object",
+ "properties": { "enabled": { "type": "boolean" } }
+ },
+ "speech_to_text": {
+ "type": "object",
+ "properties": { "enabled": { "type": "boolean" } }
+ },
+ "text_to_speech": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean" },
+ "voice": { "type": "string" },
+ "language": { "type": "string" },
+ "autoPlay": { "type": "string", "enum": ["enabled", "disabled"] }
+ }
+ },
+ "retriever_resource": {
+ "type": "object",
+ "properties": { "enabled": { "type": "boolean" } }
+ },
+ "annotation_reply": {
+ "type": "object",
+ "properties": { "enabled": { "type": "boolean" } }
+ },
+ "user_input_form": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/UserInputFormItem" }
+ },
+ "file_upload": {
+ "type": "object",
+ "properties": {
+ "image": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean" },
+ "number_limits": { "type": "integer" },
+ "detail": {"type": "string"},
+ "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } }
+ }
+ }
+ }
+ },
+ "system_parameters": {
+ "type": "object",
+ "properties": {
+ "file_size_limit": { "type": "integer" },
+ "image_file_size_limit": { "type": "integer" },
+ "audio_file_size_limit": { "type": "integer" },
+ "video_file_size_limit": { "type": "integer" }
+ }
+ }
+ }
+ },
+ "UserInputFormItem": {
+ "type": "object",
+ "oneOf": [
+ { "$ref": "#/components/schemas/TextInputControlWrapper" },
+ { "$ref": "#/components/schemas/ParagraphControlWrapper" },
+ { "$ref": "#/components/schemas/SelectControlWrapper" }
+ ]
+ },
+ "TextInputControlWrapper": {
+ "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControl" } },"required":["text-input"]
+ },
+ "ParagraphControlWrapper": {
+ "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControl" } },"required":["paragraph"]
+ },
+ "SelectControlWrapper": {
+ "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControl" } },"required":["select"]
+ },
+ "TextInputControl": {
+ "type": "object", "required": ["label", "variable", "required"],
+ "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } }
+ },
+ "ParagraphControl": {
+ "type": "object", "required": ["label", "variable", "required"],
+ "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } }
+ },
+ "SelectControl": {
+ "type": "object", "required": ["label", "variable", "required", "options"],
+ "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } } }
+ },
+ "AppMetaResponse": {
+ "type": "object",
+ "properties": {
+ "tool_icons": {
+ "type": "object",
+ "additionalProperties": {
+ "oneOf": [
+ { "type": "string", "format": "url", "description": "URL of the icon." },
+ { "$ref": "#/components/schemas/ToolIconDetail" }
+ ]
+ },
+ "description": "Tool icons. Keys are tool names."
+ }
+ }
+ },
+ "ToolIconDetail": {
+ "type": "object",
+ "properties": {
+ "background": { "type": "string", "description": "Background color in hex format." },
+ "content": { "type": "string", "description": "Emoji content." }
+ }
+ },
+ "WebAppSettingsResponse": {
+ "type": "object",
+ "properties": {
+ "title": { "type": "string" }, "chat_color_theme": { "type": "string" }, "chat_color_theme_inverted": { "type": "boolean" },
+ "icon_type": { "type": "string", "enum": ["emoji", "image"] }, "icon": { "type": "string" }, "icon_background": { "type": "string" },
+ "icon_url": { "type": "string", "format": "url", "nullable": true }, "description": { "type": "string" }, "copyright": { "type": "string" },
+ "privacy_policy": { "type": "string" }, "custom_disclaimer": { "type": "string" }, "default_language": { "type": "string" },
+ "show_workflow_steps": { "type": "boolean" }, "use_icon_as_answer_icon": { "type": "boolean" }
+ }
+ },
+ "AnnotationListResponse": {
+ "type": "object",
+ "properties": {
+ "data": { "type": "array", "items": { "$ref": "#/components/schemas/AnnotationItem" } },
+ "has_more": { "type": "boolean" },
+ "limit": { "type": "integer" },
+ "total": { "type": "integer" },
+ "page": { "type": "integer" }
+ }
+ },
+ "AnnotationItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "question": { "type": "string" },
+ "answer": { "type": "string" },
+ "hit_count": { "type": "integer" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "CreateAnnotationRequest": {
+ "type": "object",
+ "required": ["question", "answer"],
+ "properties": {
+ "question": { "type": "string" },
+ "answer": { "type": "string" }
+ }
+ },
+ "UpdateAnnotationRequest": {
+ "type": "object",
+ "required": ["question", "answer"],
+ "properties": {
+ "question": { "type": "string" },
+ "answer": { "type": "string" }
+ }
+ },
+ "InitialAnnotationReplySettingsRequest": {
+ "type": "object",
+ "required": ["score_threshold"],
+ "properties": {
+ "embedding_provider_name": { "type": "string", "description": "Specified embedding model provider name (Optional)." },
+ "embedding_model_name": { "type": "string", "description": "Specified embedding model name (Optional)." },
+ "score_threshold": { "type": "number", "format": "float", "description": "Similarity threshold for matching annotated replies." }
+ }
+ },
+ "InitialAnnotationReplySettingsResponse": {
+ "type": "object",
+ "properties": {
+ "job_id": { "type": "string", "format": "uuid" },
+ "job_status": { "type": "string" }
+ }
+ },
+ "InitialAnnotationReplySettingsStatusResponse": {
+ "type": "object",
+ "properties": {
+ "job_id": { "type": "string", "format": "uuid" },
+ "job_status": { "type": "string" },
+ "error_msg": { "type": "string", "nullable": true }
+ }
+ },
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "status": { "type": "integer" },
+ "code": { "type": "string" },
+ "message": { "type": "string" }
+ }
+ }
+ }
+ },
+ "tags": [
+ { "name": "Chat", "description": "Operations related to chat messages and interactions." },
+ { "name": "Files", "description": "File upload operations." },
+ { "name": "Feedback", "description": "User feedback operations." },
+ { "name": "Conversations", "description": "Operations related to managing conversations." },
+ { "name": "TTS", "description": "Text-to-Speech and Speech-to-Text operations." },
+ { "name": "Application", "description": "Operations to retrieve application settings and information." },
+ { "name": "Annotations", "description": "Operations related to managing annotations for direct replies." }
+ ]
+}
\ No newline at end of file
diff --git a/en/openapi_chatflow.json b/en/openapi_chatflow.json
new file mode 100644
index 00000000..d8ca1364
--- /dev/null
+++ b/en/openapi_chatflow.json
@@ -0,0 +1,993 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Advanced Chat App API",
+ "description": "Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbot, customer service AI, etc. This version includes advanced features like workflow events and more detailed file type support.",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "The base URL for the Advanced Chat App API. Replace {api_base_url} with the actual API base URL provided for your application (e.g., from props.appDetail.api_base_url).",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "Actual base URL of the API"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "Send Chat Message",
+ "description": "Send a request to the advanced chat application, supporting various file types and workflow events.",
+ "operationId": "sendAdvancedChatMessage",
+ "tags": ["Chatflow"],
+ "requestBody": {
+ "description": "Request body to send an advanced chat message.",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AdvancedChatRequest"
+ },
+ "examples": {
+ "streaming_with_file_and_workflow": {
+ "summary": "Streaming mode example with image file",
+ "value": {
+ "inputs": {"user_name": "Alice"},
+ "query": "Analyze this document and tell me its sentiment.",
+ "response_mode": "streaming",
+ "conversation_id": "conv_12345",
+ "user": "user_alice",
+ "files": [
+ {
+ "type": "document",
+ "transfer_method": "remote_url",
+ "url": "https://example.com/mydoc.pdf"
+ }
+ ],
+ "auto_generate_name": true
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful response. The content type and structure depend on the `response_mode`.\n- `blocking`: `application/json` with `ChatCompletionResponse`.\n- `streaming`: `text/event-stream` with `ChunkAdvancedChatEvent` stream.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponse"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "A stream of Server-Sent Events. See `ChunkAdvancedChatEvent` for structures."
+ },
+ "examples": {
+ "workflow_events_example": {
+ "summary": "Example stream including workflow events",
+ "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"task_abc\", \"workflow_run_id\": \"wf_run_1\", \"data\": {\"id\": \"wf_run_1\", \"workflow_id\": \"wf_def_xyz\", \"sequence_number\": 1, \"created_at\": 1705395332}}\n\ndata: {\"event\": \"node_started\", \"task_id\": \"task_abc\", \"workflow_run_id\": \"wf_run_1\", \"data\": {\"id\": \"node_run_1\", \"node_id\": \"node_start\", \"node_type\": \"start\", \"title\": \"Start Node\", \"index\": 0, \"inputs\": {}, \"created_at\": 1705395333}}\n\ndata: {\"event\": \"message\", \"task_id\": \"task_abc\", \"message_id\": \"msg_123\", \"conversation_id\": \"conv_123\", \"answer\": \"Processing... \", \"created_at\": 1705395334}\n\ndata: {\"event\": \"node_finished\", \"task_id\": \"task_abc\", \"workflow_run_id\": \"wf_run_1\", \"data\": {\"id\": \"node_run_1\", \"node_id\": \"node_start\", \"node_type\": \"start\", \"title\": \"Start Node\", \"index\": 0, \"status\": \"succeeded\", \"elapsed_time\": 0.5, \"created_at\": 1705395333}}\n\ndata: {\"event\": \"message_end\", \"task_id\": \"task_abc\", \"message_id\": \"msg_123\", \"conversation_id\": \"conv_123\", \"metadata\": {\"usage\": {\"total_tokens\": 10}}}\n\ndata: {\"event\": \"workflow_finished\", \"task_id\": \"task_abc\", \"workflow_run_id\": \"wf_run_1\", \"data\": {\"id\": \"wf_run_1\", \"workflow_id\": \"wf_def_xyz\", \"status\": \"succeeded\", \"elapsed_time\": 2.5, \"total_tokens\": 150, \"total_steps\": 3, \"created_at\": 1705395332, \"finished_at\": 1705395335}}\n\n"
+ }
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGeneric" },
+ "404": { "$ref": "#/components/responses/ConversationNotFound" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "File Upload",
+ "description": "Upload a file for use when sending messages, enabling multimodal understanding. Supports any formats supported by your application. Uploaded files are for use by the current end-user only.",
+ "operationId": "uploadAdvancedChatFile",
+ "tags": ["Files"],
+ "requestBody": {
+ "description": "File upload request. Requires multipart/form-data.",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "The file to be uploaded."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, unique within the application."
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "File uploaded successfully.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponse"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFile" },
+ "413": { "$ref": "#/components/responses/FileTooLarge" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFile" },
+ "503": { "$ref": "#/components/responses/S3ErrorFile" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "Stop Advanced Chat Message Generation",
+ "description": "Stops an advanced chat message generation task. Only supported in streaming mode.",
+ "operationId": "stopAdvancedChatMessageGeneration",
+ "tags": ["Chatflow"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "Task ID from the streaming chunk.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "User identifier, consistent with the send message call."
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "Message Feedback",
+ "description": "Provide feedback for a message.",
+ "operationId": "postAdvancedChatMessageFeedback",
+ "tags": ["Feedback"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "Message ID.",
+ "schema": { "type": "string" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/MessageFeedbackRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "Get feedbacks of application",
+ "description": "Get application's feedbacks.",
+ "operationId": "getAdvancedChatAppFeedbacks",
+ "tags": ["Feedback"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParam" }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of application feedbacks.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppFeedbacksResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "Next Suggested Questions",
+ "description": "Get next questions suggestions for the current message.",
+ "operationId": "getAdvancedSuggestedQuestions",
+ "tags": ["Chatflow"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "Message ID.",
+ "schema": { "type": "string" }
+ },
+ { "$ref": "#/components/parameters/UserQueryParam" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved suggested questions.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "Get Conversation History Messages",
+ "description": "Returns historical chat records in a scrolling load format.",
+ "operationId": "getAdvancedConversationHistory",
+ "tags": ["Conversations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdQueryParam" },
+ { "$ref": "#/components/parameters/UserQueryParam" },
+ {
+ "name": "first_id",
+ "in": "query",
+ "description": "ID of the first chat record on the current page (for pagination).",
+ "schema": { "type": "string" }
+ },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversation history.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationHistoryResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "Get Conversations",
+ "description": "Retrieve the conversation list for the current user.",
+ "operationId": "getAdvancedConversationsList",
+ "tags": ["Conversations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/UserQueryParam" },
+ { "$ref": "#/components/parameters/LastIdQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" },
+ { "$ref": "#/components/parameters/SortByQueryParam" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversations list.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationsListResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "Delete Conversation",
+ "description": "Delete a conversation.",
+ "operationId": "deleteAdvancedConversation",
+ "tags": ["Conversations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParam" }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": { "type": "string", "description": "The user identifier." }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "204": { "description": "Conversation deleted successfully. No Content." }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "Conversation Rename",
+ "description": "Rename the session.",
+ "operationId": "renameAdvancedConversation",
+ "tags": ["Conversations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParam" }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationRenameRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Conversation renamed successfully.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationRenameResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "Get Conversation Variables",
+ "description": "Retrieve variables from a specific conversation.",
+ "operationId": "getAdvancedConversationVariables",
+ "tags": ["Conversations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParam" },
+ { "$ref": "#/components/parameters/UserQueryParam" },
+ { "$ref": "#/components/parameters/LastIdQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" },
+ { "$ref": "#/components/parameters/VariableNameQueryParam" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved conversation variables.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationVariablesResponse" }
+ }
+ }
+ },
+ "404": { "$ref": "#/components/responses/ConversationNotFound" }
+ }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "Speech to Text",
+ "description": "Convert audio file to text. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. File size limit: 15MB.",
+ "operationId": "advancedAudioToText",
+ "tags": ["TTS"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": { "$ref": "#/components/schemas/AudioToTextRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successfully converted audio to text.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AudioToTextResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "Text to Audio",
+ "description": "Convert text to speech.",
+ "operationId": "advancedTextToAudio",
+ "tags": ["TTS"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/TextToAudioJsonRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Audio file generated successfully.",
+ "content": {
+ "audio/wav": { "schema": { "type": "string", "format": "binary" } },
+ "audio/mp3": { "schema": { "type": "string", "format": "binary" } }
+ },
+ "headers": {
+ "Content-Type": {
+ "schema": { "type": "string", "example": "audio/wav" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "Get Application Basic Information",
+ "operationId": "getAdvancedChatAppInfo",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Basic application information.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppInfoResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "Get Application Parameters Information",
+ "operationId": "getAdvancedChatAppParameters",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Application parameters.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ChatAppParametersResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "Get Application Meta Information",
+ "operationId": "getAdvancedChatAppMeta",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Application meta information (tool icons).",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppMetaResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "Get Application WebApp Settings",
+ "operationId": "getAdvancedChatWebAppSettings",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "WebApp settings.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/WebAppSettingsResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/apps/annotations": {
+ "get": {
+ "summary": "Get Annotation List",
+ "operationId": "getAdvancedAnnotationList",
+ "tags": ["Annotations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Annotation list.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AnnotationListResponse" }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "summary": "Create Annotation",
+ "operationId": "createAdvancedAnnotation",
+ "tags": ["Annotations"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/CreateAnnotationRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "description": "Annotation created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } },
+ "201": { "description": "Annotation created.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } }
+ }
+ }
+ },
+ "/apps/annotations/{annotation_id}": {
+ "put": {
+ "summary": "Update Annotation",
+ "operationId": "updateAdvancedAnnotation",
+ "tags": ["Annotations"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParam" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnnotationRequest" } } }
+ },
+ "responses": {
+ "200": { "description": "Annotation updated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } }
+ }
+ },
+ "delete": {
+ "summary": "Delete Annotation",
+ "operationId": "deleteAdvancedAnnotation",
+ "tags": ["Annotations"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParam" } ],
+ "responses": {
+ "204": { "description": "Annotation deleted." }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}": {
+ "post": {
+ "summary": "Initial Annotation Reply Settings",
+ "operationId": "initialAdvancedAnnotationReplySettings",
+ "tags": ["Annotations"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationActionPathParam" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" } } }
+ },
+ "responses": {
+ "200": { "description": "Task initiated.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" } } } },
+ "202": { "description": "Task accepted.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" } } } }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}/status/{job_id}": {
+ "get": {
+ "summary": "Query Initial Annotation Reply Settings Task Status",
+ "operationId": "getAdvancedInitialAnnotationReplySettingsStatus",
+ "tags": ["Annotations"],
+ "parameters": [
+ { "$ref": "#/components/parameters/AnnotationActionPathParam" },
+ { "$ref": "#/components/parameters/JobIdPathParam" }
+ ],
+ "responses": {
+ "200": { "description": "Task status.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" } } } }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "API_KEY",
+ "description": "API Key authentication."
+ }
+ },
+ "parameters": {
+ "PageQueryParam": { "name": "page", "in": "query", "description": "Page number.", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParam": { "name": "limit", "in": "query", "description": "Number of items per page.", "schema": { "type": "integer" } },
+ "LimitQueryParamDefault20": { "name": "limit", "in": "query", "description": "Number of items per page.", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Max100": { "name": "limit", "in": "query", "description": "Number of items per page (Default 20, Max 100).", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "UserQueryParam": { "name": "user", "in": "query", "required": true, "description": "User identifier.", "schema": { "type": "string" } },
+ "ConversationIdQueryParam": { "name": "conversation_id", "in": "query", "required": true, "description": "Conversation ID.", "schema": { "type": "string" } },
+ "LastIdQueryParam": { "name": "last_id", "in": "query", "description": "ID of the last record for pagination.", "schema": { "type": "string" } },
+ "SortByQueryParam": { "name": "sort_by", "in": "query", "description": "Sorting field (e.g., -updated_at).", "schema": { "type": "string", "enum": ["created_at", "-created_at", "updated_at", "-updated_at"], "default": "-updated_at" } },
+ "ConversationIdPathParam": { "name": "conversation_id", "in": "path", "required": true, "description": "Conversation ID.", "schema": { "type": "string" } },
+ "VariableNameQueryParam": { "name": "variable_name", "in": "query", "description": "Filter by variable name.", "schema": { "type": "string" } },
+ "AnnotationIdPathParam": { "name": "annotation_id", "in": "path", "required": true, "description": "Annotation ID.", "schema": { "type": "string", "format": "uuid" } },
+ "AnnotationActionPathParam": { "name": "action", "in": "path", "required": true, "description": "Action: 'enable' or 'disable'.", "schema": { "type": "string", "enum": ["enable", "disable"] } },
+ "JobIdPathParam": { "name": "job_id", "in": "path", "required": true, "description": "Job ID.", "schema": { "type": "string", "format": "uuid" } }
+ },
+ "responses": {
+ "BadRequestGeneric": { "description": "Bad Request. Check parameters.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "BadRequestFile": { "description": "Bad Request for file operation.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "FileTooLarge": { "description": "File is too large.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "UnsupportedFileTypeFile": { "description": "Unsupported file type for upload.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "S3ErrorFile": { "description": "S3 storage error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "InternalServerError": { "description": "Internal server error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "SuccessResult": { "description": "Operation successful.", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } },
+ "ConversationNotFound": { "description": "Conversation not found.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }
+ },
+ "schemas": {
+ "AdvancedChatRequest": {
+ "type": "object",
+ "required": ["query", "user"],
+ "properties": {
+ "query": { "type": "string", "description": "User input/question content." },
+ "inputs": {
+ "type": "object",
+ "description": "Key/value pairs for app variables. For file type variables, value should be an InputFileObject.",
+ "additionalProperties": {
+ "oneOf": [
+ { "type": "string" },
+ { "type": "number" },
+ { "type": "boolean" },
+ { "$ref": "#/components/schemas/InputFileObjectAdvanced" }
+ ]
+ },
+ "default": {}
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "Response mode. Cloudflare timeout is 100s for blocking." },
+ "user": { "type": "string", "description": "User identifier." },
+ "conversation_id": { "type": "string", "description": "Conversation ID to continue." },
+ "files": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/InputFileObjectAdvanced" },
+ "description": "List of files for Vision-capable models or general file input."
+ },
+ "auto_generate_name": { "type": "boolean", "default": true, "description": "Auto-generate conversation title." }
+ }
+ },
+ "InputFileObjectAdvanced": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["document", "image", "audio", "video", "custom"],
+ "description": "Type of the file. 'document' covers TXT, MD, PDF, HTML, XLSX, DOCX, CSV, EML, MSG, PPTX, XML, EPUB. 'image' covers JPG, PNG, GIF, WEBP, SVG. 'audio' covers MP3, M4A, WAV, WEBM, AMR. 'video' covers MP4, MOV, MPEG, MPGA."
+ },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"] },
+ "url": { "type": "string", "format": "url", "description": "URL (if `transfer_method` is `remote_url`)." },
+ "upload_file_id": { "type": "string", "description": "Uploaded file ID (if `transfer_method` is `local_file`)." }
+ },
+ "oneOf": [
+ {"required": ["url"]},
+ {"required": ["upload_file_id"]}
+ ],
+ "example": { "type": "image", "transfer_method": "remote_url", "url": "https://example.com/image.png" }
+ },
+ "ChatCompletionResponse": {
+ "type": "object",
+ "description": "Response for blocking mode chat.",
+ "properties": {
+ "event": { "type": "string", "example": "message" },
+ "task_id": { "type": "string", "format": "uuid" },
+ "id": { "type": "string", "format": "uuid", "description": "Unique ID of this response event." },
+ "message_id": { "type": "string", "format": "uuid" },
+ "conversation_id": { "type": "string", "format": "uuid" },
+ "mode": { "type": "string", "example": "chat" },
+ "answer": { "type": "string" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadata" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "ResponseMetadata": {
+ "type": "object",
+ "properties": {
+ "usage": { "$ref": "#/components/schemas/Usage" },
+ "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResource" } }
+ }
+ },
+ "ChunkAdvancedChatEvent": {
+ "type": "object",
+ "required": ["event"],
+ "properties": {
+ "event": { "type": "string", "enum": ["message", "message_file", "message_end", "tts_message", "tts_message_end", "message_replace", "workflow_started", "node_started", "node_finished", "workflow_finished", "error", "ping"] }
+ },
+ "discriminator": {
+ "propertyName": "event",
+ "mapping": {
+ "message": "#/components/schemas/StreamEventAdvChatMessage",
+ "message_file": "#/components/schemas/StreamEventAdvMessageFile",
+ "message_end": "#/components/schemas/StreamEventAdvMessageEnd",
+ "tts_message": "#/components/schemas/StreamEventAdvTtsMessage",
+ "tts_message_end": "#/components/schemas/StreamEventAdvTtsMessageEnd",
+ "message_replace": "#/components/schemas/StreamEventAdvMessageReplace",
+ "workflow_started": "#/components/schemas/StreamEventAdvWorkflowStarted",
+ "node_started": "#/components/schemas/StreamEventAdvNodeStarted",
+ "node_finished": "#/components/schemas/StreamEventAdvNodeFinished",
+ "workflow_finished": "#/components/schemas/StreamEventAdvWorkflowFinished",
+ "error": "#/components/schemas/StreamEventAdvError",
+ "ping": "#/components/schemas/StreamEventAdvPing"
+ }
+ }
+ },
+ "StreamEventBaseAdv": {
+ "type": "object",
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "message_id": { "type": "string", "format": "uuid" },
+ "conversation_id": { "type": "string", "format": "uuid" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "StreamEventAdvChatMessage": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "$ref": "#/components/schemas/StreamEventBaseAdv" },
+ { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string" } } } ]
+ },
+ "StreamEventAdvMessageFile": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["id", "type", "belongs_to", "url", "conversation_id"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "type": { "type": "string", "description": "File type, e.g., 'image'." },
+ "belongs_to": { "type": "string", "enum": ["assistant"] },
+ "url": { "type": "string", "format": "url" },
+ "conversation_id": { "type": "string", "format": "uuid" }
+ }
+ }
+ ]
+ },
+ "StreamEventAdvMessageEnd": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "$ref": "#/components/schemas/StreamEventBaseAdv" },
+ { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadata" } } } ]
+ },
+ "StreamEventAdvTtsMessage": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "$ref": "#/components/schemas/StreamEventBaseAdv" },
+ { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 encoded audio." } } }
+ ]
+ },
+ "StreamEventAdvTtsMessageEnd": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "$ref": "#/components/schemas/StreamEventBaseAdv" },
+ { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "Empty string." } } }
+ ]
+ },
+ "StreamEventAdvMessageReplace": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "$ref": "#/components/schemas/StreamEventBaseAdv" },
+ { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "Replacement content." } } }
+ ]
+ },
+ "StreamEventAdvWorkflowStarted": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["task_id", "workflow_run_id", "data"],
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "workflow_run_id": { "type": "string", "format": "uuid" },
+ "data": { "$ref": "#/components/schemas/WorkflowStartedData" }
+ }
+ }
+ ]
+ },
+ "WorkflowStartedData": {
+ "type": "object", "required": ["id", "workflow_id", "sequence_number", "created_at"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "workflow_id": { "type": "string", "format": "uuid" },
+ "sequence_number": { "type": "integer" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "StreamEventAdvNodeStarted": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["task_id", "workflow_run_id", "data"],
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "workflow_run_id": { "type": "string", "format": "uuid" },
+ "data": { "$ref": "#/components/schemas/NodeStartedData" }
+ }
+ }
+ ]
+ },
+ "NodeStartedData": {
+ "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "created_at"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "Unique ID of this node execution instance." },
+ "node_id": { "type": "string", "format": "uuid", "description": "ID of the node definition." },
+ "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer" },
+ "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true },
+ "inputs": { "type": "object", "additionalProperties": true, "description": "Variables used by the node." },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "StreamEventAdvNodeFinished": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["task_id", "workflow_run_id", "data"],
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "workflow_run_id": { "type": "string", "format": "uuid" },
+ "data": { "$ref": "#/components/schemas/NodeFinishedData" }
+ }
+ }
+ ]
+ },
+ "NodeFinishedData": {
+ "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "status", "created_at"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string", "format": "uuid" },
+ "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer" },
+ "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true },
+ "inputs": { "type": "object", "additionalProperties": true, "nullable": true },
+ "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "Node process data (JSON)." },
+ "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "Output content (JSON)." },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] },
+ "error": { "type": "string", "nullable": true },
+ "elapsed_time": { "type": "number", "format": "float", "nullable": true },
+ "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadata" , "nullable": true},
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "NodeExecutionMetadata": {
+ "type": "object",
+ "properties": {
+ "total_tokens": { "type": "integer", "nullable": true },
+ "total_price": { "type": "number", "format": "float", "nullable": true, "description": "Using float for price compatibility, MD says decimal." },
+ "currency": { "type": "string", "nullable": true, "example": "USD" }
+ }
+ },
+ "StreamEventAdvWorkflowFinished": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["task_id", "workflow_run_id", "data"],
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "workflow_run_id": { "type": "string", "format": "uuid" },
+ "data": { "$ref": "#/components/schemas/WorkflowFinishedData" }
+ }
+ }
+ ]
+ },
+ "WorkflowFinishedData": {
+ "type": "object", "required": ["id", "workflow_id", "status", "created_at", "finished_at"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid" }, "workflow_id": { "type": "string", "format": "uuid" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] },
+ "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "Output content (JSON)." },
+ "error": { "type": "string", "nullable": true },
+ "elapsed_time": { "type": "number", "format": "float", "nullable": true },
+ "total_tokens": { "type": "integer", "nullable": true },
+ "total_steps": { "type": "integer", "default": 0 },
+ "created_at": { "type": "integer", "format": "int64" },
+ "finished_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "StreamEventAdvError": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" },
+ { "type": "object", "required": ["task_id", "status", "code", "message"],
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "May not always be present in a generic error." },
+ "status": { "type": "integer" }, "code": { "type": "string" }, "message": { "type": "string" }
+ }
+ }
+ ]
+ },
+ "StreamEventAdvPing": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkAdvancedChatEvent" }, { "type": "object" } ]
+ },
+ "Usage": {
+ "type": "object", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } }
+ },
+ "RetrieverResource": {
+ "type": "object", "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } }
+ },
+ "FileUploadResponse": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "size": { "type": "integer" }, "extension": { "type": "string" }, "mime_type": { "type": "string" }, "created_by": { "type": "string", "format": "uuid" }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "MessageFeedbackRequest": {
+ "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "user": { "type": "string" }, "content": { "type": "string", "nullable": true } }
+ },
+ "AppFeedbacksResponse": {
+ "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItem" } } }
+ },
+ "FeedbackItem": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }
+ },
+ "SuggestedQuestionsResponse": {
+ "type": "object", "properties": { "result": { "type": "string", "example": "success" }, "data": { "type": "array", "items": { "type": "string" } } }
+ },
+ "ConversationHistoryResponse": {
+ "type": "object", "properties": { "limit": { "type": "integer" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationMessageItem" } } }
+ },
+ "ConversationMessageItem": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "inputs": { "type": "object", "additionalProperties": true }, "query": { "type": "string" }, "answer": { "type": "string" }, "message_files": { "type": "array", "items": { "$ref": "#/components/schemas/MessageFileItem" } }, "feedback": { "type": "object", "nullable": true, "properties": { "rating": { "type": "string", "enum": ["like", "dislike"] } } }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResource" } }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "MessageFileItem": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "type": { "type": "string" }, "url": { "type": "string", "format": "url" }, "belongs_to": { "type": "string", "enum": ["user", "assistant"] } }
+ },
+ "ConversationsListResponse": {
+ "type": "object", "properties": { "limit": { "type": "integer" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationListItem" } } }
+ },
+ "ConversationListItem": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "inputs": { "type": "object", "additionalProperties": true }, "status": { "type": "string" }, "introduction": { "type": "string", "nullable": true }, "created_at": { "type": "integer", "format": "int64" }, "updated_at": { "type": "integer", "format": "int64" } }
+ },
+ "ConversationRenameRequest": {
+ "type": "object", "required": ["user"], "properties": { "name": { "type": "string", "nullable": true }, "auto_generate": { "type": "boolean", "default": false }, "user": { "type": "string" } }
+ },
+ "ConversationRenameResponse": { "$ref": "#/components/schemas/ConversationListItem" },
+ "ConversationVariablesResponse": {
+ "type": "object", "properties": { "limit": { "type": "integer" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationVariableItem" } } }
+ },
+ "ConversationVariableItem": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "value_type": { "type": "string" }, "value": { "type": "string" }, "description": { "type": "string", "nullable": true }, "created_at": { "type": "integer", "format": "int64" }, "updated_at": { "type": "integer", "format": "int64" } }
+ },
+ "AudioToTextRequest": {
+ "type": "object", "required": ["file", "user"], "properties": { "file": { "type": "string", "format": "binary", "description": "Audio file. Formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. Limit: 15MB." }, "user": { "type": "string" } }
+ },
+ "AudioToTextResponse": { "type": "object", "properties": { "text": { "type": "string" } } },
+ "TextToAudioJsonRequest": {
+ "type": "object", "required": ["user"],
+ "properties": {
+ "message_id": { "type": "string", "format": "uuid", "description": "Message ID (priority)." },
+ "text": { "type": "string", "description": "Speech content." },
+ "user": { "type": "string" },
+ "streaming": {"type": "boolean", "default": false, "description": "If true, response will be a stream of audio chunks."}
+ },
+ "description": "Requires `user`. Provide `message_id` or `text`."
+ },
+ "AppInfoResponse": {
+ "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } } }
+ },
+ "ChatAppParametersResponse": {
+ "type": "object", "properties": { "opening_statement": { "type": "string" }, "suggested_questions": { "type": "array", "items": { "type": "string" } }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "text_to_speech": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "voice": { "type": "string" }, "language": { "type": "string" }, "autoPlay": { "type": "string", "enum": ["enabled", "disabled"] } } }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean" } } }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItem" } }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } } } } }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer" }, "image_file_size_limit": { "type": "integer" }, "audio_file_size_limit": { "type": "integer" }, "video_file_size_limit": { "type": "integer" } } } }
+ },
+ "UserInputFormItem": { "type": "object", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapper" }, { "$ref": "#/components/schemas/ParagraphControlWrapper" }, { "$ref": "#/components/schemas/SelectControlWrapper" } ] },
+ "TextInputControlWrapper": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControl" } }, "required":["text-input"] },
+ "ParagraphControlWrapper": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControl" } }, "required":["paragraph"] },
+ "SelectControlWrapper": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControl" } }, "required":["select"] },
+ "TextInputControl": { "type": "object", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } } },
+ "ParagraphControl": { "type": "object", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } } },
+ "SelectControl": { "type": "object", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } } } },
+ "AppMetaResponse": { "type": "object", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "type": "string", "format": "url" }, { "$ref": "#/components/schemas/ToolIconDetail" } ] } } } },
+ "ToolIconDetail": { "type": "object", "properties": { "background": { "type": "string" }, "content": { "type": "string" } } },
+ "WebAppSettingsResponse": { "type": "object", "properties": { "title": { "type": "string" }, "chat_color_theme": { "type": "string" }, "chat_color_theme_inverted": { "type": "boolean" }, "icon_type": { "type": "string", "enum": ["emoji", "image"] }, "icon": { "type": "string" }, "icon_background": { "type": "string" }, "icon_url": { "type": "string", "format": "url", "nullable": true }, "description": { "type": "string" }, "copyright": { "type": "string" }, "privacy_policy": { "type": "string" }, "custom_disclaimer": { "type": "string" }, "default_language": { "type": "string" }, "show_workflow_steps": { "type": "boolean" }, "use_icon_as_answer_icon": { "type": "boolean" } } },
+ "AnnotationListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AnnotationItem" } }, "has_more": { "type": "boolean" }, "limit": { "type": "integer" }, "total": { "type": "integer" }, "page": { "type": "integer" } } },
+ "AnnotationItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "question": { "type": "string" }, "answer": { "type": "string" }, "hit_count": { "type": "integer" }, "created_at": { "type": "integer", "format": "int64" } } },
+ "CreateAnnotationRequest": { "type": "object", "required": ["question", "answer"], "properties": { "question": { "type": "string" }, "answer": { "type": "string" } } },
+ "UpdateAnnotationRequest": { "type": "object", "required": ["question", "answer"], "properties": { "question": { "type": "string" }, "answer": { "type": "string" } } },
+ "InitialAnnotationReplySettingsRequest": { "type": "object", "required": ["score_threshold"], "properties": { "embedding_provider_name": { "type": "string", "nullable": true }, "embedding_model_name": { "type": "string", "nullable": true }, "score_threshold": { "type": "number", "format": "float" } } },
+ "InitialAnnotationReplySettingsResponse": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid" }, "job_status": { "type": "string" } } },
+ "InitialAnnotationReplySettingsStatusResponse": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid" }, "job_status": { "type": "string" }, "error_msg": { "type": "string", "nullable": true } } },
+ "ErrorResponse": { "type": "object", "properties": { "status": { "type": "integer", "nullable": true }, "code": { "type": "string", "nullable": true }, "message": { "type": "string" } } }
+ }
+ },
+ "tags": [
+ { "name": "Chatflow", "description": "Advanced chat operations with workflow events." },
+ { "name": "Files", "description": "File upload operations for advanced chat." },
+ { "name": "Feedback", "description": "User feedback operations for advanced chat." },
+ { "name": "Conversations", "description": "Conversation management for advanced chat." },
+ { "name": "TTS", "description": "Speech and Text conversion for advanced chat." },
+ { "name": "Application", "description": "Application settings and info for advanced chat." },
+ { "name": "Annotations", "description": "Annotation management for advanced chat." }
+ ]
+}
\ No newline at end of file
diff --git a/en/openapi_completion.json b/en/openapi_completion.json
new file mode 100644
index 00000000..8c7c086f
--- /dev/null
+++ b/en/openapi_completion.json
@@ -0,0 +1,1203 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Completion App API",
+ "description": "The text generation application offers non-session support and is ideal for translation, article writing, summarization AI, and more.",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "The base URL for the Completion App API. Replace {api_base_url} with the actual API base URL provided for your application (e.g., from props.appDetail.api_base_url).",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "Actual base URL of the API"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/completion-messages": {
+ "post": {
+ "summary": "Create Completion Message",
+ "description": "Send a request to the text generation application.",
+ "operationId": "createCompletionMessage",
+ "tags": ["Completion"],
+ "requestBody": {
+ "description": "Request body to create a completion message.",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CompletionRequest"
+ },
+ "examples": {
+ "streaming_example": {
+ "summary": "Streaming mode example",
+ "value": {
+ "inputs": {"query": "Hello, world!"},
+ "response_mode": "streaming",
+ "user": "abc-123"
+ }
+ },
+ "blocking_example": {
+ "summary": "Blocking mode example",
+ "value": {
+ "inputs": {"query": "Translate this to French: Hello"},
+ "response_mode": "blocking",
+ "user": "def-456"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful response. The content type and structure depend on the `response_mode` parameter in the request.\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 `ChunkCompletionResponse` stream.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CompletionResponse"
+ },
+ "examples": {
+ "blockingResponse": {
+ "summary": "Example of a blocking mode response",
+ "value": {
+ "event": "message",
+ "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
+ "mode": "completion",
+ "answer": "Hello World!...",
+ "metadata": {
+ "usage": {
+ "prompt_tokens": 1033,
+ "prompt_unit_price": "0.001",
+ "prompt_price_unit": "0.001",
+ "prompt_price": "0.0010330",
+ "completion_tokens": 128,
+ "completion_unit_price": "0.002",
+ "completion_price_unit": "0.001",
+ "completion_price": "0.0002560",
+ "total_tokens": 1161,
+ "total_price": "0.0012890",
+ "currency": "USD",
+ "latency": 0.7682376249867957
+ }
+ },
+ "created_at": 1705407629
+ }
+ }
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "A stream of Server-Sent Events. Each event is a JSON object prefixed with 'data: ' and suffixed with '\\n\\n'. See `ChunkCompletionEvent` for possible event structures."
+ },
+ "examples": {
+ "streamingResponse": {
+ "summary": "Example of a streaming mode response",
+ "value": "data: {\"event\": \"message\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \" I\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \"'m\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message_end\", \"id\": \"5e52ce04-874b-4d27-9045-b3bc80def685\", \"metadata\": {\"usage\": {\"prompt_tokens\": 1033, \"prompt_unit_price\": \"0.001\", \"prompt_price_unit\": \"0.001\", \"prompt_price\": \"0.0010330\", \"completion_tokens\": 135, \"completion_unit_price\": \"0.002\", \"completion_price_unit\": \"0.001\", \"completion_price\": \"0.0002700\", \"total_tokens\": 1168, \"total_price\": \"0.0013030\", \"currency\": \"USD\", \"latency\": 1.381760165997548}}}\n\ndata: {\"event\": \"tts_message\", \"task_id\": \"3bf8a0bb-e73b-4690-9e66-4e429bad8ee7\", \"message_id\": \"a8bdc41c-13b2-4c18-bfd9-054b9803038c\", \"created_at\": 1721205487, \"audio\": \"base64encodedaudio...\"}\n\ndata: {\"event\": \"tts_message_end\", \"task_id\": \"3bf8a0bb-e73b-4690-9e66-4e429bad8ee7\", \"message_id\": \"a8bdc41c-13b2-4c18-bfd9-054b9803038c\", \"created_at\": 1721205487, \"audio\": \"\"}\n\n"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request. Possible error codes:\n- `invalid_param`: Abnormal parameter input.\n- `app_unavailable`: App configuration unavailable.\n- `provider_not_initialize`: No available model credential configuration.\n- `provider_quota_exceeded`: Model invocation quota insufficient.\n- `model_currently_not_support`: Current model unavailable.\n- `completion_request_error`: Text generation failed.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "404": {
+ "description": "Conversation does not exist.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "File Upload",
+ "description": "Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text. Supports png, jpg, jpeg, webp, gif formats. Uploaded files are for use by the current end-user only.",
+ "operationId": "uploadFile",
+ "tags": ["Files"],
+ "requestBody": {
+ "description": "File upload request. Requires multipart/form-data.",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "The file to be uploaded. Supported image types: png, jpg, jpeg, webp, gif."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, defined by the developer's rules, must be unique within the application."
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "File uploaded successfully.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponse"
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
+ "name": "example.png",
+ "size": 1024,
+ "extension": "png",
+ "mime_type": "image/png",
+ "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
+ "created_at": 1577836800
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request. Possible error codes:\n- `no_file_uploaded`: A file must be provided.\n- `too_many_files`: Currently only one file is accepted.\n- `unsupported_preview`: The file does not support preview.\n- `unsupported_estimate`: The file does not support estimation.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "413": {
+ "description": "`file_too_large`: The file is too large.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "415": {
+ "description": "`unsupported_file_type`: Unsupported extension. Currently only document files are accepted (Note: description says image types png, jpg, etc. are supported for this endpoint, but this error message refers to document files. Clarification might be needed from source documentation).",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "503": {
+ "description": "Service Unavailable. Possible error codes:\n- `s3_connection_failed`: Unable to connect to S3 service.\n- `s3_permission_denied`: No permission to upload files to S3.\n- `s3_file_too_large`: File exceeds S3 size limit.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/completion-messages/{task_id}/stop": {
+ "post": {
+ "summary": "Stop Generate",
+ "description": "Stops a generation task. Only supported in streaming mode.",
+ "operationId": "stopGenerate",
+ "tags": ["Completion"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "Task ID, can be obtained from the streaming chunk return of a `/completion-messages` request.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface."
+ }
+ }
+ },
+ "examples": {
+ "example":{
+ "value": {
+ "user": "abc-123"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Stop request successful.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "result": "success"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "Message Feedback",
+ "description": "End-users can provide feedback messages, facilitating application developers to optimize expected outputs.",
+ "operationId": "postMessageFeedback",
+ "tags": ["Feedback"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "Message ID for which feedback is being provided.",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MessageFeedbackRequest"
+ },
+ "examples": {
+ "like_example": {
+ "value": {
+ "rating": "like",
+ "user": "abc-123",
+ "content": "message feedback information"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Feedback submitted successfully.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "string",
+ "example": "success"
+ }
+ }
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "result": "success"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "Get feedbacks of application",
+ "description": "Get application's feedbacks.",
+ "operationId": "getAppFeedbacks",
+ "tags": ["Feedback"],
+ "parameters": [
+ {
+ "name": "page",
+ "in": "query",
+ "description": "(optional) Pagination page number. Default: 1",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "default": 1
+ }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "description": "(optional) Records per page. Default: 20",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "default": 20
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of application feedbacks.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppFeedbacksResponse"
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "data": [
+ {
+ "id": "8c0fbed8-e2f9-49ff-9f0e-15a35bdd0e25",
+ "app_id": "f252d396-fe48-450e-94ec-e184218e7346",
+ "conversation_id": "2397604b-9deb-430e-b285-4726e51fd62d",
+ "message_id": "709c0b0f-0a96-4a4e-91a4-ec0889937b11",
+ "rating": "like",
+ "content": "message feedback information-3",
+ "from_source": "user",
+ "from_end_user_id": "74286412-9a1a-42c1-929c-01edb1d381d5",
+ "from_account_id": null,
+ "created_at": "2025-04-24T09:24:38",
+ "updated_at": "2025-04-24T09:24:38"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "Text to Audio",
+ "description": "Convert text to speech.",
+ "operationId": "textToAudio",
+ "tags": ["TTS"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/TextToAudioRequest"
+ },
+ "examples": {
+ "example": {
+ "value": {
+ "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
+ "text": "Hello Dify",
+ "user": "abc-123"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Audio file generated successfully.",
+ "content": {
+ "audio/wav": {
+ "schema": {
+ "type": "string",
+ "format": "binary",
+ "description": "The generated audio file in WAV format."
+ }
+ }
+ },
+ "headers": {
+ "Content-Type": {
+ "description": "The content type of the response, typically `audio/wav` or `audio/mp3` depending on server configuration.",
+ "schema": {
+ "type": "string",
+ "example": "audio/wav"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "Get Application Basic Information",
+ "description": "Used to get basic information about this application.",
+ "operationId": "getAppInfo",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Basic information of the application.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppInfoResponse"
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "name": "My App",
+ "description": "This is my app.",
+ "tags": [
+ "tag1",
+ "tag2"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "Get Application Parameters Information",
+ "description": "Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.",
+ "operationId": "getAppParameters",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "Application parameters information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppParametersResponse"
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "opening_statement": "Hello!",
+ "suggested_questions_after_answer": {
+ "enabled": true
+ },
+ "speech_to_text": {
+ "enabled": true
+ },
+ "retriever_resource": {
+ "enabled": true
+ },
+ "annotation_reply": {
+ "enabled": true
+ },
+ "user_input_form": [
+ {
+ "paragraph": {
+ "label": "Query",
+ "variable": "query",
+ "required": true,
+ "default": ""
+ }
+ }
+ ],
+ "file_upload": {
+ "image": {
+ "enabled": false,
+ "number_limits": 3,
+ "detail": "high",
+ "transfer_methods": [
+ "remote_url",
+ "local_file"
+ ]
+ }
+ },
+ "system_parameters": {
+ "file_size_limit": 15,
+ "image_file_size_limit": 10,
+ "audio_file_size_limit": 50,
+ "video_file_size_limit": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "Get Application WebApp Settings",
+ "description": "Used to get the WebApp settings of the application.",
+ "operationId": "getWebAppSettings",
+ "tags": ["Application"],
+ "responses": {
+ "200": {
+ "description": "WebApp settings of the application.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WebAppSettingsResponse"
+ },
+ "examples": {
+ "success": {
+ "value": {
+ "title": "My App",
+ "chat_color_theme": "#ff4a4a",
+ "chat_color_theme_inverted": false,
+ "icon_type": "emoji",
+ "icon": "😄",
+ "icon_background": "#FFEAD5",
+ "icon_url": null,
+ "description": "This is my app.",
+ "copyright": "all rights reserved",
+ "privacy_policy": "",
+ "custom_disclaimer": "All generated by AI",
+ "default_language": "en-US",
+ "show_workflow_steps": false,
+ "use_icon_as_answer_icon": false
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "API_KEY",
+ "description": "API Key authentication. For all API requests, include your API Key in the `Authorization` HTTP Header, prefixed with 'Bearer '. Example: `Authorization: Bearer {API_KEY}`. **Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.**"
+ }
+ },
+ "schemas": {
+ "CompletionRequest": {
+ "type": "object",
+ "properties": {
+ "inputs": {
+ "type": "object",
+ "description": "Allows the entry of various variable values defined by the App. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. The text generation application requires at least one key/value pair to be inputted.",
+ "required": ["query"],
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The input text, the content to be processed."
+ }
+ },
+ "additionalProperties": {
+ "type": "string"
+ },
+ "example": {"query": "Translate 'hello' to Spanish."}
+ },
+ "response_mode": {
+ "type": "string",
+ "enum": ["streaming", "blocking"],
+ "description": "The mode of response return.\n- `streaming`: Streaming mode (recommended), implements a typewriter-like output through SSE ([Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)).\n- `blocking`: Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long). *Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds in blocking mode for long processes.*",
+ "example": "streaming"
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, used to define the identity of the end-user for retrieval and statistics. Should be uniquely defined by the developer within the application.",
+ "example": "user-12345"
+ },
+ "files": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/InputFileObject"
+ },
+ "description": "File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability."
+ }
+ },
+ "required": [
+ "inputs"
+ ]
+ },
+ "InputFileObject": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["image"],
+ "description": "Supported type: `image` (currently only supports image type)."
+ },
+ "transfer_method": {
+ "type": "string",
+ "enum": ["remote_url", "local_file"],
+ "description": "Transfer method: `remote_url` for image URL / `local_file` for file upload."
+ },
+ "url": {
+ "type": "string",
+ "format": "url",
+ "description": "Image URL (when the transfer method is `remote_url`)."
+ },
+ "upload_file_id": {
+ "type": "string",
+ "description": "Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)."
+ }
+ },
+ "oneOf": [
+ {"required": ["type", "transfer_method", "url"]},
+ {"required": ["type", "transfer_method", "upload_file_id"]}
+ ],
+ "example": {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://example.com/image.png"
+ }
+ },
+ "CompletionResponse": {
+ "type": "object",
+ "description": "Response object for blocking mode completion.",
+ "properties": {
+ "event": {
+ "type": "string",
+ "description": "Event type, for blocking mode this is typically 'message'.",
+ "example": "message"
+ },
+ "message_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Unique message ID."
+ },
+ "mode": {
+ "type": "string",
+ "description": "App mode, fixed as `completion` for this response type (Note: MD also mentions 'chat', using 'completion' from example).",
+ "example": "completion"
+ },
+ "answer": {
+ "type": "string",
+ "description": "Complete response content."
+ },
+ "metadata": {
+ "type": "object",
+ "properties": {
+ "usage": {
+ "$ref": "#/components/schemas/Usage"
+ },
+ "retriever_resources": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RetrieverResource"
+ },
+ "description": "Citation and Attribution List."
+ }
+ }
+ },
+ "created_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Message creation timestamp (Unix epoch).",
+ "example": 1705395332
+ }
+ }
+ },
+ "ChunkCompletionEvent": {
+ "type": "object",
+ "description": "Structure of a Server-Sent Event chunk in streaming mode. The `event` field determines the structure of the rest of the object.",
+ "discriminator": {
+ "propertyName": "event",
+ "mapping": {
+ "message": "#/components/schemas/StreamEventMessage",
+ "message_end": "#/components/schemas/StreamEventMessageEnd",
+ "tts_message": "#/components/schemas/StreamEventTtsMessage",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEnd",
+ "message_replace": "#/components/schemas/StreamEventMessageReplace",
+ "error": "#/components/schemas/StreamEventError",
+ "ping": "#/components/schemas/StreamEventPing"
+ }
+ },
+ "properties": {
+ "event": {
+ "type": "string",
+ "enum": ["message", "message_end", "tts_message", "tts_message_end", "message_replace", "error", "ping"],
+ "description": "The type of event."
+ },
+ "task_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Task ID, used for request tracking and the Stop Generate API. Not present in 'ping' event."
+ },
+ "message_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Unique message ID. Not present in 'ping' event."
+ },
+ "created_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Creation timestamp (Unix epoch). Not present in 'ping' event.",
+ "example": 1705395332
+ }
+ },
+ "required": ["event"]
+ },
+ "StreamEventMessage": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "LLM returns text chunk event.",
+ "properties": {
+ "answer": {
+ "type": "string",
+ "description": "LLM returned text chunk content."
+ }
+ },
+ "required": ["task_id", "message_id", "answer", "created_at"]
+ }
+ ]
+ },
+ "StreamEventMessageEnd": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "Message end event, receiving this event means streaming has ended.",
+ "properties": {
+ "metadata": {
+ "type": "object",
+ "properties": {
+ "usage": { "$ref": "#/components/schemas/Usage" },
+ "retriever_resources": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/RetrieverResource" },
+ "description": "Citation and Attribution List."
+ }
+ }
+ }
+ },
+ "required": ["task_id", "message_id", "metadata"]
+ }
+ ]
+ },
+ "StreamEventTtsMessage": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "TTS audio stream event. The content is an audio block in Mp3 format, encoded as a base64 string. (This message is available only when auto-play is enabled)",
+ "properties": {
+ "audio": {
+ "type": "string",
+ "format": "byte",
+ "description": "The audio after speech synthesis, encoded in base64 text content. When playing, simply decode the base64 and feed it into the player."
+ }
+ },
+ "required": ["task_id", "message_id", "audio", "created_at"]
+ }
+ ]
+ },
+ "StreamEventTtsMessageEnd": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "TTS audio stream end event.",
+ "properties": {
+ "audio": {
+ "type": "string",
+ "description": "The end event has no audio, so this is an empty string."
+ }
+ },
+ "required": ["task_id", "message_id", "audio", "created_at"]
+ }
+ ]
+ },
+ "StreamEventMessageReplace": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "Message content replacement event. When output content moderation is enabled, if the content is flagged, then the message content will be replaced with a preset reply through this event.",
+ "properties": {
+ "answer": {
+ "type": "string",
+ "description": "Replacement content (directly replaces all LLM reply text)."
+ }
+ },
+ "required": ["task_id", "message_id", "answer", "created_at"]
+ }
+ ]
+ },
+ "StreamEventError": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "Exceptions that occur during the streaming process will be output in the form of stream events, and reception of an error event will end the stream.",
+ "properties": {
+ "status": {
+ "type": "integer",
+ "description": "HTTP status code."
+ },
+ "code": {
+ "type": "string",
+ "description": "Error code."
+ },
+ "message": {
+ "type": "string",
+ "description": "Error message."
+ }
+ },
+ "required": ["task_id", "message_id", "status", "code", "message"]
+ }
+ ]
+ },
+ "StreamEventPing": {
+ "allOf": [
+ { "$ref": "#/components/schemas/ChunkCompletionEvent" },
+ {
+ "type": "object",
+ "description": "Ping event every 10 seconds to keep the connection alive. This event type does not contain other fields like task_id or message_id."
+ }
+ ]
+ },
+ "Usage": {
+ "type": "object",
+ "description": "Model usage information.",
+ "properties": {
+ "prompt_tokens": { "type": "integer" },
+ "prompt_unit_price": { "type": "string", "format": "decimal" },
+ "prompt_price_unit": { "type": "string", "format": "decimal" },
+ "prompt_price": { "type": "string", "format": "decimal" },
+ "completion_tokens": { "type": "integer" },
+ "completion_unit_price": { "type": "string", "format": "decimal" },
+ "completion_price_unit": { "type": "string", "format": "decimal" },
+ "completion_price": { "type": "string", "format": "decimal" },
+ "total_tokens": { "type": "integer" },
+ "total_price": { "type": "string", "format": "decimal" },
+ "currency": { "type": "string", "example": "USD" },
+ "latency": { "type": "number", "format": "double" }
+ }
+ },
+ "RetrieverResource": {
+ "type": "object",
+ "description": "Citation and Attribution information for a resource.",
+ "properties": {
+ "document_id": { "type": "string", "description": "ID of the retrieved document." },
+ "segment_id": { "type": "string", "description": "ID of the specific segment within the document." },
+ "score": { "type": "number", "format": "float", "description": "Relevance score of the resource." },
+ "content": { "type": "string", "description": "Content snippet from the resource." }
+ }
+ },
+ "FileUploadResponse": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "ID of the uploaded file." },
+ "name": { "type": "string", "description": "File name." },
+ "size": { "type": "integer", "description": "File size (bytes)." },
+ "extension": { "type": "string", "description": "File extension." },
+ "mime_type": { "type": "string", "description": "File mime-type." },
+ "created_by": { "type": "string", "format": "uuid", "description": "End-user ID who uploaded the file." },
+ "created_at": { "type": "integer", "format": "int64", "description": "Creation timestamp (Unix epoch).", "example": 1577836800 }
+ }
+ },
+ "MessageFeedbackRequest": {
+ "type": "object",
+ "properties": {
+ "rating": {
+ "type": "string",
+ "enum": ["like", "dislike", null],
+ "nullable": true,
+ "description": "Upvote as `like`, downvote as `dislike`, revoke upvote/downvote as `null`."
+ },
+ "user": {
+ "type": "string",
+ "description": "User identifier, defined by the developer's rules, must be unique within the application."
+ },
+ "content": {
+ "type": "string",
+ "description": "The specific content of message feedback."
+ }
+ },
+ "required": ["user"]
+ },
+ "AppFeedbacksResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/FeedbackItem"
+ },
+ "description": "List of application feedback items."
+ }
+ }
+ },
+ "FeedbackItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "app_id": { "type": "string", "format": "uuid" },
+ "conversation_id": { "type": "string", "format": "uuid" },
+ "message_id": { "type": "string", "format": "uuid" },
+ "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true },
+ "content": { "type": "string" },
+ "from_source": { "type": "string" },
+ "from_end_user_id": { "type": "string", "format": "uuid" },
+ "from_account_id": { "type": "string", "format": "uuid", "nullable": true },
+ "created_at": { "type": "string", "format": "date-time" },
+ "updated_at": { "type": "string", "format": "date-time" }
+ }
+ },
+ "TextToAudioRequest": {
+ "type": "object",
+ "properties": {
+ "message_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "For text messages generated by Dify, simply pass the generated message-id directly. The backend will use the message-id to look up the corresponding content and synthesize the voice information directly. If both message_id and text are provided simultaneously, the message_id is given priority."
+ },
+ "text": {
+ "type": "string",
+ "description": "Speech generated content. Used if message_id is not provided or not found."
+ },
+ "user": {
+ "type": "string",
+ "description": "The user identifier, defined by the developer, must ensure uniqueness within the app."
+ }
+ },
+ "required": ["user"],
+ "description": "At least one of `message_id` or `text` must be provided, along with `user`."
+ },
+ "AppInfoResponse": {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string", "description": "Application name." },
+ "description": { "type": "string", "description": "Application description." },
+ "tags": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Application tags."
+ }
+ }
+ },
+ "AppParametersResponse": {
+ "type": "object",
+ "properties": {
+ "opening_statement": { "type": "string", "description": "Opening statement." },
+ "suggested_questions": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "List of suggested questions for the opening."
+ },
+ "suggested_questions_after_answer": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean", "description": "Whether suggesting questions after an answer is enabled." }
+ }
+ },
+ "speech_to_text": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean", "description": "Whether speech to text is enabled." }
+ }
+ },
+ "retriever_resource": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean", "description": "Whether citation and attribution (retriever resource) is enabled." }
+ }
+ },
+ "annotation_reply": {
+ "type": "object",
+ "properties": {
+ "enabled": { "type": "boolean", "description": "Whether annotation reply is enabled." }
+ }
+ },
+ "user_input_form": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/UserInputFormItem" },
+ "description": "User input form configuration."
+ },
+ "file_upload": {
+ "type": "object",
+ "description": "File upload configuration.",
+ "properties": {
+ "image": {
+ "type": "object",
+ "description": "Image settings. Currently only supports image types: png, jpg, jpeg, webp, gif.",
+ "properties": {
+ "enabled": { "type": "boolean", "description": "Whether image upload is enabled." },
+ "number_limits": { "type": "integer", "description": "Image number limit, default is 3." },
+ "detail": {"type": "string", "description": "Detail level for image processing (e.g., 'high'). From example, not in main description."},
+ "transfer_methods": {
+ "type": "array",
+ "items": { "type": "string", "enum": ["remote_url", "local_file"] },
+ "description": "List of transfer methods, must choose at least one if enabled."
+ }
+ }
+ }
+ }
+ },
+ "system_parameters": {
+ "type": "object",
+ "description": "System parameters.",
+ "properties": {
+ "file_size_limit": { "type": "integer", "description": "Document upload size limit (MB)." },
+ "image_file_size_limit": { "type": "integer", "description": "Image file upload size limit (MB)." },
+ "audio_file_size_limit": { "type": "integer", "description": "Audio file upload size limit (MB)." },
+ "video_file_size_limit": { "type": "integer", "description": "Video file upload size limit (MB)." }
+ }
+ }
+ }
+ },
+ "UserInputFormItem": {
+ "type": "object",
+ "description": "Represents a single item in the user input form. It will have one of the specific control type keys.",
+ "oneOf": [
+ { "$ref": "#/components/schemas/TextInputControlWrapper" },
+ { "$ref": "#/components/schemas/ParagraphControlWrapper" },
+ { "$ref": "#/components/schemas/SelectControlWrapper" }
+ ]
+ },
+ "TextInputControlWrapper": {
+ "type": "object",
+ "properties": {
+ "text-input": { "$ref": "#/components/schemas/TextInputControl" }
+ },
+ "required": ["text-input"]
+ },
+ "ParagraphControlWrapper": {
+ "type": "object",
+ "properties": {
+ "paragraph": { "$ref": "#/components/schemas/ParagraphControl" }
+ },
+ "required": ["paragraph"]
+ },
+ "SelectControlWrapper": {
+ "type": "object",
+ "properties": {
+ "select": { "$ref": "#/components/schemas/SelectControl" }
+ },
+ "required": ["select"]
+ },
+ "TextInputControl": {
+ "type": "object",
+ "description": "Text input control.",
+ "properties": {
+ "label": { "type": "string", "description": "Variable display label name." },
+ "variable": { "type": "string", "description": "Variable ID." },
+ "required": { "type": "boolean", "description": "Whether it is required." },
+ "default": { "type": "string", "description": "Default value." }
+ },
+ "required": ["label", "variable", "required"]
+ },
+ "ParagraphControl": {
+ "type": "object",
+ "description": "Paragraph text input control.",
+ "properties": {
+ "label": { "type": "string", "description": "Variable display label name." },
+ "variable": { "type": "string", "description": "Variable ID." },
+ "required": { "type": "boolean", "description": "Whether it is required." },
+ "default": { "type": "string", "description": "Default value." }
+ },
+ "required": ["label", "variable", "required"]
+ },
+ "SelectControl": {
+ "type": "object",
+ "description": "Dropdown control.",
+ "properties": {
+ "label": { "type": "string", "description": "Variable display label name." },
+ "variable": { "type": "string", "description": "Variable ID." },
+ "required": { "type": "boolean", "description": "Whether it is required." },
+ "default": { "type": "string", "description": "Default value." },
+ "options": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Option values."
+ }
+ },
+ "required": ["label", "variable", "required", "options"]
+ },
+ "WebAppSettingsResponse": {
+ "type": "object",
+ "properties": {
+ "title": { "type": "string", "description": "WebApp name." },
+ "chat_color_theme": { "type": "string", "description": "Chat color theme, in hex format (e.g., #RRGGBB)." },
+ "chat_color_theme_inverted": { "type": "boolean", "description": "Whether the chat color theme is inverted." },
+ "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "Icon type." },
+ "icon": { "type": "string", "description": "Icon. If it's `emoji` type, it's an emoji symbol; if it's `image` type, it's an image URL." },
+ "icon_background": { "type": "string", "description": "Background color in hex format (e.g., #RRGGBB)." },
+ "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "Icon URL (likely refers to image type if `icon` field is just a name/id)." },
+ "description": { "type": "string", "description": "Description." },
+ "copyright": { "type": "string", "description": "Copyright information." },
+ "privacy_policy": { "type": "string", "description": "Privacy policy link." },
+ "custom_disclaimer": { "type": "string", "description": "Custom disclaimer." },
+ "default_language": { "type": "string", "description": "Default language (e.g., en-US)." },
+ "show_workflow_steps": { "type": "boolean", "description": "Whether to show workflow details." },
+ "use_icon_as_answer_icon": { "type": "boolean", "description": "Whether to replace 🤖 in chat with the WebApp icon." }
+ }
+ },
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "status": { "type": "integer", "description": "HTTP status code." },
+ "code": { "type": "string", "description": "Error code specific to the application." },
+ "message": { "type": "string", "description": "A human-readable error message." }
+ }
+ }
+ }
+ },
+ "tags": [
+ { "name": "Completion", "description": "Operations related to text generation and completion." },
+ { "name": "Files", "description": "Operations related to file management." },
+ { "name": "Feedback", "description": "Operations related to user feedback." },
+ { "name": "TTS", "description": "Operations related to Text-to-Speech." },
+ { "name": "Application", "description": "Operations to retrieve application settings and information." }
+ ]
+}
\ No newline at end of file
diff --git a/en/openapi_workflow.json b/en/openapi_workflow.json
new file mode 100644
index 00000000..c25e4f6f
--- /dev/null
+++ b/en/openapi_workflow.json
@@ -0,0 +1,472 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Workflow App API",
+ "description": "Workflow applications offers non-session support and is ideal for translation, article writing, summarization AI, and more.",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "The base URL for the Workflow App API. Replace {api_base_url} with the actual API base URL.",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "Actual base URL of the API"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/workflows/run": {
+ "post": {
+ "summary": "Execute Workflow",
+ "description": "Execute workflow. Cannot be executed without a published workflow.",
+ "operationId": "executeWorkflow",
+ "tags": ["Workflow Execution"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowExecutionRequest"
+ },
+ "examples": {
+ "basic_execution": {
+ "summary": "Basic workflow execution",
+ "value": {
+ "inputs": {
+ "query": "Summarize this text: ..."
+ },
+ "response_mode": "streaming",
+ "user": "user_workflow_123"
+ }
+ },
+ "with_file_array_variable":{
+ "summary": "Example with a file array input variable",
+ "value": {
+ "inputs": {
+ "my_documents": [
+ {
+ "type": "document",
+ "transfer_method": "local_file",
+ "upload_file_id": "uploaded_file_id_abc"
+ },
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://example.com/image.jpg"
+ }
+ ]
+ },
+ "response_mode": "blocking",
+ "user": "user_workflow_456"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Successful workflow execution. Structure depends on `response_mode`.\n- `blocking`: `application/json` with `WorkflowCompletionResponse`.\n- `streaming`: `text/event-stream` with `ChunkWorkflowEvent` stream.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowCompletionResponse"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "A stream of Server-Sent Events. See `ChunkWorkflowEvent` for structures."
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestWorkflow" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/workflows/run/{workflow_run_id}": {
+ "get": {
+ "summary": "Get Workflow Run Detail",
+ "description": "Retrieve the current execution results of a workflow task based on the workflow execution ID.",
+ "operationId": "getWorkflowRunDetail",
+ "tags": ["Workflow Execution"],
+ "parameters": [
+ {
+ "name": "workflow_run_id",
+ "in": "path",
+ "required": true,
+ "description": "Workflow Run ID, can be obtained from workflow execution response or streaming events.",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved workflow run details.",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponse" }
+ }
+ }
+ },
+ "404": {"description": "Workflow run not found."}
+ }
+ }
+ },
+ "/workflows/tasks/{task_id}/stop": {
+ "post": {
+ "summary": "Stop Workflow Task Generation",
+ "description": "Stops a workflow task generation. Only supported in streaming mode.",
+ "operationId": "stopWorkflowTaskGeneration",
+ "tags": ["Workflow Execution"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "Task ID from the streaming chunk.",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": { "type": "string", "description": "User identifier." }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "File Upload for Workflow",
+ "description": "Upload a file for use in workflows. Supports any formats supported by your workflow. Uploaded files are for the current end-user only.",
+ "operationId": "uploadWorkflowFile",
+ "tags": ["Files"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": { "type": "string", "format": "binary", "description": "The file to be uploaded." },
+ "user": { "type": "string", "description": "User identifier." }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "File uploaded successfully.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponse" } } }
+ },
+ "201": {
+ "description": "File created successfully (alternative success code).",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponse" } } }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFile" },
+ "413": { "$ref": "#/components/responses/FileTooLarge" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFile" },
+ "503": { "$ref": "#/components/responses/S3ErrorFile" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/workflows/logs": {
+ "get": {
+ "summary": "Get Workflow Logs",
+ "description": "Returns workflow logs, with the first page returning the latest `{limit}` messages, i.e., in reverse order.",
+ "operationId": "getWorkflowLogs",
+ "tags": ["Workflow Execution"],
+ "parameters": [
+ { "name": "keyword", "in": "query", "description": "Keyword to search.", "schema": { "type": "string" } },
+ { "name": "status", "in": "query", "description": "Filter by status.", "schema": { "type": "string", "enum": ["succeeded", "failed", "stopped", "running"] } },
+ { "name": "page", "in": "query", "description": "Current page.", "schema": { "type": "integer", "default": 1 } },
+ { "name": "limit", "in": "query", "description": "Number of items per page.", "schema": { "type": "integer", "default": 20 } }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successfully retrieved workflow logs.",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowLogsResponse" } } }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "Get Application Basic Information",
+ "operationId": "getWorkflowAppInfo",
+ "tags": ["Application"],
+ "responses": {
+ "200": { "description": "Basic application information.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponse" } } } }
+ }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "Get Application Parameters Information",
+ "operationId": "getWorkflowAppParameters",
+ "tags": ["Application"],
+ "responses": {
+ "200": { "description": "Application parameters.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowAppParametersResponse" } } } }
+ }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "Get Application WebApp Settings",
+ "operationId": "getWorkflowWebAppSettings",
+ "tags": ["Application"],
+ "responses": {
+ "200": { "description": "WebApp settings.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowWebAppSettingsResponse" } } } }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API Key authentication." }
+ },
+ "responses": {
+ "BadRequestWorkflow": { "description": "Bad Request for workflow operation. Possible error codes: invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, workflow_request_error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "BadRequestFile": { "description": "Bad Request for file operation.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "FileTooLarge": { "description": "File is too large.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "UnsupportedFileTypeFile": { "description": "Unsupported file type for upload.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "S3ErrorFile": { "description": "S3 storage error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "InternalServerError": { "description": "Internal server error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "SuccessResult": { "description": "Operation successful.", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } }
+ },
+ "schemas": {
+ "WorkflowExecutionRequest": {
+ "type": "object",
+ "required": ["inputs", "response_mode", "user"],
+ "properties": {
+ "inputs": {
+ "type": "object",
+ "description": "Key/value pairs for workflow variables. Value for a file array type variable should be a list of InputFileObjectWorkflow.",
+ "additionalProperties": {
+ "oneOf": [
+ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" },
+ { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectWorkflow" } }
+ ]
+ },
+ "example": { "user_query": "Translate this for me.", "target_language": "French" }
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "description": "Response mode. Cloudflare timeout is 100s for blocking." },
+ "user": { "type": "string", "description": "User identifier." }
+ }
+ },
+ "InputFileObjectWorkflow": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "Type of file." },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"] },
+ "url": { "type": "string", "format": "url", "description": "URL (if `remote_url`)." },
+ "upload_file_id": { "type": "string", "description": "Uploaded file ID (if `local_file`)." }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "WorkflowCompletionResponse": {
+ "type": "object",
+ "description": "Response for blocking mode workflow execution.",
+ "properties": {
+ "workflow_run_id": { "type": "string", "format": "uuid" },
+ "task_id": { "type": "string", "format": "uuid" },
+ "data": { "$ref": "#/components/schemas/WorkflowFinishedData" }
+ }
+ },
+ "ChunkWorkflowEvent": {
+ "type": "object",
+ "required": ["event"],
+ "properties": {
+ "event": { "type": "string", "enum": ["workflow_started", "node_started", "text_chunk", "node_finished", "workflow_finished", "tts_message", "tts_message_end", "ping"] }
+ },
+ "discriminator": {
+ "propertyName": "event",
+ "mapping": {
+ "workflow_started": "#/components/schemas/StreamEventWfWorkflowStarted",
+ "node_started": "#/components/schemas/StreamEventWfNodeStarted",
+ "text_chunk": "#/components/schemas/StreamEventWfTextChunk",
+ "node_finished": "#/components/schemas/StreamEventWfNodeFinished",
+ "workflow_finished": "#/components/schemas/StreamEventWfWorkflowFinished",
+ "tts_message": "#/components/schemas/StreamEventWfTtsMessage",
+ "tts_message_end": "#/components/schemas/StreamEventWfTtsMessageEnd",
+ "ping": "#/components/schemas/StreamEventWfPing"
+ }
+ }
+ },
+ "StreamEventBaseWf": {
+ "type": "object",
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid" },
+ "workflow_run_id": { "type": "string", "format": "uuid" }
+ }
+ },
+ "StreamEventWfWorkflowStarted": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowStartedData" } } } ]
+ },
+ "WorkflowStartedData": {
+ "type": "object", "required": ["id", "workflow_id", "sequence_number", "created_at"],
+ "properties": { "id": { "type": "string", "format": "uuid" }, "workflow_id": { "type": "string", "format": "uuid" }, "sequence_number": { "type": "integer" }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "StreamEventWfNodeStarted": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeStartedData" } } } ]
+ },
+ "NodeStartedData": {
+ "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "created_at"],
+ "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string", "format": "uuid" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true }, "inputs": { "type": "object", "additionalProperties": true }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "StreamEventWfTextChunk": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/TextChunkData" } } } ]
+ },
+ "TextChunkData": {
+ "type": "object", "required": ["text", "from_variable_selector"],
+ "properties": { "text": { "type": "string" }, "from_variable_selector": { "type": "array", "items": { "type": "string" }, "description": "Text source path." } }
+ },
+ "StreamEventWfNodeFinished": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeFinishedData" } } } ]
+ },
+ "NodeFinishedData": {
+ "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "status", "created_at"],
+ "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string", "format": "uuid" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] }, "error": { "type": "string", "nullable": true }, "elapsed_time": { "type": "number", "format": "float", "nullable": true }, "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadata" , "nullable": true }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "NodeExecutionMetadata": {
+ "type": "object", "properties": { "total_tokens": { "type": "integer", "nullable": true }, "total_price": { "type": "number", "format": "float", "nullable": true }, "currency": { "type": "string", "nullable": true, "example": "USD" } }
+ },
+ "StreamEventWfWorkflowFinished": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowFinishedData" } } } ]
+ },
+ "WorkflowFinishedData": {
+ "type": "object", "required": ["id", "workflow_id", "status", "created_at", "finished_at"],
+ "properties": { "id": { "type": "string", "format": "uuid" }, "workflow_id": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true }, "error": { "type": "string", "nullable": true }, "elapsed_time": { "type": "number", "format": "float", "nullable": true }, "total_tokens": { "type": "integer", "nullable": true }, "total_steps": { "type": "integer", "default": 0 }, "created_at": { "type": "integer", "format": "int64" }, "finished_at": { "type": "integer", "format": "int64" } }
+ },
+ "StreamEventWfTtsMessage": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string", "format": "byte" }, "message_id": {"type": "string", "format": "uuid"}, "created_at": {"type": "integer", "format":"int64"} } }
+ ]
+ },
+ "StreamEventWfTtsMessageEnd": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/StreamEventBaseWf" },
+ { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string" }, "message_id": {"type": "string", "format": "uuid"}, "created_at": {"type": "integer", "format":"int64"} } }
+ ]
+ },
+ "StreamEventWfPing": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "type": "object" } ]
+ },
+ "WorkflowRunDetailResponse": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "workflow_id": { "type": "string", "format": "uuid" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] },
+ "inputs": { "type": "string", "description": "JSON string of input content." },
+ "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "JSON object of output content." },
+ "error": { "type": "string", "nullable": true },
+ "total_steps": { "type": "integer" },
+ "total_tokens": { "type": "integer" },
+ "created_at": { "type": "integer", "format": "int64" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true },
+ "elapsed_time": { "type": "number", "format": "float", "nullable": true }
+ }
+ },
+ "FileUploadResponse": {
+ "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "size": { "type": "integer" }, "extension": { "type": "string" }, "mime_type": { "type": "string" }, "created_by": { "type": "string", "format": "uuid" }, "created_at": { "type": "integer", "format": "int64" } }
+ },
+ "WorkflowLogsResponse": {
+ "type": "object",
+ "properties": {
+ "page": { "type": "integer" },
+ "limit": { "type": "integer" },
+ "total": { "type": "integer" },
+ "has_more": { "type": "boolean" },
+ "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowLogItem" } }
+ }
+ },
+ "WorkflowLogItem": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "workflow_run": { "$ref": "#/components/schemas/WorkflowRunSummary" },
+ "created_from": { "type": "string" },
+ "created_by_role": { "type": "string" },
+ "created_by_account": { "type": "string", "format": "uuid", "nullable": true },
+ "created_by_end_user": { "$ref": "#/components/schemas/EndUserSummary" },
+ "created_at": { "type": "integer", "format": "int64" }
+ }
+ },
+ "WorkflowRunSummary": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "version": { "type": "string" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"] },
+ "error": { "type": "string", "nullable": true },
+ "elapsed_time": { "type": "number", "format": "float" },
+ "total_tokens": { "type": "integer" },
+ "total_steps": { "type": "integer" },
+ "created_at": { "type": "integer", "format": "int64" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true }
+ }
+ },
+ "EndUserSummary": {
+ "type": "object",
+ "properties": {
+ "id": { "type": "string", "format": "uuid" },
+ "type": { "type": "string" },
+ "is_anonymous": { "type": "boolean" },
+ "session_id": { "type": "string" }
+ }
+ },
+ "AppInfoResponse": {
+ "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } } }
+ },
+ "WorkflowAppParametersResponse": {
+ "type": "object", "properties": { "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItem" } }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } } } } }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer" }, "image_file_size_limit": { "type": "integer" }, "audio_file_size_limit": { "type": "integer" }, "video_file_size_limit": { "type": "integer" } } } }
+ },
+ "UserInputFormItem": { "type": "object", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapper" }, { "$ref": "#/components/schemas/ParagraphControlWrapper" }, { "$ref": "#/components/schemas/SelectControlWrapper" } ] },
+ "TextInputControlWrapper": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControl" } }, "required":["text-input"] },
+ "ParagraphControlWrapper": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControl" } }, "required":["paragraph"] },
+ "SelectControlWrapper": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControl" } }, "required":["select"] },
+ "TextInputControl": { "type": "object", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } } },
+ "ParagraphControl": { "type": "object", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" } } },
+ "SelectControl": { "type": "object", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string" }, "variable": { "type": "string" }, "required": { "type": "boolean" }, "default": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } } } },
+ "WorkflowWebAppSettingsResponse": {
+ "type": "object", "properties": { "title": { "type": "string" }, "icon_type": { "type": "string", "enum": ["emoji", "image"] }, "icon": { "type": "string" }, "icon_background": { "type": "string" }, "icon_url": { "type": "string", "format": "url", "nullable": true }, "description": { "type": "string" }, "copyright": { "type": "string" }, "privacy_policy": { "type": "string" }, "custom_disclaimer": { "type": "string" }, "default_language": { "type": "string" }, "show_workflow_steps": { "type": "boolean" } }
+ },
+ "ErrorResponse": { "type": "object", "properties": { "status": { "type": "integer", "nullable": true }, "code": { "type": "string", "nullable": true }, "message": { "type": "string" } } }
+ }
+ },
+ "tags": [
+ { "name": "Workflow Execution", "description": "Operations related to executing and managing workflows." },
+ { "name": "Files", "description": "File upload operations specific to workflows." },
+ { "name": "Application", "description": "Application settings and info for workflow apps." }
+ ]
+}
\ No newline at end of file
diff --git a/ja-jp/openapi_chat.json b/ja-jp/openapi_chat.json
new file mode 100644
index 00000000..1cb1756c
--- /dev/null
+++ b/ja-jp/openapi_chat.json
@@ -0,0 +1,440 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "チャットアプリAPI",
+ "description": "チャットアプリケーションはセッションの持続性をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これは、チャットボットやカスタマーサービスAIなどに適用できます。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "APIのベースURL。{api_base_url}をアプリケーション提供の実際のAPIベースURLに置き換えてください。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "実際のAPIベースURL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "チャットメッセージを送信",
+ "description": "チャットアプリケーションにリクエストを送信します。",
+ "operationId": "sendBasicChatMessageJa",
+ "tags": ["チャットメッセージ"],
+ "requestBody": {
+ "description": "チャットメッセージ送信リクエストボディ。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BasicChatRequestJa"
+ },
+ "examples": {
+ "streaming_with_file_ja": {
+ "summary": "ファイルとカスタム入力を含むストリーミングリクエストの例",
+ "value": {
+ "inputs": {
+ "name": "dify"
+ },
+ "query": "iPhone 13 Pro Maxの仕様は何ですか?",
+ "response_mode": "streaming",
+ "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
+ "user": "abc-123",
+ "files": [
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://cloud.dify.ai/logo/logo-site.png"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "リクエスト成功。応答のコンテンツタイプと構造はリクエストの`response_mode`パラメータに依存します。\n- `response_mode`が`blocking`の場合、`application/json`形式の`ChatCompletionResponseJa`オブジェクトを返します。\n- `response_mode`が`streaming`の場合、`text/event-stream`形式の`ChunkBasicChatEventJa`オブジェクトストリームを返します。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponseJa"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSEイベントストリーム。各イベントは'data: 'で始まり、'\\n\\n'で終わります。詳細な構造は`ChunkBasicChatEventJa`を参照してください。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGenericJa" },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundJa" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJa" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "ファイルアップロード",
+ "description": "メッセージ送信時に使用するためのファイルをアップロードします(現在は画像のみサポート)。画像とテキストのマルチモーダル理解を可能にします。png、jpg、jpeg、webp、gif形式をサポートしています。アップロードされたファイルは現在のエンドユーザーのみが使用できます。",
+ "operationId": "uploadBasicChatFileJa",
+ "tags": ["ファイル操作"],
+ "requestBody": {
+ "description": "ファイルアップロードリクエスト。`multipart/form-data`リクエストが必要です。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。" },
+ "user": { "type": "string", "description": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致している必要があります。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "description": "ファイルアップロード成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJa" } } } },
+ "201": { "description": "ファイル作成成功(代替成功コード)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJa" } } } },
+ "400": { "$ref": "#/components/responses/BadRequestFileJa" },
+ "413": { "$ref": "#/components/responses/FileTooLargeJa" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileJa" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileJa" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJa" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "生成停止",
+ "description": "チャットメッセージの生成を停止します。ストリーミングモードでのみサポートされています。",
+ "operationId": "stopBasicChatMessageGenerationJa",
+ "tags": ["チャットメッセージ"],
+ "parameters": [ { "name": "task_id", "in": "path", "required": true, "description": "タスクID、ストリーミングチャンクの返り値から取得できます。", "schema": { "type": "string", "format": "uuid" } } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["user"], "properties": { "user": { "type": "string", "description": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致している必要があります。" } } } } } },
+ "responses": { "200": { "$ref": "#/components/responses/SuccessResultJa" } }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "メッセージフィードバック",
+ "description": "エンドユーザーはフィードバックメッセージを提供でき、アプリケーション開発者が期待される出力を最適化するのに役立ちます。",
+ "operationId": "postBasicChatMessageFeedbackJa",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "メッセージID。", "schema": { "type": "string", "format": "uuid" } } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestJa" } } } },
+ "responses": { "200": { "$ref": "#/components/responses/SuccessResultJa" } }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "アプリのメッセージの「いいね」とフィードバックを取得",
+ "description": "アプリのエンドユーザーからのフィードバックや「いいね」を取得します。",
+ "operationId": "getBasicChatAppFeedbacksJa",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [ { "$ref": "#/components/parameters/PageQueryParamJa" }, { "$ref": "#/components/parameters/LimitQueryParamJa" } ],
+ "responses": { "200": { "description": "アプリのフィードバックリストを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseJa" } } } } }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "次の推奨質問",
+ "description": "現在のメッセージに対する次の質問の提案を取得します。",
+ "operationId": "getBasicChatSuggestedQuestionsJa",
+ "tags": ["チャットメッセージ"],
+ "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "メッセージID。", "schema": { "type": "string", "format": "uuid" } }, { "$ref": "#/components/parameters/UserQueryParamJa" } ],
+ "responses": { "200": { "description": "推奨質問リストを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseJa" } } } } }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "会話履歴メッセージを取得",
+ "description": "スクロールロード形式で過去のチャット記録を返し、最初のページは最新の`{limit}`メッセージを返します。つまり、逆順です。",
+ "operationId": "getBasicChatConversationHistoryJa",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdQueryParamJa" }, { "$ref": "#/components/parameters/UserQueryParamJa" }, { "name": "first_id", "in": "query", "description": "現在のページの最初のチャット記録のID、デフォルトはnullです。", "schema": { "type": "string", "format": "uuid", "nullable": true } }, { "$ref": "#/components/parameters/LimitQueryParamDefault20Ja" } ],
+ "responses": { "200": { "description": "会話履歴メッセージを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BasicConversationHistoryResponseJa" } } } } }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "会話を取得",
+ "description": "現在のユーザーの会話リストを取得し、デフォルトで最新の20件を返します。",
+ "operationId": "getBasicChatConversationsListJa",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/UserQueryParamJa" }, { "$ref": "#/components/parameters/LastIdQueryParamJa" }, { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Ja" }, { "$ref": "#/components/parameters/SortByQueryParamJa" } ],
+ "responses": { "200": { "description": "会話リストを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationsListResponseJa" } } } } }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "会話を削除",
+ "description": "指定された会話を削除します。",
+ "operationId": "deleteBasicChatConversationJa",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJa" } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["user"], "properties": { "user": { "type": "string", "description": "ユーザー識別子。" } } } } } },
+ "responses": { "204": { "description": "会話の削除に成功しました。コンテンツはありません。" } }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "会話の名前を変更",
+ "description": "セッションの名前を変更します。セッション名は、複数のセッションをサポートするクライアントでの表示に使用されます。",
+ "operationId": "renameBasicChatConversationJa",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJa" } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestJa" } } } },
+ "responses": { "200": { "description": "会話の名前変更に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseJa" } } } } }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "会話変数の取得",
+ "description": "特定の会話から変数を取得します。このエンドポイントは、会話中に取得された構造化データを抽出するのに役立ちます。",
+ "operationId": "getBasicChatConversationVariablesJa",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJa" }, { "$ref": "#/components/parameters/UserQueryParamJa" }, { "$ref": "#/components/parameters/LastIdQueryParamJa" }, { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Ja" }, { "$ref": "#/components/parameters/VariableNameQueryParamJa" } ],
+ "responses": { "200": { "description": "会話変数を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseJa" } } } }, "404": { "$ref": "#/components/responses/ConversationNotFoundJa" } }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "音声からテキストへ",
+ "description": "オーディオファイルをテキストに変換します。サポートされている形式:mp3, mp4, mpeg, mpga, m4a, wav, webm。ファイルサイズ制限:15MB。",
+ "operationId": "basicChatAudioToTextJa",
+ "tags": ["音声とテキスト変換"],
+ "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestJa" } } } },
+ "responses": { "200": { "description": "音声からテキストへの変換に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseJa" } } } } }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "テキストから音声へ",
+ "description": "テキストコンテンツを音声に変換します。",
+ "operationId": "basicChatTextToAudioJa",
+ "tags": ["音声とテキスト変換"],
+ "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/TextToAudioFormRequestJa" } } } },
+ "responses": { "200": { "description": "音声ファイルの生成に成功しました。", "content": { "audio/wav": { "schema": { "type": "string", "format": "binary" } }, "audio/mp3": { "schema": { "type": "string", "format": "binary" } } }, "headers": { "Content-Type": { "schema": { "type": "string", "example": "audio/wav" } } } } }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "アプリケーションの基本情報を取得",
+ "operationId": "getBasicChatAppInfoJa",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJa" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "アプリケーションのパラメータ情報を取得",
+ "description": "ページに入る際に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。",
+ "operationId": "getBasicChatAppParametersJa",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BasicChatAppParametersResponseJa" } } } } }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "アプリケーションのメタ情報を取得",
+ "description": "このアプリケーションのツールのアイコンを取得するために使用されます。",
+ "operationId": "getBasicChatAppMetaJa",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションのメタ情報を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseJa" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "アプリのWebApp設定を取得",
+ "description": "アプリのWebApp設定を取得するために使用します。",
+ "operationId": "getBasicChatWebAppSettingsJa",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "WebApp設定。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseJa" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "APIキー認証。すべてのAPIリクエストにおいて、Authorization HTTPヘッダーにAPIキーを含めてください。形式:Bearer {API_KEY}。APIキーの漏洩を防ぐため、APIキーはクライアント側で共有または保存せず、サーバー側で保存することを強くお勧めします。" }
+ },
+ "parameters": {
+ "PageQueryParamJa": { "name": "page", "in": "query", "description": "(任意)ページ番号。デフォルト値:1。", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParamJa": { "name": "limit", "in": "query", "description": "(任意)1ページあたりの件数。デフォルト値:20。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Ja": { "name": "limit", "in": "query", "description": "1回のリクエストで返すレコードの数、デフォルトは20です。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Max100Ja": { "name": "limit", "in": "query", "description": "1回のリクエストで返すレコードの数、デフォルトは20件です。最大100、最小1。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "UserQueryParamJa": { "name": "user", "in": "query", "required": true, "description": "ユーザー識別子。アプリケーション内で開発者によって一意に定義される必要があります。", "schema": { "type": "string" } },
+ "ConversationIdQueryParamJa": { "name": "conversation_id", "in": "query", "required": true, "description": "会話ID。", "schema": { "type": "string", "format": "uuid" } },
+ "LastIdQueryParamJa": { "name": "last_id", "in": "query", "description": "(Optional)現在のページの最後のレコードのID、デフォルトはnullです。", "schema": { "type": "string", "format": "uuid", "nullable": true } },
+ "SortByQueryParamJa": { "name": "sort_by", "in": "query", "description": "(Optional)ソートフィールド、デフォルト:-updated_at(更新時間で降順にソート)。利用可能な値:created_at, -created_at, updated_at, -updated_at。フィールドの前の記号「-」は逆順を表します。", "schema": { "type": "string", "enum": ["created_at", "-created_at", "updated_at", "-updated_at"], "default": "-updated_at" } },
+ "ConversationIdPathParamJa": { "name": "conversation_id", "in": "path", "required": true, "description": "会話ID。", "schema": { "type": "string", "format": "uuid" } },
+ "VariableNameQueryParamJa": { "name": "variable_name", "in": "query", "description": "(Optional)変数名でフィルタリングします。", "schema": { "type": "string" } }
+ },
+ "responses": {
+ "BadRequestGenericJa": { "description": "リクエストパラメータエラー。考えられる原因:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, completion_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "BadRequestFileJa": { "description": "ファイル操作リクエストエラー。考えられる原因:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "FileTooLargeJa": { "description": "ファイルが大きすぎます (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "UnsupportedFileTypeFileJa": { "description": "サポートされていないファイルタイプ (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "S3ErrorFileJa": { "description": "S3ストレージサービスエラー。考えられる原因:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "InternalServerErrorJa": { "description": "内部サーバーエラー。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } },
+ "SuccessResultJa": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } },
+ "ConversationNotFoundJa": { "description": "会話が存在しません。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } } } }
+ },
+ "schemas": {
+ "BasicChatRequestJa": {
+ "type": "object", "required": ["query", "user"],
+ "properties": {
+ "query": { "type": "string", "description": "ユーザー入力/質問内容。" },
+ "inputs": { "type": "object", "description": "アプリで定義されたさまざまな変数値の入力を許可します。デフォルトは`{}`。", "additionalProperties": true, "default": {} },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "応答の返却モード。streaming(推奨)はSSEベース。blockingは実行完了後に結果を返します(Cloudflareの100秒タイムアウト制限あり;エージェントアシスタントモードではサポートされていません)。" },
+ "user": { "type": "string", "description": "ユーザー識別子、アプリケーション内で一意である必要があります。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID、以前のチャット記録に基づいて会話を続けるには、前のメッセージのconversation_idを渡す必要があります。" },
+ "files": { "type": "array", "items": { "$ref": "#/components/schemas/BasicInputFileObjectJa" }, "description": "アップロードされたファイルリスト。現在は画像タイプのみサポート。" },
+ "auto_generate_name": { "type": "boolean", "default": true, "description": "タイトルを自動生成します。デフォルトは`true`です。" }
+ }
+ },
+ "BasicInputFileObjectJa": {
+ "type": "object", "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["image"], "description": "サポートされているタイプ:`image`(現在は画像タイプのみサポート)。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "転送方法。" },
+ "url": { "type": "string", "format": "url", "description": "画像URL(転送方法が`remote_url`の場合)。" },
+ "upload_file_id": { "type": "string", "format":"uuid", "description": "アップロードされたファイルID(転送方法が`local_file`の場合)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "ChatCompletionResponseJa": {
+ "type": "object", "description": "ブロッキングモードでの完全なアプリ結果。",
+ "properties": {
+ "event": { "type": "string", "example": "message", "description": "イベントタイプ、固定で `message`。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "id": { "type": "string", "format": "uuid", "description": "ユニークID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" },
+ "mode": { "type": "string", "example": "chat", "description": "アプリモード、`chat`として固定。" },
+ "answer": { "type": "string", "description": "完全な応答内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadataJa" },
+ "created_at": { "type": "integer", "format": "int64", "description": "メッセージ作成タイムスタンプ。" }
+ }
+ },
+ "ResponseMetadataJa": {
+ "type": "object", "description": "メタデータ。",
+ "properties": { "usage": { "$ref": "#/components/schemas/UsageJa" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceJa" }, "description": "引用と帰属リスト。" } }
+ },
+ "ChunkBasicChatEventJa": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["message", "agent_message", "agent_thought", "message_file", "message_end", "tts_message", "tts_message_end", "message_replace", "error", "ping"], "description": "イベントタイプ。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "message": "#/components/schemas/StreamEventChatMessageJa", "agent_message": "#/components/schemas/StreamEventAgentMessageJa",
+ "agent_thought": "#/components/schemas/StreamEventAgentThoughtJa", "message_file": "#/components/schemas/StreamEventMessageFileJa",
+ "message_end": "#/components/schemas/StreamEventMessageEndJa", "tts_message": "#/components/schemas/StreamEventTtsMessageJa",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEndJa", "message_replace": "#/components/schemas/StreamEventMessageReplaceJa",
+ "error": "#/components/schemas/StreamEventErrorJa", "ping": "#/components/schemas/StreamEventPingJa"
+ }}
+ },
+ "StreamEventBaseChatJa": {
+ "type": "object", "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }
+ }
+ },
+ "StreamEventChatMessageJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLMが返したテキストチャンク内容。" } } } ] },
+ "StreamEventAgentMessageJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLMが返したテキストチャンク内容(エージェントモード)。" } } } ] },
+ "StreamEventAgentThoughtJa": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" },
+ { "type": "object", "required": ["id", "task_id", "message_id", "position", "created_at", "conversation_id"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "エージェント思考ID。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "position": { "type": "integer", "description": "エージェント思考のメッセージ内での位置。" },
+ "thought": { "type": "string", "nullable": true, "description": "エージェントの思考内容。" },
+ "observation": { "type": "string", "nullable": true, "description": "ツール呼び出しからの応答。" },
+ "tool": { "type": "string", "nullable": true, "description": "使用されたツールのリスト、;で区切られます。" },
+ "tool_input": { "type": "string", "nullable": true, "description": "ツールの入力、JSON形式の文字列。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" },
+ "message_files": { "type": "array", "items": { "type": "string", "format": "uuid", "description": "ファイルID" }, "description": "現在のエージェント思考に関連するファイルIDのリスト。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" }
+ }
+ }
+ ]
+ },
+ "StreamEventMessageFileJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "type": "object", "required": ["id", "type", "belongs_to", "url", "conversation_id"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ファイル一意ID。" }, "type": { "type": "string", "enum": ["image"], "description": "ファイルタイプ、現在は'image'のみ許可。" }, "belongs_to": { "type": "string", "enum": ["assistant"], "description": "所属、ここでは'assistant'のみ。" }, "url": { "type": "string", "format": "url", "description": "ファイルのリモートURL。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" } } } ] },
+ "StreamEventMessageEndJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadataJa" } } } ] },
+ "StreamEventTtsMessageJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64エンコードされたオーディオブロック。" } } } ] },
+ "StreamEventTtsMessageEndJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空の文字列。" } } } ] },
+ "StreamEventMessageReplaceJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "$ref": "#/components/schemas/StreamEventBaseChatJa" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "置換内容(すべてのLLM返信テキストを直接置換)。" } } } ] },
+ "StreamEventErrorJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "type": "object", "required": ["task_id", "status", "code", "message"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "一意のメッセージID(エラーイベントでは存在しない場合があります)。" }, "status": { "type": "integer", "description": "HTTPステータスコード。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] },
+ "StreamEventPingJa": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventJa" }, { "type": "object", "description": "接続を維持するために10秒ごとにpingイベントが発生します。" } ] },
+ "UsageJa": { "type": "object", "description": "モデル使用情報。", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } } },
+ "RetrieverResourceJa": { "type": "object", "description": "引用と帰属情報。", "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } } },
+ "FileUploadResponseJa": { "type": "object", "description": "ファイルアップロード成功後の応答。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "ファイル名。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルのMIMEタイプ。" }, "created_by": { "type": "string", "format": "uuid", "description": "エンドユーザーID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "MessageFeedbackRequestJa": { "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "アップボートは`like`、ダウンボートは`dislike`、アップボートの取り消しは`null`。" }, "user": { "type": "string", "description": "ユーザー識別子。" }, "content": { "type": "string", "nullable": true, "description": "メッセージのフィードバックです。" } } },
+ "AppFeedbacksResponseJa": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItemJa" }, "description": "このアプリの「いいね」とフィードバックの一覧を返します。" } } },
+ "FeedbackItemJa": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
+ "SuggestedQuestionsResponseJa": { "type": "object", "properties": { "result": { "type": "string", "example": "success" }, "data": { "type": "array", "items": { "type": "string" }, "description": "推奨質問のリスト。" } } },
+ "BasicConversationHistoryResponseJa": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返されたアイテムの数。" }, "has_more": { "type": "boolean", "description": "次のページがあるかどうか。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/BasicConversationMessageItemJa" }, "description": "メッセージリスト。" } } },
+ "BasicConversationMessageItemJa": { "type": "object", "description": "会話内の単一メッセージ。", "properties": { "id": { "type": "string", "format": "uuid", "description": "メッセージID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ユーザー入力パラメータ。" }, "query": { "type": "string", "description": "ユーザー入力/質問内容。" }, "answer": { "type": "string", "description": "応答メッセージ内容。" }, "message_files": { "type": "array", "items": { "$ref": "#/components/schemas/MessageFileItemJa" }, "description": "メッセージファイルリスト。" }, "feedback": { "type": "object", "nullable": true, "properties": { "rating": { "type": "string", "enum": ["like", "dislike"], "description": "アップボートは`like` / ダウンボートは`dislike`。" } }, "description": "フィードバック情報。" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceJa" }, "description": "引用と帰属リスト。" }, "agent_thoughts": { "type": "array", "items": { "$ref": "#/components/schemas/AgentThoughtItemJa" }, "description": "エージェントの思考(基本アシスタントの場合は空)。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "AgentThoughtItemJa": {
+ "type": "object", "description": "エージェントの思考ステップ。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "エージェント思考ID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "position": { "type": "integer", "description": "エージェント思考のメッセージ内での位置。" },
+ "thought": { "type": "string", "nullable": true, "description": "LLMが考えていること。" },
+ "observation": { "type": "string", "nullable": true, "description": "ツール呼び出しからの応答。" },
+ "tool": { "type": "string", "nullable": true, "description": "呼び出されたツールのリスト、;で区切られます。" },
+ "tool_input": { "type": "string", "nullable": true, "description": "ツールの入力、JSON形式。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" },
+ "message_files": { "type": "array", "items": { "type": "string", "format": "uuid", "description": "ファイルID" }, "description": "現在のエージェント思考に関連するファイルIDのリスト。" }
+ }
+ },
+ "MessageFileItemJa": { "type": "object", "description": "メッセージ内のファイル項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "type": { "type": "string", "description": "ファイルタイプ、例:'image'。" }, "url": { "type": "string", "format": "url", "description": "プレビュー画像URL。" }, "belongs_to": { "type": "string", "enum": ["user", "assistant"], "description": "所属。" } } },
+ "ConversationsListResponseJa": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返されたエントリの数。" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationListItemJa" }, "description": "会話のリスト。" } } },
+ "ConversationListItemJa": { "type": "object", "description": "会話リスト内の単一項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "会話ID。" }, "name": { "type": "string", "description": "会話名。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ユーザー入力パラメータ。" }, "status": { "type": "string", "description": "会話状態。" }, "introduction": { "type": "string", "nullable": true, "description": "紹介。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "更新タイムスタンプ。" } } },
+ "ConversationRenameRequestJa": { "type": "object", "required": ["user"], "properties": { "name": { "type": "string", "nullable": true, "description": "(Optional)会話の名前。`auto_generate`が`true`の場合、省略できます。" }, "auto_generate": { "type": "boolean", "default": false, "description": "(Optional)タイトルを自動生成します。デフォルトは`false`です。" }, "user": { "type": "string", "description": "ユーザー識別子。" } } },
+ "ConversationRenameResponseJa": { "$ref": "#/components/schemas/ConversationListItemJa" },
+ "ConversationVariablesResponseJa": { "type": "object", "properties": { "limit": { "type": "integer", "description": "ページごとのアイテム数。" }, "has_more": { "type": "boolean", "description": "さらにアイテムがあるかどうか。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationVariableItemJa" }, "description": "変数のリスト。" } } },
+ "ConversationVariableItemJa": { "type": "object", "description": "会話内の変数項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "変数ID。" }, "name": { "type": "string", "description": "変数名。" }, "value_type": { "type": "string", "description": "変数タイプ(文字列、数値、真偽値など)。" }, "value": { "type": "string", "description": "変数値。" }, "description": { "type": "string", "nullable": true, "description": "変数の説明。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最終更新タイムスタンプ。" } } },
+ "AudioToTextRequestJa": { "type": "object", "required": ["file", "user"], "properties": { "file": { "type": "string", "format": "binary", "description": "オーディオファイル。サポートされている形式:`['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`。ファイルサイズ制限:15MB。" }, "user": { "type": "string", "description": "ユーザー識別子。" } } },
+ "AudioToTextResponseJa": { "type": "object", "properties": { "text": { "type": "string", "description": "出力テキスト。" } } },
+ "TextToAudioFormRequestJa": { "type": "object", "required": ["user"], "properties": { "message_id": { "type": "string", "format": "uuid", "description": "メッセージID(優先)。" }, "text": { "type": "string", "description": "音声生成コンテンツ。" }, "user": { "type": "string", "description": "ユーザー識別子。" } }, "description": "`user`が必要です。`message_id`または`text`を提供してください。このバージョンはmultipart/form-dataです。" },
+ "AppInfoResponseJa": { "type": "object", "description": "アプリケーションの基本情報。", "properties": { "name": { "type": "string", "description": "アプリケーションの名前。" }, "description": { "type": "string", "description": "アプリケーションの説明。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "アプリケーションのタグ。" } } },
+ "BasicChatAppParametersResponseJa": { "type": "object", "description": "アプリケーションのパラメータ情報。", "properties": { "opening_statement": { "type": "string", "description": "開始文。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "開始時の推奨質問のリスト。" }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "答えを有効にした後の質問を提案します。" }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "音声からテキストへ。" }, "text_to_speech": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" }, "voice": { "type": "string", "description": "音声タイプ。" }, "language": { "type": "string", "description": "言語。" }, "autoPlay": { "type": "string", "enum": ["enabled", "disabled"], "description": "自動再生:enabled 有効, disabled 無効。" } }, "description": "テキストから音声へ。" }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "引用と帰属。" }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "注釈返信。" }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemJa" }, "description": "ユーザー入力フォームの構成。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "画像設定。サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。" } }, "description": "ファイルアップロード構成。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "ドキュメントアップロードサイズ制限(MB)。" }, "image_file_size_limit": { "type": "integer", "description": "画像ファイルアップロードサイズ制限(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "オーディオファイルアップロードサイズ制限(MB)。" }, "video_file_size_limit": { "type": "integer", "description": "ビデオファイルアップロードサイズ制限(MB)。" } }, "description": "システムパラメータ。" } } },
+ "UserInputFormItemJa": { "type": "object", "description": "ユーザー入力フォーム内のコントロール項目。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperJa" }, { "$ref": "#/components/schemas/ParagraphControlWrapperJa" }, { "$ref": "#/components/schemas/SelectControlWrapperJa" } ] },
+ "TextInputControlWrapperJa": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlJa" } }, "required":["text-input"] },
+ "ParagraphControlWrapperJa": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlJa" } }, "required":["paragraph"] },
+ "SelectControlWrapperJa": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlJa" } }, "required":["select"] },
+ "TextInputControlJa": { "type": "object", "description": "テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "ParagraphControlJa": { "type": "object", "description": "段落テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "SelectControlJa": { "type": "object", "description": "ドロップダウンコントロール。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "オプション値。" } } },
+ "AppMetaResponseJa": { "type": "object", "description": "アプリケーションのメタ情報。", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "type": "string", "format": "url", "description": "アイコンのURL。" }, { "$ref": "#/components/schemas/ToolIconDetailJa" } ] }, "description": "ツールアイコン。キーはツール名です。" } } },
+ "ToolIconDetailJa": { "type": "object", "description": "ツールアイコンの詳細。", "properties": { "background": { "type": "string", "description": "背景色(16進数形式)。" }, "content": { "type": "string", "description": "絵文字。" } } },
+ "WebAppSettingsResponseJa": { "type": "object", "description": "アプリのWebApp設定。", "properties": { "title": { "type": "string", "description": "WebApp名。" }, "chat_color_theme": { "type": "string", "description": "チャットの色テーマ、16進数形式。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "チャットの色テーマを反転するかどうか。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "アイコンタイプ。" }, "icon": { "type": "string", "description": "アイコン内容(絵文字または画像URL)。" }, "icon_background": { "type": "string", "description": "16進数形式の背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "アイコンのURL。" }, "description": { "type": "string", "description": "説明。" }, "copyright": { "type": "string", "description": "著作権情報。" }, "privacy_policy": { "type": "string", "description": "プライバシーポリシーのリンク。" }, "custom_disclaimer": { "type": "string", "description": "カスタム免責事項。" }, "default_language": { "type": "string", "description": "デフォルト言語。" }, "show_workflow_steps": { "type": "boolean", "description": "ワークフローの詳細を表示するかどうか。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "WebAppのアイコンをチャット内の🤖に置き換えるかどうか。" } } },
+ "ErrorResponseJa": { "type": "object", "description": "エラー応答。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTPステータスコード。" }, "code": { "type": "string", "nullable": true, "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } }
+ }
+ },
+ "tags": [
+ { "name": "チャットメッセージ", "description": "チャットメッセージと対話に関連する操作。" },
+ { "name": "ファイル操作", "description": "ファイルアップロードに関連する操作。" },
+ { "name": "メッセージフィードバック", "description": "ユーザーからのメッセージフィードバック操作。" },
+ { "name": "会話管理", "description": "会話セッションの管理に関連する操作。" },
+ { "name": "音声とテキスト変換", "description": "テキストから音声、音声からテキストへの変換操作。" },
+ { "name": "アプリケーション設定", "description": "アプリケーション設定と情報の取得に関連する操作。" }
+ ]
+}
\ No newline at end of file
diff --git a/ja-jp/openapi_chatflow.json b/ja-jp/openapi_chatflow.json
new file mode 100644
index 00000000..4d832fb8
--- /dev/null
+++ b/ja-jp/openapi_chatflow.json
@@ -0,0 +1,588 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "高度なチャットアプリAPI (Chatflow API)",
+ "description": "チャットアプリケーションはセッションの持続性をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これは、チャットボットやカスタマーサービスAIなどに適用できます。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "APIのベースURL。 {api_base_url} をアプリケーション提供の実際のAPIベースURLに置き換えてください。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "実際のAPIベースURL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "チャットメッセージを送信",
+ "description": "チャットアプリケーションにリクエストを送信します。",
+ "operationId": "sendChatflowMessageJp",
+ "tags": ["チャットメッセージ"],
+ "requestBody": {
+ "description": "チャットメッセージ送信のリクエストボディ。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatflowRequestJp"
+ },
+ "examples": {
+ "streaming_with_file": {
+ "summary": "ファイルとカスタム入力を含むストリーミングリクエストの例",
+ "value": {
+ "inputs": {
+ "name": "dify"
+ },
+ "query": "iPhone 13 Pro Maxの仕様は何ですか?",
+ "response_mode": "streaming",
+ "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
+ "user": "abc-123",
+ "files": [
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://cloud.dify.ai/logo/logo-site.png"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "リクエスト成功。応答のコンテントタイプと構造はリクエストの `response_mode` パラメータに依存します。\n- `response_mode` が `blocking` の場合、`application/json` 形式の `ChatCompletionResponseJp` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、`text/event-stream` 形式の `ChunkChatflowEventJp` オブジェクトのストリームを返します。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponseJp"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSEイベントストリーム。各イベントは 'data: ' で始まり、'\\n\\n' で終わります。詳細な構造は `ChunkChatflowEventJp` を参照してください。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGenericJp" },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "ファイルアップロード",
+ "description": "メッセージ送信時に使用するファイルをアップロードし、画像とテキストのマルチモーダル理解を可能にします。アプリケーションでサポートされている形式をサポートします。アップロードされたファイルは現在のエンドユーザーのみが使用できます。",
+ "operationId": "uploadChatflowFileJp",
+ "tags": ["ファイル操作"],
+ "requestBody": {
+ "description": "ファイルアップロードリクエスト。`multipart/form-data` リクエストが必要です。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "アップロードするファイル。"
+ },
+ "user": {
+ "type": "string",
+ "description": "ユーザー識別子。開発者のルールによって定義され、アプリケーション内で一意でなければなりません。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "ファイルアップロード成功。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponseJp"
+ }
+ }
+ }
+ },
+ "201": {
+ "description": "ファイル作成成功(代替成功コード)。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFileJp" },
+ "413": { "$ref": "#/components/responses/FileTooLargeJp" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileJp" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "生成を停止",
+ "description": "チャットメッセージの生成を停止します。ストリーミングモードでのみサポートされています。",
+ "operationId": "stopChatflowMessageGenerationJp",
+ "tags": ["チャットメッセージ"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "タスクID、ストリーミングチャンクの返り値から取得できます。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "ユーザー識別子。送信メッセージインターフェースで渡されたユーザーと一致している必要があります。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultJp" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "メッセージフィードバック",
+ "description": "エンドユーザーはフィードバックメッセージを提供でき、アプリケーション開発者が期待される出力を最適化するのを支援します。",
+ "operationId": "postChatflowMessageFeedbackJp",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "メッセージID。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestJp" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultJp" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "アプリのメッセージの「いいね」とフィードバックを取得",
+ "description": "アプリのエンドユーザーからのフィードバックや「いいね」を取得します。",
+ "operationId": "getChatflowAppFeedbacksJp",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParamJp" },
+ { "$ref": "#/components/parameters/LimitQueryParamJp" }
+ ],
+ "responses": {
+ "200": {
+ "description": "アプリのフィードバックリストを正常に取得しました。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseJp" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "次の推奨質問",
+ "description": "現在のメッセージに対する次の質問の提案を取得します。",
+ "operationId": "getChatflowSuggestedQuestionsJp",
+ "tags": ["チャットメッセージ"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "メッセージID。",
+ "schema": { "type": "string", "format": "uuid" }
+ },
+ { "$ref": "#/components/parameters/UserQueryParamJp" }
+ ],
+ "responses": {
+ "200": {
+ "description": "推奨質問リストを正常に取得しました。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseJp" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "会話履歴メッセージを取得",
+ "description": "スクロールロード形式で履歴チャット記録を返し、最初のページは最新の`{limit}`メッセージを返します。つまり、逆順です。",
+ "operationId": "getChatflowConversationHistoryJp",
+ "tags": ["会話管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdQueryParamJp" },
+ { "$ref": "#/components/parameters/UserQueryParamJp" },
+ {
+ "name": "first_id",
+ "in": "query",
+ "description": "現在のページの最初のチャット記録のID、デフォルトはnullです。",
+ "schema": { "type": "string", "format": "uuid", "nullable": true }
+ },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Jp" }
+ ],
+ "responses": {
+ "200": {
+ "description": "会話履歴メッセージを正常に取得しました。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationHistoryResponseJp" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "会話を取得",
+ "description": "現在のユーザーの会話リストを取得し、デフォルトで最新の20件を返します。",
+ "operationId": "getChatflowConversationsListJp",
+ "tags": ["会話管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/UserQueryParamJp" },
+ { "$ref": "#/components/parameters/LastIdQueryParamJp" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Jp" },
+ { "$ref": "#/components/parameters/SortByQueryParamJp" }
+ ],
+ "responses": {
+ "200": {
+ "description": "会話リストを正常に取得しました。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationsListResponseJp" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "会話を削除",
+ "description": "指定された会話を削除します。",
+ "operationId": "deleteChatflowConversationJp",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJp" } ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object", "required": ["user"],
+ "properties": { "user": { "type": "string", "description": "ユーザー識別子。" } }
+ }
+ }
+ }
+ },
+ "responses": { "204": { "description": "会話が正常に削除されました。コンテンツはありません。" } }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "会話の名前を変更",
+ "description": "セッションの名前を変更します。",
+ "operationId": "renameChatflowConversationJp",
+ "tags": ["会話管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJp" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestJp" } } }
+ },
+ "responses": {
+ "200": { "description": "会話の名前が正常に変更されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseJp" } } } }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "会話変数の取得",
+ "description": "特定の会話から変数を取得します。このエンドポイントは、会話中に取得された構造化データを抽出するのに役立ちます。",
+ "operationId": "getChatflowConversationVariablesJp",
+ "tags": ["会話管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParamJp" },
+ { "$ref": "#/components/parameters/UserQueryParamJp" },
+ { "$ref": "#/components/parameters/LastIdQueryParamJp" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Jp" },
+ { "$ref": "#/components/parameters/VariableNameQueryParamJp" }
+ ],
+ "responses": {
+ "200": { "description": "会話変数を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseJp" } } } },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundJp" }
+ }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "音声からテキストへ",
+ "description": "オーディオファイルをテキストに変換します。サポートされている形式:mp3, mp4, mpeg, mpga, m4a, wav, webm。ファイルサイズ制限:15MB。",
+ "operationId": "chatflowAudioToTextJp",
+ "tags": ["音声・テキスト変換"],
+ "requestBody": {
+ "required": true,
+ "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestJp" } } }
+ },
+ "responses": {
+ "200": { "description": "音声をテキストに正常に変換しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseJp" } } } }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "テキストから音声へ",
+ "description": "テキストコンテンツを音声に変換します。",
+ "operationId": "chatflowTextToAudioJp",
+ "tags": ["音声・テキスト変換"],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioJsonRequestJp" } } }
+ },
+ "responses": {
+ "200": {
+ "description": "音声ファイルを正常に生成しました。",
+ "content": { "audio/wav": { "schema": { "type": "string", "format": "binary" } }, "audio/mp3": { "schema": { "type": "string", "format": "binary" } } },
+ "headers": { "Content-Type": { "schema": { "type": "string", "example": "audio/wav" } } }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "アプリケーションの基本情報を取得",
+ "operationId": "getChatflowAppInfoJp",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJp" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "アプリケーションのパラメータ情報を取得",
+ "description": "ページに入る際に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。",
+ "operationId": "getChatflowAppParametersJp",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseJp" } } } } }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "アプリケーションのメタ情報を取得",
+ "description": "このアプリケーションのツールのアイコンを取得するために使用されます。",
+ "operationId": "getChatflowAppMetaJp",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "アプリケーションのメタ情報を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseJp" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "アプリのWebApp設定を取得",
+ "description": "アプリのWebApp設定を取得するために使用します。",
+ "operationId": "getChatflowWebAppSettingsJp",
+ "tags": ["アプリケーション設定"],
+ "responses": { "200": { "description": "WebAppの設定情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseJp" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "APIキー認証。すべてのAPIリクエストには、Authorization HTTPヘッダーにAPIキーを `Bearer {API_KEY}` の形式で含めてください。APIキーはサーバー側に保存し、クライアント側で共有または保存しないことを強くお勧めします。" }
+ },
+ "parameters": {
+ "PageQueryParamJp": { "name": "page", "in": "query", "description": "(任意)ページ番号。デフォルト値:1。", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParamJp": { "name": "limit", "in": "query", "description": "(任意)1ページあたりの件数。デフォルト値:20。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Jp": { "name": "limit", "in": "query", "description": "1回のリクエストで返す記録の数、デフォルトは20です。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Max100Jp": { "name": "limit", "in": "query", "description": "1回のリクエストで返す記録の数、デフォルトは最新の20件です。最大100、最小1。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "UserQueryParamJp": { "name": "user", "in": "query", "required": true, "description": "ユーザー識別子。アプリケーション内で開発者によって一意に定義されるべきです。", "schema": { "type": "string" } },
+ "ConversationIdQueryParamJp": { "name": "conversation_id", "in": "query", "required": true, "description": "会話ID。", "schema": { "type": "string", "format": "uuid" } },
+ "LastIdQueryParamJp": { "name": "last_id", "in": "query", "description": "(Optional)現在のページの最後の記録のID、デフォルトはnullです。", "schema": { "type": "string", "format": "uuid", "nullable": true } },
+ "SortByQueryParamJp": { "name": "sort_by", "in": "query", "description": "(Optional)ソートフィールド、デフォルト:-updated_at(更新時間で降順にソート)。利用可能な値:created_at, -created_at, updated_at, -updated_at。'-'は逆順を表します。", "schema": { "type": "string", "enum": ["created_at", "-created_at", "updated_at", "-updated_at"], "default": "-updated_at" } },
+ "ConversationIdPathParamJp": { "name": "conversation_id", "in": "path", "required": true, "description": "会話ID。", "schema": { "type": "string", "format": "uuid" } },
+ "VariableNameQueryParamJp": { "name": "variable_name", "in": "query", "description": "(任意)変数名でフィルタリングします。", "schema": { "type": "string" } }
+ },
+ "responses": {
+ "BadRequestGenericJp": { "description": "リクエストパラメータエラー。考えられる原因:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, completion_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "BadRequestFileJp": { "description": "ファイル操作リクエストエラー。考えられる原因:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "FileTooLargeJp": { "description": "ファイルが大きすぎます (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "UnsupportedFileTypeFileJp": { "description": "サポートされていないファイルタイプ (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "S3ErrorFileJp": { "description": "S3ストレージサービスエラー。考えられる原因:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "InternalServerErrorJp": { "description": "内部サーバーエラー。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "SuccessResultJp": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } },
+ "ConversationNotFoundJp": { "description": "会話が存在しません。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } }
+ },
+ "schemas": {
+ "ChatflowRequestJp": {
+ "type": "object",
+ "required": ["query", "user"],
+ "properties": {
+ "query": { "type": "string", "description": "ユーザー入力/質問内容。" },
+ "inputs": {
+ "type": "object",
+ "description": "アプリによって定義されたさまざまな変数値の入力を許可します。変数がファイルタイプの場合、InputFileObjectJp オブジェクトを指定します。",
+ "additionalProperties": {
+ "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "$ref": "#/components/schemas/InputFileObjectJp" } ]
+ },
+ "default": {}
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "応答の返却モード。streaming (推奨) はSSEを使用。blocking は実行完了後に結果を返します (Cloudflareの100秒タイムアウト制限あり)。" },
+ "user": { "type": "string", "description": "ユーザー識別子。アプリケーション内で一意であるべきです。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。以前のチャット記録に基づいて会話を続ける場合に必要です。" },
+ "files": { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectJp" }, "description": "ファイルリスト。モデルがビジョン機能をサポートしている場合に利用可能です。" },
+ "auto_generate_name": { "type": "boolean", "default": true, "description": "タイトルを自動生成。デフォルトはtrue。" }
+ }
+ },
+ "InputFileObjectJp": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "ファイルタイプ。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: その他。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "転送方法。" },
+ "url": { "type": "string", "format": "url", "description": "画像URL(transfer_methodがremote_urlの場合)。" },
+ "upload_file_id": { "type": "string", "format":"uuid", "description": "アップロードされたファイルID(transfer_methodがlocal_fileの場合)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "ChatCompletionResponseJp": {
+ "type": "object", "description": "ブロッキングモードでの完全なアプリ結果。",
+ "properties": {
+ "event": { "type": "string", "example": "message", "description": "イベントタイプ、固定で `message`。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "id": { "type": "string", "format": "uuid", "description": "ユニークID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" },
+ "mode": { "type": "string", "example": "chat", "description": "アプリモード、`chat`として固定。" },
+ "answer": { "type": "string", "description": "完全な応答内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadataJp" },
+ "created_at": { "type": "integer", "format": "int64", "description": "メッセージ作成タイムスタンプ。" }
+ }
+ },
+ "ResponseMetadataJp": {
+ "type": "object", "description": "メタデータ。",
+ "properties": { "usage": { "$ref": "#/components/schemas/UsageJp" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceJp" }, "description": "引用と帰属リスト。" } }
+ },
+ "ChunkChatflowEventJp": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["message", "message_file", "message_end", "tts_message", "tts_message_end", "message_replace", "workflow_started", "node_started", "node_finished", "workflow_finished", "error", "ping"], "description": "イベントタイプ。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "message": "#/components/schemas/StreamEventChatMessageJp", "message_file": "#/components/schemas/StreamEventMessageFileJp",
+ "message_end": "#/components/schemas/StreamEventMessageEndJp", "tts_message": "#/components/schemas/StreamEventTtsMessageJp",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEndJp", "message_replace": "#/components/schemas/StreamEventMessageReplaceJp",
+ "workflow_started": "#/components/schemas/StreamEventWorkflowStartedJp", "node_started": "#/components/schemas/StreamEventNodeStartedJp",
+ "node_finished": "#/components/schemas/StreamEventNodeFinishedJp", "workflow_finished": "#/components/schemas/StreamEventWorkflowFinishedJp",
+ "error": "#/components/schemas/StreamEventErrorJp", "ping": "#/components/schemas/StreamEventPingJp"
+ }}
+ },
+ "StreamEventBaseChatJp": {
+ "type": "object", "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }
+ }
+ },
+ "StreamEventChatMessageJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseChatJp" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLMが返したテキストチャンク内容。" } } } ] },
+ "StreamEventMessageFileJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["id", "type", "belongs_to", "url", "conversation_id"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ファイル一意ID。" }, "type": { "type": "string", "enum": ["image"], "description": "ファイルタイプ、現在はimageのみ。" }, "belongs_to": { "type": "string", "enum": ["assistant"], "description": "所属、ここではassistantのみ。" }, "url": { "type": "string", "format": "url", "description": "ファイルのリモートURL。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" } } } ] },
+ "StreamEventMessageEndJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseChatJp" }, { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadataJp" } } } ] },
+ "StreamEventTtsMessageJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseChatJp" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64エンコードされたオーディオブロック。" } } } ] },
+ "StreamEventTtsMessageEndJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseChatJp" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空の文字列。" } } } ] },
+ "StreamEventMessageReplaceJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseChatJp" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "置換内容(すべてのLLM返信テキストを直接置き換えます)。" } } } ] },
+ "StreamEventWorkflowStartedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/WorkflowStartedDataJp" } } } ] },
+ "WorkflowStartedDataJp": { "type": "object", "required": ["id", "workflow_id", "sequence_number", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行の一意ID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "関連ワークフローのID。" }, "sequence_number": { "type": "integer", "description": "自己増加シリアル番号、アプリ内で自己増加し、1から始まります。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "StreamEventNodeStartedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/NodeStartedDataJp" } } } ] },
+ "NodeStartedDataJp": { "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行の一意ID (文脈からノード実行IDであるべき)。" }, "node_id": { "type": "string", "format": "uuid", "description": "ノードのID。" }, "node_type": { "type": "string", "description": "ノードのタイプ。" }, "title": { "type": "string", "description": "ノードの名前。" }, "index": { "type": "integer", "description": "実行シーケンス番号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "オプションのプレフィックスノードID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ノードで使用されるすべての前のノード変数の内容。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始のタイムスタンプ。" } } },
+ "StreamEventNodeFinishedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/NodeFinishedDataJp" } } } ] },
+ "NodeFinishedDataJp": { "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "status", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行の一意ID。" }, "node_id": { "type": "string", "format": "uuid", "description": "ノードのID。" }, "node_type": { "type": "string", "description": "ノードのタイプ。" }, "title": { "type": "string", "description": "ノードの名前。" }, "index": { "type": "integer", "description": "実行シーケンス番号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "オプションのプレフィックスノードID。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノードで使用されるすべての前のノード変数の内容。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "オプションのノードプロセスデータ (JSON)。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "オプションの出力内容 (JSON)。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行の状態。" }, "error": { "type": "string", "nullable": true, "description": "オプションのエラー理由。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "オプションの使用される合計秒数。" }, "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadataJp" , "nullable": true, "description": "メタデータ"}, "created_at": { "type": "integer", "format": "int64", "description": "開始のタイムスタンプ。" } } },
+ "NodeExecutionMetadataJp": { "type": "object", "description": "ノード実行メタデータ。", "properties": { "total_tokens": { "type": "integer", "nullable": true, "description": "オプションの使用されるトークン数。" }, "total_price": { "type": "number", "format": "float", "nullable": true, "description": "オプションの合計コスト (floatでdecimalを代用)。" }, "currency": { "type": "string", "nullable": true, "example": "USD", "description": "オプションの通貨。" } } },
+ "StreamEventWorkflowFinishedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/WorkflowFinishedDataJp" } } } ] },
+ "WorkflowFinishedDataJp": { "type": "object", "required": ["id", "workflow_id", "status", "created_at", "finished_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行のID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "関連ワークフローのID。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行の状態。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "オプションの出力内容 (JSON)。" }, "error": { "type": "string", "nullable": true, "description": "オプションのエラー理由。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "オプションの使用される合計秒数。" }, "total_tokens": { "type": "integer", "nullable": true, "description": "オプションの使用されるトークン数。" }, "total_steps": { "type": "integer", "default": 0, "description": "合計ステップ数、デフォルト0。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始時間。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了時間。" } } },
+ "StreamEventErrorJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "required": ["task_id", "status", "code", "message"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "一意のメッセージID(エラーイベントでは存在しない場合がある)。" }, "status": { "type": "integer", "description": "HTTPステータスコード。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] },
+ "StreamEventPingJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatflowEventJp" }, { "type": "object", "description": "接続を維持するために10秒ごとにpingイベントが発生します。" } ] },
+ "UsageJp": { "type": "object", "description": "モデル使用情報。", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } } },
+ "RetrieverResourceJp": { "type": "object", "description": "引用と帰属リスト。", "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } } },
+ "FileUploadResponseJp": { "type": "object", "description": "ファイルアップロード成功時の応答。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "ファイル名。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルのMIMEタイプ。" }, "created_by": { "type": "string", "format": "uuid", "description": "エンドユーザーID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "MessageFeedbackRequestJp": { "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "アップボートは`like`、ダウンボートは`dislike`、取り消しは`null`。" }, "user": { "type": "string", "description": "ユーザー識別子。" }, "content": { "type": "string", "nullable": true, "description": "メッセージフィードバックの具体的な内容。" } } },
+ "AppFeedbacksResponseJp": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItemJp" }, "description": "このアプリの「いいね」とフィードバックの一覧。" } } },
+ "FeedbackItemJp": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
+ "SuggestedQuestionsResponseJp": { "type": "object", "properties": { "result": { "type": "string", "example": "success" }, "data": { "type": "array", "items": { "type": "string" }, "description": "推奨質問のリスト。" } } },
+ "ConversationHistoryResponseJp": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返された項目数。" }, "has_more": { "type": "boolean", "description": "次のページがあるかどうか。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationMessageItemJp" }, "description": "メッセージリスト。" } } },
+ "ConversationMessageItemJp": { "type": "object", "description": "会話内の単一メッセージ。", "properties": { "id": { "type": "string", "format": "uuid", "description": "メッセージID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ユーザー入力パラメータ。" }, "query": { "type": "string", "description": "ユーザー入力/質問内容。" }, "answer": { "type": "string", "description": "応答メッセージ内容。" }, "message_files": { "type": "array", "items": { "$ref": "#/components/schemas/MessageFileItemJp" }, "description": "メッセージファイルリスト。" }, "feedback": { "type": "object", "nullable": true, "properties": { "rating": { "type": "string", "enum": ["like", "dislike"], "description": "アップボートは`like` / ダウンボートは`dislike`。" } }, "description": "フィードバック情報。" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceJp" }, "description": "引用と帰属リスト。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "MessageFileItemJp": { "type": "object", "description": "メッセージ内のファイル項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "type": { "type": "string", "description": "ファイルタイプ、例:'image'。" }, "url": { "type": "string", "format": "url", "description": "プレビュー画像URL。" }, "belongs_to": { "type": "string", "enum": ["user", "assistant"], "description": "所属。" } } },
+ "ConversationsListResponseJp": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返されたエントリ数。" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationListItemJp" }, "description": "会話のリスト。" } } },
+ "ConversationListItemJp": { "type": "object", "description": "会話リスト内の単一項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "会話ID。" }, "name": { "type": "string", "description": "会話名。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ユーザー入力パラメータ。" }, "status": { "type": "string", "description": "会話状態。" }, "introduction": { "type": "string", "nullable": true, "description": "紹介。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "更新タイムスタンプ。" } } },
+ "ConversationRenameRequestJp": { "type": "object", "required": ["user"], "properties": { "name": { "type": "string", "nullable": true, "description": "(Optional)会話の名前。`auto_generate`が`true`の場合省略可。" }, "auto_generate": { "type": "boolean", "default": false, "description": "(Optional)タイトルを自動生成、デフォルトは`false`。" }, "user": { "type": "string", "description": "ユーザー識別子。" } } },
+ "ConversationRenameResponseJp": { "$ref": "#/components/schemas/ConversationListItemJp" },
+ "ConversationVariablesResponseJp": { "type": "object", "properties": { "limit": { "type": "integer", "description": "ページごとのアイテム数。" }, "has_more": { "type": "boolean", "description": "さらにアイテムがあるかどうか。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationVariableItemJp" }, "description": "変数のリスト。" } } },
+ "ConversationVariableItemJp": { "type": "object", "description": "会話内の変数項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "変数ID。" }, "name": { "type": "string", "description": "変数名。" }, "value_type": { "type": "string", "description": "変数タイプ(文字列、数値、真偽値など)。" }, "value": { "type": "string", "description": "変数値。" }, "description": { "type": "string", "nullable": true, "description": "変数の説明。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最終更新タイムスタンプ。" } } },
+ "AudioToTextRequestJp": { "type": "object", "required": ["file", "user"], "properties": { "file": { "type": "string", "format": "binary", "description": "オーディオファイル。サポート形式:`['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`。サイズ制限:15MB。" }, "user": { "type": "string", "description": "ユーザー識別子。" } } },
+ "AudioToTextResponseJp": { "type": "object", "properties": { "text": { "type": "string", "description": "出力テキスト。" } } },
+ "TextToAudioJsonRequestJp": { "type": "object", "required": ["user"], "properties": { "message_id": { "type": "string", "format": "uuid", "description": "メッセージID(優先)。" }, "text": { "type": "string", "description": "音声生成コンテンツ。" }, "user": { "type": "string", "description": "ユーザー識別子。" }, "streaming": {"type": "boolean", "default": false, "description": "trueの場合、応答はオーディオチャンクのストリームになります。"} }, "description": "`user` が必要です。`message_id` または `text` を提供してください。" },
+ "AppInfoResponseJp": { "type": "object", "description": "アプリケーションの基本情報。", "properties": { "name": { "type": "string", "description": "アプリケーションの名前。" }, "description": { "type": "string", "description": "アプリケーションの説明。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "アプリケーションのタグ。" } } },
+ "ChatAppParametersResponseJp": { "type": "object", "description": "アプリケーションのパラメータ情報。", "properties": { "opening_statement": { "type": "string", "description": "開始の挨拶。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "開始時の推奨質問のリスト。" }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "答えを有効にした後の質問を提案します。" }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "音声からテキストへ。" }, "text_to_speech": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" }, "voice": { "type": "string", "description": "音声タイプ。" }, "language": { "type": "string", "description": "言語。" }, "autoPlay": { "type": "string", "enum": ["enabled", "disabled"], "description": "自動再生:enabled 有効, disabled 無効。" } }, "description": "テキストから音声へ。" }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "引用と帰属。" }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "有効かどうか。" } }, "description": "注釈返信。" }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemJp" }, "description": "ユーザー入力フォームの設定。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "画像設定。サポートされている画像タイプ:png, jpg, jpeg, webp, gif。" } }, "description": "ファイルアップロード設定。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "ドキュメントアップロードサイズ制限(MB)。" }, "image_file_size_limit": { "type": "integer", "description": "画像ファイルアップロードサイズ制限(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "オーディオファイルアップロードサイズ制限(MB)。" }, "video_file_size_limit": { "type": "integer", "description": "ビデオファイルアップロードサイズ制限(MB)。" } }, "description": "システムパラメータ。" } } },
+ "UserInputFormItemJp": { "type": "object", "description": "ユーザー入力フォームのコントロール項目。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperJp" }, { "$ref": "#/components/schemas/ParagraphControlWrapperJp" }, { "$ref": "#/components/schemas/SelectControlWrapperJp" } ] },
+ "TextInputControlWrapperJp": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlJp" } }, "required":["text-input"] },
+ "ParagraphControlWrapperJp": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlJp" } }, "required":["paragraph"] },
+ "SelectControlWrapperJp": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlJp" } }, "required":["select"] },
+ "TextInputControlJp": { "type": "object", "description": "テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "ParagraphControlJp": { "type": "object", "description": "段落テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "SelectControlJp": { "type": "object", "description": "ドロップダウンコントロール。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "オプション値。" } } },
+ "AppMetaResponseJp": { "type": "object", "description": "アプリケーションのメタ情報。", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "type": "string", "format": "url", "description": "アイコンのURL。" }, { "$ref": "#/components/schemas/ToolIconDetailJp" } ] }, "description": "ツールアイコン。キーはツール名です。" } } },
+ "ToolIconDetailJp": { "type": "object", "description": "ツールアイコン詳細。", "properties": { "background": { "type": "string", "description": "背景色(16進数形式)。" }, "content": { "type": "string", "description": "絵文字。" } } },
+ "WebAppSettingsResponseJp": { "type": "object", "description": "アプリのWebApp設定。", "properties": { "title": { "type": "string", "description": "WebApp名。" }, "chat_color_theme": { "type": "string", "description": "チャットの色テーマ、16進数形式。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "チャットの色テーマを反転するかどうか。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "アイコンタイプ。" }, "icon": { "type": "string", "description": "アイコン。`emoji`タイプの場合は絵文字、`image`タイプの場合は画像URL。" }, "icon_background": { "type": "string", "description": "16進数形式の背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "アイコンのURL。" }, "description": { "type": "string", "description": "説明。" }, "copyright": { "type": "string", "description": "著作権情報。" }, "privacy_policy": { "type": "string", "description": "プライバシーポリシーのリンク。" }, "custom_disclaimer": { "type": "string", "description": "カスタム免責事項。" }, "default_language": { "type": "string", "description": "デフォルト言語。" }, "show_workflow_steps": { "type": "boolean", "description": "ワークフローの詳細を表示するかどうか。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "WebAppのアイコンをチャット内のロボットアイコンに置き換えるかどうか。" } } },
+ "ErrorResponseJp": { "type": "object", "description": "エラー応答。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTPステータスコード。" }, "code": { "type": "string", "nullable": true, "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } }
+ }
+ },
+ "tags": [
+ { "name": "チャットメッセージ", "description": "チャットメッセージとインタラクションに関連する操作。" },
+ { "name": "ファイル操作", "description": "ファイルアップロードに関連する操作。" },
+ { "name": "メッセージフィードバック", "description": "ユーザーメッセージへのフィードバック操作。" },
+ { "name": "会話管理", "description": "会話セッションの管理に関連する操作。" },
+ { "name": "音声・テキスト変換", "description": "テキストから音声へ、音声からテキストへの変換操作。" },
+ { "name": "アプリケーション設定", "description": "アプリケーション設定と情報の取得に関連する操作。" }
+ ]
+}
\ No newline at end of file
diff --git a/ja-jp/openapi_completion.json b/ja-jp/openapi_completion.json
new file mode 100644
index 00000000..381f01f9
--- /dev/null
+++ b/ja-jp/openapi_completion.json
@@ -0,0 +1,275 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Completion アプリ API",
+ "description": "テキスト生成アプリケーションはセッションレスをサポートし、翻訳、記事作成、要約AI等に最適です。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "API のベースURL。 {api_base_url} をアプリケーション提供の実際の API ベースURLに置き換えてください。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "実際の API ベースURL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/completion-messages": {
+ "post": {
+ "summary": "完了メッセージの作成",
+ "description": "テキスト生成アプリケーションにリクエストを送信します。",
+ "operationId": "createCompletionMessageJp",
+ "tags": ["完了メッセージ"],
+ "requestBody": {
+ "description": "完了メッセージを作成するためのリクエストボディ。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CompletionRequestJp"
+ },
+ "examples": {
+ "streaming_example_jp": {
+ "summary": "ストリーミングモードの例",
+ "value": {
+ "inputs": {"query": "こんにちは、世界!"},
+ "response_mode": "streaming",
+ "user": "jp_user_123"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "リクエスト成功。レスポンスのコンテントタイプと構造はリクエストの `response_mode` パラメータに依存します。\n- `response_mode` が `blocking` の場合、`application/json` で `CompletionResponseJp` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、`text/event-stream` で `ChunkCompletionEventJp` のストリームを返します。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CompletionResponseJp"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSE (Server-Sent Events) のストリーム。各イベントは 'data: ' で始まり、'\\n\\n' で終わるJSONオブジェクトです。詳細は `ChunkCompletionEventJp` を参照してください。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGenericJp" },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "ファイルアップロード",
+ "description": "メッセージ送信時に使用するファイル(現在は画像のみ対応)をアップロードし、画像とテキストのマルチモーダルな理解を可能にします。png、jpg、jpeg、webp、gif形式に対応しています。アップロードされたファイルは、現在のエンドユーザーのみが使用できます。",
+ "operationId": "uploadCompletionFileJp",
+ "tags": ["ファイル操作"],
+ "requestBody": {
+ "description": "ファイルアップロードリクエスト。`multipart/form-data` 形式が必要です。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。" },
+ "user": { "type": "string", "description": "開発者のルールで定義されたユーザー識別子。アプリケーション内で一意である必要があります。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "description": "ファイルアップロード成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } } },
+ "201": { "description": "ファイル作成成功(代替成功コード)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } } },
+ "400": { "$ref": "#/components/responses/BadRequestFileJp" },
+ "413": { "$ref": "#/components/responses/FileTooLargeJp" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileJp" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/completion-messages/{task_id}/stop": {
+ "post": {
+ "summary": "生成の停止",
+ "description": "完了メッセージの生成を停止します。ストリーミングモードでのみサポートされています。",
+ "operationId": "stopCompletionGenerationJp",
+ "tags": ["完了メッセージ"],
+ "parameters": [
+ { "name": "task_id", "in": "path", "required": true, "description": "タスクID、ストリーミングチャンクの返信から取得可能。", "schema": { "type": "string", "format": "uuid" } }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "type": "object", "required": ["user"], "properties": { "user": { "type": "string", "description": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致する必要があります。" } } } } }
+ },
+ "responses": { "200": { "$ref": "#/components/responses/SuccessResultJp" } }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "メッセージフィードバック",
+ "description": "エンドユーザーはフィードバックメッセージを提供でき、アプリケーション開発者が期待される出力を最適化するのに役立ちます。",
+ "operationId": "postCompletionMessageFeedbackJp",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "メッセージID。", "schema": { "type": "string", "format": "uuid" } } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestJp" } } } },
+ "responses": { "200": { "$ref": "#/components/responses/SuccessResultJp" } }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "アプリのメッセージの「いいね」とフィードバックを取得",
+ "description": "アプリのエンドユーザーからのフィードバックや「いいね」を取得します。",
+ "operationId": "getAppFeedbacksCompletionJp",
+ "tags": ["メッセージフィードバック"],
+ "parameters": [
+ { "name": "page", "in": "query", "description": "(任意)ページ番号。デフォルト値:1。", "schema": { "type": "integer", "default": 1 } },
+ { "name": "limit", "in": "query", "description": "(任意)1ページあたりの件数。デフォルト値:20。", "schema": { "type": "integer", "default": 20 } }
+ ],
+ "responses": { "200": { "description": "フィードバックリストの取得成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseJp" } } } } }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "テキストから音声",
+ "description": "テキストを音声に変換します。",
+ "operationId": "textToAudioCompletionJp",
+ "tags": ["音声変換"],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioRequestJp" } } } },
+ "responses": {
+ "200": {
+ "description": "音声ファイル生成成功。", "content": { "audio/wav": { "schema": { "type": "string", "format": "binary" } }, "audio/mp3": { "schema": { "type": "string", "format": "binary" } } },
+ "headers": { "Content-Type": { "schema": { "type": "string", "example": "audio/wav" } } }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "アプリケーションの基本情報を取得",
+ "operationId": "getCompletionAppInfoJp",
+ "tags": ["アプリケーション情報"],
+ "responses": { "200": { "description": "アプリケーション基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJp" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "アプリケーションのパラメータ情報を取得",
+ "operationId": "getCompletionAppParametersJp",
+ "tags": ["アプリケーション情報"],
+ "responses": { "200": { "description": "アプリケーションパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompletionAppParametersResponseJp" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "アプリのWebApp設定を取得",
+ "operationId": "getCompletionWebAppSettingsJp",
+ "tags": ["アプリケーション情報"],
+ "responses": { "200": { "description": "WebApp設定。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseJp" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key認証。すべてのAPIリクエストで、`Authorization` HTTPヘッダーに `Bearer {API_KEY}` の形式でAPIキーを含めてください。APIキーの漏洩を避けるため、サーバーサイドでの保存を強く推奨します。" }
+ },
+ "responses": {
+ "BadRequestGenericJp": { "description": "リクエストパラメータエラー。エラーコード例: invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, completion_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "ConversationNotFoundJp": { "description": "会話が存在しません。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "InternalServerErrorJp": { "description": "内部サーバーエラー。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "BadRequestFileJp": { "description": "ファイル操作リクエストエラー。エラーコード例: no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "FileTooLargeJp": { "description": "ファイルが大きすぎます (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "UnsupportedFileTypeFileJp": { "description": "サポートされていないファイルタイプです (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "S3ErrorFileJp": { "description": "S3ストレージサービスエラー。エラーコード例: s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "SuccessResultJp": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } }
+ },
+ "schemas": {
+ "CompletionRequestJp": {
+ "type": "object", "required": ["inputs"],
+ "properties": {
+ "inputs": { "type": "object", "required": ["query"], "properties": { "query": { "type": "string", "description": "入力テキスト、処理される内容。" } }, "additionalProperties": true, "description": "アプリで定義された各種変数値を入力。少なくとも1つのキー/値ペアが必要。" },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "レスポンス返却モード。streaming (推奨): SSEによるタイプライター風出力。blocking: 実行完了後に結果返却 (Cloudflare 100秒制限あり)。" },
+ "user": { "type": "string", "description": "ユーザー識別子。アプリケーション内で開発者が一意に定義。" },
+ "files": { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectJp" }, "description": "(任意) ファイルリスト。モデルがVision機能をサポートしている場合のみ利用可能。" }
+ }
+ },
+ "InputFileObjectJp": {
+ "type": "object", "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["image"], "description": "サポートされるタイプ:`image`(現在は画像タイプのみサポート)。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "転送方法。" },
+ "url": { "type": "string", "format": "url", "description": "画像URL(`transfer_method`が`remote_url`の場合)。" },
+ "upload_file_id": { "type": "string", "format": "uuid", "description": "アップロードされたファイルID(`transfer_method`が`local_file`の場合)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "CompletionResponseJp": {
+ "type": "object", "description": "ブロッキングモードでのアプリの完全な結果。",
+ "properties": {
+ "event": { "type": "string", "description": "イベントタイプ、通常 'message'。(MarkdownではChatCompletionResponseで 'chat' とあったが、Completionの文脈では 'completion' or 'message' が一般的。blocking example に合わせて 'message' を使用)" },
+ "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" },
+ "mode": { "type": "string", "description": "アプリモード。ブロッキングモードの例では 'completion'、Markdown本文では 'chat' と記載。ここでは 'completion' を採用。" },
+ "answer": { "type": "string", "description": "完全な応答内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadataJp" },
+ "created_at": { "type": "integer", "format": "int64", "description": "メッセージ作成タイムスタンプ。" }
+ }
+ },
+ "ResponseMetadataJp": { "type": "object", "description": "メタデータ。", "properties": { "usage": { "$ref": "#/components/schemas/UsageJp" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceJp" }, "description": "引用と帰属のリスト。" } } },
+ "ChunkCompletionEventJp": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["message", "message_end", "tts_message", "tts_message_end", "message_replace", "error", "ping"], "description": "イベントタイプ。" } },
+ "discriminator": { "propertyName": "event", "mapping": { "message": "#/components/schemas/StreamEventMessageJp", "message_end": "#/components/schemas/StreamEventMessageEndJp", "tts_message": "#/components/schemas/StreamEventTtsMessageJp", "tts_message_end": "#/components/schemas/StreamEventTtsMessageEndJp", "message_replace": "#/components/schemas/StreamEventMessageReplaceJp", "error": "#/components/schemas/StreamEventErrorJp", "ping": "#/components/schemas/StreamEventPingJp" } }
+ },
+ "StreamEventBaseCompletionJp": { "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "StreamEventMessageJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLMが返したテキストチャンクの内容。" } } } ] },
+ "StreamEventMessageEndJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadataJp" } } } ] },
+ "StreamEventTtsMessageJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64エンコードされた音声ブロック。" } } } ] },
+ "StreamEventTtsMessageEndJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空文字列。" } } } ] },
+ "StreamEventMessageReplaceJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "置換内容。" } } } ] },
+ "StreamEventErrorJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseCompletionJp" }, { "type": "object", "required": ["status", "code", "message"], "properties": { "status": { "type": "integer", "description": "HTTPステータスコード。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] },
+ "StreamEventPingJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEventJp" }, { "type": "object", "description": "接続維持のためのPingイベント。" } ] },
+ "UsageJp": { "type": "object", "description": "モデル使用情報。", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } } },
+ "RetrieverResourceJp": { "type": "object", "description": "引用と帰属の情報。", "properties": { "document_id": { "type": "string" }, "segment_id": { "type": "string" }, "score": { "type": "number" }, "content": { "type": "string" } } },
+ "FileUploadResponseJp": { "type": "object", "description": "ファイルアップロード成功時のレスポンス。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "ファイル名。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルのMIMEタイプ。" }, "created_by": { "type": "string", "format": "uuid", "description": "エンドユーザーID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "MessageFeedbackRequestJp": { "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "高評価 `like`, 低評価 `dislike`, 取り消し `null`。" }, "user": { "type": "string", "description": "ユーザー識別子。" }, "content": { "type": "string", "nullable": true, "description": "メッセージフィードバックの具体的な内容。" } } },
+ "AppFeedbacksResponseJp": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItemJp" }, "description": "このアプリの「いいね」とフィードバックの一覧。" } } },
+ "FeedbackItemJp": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
+ "TextToAudioRequestJp": { "type": "object", "required": ["user"], "properties": { "message_id": { "type": "string", "format": "uuid", "description": "メッセージID(textより優先)。" }, "text": { "type": "string", "description": "音声生成コンテンツ。" }, "user": { "type": "string", "description": "ユーザー識別子。" } }, "description": "`user`が必須。`message_id`または`text`のいずれかを提供。" },
+ "AppInfoResponseJp": { "type": "object", "description": "アプリケーションの基本情報。", "properties": { "name": { "type": "string", "description": "アプリケーションの名前。" }, "description": { "type": "string", "description": "アプリケーションの説明。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "アプリケーションのタグ。" } } },
+ "CompletionAppParametersResponseJp": { "type": "object", "description": "アプリケーションのパラメータ情報。", "properties": { "opening_statement": { "type": "string", "description": "開始文。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "開始時の提案質問リスト。" }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "description": "回答後の提案質問。" }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "description": "音声からテキスト。" }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "description": "引用と帰属。" }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "description": "注釈付き返信。" }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemJp" }, "description": "ユーザー入力フォーム設定。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "画像設定。" } }, "description": "ファイルアップロード設定。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer" }, "image_file_size_limit": { "type": "integer" }, "audio_file_size_limit": { "type": "integer" }, "video_file_size_limit": { "type": "integer" } }, "description": "システムパラメータ。" } } },
+ "UserInputFormItemJp": { "type": "object", "description": "ユーザー入力フォームのコントロール項目。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperJp" }, { "$ref": "#/components/schemas/ParagraphControlWrapperJp" }, { "$ref": "#/components/schemas/SelectControlWrapperJp" } ] },
+ "TextInputControlWrapperJp": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlJp" } }, "required":["text-input"] },
+ "ParagraphControlWrapperJp": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlJp" } }, "required":["paragraph"] },
+ "SelectControlWrapperJp": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlJp" } }, "required":["select"] },
+ "TextInputControlJp": { "type": "object", "description": "テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "ParagraphControlJp": { "type": "object", "description": "段落テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "SelectControlJp": { "type": "object", "description": "ドロップダウンコントロール。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必须かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "オプション値。" } } },
+ "WebAppSettingsResponseJp": { "type": "object", "description": "アプリケーションのWebApp設定。", "properties": { "title": { "type": "string", "description": "WebApp名。" }, "chat_color_theme": { "type": "string", "description": "チャットの色テーマ(16進数)。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "テーマ反転。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "アイコンタイプ。" }, "icon": { "type": "string", "description": "アイコン(emojiまたは画像URL)。" }, "icon_background": { "type": "string", "description": "背景色(16進数)。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "アイコンURL。" }, "description": { "type": "string", "description": "説明。" }, "copyright": { "type": "string", "description": "著作権情報。" }, "privacy_policy": { "type": "string", "description": "プライバシーポリシーリンク。" }, "custom_disclaimer": { "type": "string", "description": "カスタム免責事項。" }, "default_language": { "type": "string", "description": "デフォルト言語。" }, "show_workflow_steps": { "type": "boolean", "description": "ワークフロー詳細表示。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "WebAppアイコンを返信アイコンとして使用。" } } },
+ "ErrorResponseJp": { "type": "object", "description": "エラーレスポンス。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTPステータスコード。" }, "code": { "type": "string", "nullable": true, "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } }
+ }
+ },
+ "tags": [
+ { "name": "完了メッセージ", "description": "テキスト生成と完了に関連する操作。" },
+ { "name": "ファイル操作", "description": "ファイル管理に関連する操作。" },
+ { "name": "メッセージフィードバック", "description": "ユーザーフィードバックに関連する操作。" },
+ { "name": "音声変換", "description": "テキストから音声への変換に関連する操作。" },
+ { "name": "アプリケーション情報", "description": "アプリケーションの設定と情報を取得する操作。" }
+ ]
+}
\ No newline at end of file
diff --git a/ja-jp/openapi_workflow.json b/ja-jp/openapi_workflow.json
new file mode 100644
index 00000000..d70b8c85
--- /dev/null
+++ b/ja-jp/openapi_workflow.json
@@ -0,0 +1,385 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "ワークフローアプリAPI",
+ "description": "ワークフローアプリケーションは、セッションをサポートせず、翻訳、記事作成、要約AIなどに最適です。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "APIのベースURL。{api_base_url}を実際のAPIベースURLに置き換えてください。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "実際のAPIベースURL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/workflows/run": {
+ "post": {
+ "summary": "ワークフローを実行",
+ "description": "ワークフローを実行します。公開されたワークフローがないと実行できません。",
+ "operationId": "executeWorkflowJp",
+ "tags": ["ワークフロー実行"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowExecutionRequestJp"
+ },
+ "examples": {
+ "basic_execution_jp": {
+ "summary": "基本的なワークフロー実行の例",
+ "value": {
+ "inputs": {
+ "query": "このテキストを要約してください:..."
+ },
+ "response_mode": "streaming",
+ "user": "workflow_user_jp_001"
+ }
+ },
+ "with_file_array_variable_jp":{
+ "summary": "ファイルリスト変数を含む入力の例",
+ "value": {
+ "inputs": {
+ "my_documents": [
+ {
+ "type": "document",
+ "transfer_method": "local_file",
+ "upload_file_id": "アップロードされたファイルID_xyz"
+ },
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://example.com/image.jpg"
+ }
+ ]
+ },
+ "response_mode": "blocking",
+ "user": "workflow_user_jp_002"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "ワークフローの実行に成功しました。応答の構造は`response_mode`によって異なります。\n- `blocking`: `application/json`形式で、`WorkflowCompletionResponseJp`オブジェクトが含まれます。\n- `streaming`: `text/event-stream`形式で、`ChunkWorkflowEventJp`イベントストリームが含まれます。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowCompletionResponseJp"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSEイベントストリーム。各イベントは'data: 'で始まり、'\\n\\n'で終わります。具体的な構造は`ChunkWorkflowEventJp`を参照してください。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestWorkflowJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/workflows/run/{workflow_run_id}": {
+ "get": {
+ "summary": "ワークフロー実行詳細を取得",
+ "description": "ワークフロー実行IDに基づいて、ワークフロータスクの現在の実行結果を取得します。",
+ "operationId": "getWorkflowRunDetailJp",
+ "tags": ["ワークフロー実行"],
+ "parameters": [
+ {
+ "name": "workflow_run_id",
+ "in": "path",
+ "required": true,
+ "description": "ワークフロー実行ID。ワークフロー実行の応答またはストリーミングイベントから取得できます。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "ワークフロー実行詳細の取得に成功しました。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponseJp" }
+ }
+ }
+ },
+ "404": {"description": "ワークフロー実行記録が見つかりません。"}
+ }
+ }
+ },
+ "/workflows/tasks/{task_id}/stop": {
+ "post": {
+ "summary": "生成を停止 (ワークフロータスク)",
+ "description": "ワークフロータスクの生成を停止します。ストリーミングモードでのみサポートされています。",
+ "operationId": "stopWorkflowTaskGenerationJp",
+ "tags": ["ワークフロー実行"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "タスクID。ストリーミングチャンクの返り値から取得可能。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": { "type": "string", "description": "ユーザー識別子。実行ワークフローAPIに渡されたユーザーと一致する必要があります。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultJp" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "ファイルアップロード (ワークフロー用)",
+ "description": "ワークフローで使用するファイルをアップロードします。ワークフローでサポートされている任意の形式をサポートします。アップロードされたファイルは、現在のエンドユーザーのみが使用できます。",
+ "operationId": "uploadWorkflowFileJp",
+ "tags": ["ファイル操作 (ワークフロー)"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。" },
+ "user": { "type": "string", "description": "ユーザー識別子。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "description": "ファイルのアップロードに成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } } },
+ "201": { "description": "ファイルの作成に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } } },
+ "400": { "$ref": "#/components/responses/BadRequestFileJp" },
+ "413": { "$ref": "#/components/responses/FileTooLargeJp" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileJp" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileJp" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorJp" }
+ }
+ }
+ },
+ "/workflows/logs": {
+ "get": {
+ "summary": "ワークフローログを取得",
+ "description": "ワークフローログを返します。最初のページは最新の`{limit}`メッセージを返します。つまり、逆順です。",
+ "operationId": "getWorkflowLogsJp",
+ "tags": ["ワークフロー実行"],
+ "parameters": [
+ { "name": "keyword", "in": "query", "description": "(オプション)検索するキーワード。", "schema": { "type": "string" } },
+ { "name": "status", "in": "query", "description": "(オプション)実行ステータス:succeeded, failed, stopped, running。", "schema": { "type": "string", "enum": ["succeeded", "failed", "stopped", "running"] } },
+ { "name": "page", "in": "query", "description": "(オプション)現在のページ、デフォルトは1。", "schema": { "type": "integer", "default": 1 } },
+ { "name": "limit", "in": "query", "description": "(オプション)1回のリクエストで返すアイテムの数、デフォルトは20。", "schema": { "type": "integer", "default": 20 } }
+ ],
+ "responses": {
+ "200": { "description": "ワークフローログの取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowLogsResponseJp" } } } }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "アプリケーションの基本情報を取得 (ワークフロー)",
+ "operationId": "getWorkflowAppInfoJp",
+ "tags": ["アプリケーション設定 (ワークフロー)"],
+ "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJp" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "アプリケーションのパラメータ情報を取得 (ワークフロー)",
+ "operationId": "getWorkflowAppParametersJp",
+ "tags": ["アプリケーション設定 (ワークフロー)"],
+ "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowAppParametersResponseJp" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "アプリのWebApp設定を取得 (ワークフロー)",
+ "operationId": "getWorkflowWebAppSettingsJp",
+ "tags": ["アプリケーション設定 (ワークフロー)"],
+ "responses": { "200": { "description": "WebApp設定情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowWebAppSettingsResponseJp" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key認証。すべてのAPIリクエストにおいて、Authorization HTTPヘッダーにAPIキーを含めてください(例:Bearer {API_KEY})。APIキーの漏洩を防ぐため、サーバー側で保存することを強くお勧めします。" }
+ },
+ "responses": {
+ "BadRequestWorkflowJp": { "description": "リクエストパラメータエラーまたはワークフロー実行失敗。考えられるエラーコード:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, workflow_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "BadRequestFileJp": { "description": "ファイル操作リクエストエラー。考えられるエラーコード:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "FileTooLargeJp": { "description": "ファイルが大きすぎます (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "UnsupportedFileTypeFileJp": { "description": "サポートされていないファイルタイプです (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "S3ErrorFileJp": { "description": "S3ストレージサービスエラー。考えられるエラーコード:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "InternalServerErrorJp": { "description": "内部サーバーエラー。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } },
+ "SuccessResultJp": { "description": "操作に成功しました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } }
+ },
+ "schemas": {
+ "WorkflowExecutionRequestJp": {
+ "type": "object",
+ "required": ["inputs", "response_mode", "user"],
+ "properties": {
+ "inputs": {
+ "type": "object",
+ "description": "アプリで定義されたさまざまな変数値の入力を許可します。変数がファイルリストの場合、その値はInputFileObjectWorkflowJpオブジェクトのリストである必要があります。",
+ "additionalProperties": {
+ "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" }, { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectWorkflowJp" } } ]
+ },
+ "example": { "user_query": "これを翻訳してください。", "target_language": "フランス語" }
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "description": "応答の返却モード。streaming (推奨) はSSEに基づきます。blocking は実行完了後に結果を返します (Cloudflareの100秒タイムアウト制限あり)。" },
+ "user": { "type": "string", "description": "ユーザー識別子。アプリケーション内で一意である必要があります。" },
+ "files": { "type": "array", "items": {"$ref": "#/components/schemas/InputFileObjectWorkflowJp"}, "description": "(オプション)このフィールドはinputs内のファイル型変数に置き換えられました。下位互換性のために残されていますが、inputsを使用することを推奨します。"}
+ }
+ },
+ "InputFileObjectWorkflowJp": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "ファイルタイプ。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: その他。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "転送方法。" },
+ "url": { "type": "string", "format": "url", "description": "画像URL (`remote_url`の場合)。" },
+ "upload_file_id": { "type": "string", "format": "uuid", "description": "アップロードされたファイルID (`local_file`の場合)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "WorkflowCompletionResponseJp": {
+ "type": "object", "description": "ブロッキングモードでのワークフロー実行結果。",
+ "properties": {
+ "workflow_run_id": { "type": "string", "format": "uuid", "description": "ワークフロー実行の一意のID。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" },
+ "data": { "$ref": "#/components/schemas/WorkflowFinishedDataJp" }
+ }
+ },
+ "ChunkWorkflowEventJp": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["workflow_started", "node_started", "text_chunk", "node_finished", "workflow_finished", "tts_message", "tts_message_end", "ping"], "description": "イベントタイプ。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "workflow_started": "#/components/schemas/StreamEventWfWorkflowStartedJp", "node_started": "#/components/schemas/StreamEventWfNodeStartedJp",
+ "text_chunk": "#/components/schemas/StreamEventWfTextChunkJp", "node_finished": "#/components/schemas/StreamEventWfNodeFinishedJp",
+ "workflow_finished": "#/components/schemas/StreamEventWfWorkflowFinishedJp", "tts_message": "#/components/schemas/StreamEventWfTtsMessageJp",
+ "tts_message_end": "#/components/schemas/StreamEventWfTtsMessageEndJp", "ping": "#/components/schemas/StreamEventWfPingJp"
+ }}
+ },
+ "StreamEventBaseWfJp": {
+ "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "タスクID。" }, "workflow_run_id": { "type": "string", "format": "uuid", "description": "ワークフロー実行ID。" } }
+ },
+ "StreamEventWfWorkflowStartedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowStartedDataJp" } } } ] },
+ "WorkflowStartedDataJp": { "type": "object", "description": "ワークフロー開始イベントの詳細。", "required": ["id", "workflow_id", "sequence_number", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行の一意のID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "関連するワークフローのID。" }, "sequence_number": { "type": "integer", "description": "自己増加シリアル番号、1から始まります。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始時間。" } } },
+ "StreamEventWfNodeStartedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeStartedDataJp" } } } ] },
+ "NodeStartedDataJp": { "type": "object", "description": "ノード開始イベントの詳細。", "required": ["id", "node_id", "node_type", "title", "index", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行の一意のID(文脈上、ノード実行IDであるべき)。" }, "node_id": { "type": "string", "format": "uuid", "description": "ノードのID。" }, "node_type": { "type": "string", "description": "ノードのタイプ。" }, "title": { "type": "string", "description": "ノードの名前。" }, "index": { "type": "integer", "description": "実行シーケンス番号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "(オプション)前のノードID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ノードで使用されるすべての前のノード変数の内容。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始のタイムスタンプ。" } } },
+ "StreamEventWfTextChunkJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/TextChunkDataJp" } } } ] },
+ "TextChunkDataJp": { "type": "object", "description": "テキストフラグメントイベントの詳細。", "required": ["text", "from_variable_selector"], "properties": { "text": { "type": "string", "description": "テキスト内容。" }, "from_variable_selector": { "type": "array", "items": { "type": "string" }, "description": "テキスト生成元パス。" } } },
+ "StreamEventWfNodeFinishedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeFinishedDataJp" } } } ] },
+ "NodeFinishedDataJp": { "type": "object", "description": "ノード終了イベントの詳細。", "required": ["id", "node_id", "index", "status", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行ID。" }, "node_id": { "type": "string", "format": "uuid", "description": "ノードのID。" }, "index": { "type": "integer", "description": "実行シーケンス番号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "(オプション)前のノードID。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノードで使用されるすべての前のノード変数の内容。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(オプション)ノードプロセスデータ (JSON)。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(オプション)出力内容 (JSON)。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行のステータス。" }, "error": { "type": "string", "nullable": true, "description": "(オプション)エラー理由。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(オプション)使用時間(秒)。" }, "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadataJp" , "nullable": true, "description":"メタデータ"}, "created_at": { "type": "integer", "format": "int64", "description": "開始のタイムスタンプ。" } } },
+ "NodeExecutionMetadataJp": { "type": "object", "description": "ノード実行メタデータ。", "properties": { "total_tokens": { "type": "integer", "nullable": true, "description": "(オプション)使用トークン数。" }, "total_price": { "type": "number", "format": "float", "nullable": true, "description": "(オプション)総コスト (floatでdecimalを表現)。" }, "currency": { "type": "string", "nullable": true, "example": "USD", "description": "(オプション)通貨、例:USD / RMB。" } } },
+ "StreamEventWfWorkflowFinishedJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowFinishedDataJp" } } } ] },
+ "WorkflowFinishedDataJp": { "type": "object", "description": "ワークフロー終了イベントの詳細。", "required": ["id", "workflow_id", "status", "created_at", "finished_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行のID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "関連するワークフローのID。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行のステータス。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(オプション)出力内容 (JSON)。" }, "error": { "type": "string", "nullable": true, "description": "(オプション)エラー理由。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(オプション)使用時間(秒)。" }, "total_tokens": { "type": "integer", "nullable": true, "description": "(オプション)使用トークン数。" }, "total_steps": { "type": "integer", "default": 0, "description": "総ステップ数、デフォルト0。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始時間。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了時間。" } } },
+ "StreamEventWfTtsMessageJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string", "format": "byte", "description": "音声合成後のオーディオ、base64テキストコンテンツ。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } } ] },
+ "StreamEventWfTtsMessageEndJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "$ref": "#/components/schemas/StreamEventBaseWfJp" }, { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string", "description": "終了イベントにはオーディオがないため、これは空の文字列です。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } } ] },
+ "StreamEventWfPingJp": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventJp" }, { "type": "object", "description": "接続を維持するために10秒ごとに送信されるPingイベント。" } ] },
+ "WorkflowRunDetailResponseJp": {
+ "type": "object", "description": "ワークフロー実行詳細。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行のID。" },
+ "workflow_id": { "type": "string", "format": "uuid", "description": "関連するワークフローのID。" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行のステータス。" },
+ "inputs": { "type": "string", "description": "入力内容のJSON文字列。" },
+ "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "出力内容のJSONオブジェクト。" },
+ "error": { "type": "string", "nullable": true, "description": "エラー理由。" },
+ "total_steps": { "type": "integer", "description": "タスクの総ステップ数。" },
+ "total_tokens": { "type": "integer", "description": "使用されるトークンの総数。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "タスク開始時間。" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "タスク終了時間。" },
+ "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "使用される総秒数。" }
+ }
+ },
+ "FileUploadResponseJp": { "type": "object", "description": "ファイルアップロード成功時の応答。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "ファイル名。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルのMIMEタイプ。" }, "created_by": { "type": "string", "format": "uuid", "description": "エンドユーザーID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } },
+ "WorkflowLogsResponseJp": {
+ "type": "object", "description": "ワークフローログリストの応答。",
+ "properties": {
+ "page": { "type": "integer", "description": "現在のページ。" }, "limit": { "type": "integer", "description": "1ページあたりのアイテム数。" },
+ "total": { "type": "integer", "description": "合計アイテム数。" }, "has_more": { "type": "boolean", "description": "さらにデータがあるかどうか。" },
+ "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowLogItemJp" }, "description": "現在のページのデータ。" }
+ }
+ },
+ "WorkflowLogItemJp": {
+ "type": "object", "description": "単一のワークフローログアイテム。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "ID。" },
+ "workflow_run": { "$ref": "#/components/schemas/WorkflowRunSummaryJp", "description": "ワークフロー実行ログ。" },
+ "created_from": { "type": "string", "description": "作成元。" },
+ "created_by_role": { "type": "string", "description": "作成者の役割。" },
+ "created_by_account": { "type": "string", "format": "uuid", "nullable": true, "description": "(オプション)作成者アカウント。" },
+ "created_by_end_user": { "$ref": "#/components/schemas/EndUserSummaryJp", "description": "作成者ユーザー。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "作成時間。" }
+ }
+ },
+ "WorkflowRunSummaryJp": {
+ "type": "object", "description": "ワークフロー実行概要情報。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "ID。" }, "version": { "type": "string", "description": "バージョン。" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "実行ステータス。" },
+ "error": { "type": "string", "nullable": true, "description": "(オプション)エラー。" },
+ "elapsed_time": { "type": "number", "format": "float", "description": "使用時間(秒)。" },
+ "total_tokens": { "type": "integer", "description": "消費トークン数。" },
+ "total_steps": { "type": "integer", "description": "実行ステップ長。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "開始時間。" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "終了時間。" }
+ }
+ },
+ "EndUserSummaryJp": {
+ "type": "object", "description": "エンドユーザー概要情報。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "ID。" }, "type": { "type": "string", "description": "タイプ。" },
+ "is_anonymous": { "type": "boolean", "description": "匿名かどうか。" }, "session_id": { "type": "string", "description": "セッションID。" }
+ }
+ },
+ "AppInfoResponseJp": { "type": "object", "description": "アプリケーションの基本情報。", "properties": { "name": { "type": "string", "description": "アプリケーションの名前。" }, "description": { "type": "string", "description": "アプリケーションの説明。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "アプリケーションのタグ。" } } },
+ "WorkflowAppParametersResponseJp": { "type": "object", "description": "ワークフローアプリのパラメータ情報。", "properties": { "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemJp" }, "description": "ユーザー入力フォームの設定。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "画像設定。現在サポートされている画像タイプのみ:png, jpg, jpeg, webp, gif。" } }, "description": "ファイルアップロード設定。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "ドキュメントアップロードサイズ制限(MB)。" }, "image_file_size_limit": { "type": "integer", "description": "画像ファイルアップロードサイズ制限(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "オーディオファイルアップロードサイズ制限(MB)。" }, "video_file_size_limit": { "type": "integer", "description": "ビデオファイルアップロードサイズ制限(MB)。" } }, "description": "システムパラメータ。" } } },
+ "UserInputFormItemJp": { "type": "object", "description": "ユーザー入力フォーム内のコントロールアイテム。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperJp" }, { "$ref": "#/components/schemas/ParagraphControlWrapperJp" }, { "$ref": "#/components/schemas/SelectControlWrapperJp" } ] },
+ "TextInputControlWrapperJp": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlJp" } }, "required":["text-input"] },
+ "ParagraphControlWrapperJp": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlJp" } }, "required":["paragraph"] },
+ "SelectControlWrapperJp": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlJp" } }, "required":["select"] },
+ "TextInputControlJp": { "type": "object", "description": "テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "ParagraphControlJp": { "type": "object", "description": "段落テキスト入力コントロール。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" } } },
+ "SelectControlJp": { "type": "object", "description": "ドロップダウンコントロール。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "変数表示ラベル名。" }, "variable": { "type": "string", "description": "変数ID。" }, "required": { "type": "boolean", "description": "必須かどうか。" }, "default": { "type": "string", "nullable": true, "description": "デフォルト値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "オプション値。" } } },
+ "WorkflowWebAppSettingsResponseJp": { "type": "object", "description": "ワークフローアプリのWebApp設定。", "properties": { "title": { "type": "string", "description": "WebApp名。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "アイコンタイプ。" }, "icon": { "type": "string", "description": "アイコン内容 (emojiまたは画像URL)。" }, "icon_background": { "type": "string", "description": "16進数形式の背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "アイコンのURL。" }, "description": { "type": "string", "description": "説明。" }, "copyright": { "type": "string", "description": "著作権情報。" }, "privacy_policy": { "type": "string", "description": "プライバシーポリシーのリンク。" }, "custom_disclaimer": { "type": "string", "description": "カスタム免責事項。" }, "default_language": { "type": "string", "description": "デフォルト言語。" }, "show_workflow_steps": { "type": "boolean", "description": "ワークフローの詳細を表示するかどうか。" } } },
+ "ErrorResponseJp": { "type": "object", "description": "エラー応答。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTPステータスコード。" }, "code": { "type": "string", "nullable": true, "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } }
+ }
+ },
+ "tags": [
+ { "name": "ワークフロー実行", "description": "ワークフローの実行と管理に関連する操作。" },
+ { "name": "ファイル操作 (ワークフロー)", "description": "ワークフロー固有のファイルアップロード操作。" },
+ { "name": "アプリケーション設定 (ワークフロー)", "description": "ワークフローアプリのアプリケーション設定と情報。" }
+ ]
+}
\ No newline at end of file
diff --git a/zh-hans/openapi-api-access-readme.mdx b/zh-hans/openapi-api-access-readme.mdx
new file mode 100644
index 00000000..a00b0113
--- /dev/null
+++ b/zh-hans/openapi-api-access-readme.mdx
@@ -0,0 +1,137 @@
+---
+title: '访问 API'
+summary: '学习如何通过本文档的 "Try It" 功能与 Dify API 进行交互测试,获取关于 Base URL、API 密钥的重要信息,并了解如何为我们的文档生态做出贡献。'
+---
+
+欢迎来到 Dify API 文档中心!本指南旨在帮助您快速上手,了解如何有效地使用本文档提供的交互功能来测试和理解 Dify API,并掌握 API 访问的关键要素。
+
+**重要提示:**
+
+* **本页内容:** 主要介绍 API 文档的交互方式、全局访问配置(如 Base URL、API 密钥)以及文档贡献流程。
+* **API 端点详情:** 所有具体的 API 端点(包括其参数、请求/响应结构、功能描述及示例)内容是根据我们的 OpenAPI 规范自动生成的,并包含了最新的功能注释。**请务必查阅这些自动生成的页面以获取最准确和详细的端点信息。**
+
+
+
+
+---
+
+## 交互式 API 测试
+
+为了方便您快速验证和理解 API,本文档中大部分 API 端点页面都内嵌了 "Try It" 的交互式测试功能。
+
+
+
+ 在您希望测试的 API 端点文档页面,通常在页面顶部或右侧区域,您会找到一个明显的 "Try It" 按钮或直接可交互的参数输入区域。
+
+
+
+
+ 系统可能会尝试预填,但请务必根据您的 Dify 部署环境(Cloud 或本地/私有化)选择或输入正确的 Base URL。详情请参阅下方的 [服务器地址 (Base URL)](#服务器地址-base-url) 部分。
+
+
+ 在认证区域,您需要填入从 Dify 应用中获取的有效 API 密钥。详情请参阅 [API 密钥 (API Key)](#api-密钥-api-key) 部分。
+
+
+ 如果 API 端点的 URL 中包含路径参数 (如 `/users/{user_id}` )或需要查询参数 (如 `?limit=10` ),请根据端点说明准确填写。
+
+
+ 对于 `POST`, `PUT`, `PATCH` 等需要请求体的 HTTP 方法,请参照端点文档中提供的请求体结构 (Schema) 和示例,构建正确的 JSON 内容。
+
+
+
+
+ 所有参数配置完毕后,点击 "Send" (或 "Execute") 按钮发起 API 调用。稍后,您将在同一区域看到 API 返回的完整响应,包括 HTTP 状态码、响应头和响应体。
+
+
+
+---
+
+## 🔑 API 访问配置
+
+### 服务器地址 (Base URL)
+
+API 请求的基础 URL 因您的 Dify 部署环境而异:
+
+
+ ```bash Dify Cloud (云服务版)
+https://api.dify.ai/v1
+ ```
+
+ ```bash 本地/私有化部署
+http://localhost/v1
+ ```
+
+
+ 在进行 API 调用或使用 "Try It" 功能时,请务必确认您配置的 Base URL 是正确的。
+
+
+### API 密钥 (API Key)
+
+Dify 的**每个**应用 (App) 都拥有其专属的 API 密钥,用于接口调用的身份验证和授权。
+
+* **获取途径:** 您可以在您的 Dify 应用的 概览 或 `访问 API` 或 `监控` 页面中点击 `API 密钥` 管理或生成您的 API 密钥。
+
+* **使用方法:** 获取到 API 密钥后,请将其以 `Bearer YOUR_API_KEY` 的形式加入到 HTTP 请求的 `Authorization` 头部。
+
+* **重要安全提示:**
+
+ API 密钥是访问您应用数据的凭证,具有较高权限。**请务必将其视为敏感信息并妥善保管,严禁在任何客户端(如浏览器、移动应用前端)代码中硬编码或直接暴露。** 推荐将 API 密钥存储在安全的服务器端环境,并通过后端服务代理对 Dify API 的调用。
+
+
+* **访问控制:** 在 Dify 应用的 **监控 (Monitoring) -> 后端服务API (Backend Service API)** 设置中,您可以管理 API 的访问状态,例如暂时禁用所有 API 调用。
+
+---
+
+## 📚 关于`访问 API`以及本文档
+
+### 文档的组成与来源
+
+* **本指南页 (`api-access-readme.mdx`):** 提供如何使用 API 文档、进行交互测试以及 API 访问的通用配置信息。
+* **API 端点详情页:** 侧边栏 **"API 端点"** 分组下的所有页面,均由我们的 OpenAPI 规范 ([查看 OpenAPI 规范源文件模板](https://github.com/langgenius/dify/tree/main/web/app/components/develop/template)) **自动生成**。这些页面包含了每个端点的详细描述、参数、请求/响应示例和最新的功能注解。
+
+### 如何为本文档做出贡献
+
+我们非常欢迎并感谢社区成员对 Dify 文档的贡献!
+
+
+
+ 如果您希望修改 **当前您正在阅读的这个 `API 访问与交互指南` 页面**,您可以:
+ 1. 滚动到本页底部。
+ 2. 点击 **"编辑此页" (Edit this page)** 按钮。
+ 3. 这将会直接将您引导至 GitHub 上本 `api-access-readme.mdx` 文件的编辑界面。
+
+
+ 请注意:本页底部的 **"编辑此页"** 按钮 **仅作用于当前这个指南页面 (`api-access-readme.mdx`) 本身**。
+ 它 **不适用于** `访问 API` 详情页面。
+
+
+
+
+ 如果您发现 `访问 API` 详情页中某个具体 **API 端点的描述、参数说明或示例需要更新**,这些内容来源于 OpenAPI 规范文件。
+ 1. 请前往 Dify 的文档代码仓库。
+ 2. 定位到相关的 OpenAPI JSON 文件(按语言分子目录,如 `en/openapi_chatflow.json`, `zh-hans/openapi_workflow.json` 等)。
+ 3. 修改对应的 OpenAPI 文件内容。
+ 4. 提交 Pull Request 到 Dify 主仓库。
+
+
+ 为了保持多语言文档的一致性,如果您修改了某个语言的 OpenAPI 文件,建议检查并同步更新其他语言版本中对应的 OpenAPI 文件。
+
+
+
+
+ 如果您发现了文档中的任何问题(无论是本指南页还是具体的 API 端点页),或者有改进建议:
+ 1. 您可以使用页面底部(或侧边栏)的 **"报告问题" (Report an issue)** 链接。
+ 2. 这通常会将您引导至本文档项目 (dify-docs-mintlify) 在 GitHub 上的 Issues 页面。
+ 3. 请详细描述您发现的问题、问题所在的页面链接以及您的改进建议。
+
+
+ 准确的问题报告和富有建设性的建议同样是对社区和项目的重要贡献!
+
+
+
+
+
+API 文档同步自 Dify 主仓库。你可以点击这个卡片,在 GitHub 上查看原始的代码。如果你发现不同步或错误的地方,欢迎提交 PR 来贡献代码。
+
+
+所有贡献(无论是直接编辑还是报告问题)都需要一个 GitHub 账户。我们期待您的参与,共同打造更完善的 Dify 使用文档!
\ No newline at end of file
diff --git a/zh-hans/openapi_chat.json b/zh-hans/openapi_chat.json
new file mode 100644
index 00000000..68cba375
--- /dev/null
+++ b/zh-hans/openapi_chat.json
@@ -0,0 +1,614 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "对话型应用 API",
+ "description": "对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "API 的基础 URL。请将 {api_base_url} 替换为您的应用提供的实际 API 基础 URL。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "实际的 API 基础 URL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "发送对话消息",
+ "description": "创建会话消息。",
+ "operationId": "sendBasicChatMessageCn",
+ "tags": ["对话消息"],
+ "requestBody": {
+ "description": "发送对话消息的请求体。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BasicChatRequestCn"
+ },
+ "examples": {
+ "streaming_with_file": {
+ "summary": "包含文件和自定义输入的流式请求示例",
+ "value": {
+ "inputs": {
+ "name": "dify"
+ },
+ "query": "iPhone 13 Pro Max 的规格是什么?",
+ "response_mode": "streaming",
+ "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
+ "user": "abc-123",
+ "files": [
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://cloud.dify.ai/logo/logo-site.png"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "请求成功。响应的内容类型和结构取决于请求中的 `response_mode` 参数。\n- 当 `response_mode` 为 `blocking` 时,返回 `application/json` 格式的 `ChatCompletionResponseCn` 对象。\n- 当 `response_mode` 为 `streaming` 时,返回 `text/event-stream` 格式的 `ChunkBasicChatEventCn` 对象流式序列。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponseCn"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkBasicChatEventCn`。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGenericCn" },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "上传文件",
+ "description": "上传文件(目前仅支持图片)并在发送消息时使用,可实现图文多模态理解。支持 png, jpg, jpeg, webp, gif 格式。上传的文件仅供当前终端用户使用。",
+ "operationId": "uploadBasicChatFileCn",
+ "tags": ["文件操作"],
+ "requestBody": {
+ "description": "文件上传请求。需使用 `multipart/form-data` 进行请求。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "要上传的文件。"
+ },
+ "user": {
+ "type": "string",
+ "description": "用户标识,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "文件上传成功。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponseCn"
+ }
+ }
+ }
+ },
+ "201": {
+ "description": "文件创建成功 (备选成功状态码)。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFileCn" },
+ "413": { "$ref": "#/components/responses/FileTooLargeCn" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileCn" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "停止响应",
+ "description": "停止生成对话消息。仅支持流式模式。",
+ "operationId": "stopBasicChatMessageGenerationCn",
+ "tags": ["对话消息"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "任务 ID,可在流式返回 Chunk 中获取。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "用户标识,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultCn" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "消息反馈(点赞)",
+ "description": "消息终端用户反馈、点赞,方便应用开发者优化输出预期。",
+ "operationId": "postBasicChatMessageFeedbackCn",
+ "tags": ["消息反馈"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "消息 ID。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestCn" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultCn" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "获取APP的消息点赞和反馈",
+ "description": "获取应用的终端用户反馈、点赞。",
+ "operationId": "getBasicChatAppFeedbacksCn",
+ "tags": ["消息反馈"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取应用的反馈列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "获取下一轮建议问题列表",
+ "description": "获取当前消息的下一轮建议问题列表。",
+ "operationId": "getBasicChatSuggestedQuestionsCn",
+ "tags": ["对话消息"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "消息 ID。",
+ "schema": { "type": "string", "format": "uuid" }
+ },
+ { "$ref": "#/components/parameters/UserQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取建议问题列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "获取会话历史消息",
+ "description": "滚动加载形式返回历史聊天记录,第一页返回最新 `limit` 条,即倒序返回。",
+ "operationId": "getBasicChatConversationHistoryCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdQueryParamCn" },
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ {
+ "name": "first_id",
+ "in": "query",
+ "description": "当前页第一条聊天记录的 ID,默认 null。",
+ "schema": { "type": "string", "format": "uuid", "nullable": true }
+ },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Cn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取会话历史消息。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/BasicConversationHistoryResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "获取会话列表",
+ "description": "获取当前用户的会话列表,默认返回最近的 20 条。",
+ "operationId": "getBasicChatConversationsListCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ { "$ref": "#/components/parameters/LastIdQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" },
+ { "$ref": "#/components/parameters/SortByQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取会话列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationsListResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "删除会话",
+ "description": "删除一个指定的会话。",
+ "operationId": "deleteBasicChatConversationCn",
+ "tags": ["会话管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object", "required": ["user"],
+ "properties": { "user": { "type": "string", "description": "用户标识。" } }
+ }
+ }
+ }
+ },
+ "responses": { "204": { "description": "会话删除成功,无内容返回。" } }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "会话重命名",
+ "description": "对会话进行重命名。",
+ "operationId": "renameBasicChatConversationCn",
+ "tags": ["会话管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestCn" } } }
+ },
+ "responses": {
+ "200": { "description": "会话重命名成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseCn" } } } }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "获取对话变量",
+ "description": "从特定对话中检索变量。此端点对于提取对话过程中捕获的结构化数据非常有用。",
+ "operationId": "getBasicChatConversationVariablesCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParamCn" },
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ { "$ref": "#/components/parameters/LastIdQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" },
+ { "$ref": "#/components/parameters/VariableNameQueryParamCn" }
+ ],
+ "responses": {
+ "200": { "description": "成功获取对话变量。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseCn" } } } },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundCn" }
+ }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "语音转文字",
+ "description": "将语音文件转换为文字。支持格式:mp3, mp4, mpeg, mpga, m4a, wav, webm。文件大小限制:15MB。",
+ "operationId": "basicChatAudioToTextCn",
+ "tags": ["语音与文字转换"],
+ "requestBody": {
+ "required": true,
+ "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestCn" } } }
+ },
+ "responses": {
+ "200": { "description": "成功将语音转换为文字。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseCn" } } } }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "文字转语音",
+ "description": "将文字内容转换为语音。",
+ "operationId": "basicChatTextToAudioCn",
+ "tags": ["语音与文字转换"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": { "schema": { "$ref": "#/components/schemas/TextToAudioFormRequestCn" } }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "成功生成语音文件。",
+ "content": { "audio/wav": { "schema": { "type": "string", "format": "binary" } }, "audio/mp3": { "schema": { "type": "string", "format": "binary" } } },
+ "headers": { "Content-Type": { "schema": { "type": "string", "example": "audio/wav" } } }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "获取应用基本信息",
+ "operationId": "getBasicChatAppInfoCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "获取应用参数",
+ "description": "用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。",
+ "operationId": "getBasicChatAppParametersCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseCn" } } } } }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "获取应用Meta信息",
+ "description": "用于获取工具 icon。",
+ "operationId": "getBasicChatAppMetaCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "成功获取应用 Meta 信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseCn" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "获取应用 WebApp 设置",
+ "description": "用于获取应用的 WebApp 设置。",
+ "operationId": "getBasicChatWebAppSettingsCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseCn" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含您的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。" }
+ },
+ "parameters": {
+ "PageQueryParamCn": { "name": "page", "in": "query", "description": "页码,(选填)默认值:1。", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParamCn": { "name": "limit", "in": "query", "description": "每页数量,(选填)默认值:20。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Cn": { "name": "limit", "in": "query", "description": "一次请求返回多少条记录,默认 20 条。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Max100Cn": { "name": "limit", "in": "query", "description": "一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "UserQueryParamCn": { "name": "user", "in": "query", "required": true, "description": "用户标识,由开发者定义规则,需保证用户标识在应用内唯一。", "schema": { "type": "string" } },
+ "ConversationIdQueryParamCn": { "name": "conversation_id", "in": "query", "required": true, "description": "会话 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "LastIdQueryParamCn": { "name": "last_id", "in": "query", "description": "(选填)当前页最后面一条记录的 ID,默认 null。", "schema": { "type": "string", "format": "uuid", "nullable": true } },
+ "SortByQueryParamCn": { "name": "sort_by", "in": "query", "description": "(选填)排序字段,默认 -updated_at (按更新时间倒序排列)。可选值:created_at, -created_at, updated_at, -updated_at。'-' 代表倒序。", "schema": { "type": "string", "enum": ["created_at", "-created_at", "updated_at", "-updated_at"], "default": "-updated_at" } },
+ "ConversationIdPathParamCn": { "name": "conversation_id", "in": "path", "required": true, "description": "会话 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "VariableNameQueryParamCn": { "name": "variable_name", "in": "query", "description": "(选填)按变量名称筛选。", "schema": { "type": "string" } }
+ },
+ "responses": {
+ "BadRequestGenericCn": { "description": "请求参数错误。可能原因:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, completion_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "BadRequestFileCn": { "description": "文件操作请求错误。可能原因:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "FileTooLargeCn": { "description": "文件太大 (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "UnsupportedFileTypeFileCn": { "description": "不支持的文件类型 (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "S3ErrorFileCn": { "description": "S3 存储服务错误。可能原因:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "InternalServerErrorCn": { "description": "服务内部异常。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "SuccessResultCn": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } },
+ "ConversationNotFoundCn": { "description": "对话不存在。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } }
+ },
+ "schemas": {
+ "BasicChatRequestCn": {
+ "type": "object",
+ "required": ["query", "user"],
+ "properties": {
+ "query": { "type": "string", "description": "用户输入/提问内容。" },
+ "inputs": {
+ "type": "object",
+ "description": "允许传入 App 定义的各变量值。",
+ "additionalProperties": true,
+ "default": {}
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制;Agent模式下不允许)。" },
+ "user": { "type": "string", "description": "用户标识,应用内唯一。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "(选填)会话 ID,用于继续之前的对话。" },
+ "files": { "type": "array", "items": { "$ref": "#/components/schemas/BasicInputFileObjectCn" }, "description": "(选填)上传的文件列表 (目前仅支持图片)。" },
+ "auto_generate_name": { "type": "boolean", "default": true, "description": "(选填)自动生成会话标题,默认 true。" }
+ }
+ },
+ "BasicInputFileObjectCn": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["image"], "description": "文件类型,目前仅支持 'image'。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" },
+ "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" },
+ "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "ChatCompletionResponseCn": {
+ "type": "object", "description": "阻塞模式下的完整 App 结果。",
+ "properties": {
+ "event": { "type": "string", "example": "message", "description": "事件类型,固定为 `message`。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" },
+ "id": { "type": "string", "format": "uuid", "description": "唯一ID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" },
+ "mode": { "type": "string", "example": "chat", "description": "App 模式,固定为 `chat`。" },
+ "answer": { "type": "string", "description": "完整回复内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadataCn" },
+ "created_at": { "type": "integer", "format": "int64", "description": "消息创建时间戳。" }
+ }
+ },
+ "ResponseMetadataCn": {
+ "type": "object", "description": "元数据。",
+ "properties": { "usage": { "$ref": "#/components/schemas/UsageCn" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceCn" }, "description": "引用和归属分段列表。" } }
+ },
+ "ChunkBasicChatEventCn": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["message", "agent_message", "agent_thought", "message_file", "message_end", "tts_message", "tts_message_end", "message_replace", "error", "ping"], "description": "事件类型。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "message": "#/components/schemas/StreamEventChatMessageCn",
+ "agent_message": "#/components/schemas/StreamEventAgentMessageCn",
+ "agent_thought": "#/components/schemas/StreamEventAgentThoughtCn",
+ "message_file": "#/components/schemas/StreamEventMessageFileCn",
+ "message_end": "#/components/schemas/StreamEventMessageEndCn",
+ "tts_message": "#/components/schemas/StreamEventTtsMessageCn",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEndCn",
+ "message_replace": "#/components/schemas/StreamEventMessageReplaceCn",
+ "error": "#/components/schemas/StreamEventErrorCn",
+ "ping": "#/components/schemas/StreamEventPingCn"
+ }}
+ },
+ "StreamEventBaseChatCn": {
+ "type": "object", "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" }
+ }
+ },
+ "StreamEventChatMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLM 返回文本块内容。" } } } ] },
+ "StreamEventAgentMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "Agent模式下 LLM 返回文本块内容。" } } } ] },
+ "StreamEventAgentThoughtCn": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" },
+ { "type": "object", "required": ["id", "position"],
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "agent_thought ID。" },
+ "position": { "type": "integer", "description": "agent_thought 在消息中的位置。" },
+ "thought": { "type": "string", "description": "agent 的思考内容。" },
+ "observation": { "type": "string", "description": "工具调用的返回结果。" },
+ "tool": { "type": "string", "description": "使用的工具列表,以 ';' 分割。" },
+ "tool_input": { "type": "string", "description": "工具的输入,JSON 格式的字符串。" },
+ "message_files": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "当前 agent_thought 关联的文件ID列表 (原描述为 file_id 字符串,修正为数组以匹配 agent_thoughts 历史消息中的 files)。" }
+ }
+ }
+ ]
+ },
+ "StreamEventMessageFileCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "type": "object", "required": ["id", "type", "belongs_to", "url", "conversation_id"], "properties": { "id": { "type": "string", "format": "uuid", "description": "文件唯一ID。" }, "type": { "type": "string", "enum": ["image"], "description": "文件类型,目前仅为 image。" }, "belongs_to": { "type": "string", "enum": ["assistant"], "description": "文件归属,仅为 assistant。" }, "url": { "type": "string", "format": "url", "description": "文件访问地址。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会话ID。" } } } ] },
+ "StreamEventMessageEndCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadataCn" } } } ] },
+ "StreamEventTtsMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 编码的音频块。" } } } ] },
+ "StreamEventTtsMessageEndCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空字符串。" } } } ] },
+ "StreamEventMessageReplaceCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "替换内容(直接替换 LLM 所有回复文本)。" } } } ] },
+ "StreamEventErrorCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "type": "object", "required": ["task_id", "status", "code", "message"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "消息唯一 ID(错误事件中可能不存在)。" }, "status": { "type": "integer", "description": "HTTP 状态码。" }, "code": { "type": "string", "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } } } ] },
+ "StreamEventPingCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkBasicChatEventCn" }, { "type": "object", "description": "每 10s 一次的 ping 事件,保持连接存活。" } ] },
+ "UsageCn": { "type": "object", "description": "模型用量信息。", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } } },
+ "RetrieverResourceCn": { "type": "object", "description": "引用和归属分段信息。", "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } } },
+ "FileUploadResponseCn": { "type": "object", "description": "文件上传成功后的响应。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "文件名。" }, "size": { "type": "integer", "description": "文件大小 (byte)。" }, "extension": { "type": "string", "description": "文件后缀。" }, "mime_type": { "type": "string", "description": "文件 mime-type。" }, "created_by": { "type": "string", "format": "uuid", "description": "上传人 ID。" }, "created_at": { "type": "integer", "format": "int64", "description": "上传时间。" } } },
+ "MessageFeedbackRequestCn": { "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "点赞 'like', 点踩 'dislike', 撤销点赞 null。" }, "user": { "type": "string", "description": "用户标识。" }, "content": { "type": "string", "nullable": true, "description": "消息反馈的具体信息。" } } },
+ "AppFeedbacksResponseCn": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItemCn" }, "description": "返回该APP的点赞、反馈列表。" } } },
+ "FeedbackItemCn": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
+ "SuggestedQuestionsResponseCn": { "type": "object", "properties": { "result": { "type": "string", "example": "success" }, "data": { "type": "array", "items": { "type": "string" }, "description": "建议问题列表。" } } },
+ "BasicConversationHistoryResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返回条数。" }, "has_more": { "type": "boolean", "description": "是否存在下一页。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/BasicConversationMessageItemCn" }, "description": "消息列表。" } } },
+ "BasicConversationMessageItemCn": { "type": "object", "description": "会话中的单条消息。", "properties": { "id": { "type": "string", "format": "uuid", "description": "消息 ID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "用户输入参数。" }, "query": { "type": "string", "description": "用户输入/提问内容。" }, "answer": { "type": "string", "description": "回答消息内容。" }, "message_files": { "type": "array", "items": { "$ref": "#/components/schemas/MessageFileItemCn" }, "description": "消息文件列表。" }, "feedback": { "type": "object", "nullable": true, "properties": { "rating": { "type": "string", "enum": ["like", "dislike"], "description": "点赞 'like' / 点踩 'dislike'。" } }, "description": "反馈信息。" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceCn" }, "description": "引用和归属分段列表。" }, "agent_thoughts": { "type": "array", "items": { "$ref": "#/components/schemas/AgentThoughtItemCn" }, "description": "Agent思考内容(仅Agent模式下不为空)。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" } } },
+ "MessageFileItemCn": { "type": "object", "description": "消息中的文件项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "type": { "type": "string", "description": "文件类型,例如 'image'。" }, "url": { "type": "string", "format": "url", "description": "预览图片地址。" }, "belongs_to": { "type": "string", "enum": ["user", "assistant"], "description": "文件归属方。" } } },
+ "AgentThoughtItemCn": {
+ "type": "object", "description": "Agent思考内容。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "agent_thought ID。" },
+ "chain_id": { "type": "string", "format": "uuid", "nullable": true, "description": "(示例中存在,描述中未明确,暂定为可选)"},
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一ID。" },
+ "position": { "type": "integer", "description": "agent_thought在消息中的位置。" },
+ "thought": { "type": "string", "description": "agent的思考内容。" },
+ "tool": { "type": "string", "description": "使用的工具列表,以 ';' 分割。" },
+ "tool_input": { "type": "string", "description": "工具的输入,JSON格式的字符串。" },
+ "observation": { "type": "string", "description": "工具调用的返回结果。" },
+ "files": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "当前agent_thought关联的文件ID (示例中为files,markdown中为message_files.file_id)。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" }
+ }
+ },
+ "ConversationsListResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返回条数。" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationListItemCn" }, "description": "会话列表。" } } },
+ "ConversationListItemCn": { "type": "object", "description": "会话列表中的单项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "会话 ID。" }, "name": { "type": "string", "description": "会话名称。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "用户输入参数。" }, "status": { "type": "string", "description": "会话状态。" }, "introduction": { "type": "string", "nullable": true, "description": "开场白。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" }, "updated_at": { "type": "integer", "format": "int64", "description": "更新时间。" } } },
+ "ConversationRenameRequestCn": { "type": "object", "required": ["user"], "properties": { "name": { "type": "string", "nullable": true, "description": "(选填)名称,若 auto_generate 为 true 时可不传。" }, "auto_generate": { "type": "boolean", "default": false, "description": "(选填)自动生成标题,默认 false。" }, "user": { "type": "string", "description": "用户标识。" } } },
+ "ConversationRenameResponseCn": { "$ref": "#/components/schemas/ConversationListItemCn" },
+ "ConversationVariablesResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "每页项目数。" }, "has_more": { "type": "boolean", "description": "是否有更多项目。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationVariableItemCn" }, "description": "变量列表。" } } },
+ "ConversationVariableItemCn": { "type": "object", "description": "对话中的变量项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "变量ID。" }, "name": { "type": "string", "description": "变量名称。" }, "value_type": { "type": "string", "description": "变量类型 (string, number, boolean 等)。" }, "value": { "type": "string", "description": "变量值。" }, "description": { "type": "string", "nullable": true, "description": "变量描述。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最后更新时间戳。" } } },
+ "AudioToTextRequestCn": { "type": "object", "required": ["file", "user"], "properties": { "file": { "type": "string", "format": "binary", "description": "语音文件。支持格式:['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']。大小限制:15MB。" }, "user": { "type": "string", "description": "用户标识。" } } },
+ "AudioToTextResponseCn": { "type": "object", "properties": { "text": { "type": "string", "description": "输出文字。" } } },
+ "TextToAudioFormRequestCn": { "type": "object", "required": ["user"], "properties": { "message_id": { "type": "string", "format": "uuid", "description": "消息ID (优先)。" }, "text": { "type": "string", "description": "语音生成内容。" }, "user": { "type": "string", "description": "用户标识。" } }, "description": "需要 `user`。提供 `message_id` 或 `text`。" },
+ "AppInfoResponseCn": { "type": "object", "description": "应用基本信息。", "properties": { "name": { "type": "string", "description": "应用名称。" }, "description": { "type": "string", "description": "应用描述。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "应用标签。" } } },
+ "ChatAppParametersResponseCn": { "type": "object", "description": "应用参数信息。", "properties": { "opening_statement": { "type": "string", "description": "开场白。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "开场推荐问题列表。" }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "启用回答后给出推荐问题。" }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "语音转文本。" }, "text_to_speech": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" }, "voice": { "type": "string", "description": "语音类型。" }, "language": { "type": "string", "description": "语言。" }, "autoPlay": { "type": "string", "enum": ["enabled", "disabled"], "description": "自动播放:enabled 开启, disabled 关闭。" } }, "description": "文本转语音。" }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "引用和归属。" }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "标记回复。" }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemCn" }, "description": "用户输入表单配置。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "图片设置。支持 png, jpg, jpeg, webp, gif。" } }, "description": "文件上传配置。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "文档上传大小限制 (MB)。" }, "image_file_size_limit": { "type": "integer", "description": "图片文件上传大小限制(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "音频文件上传大小限制 (MB)。" }, "video_file_size_limit": { "type": "integer", "description": "视频文件上传大小限制 (MB)。" } }, "description": "系统参数。" } } },
+ "UserInputFormItemCn": { "type": "object", "description": "用户输入表单中的控件项。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperCn" }, { "$ref": "#/components/schemas/ParagraphControlWrapperCn" }, { "$ref": "#/components/schemas/SelectControlWrapperCn" } ] },
+ "TextInputControlWrapperCn": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlCn" } }, "required":["text-input"] },
+ "ParagraphControlWrapperCn": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlCn" } }, "required":["paragraph"] },
+ "SelectControlWrapperCn": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlCn" } }, "required":["select"] },
+ "TextInputControlCn": { "type": "object", "description": "文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "ParagraphControlCn": { "type": "object", "description": "段落文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "SelectControlCn": { "type": "object", "description": "下拉控件。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "选项值。" } } },
+ "AppMetaResponseCn": { "type": "object", "description": "应用 Meta 信息。", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "type": "string", "format": "url", "description": "图标 URL。" }, { "$ref": "#/components/schemas/ToolIconDetailCn" } ] }, "description": "工具图标,键为工具名称。" } } },
+ "ToolIconDetailCn": { "type": "object", "description": "工具图标详情。", "properties": { "background": { "type": "string", "description": "hex 格式的背景色。" }, "content": { "type": "string", "description": "emoji。" } } },
+ "WebAppSettingsResponseCn": { "type": "object", "description": "应用 WebApp 设置。", "properties": { "title": { "type": "string", "description": "WebApp 名称。" }, "chat_color_theme": { "type": "string", "description": "聊天颜色主题, hex 格式。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "聊天颜色主题是否反转。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "图标类型。" }, "icon": { "type": "string", "description": "图标内容 (emoji 或图片 URL)。" }, "icon_background": { "type": "string", "description": "hex 格式的背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "图标 URL。" }, "description": { "type": "string", "description": "描述。" }, "copyright": { "type": "string", "description": "版权信息。" }, "privacy_policy": { "type": "string", "description": "隐私政策链接。" }, "custom_disclaimer": { "type": "string", "description": "自定义免责声明。" }, "default_language": { "type": "string", "description": "默认语言。" }, "show_workflow_steps": { "type": "boolean", "description": "是否显示工作流详情。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "是否使用 WebApp 图标替换聊天中的机器人图标。" } } },
+ "ErrorResponseCn": { "type": "object", "description": "错误响应。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTP 状态码。" }, "code": { "type": "string", "nullable": true, "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } } }
+ }
+ },
+ "tags": [
+ { "name": "对话消息", "description": "与对话消息和交互相关的操作。" },
+ { "name": "文件操作", "description": "文件上传相关的操作。" },
+ { "name": "消息反馈", "description": "用户对消息的反馈操作。" },
+ { "name": "会话管理", "description": "管理对话会话相关的操作。" },
+ { "name": "语音与文字转换", "description": "文本转语音和语音转文本操作。" },
+ { "name": "应用配置", "description": "获取应用设置和信息相关的操作。" }
+ ]
+}
\ No newline at end of file
diff --git a/zh-hans/openapi_chatflow.json b/zh-hans/openapi_chatflow.json
new file mode 100644
index 00000000..80e80258
--- /dev/null
+++ b/zh-hans/openapi_chatflow.json
@@ -0,0 +1,658 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "工作流编排对话型应用 API (Chatflow API)",
+ "description": "对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "API 的基础 URL。请将 {api_base_url} 替换为您的应用提供的实际 API 基础 URL。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "实际的 API 基础 URL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/chat-messages": {
+ "post": {
+ "summary": "发送对话消息",
+ "description": "创建会话消息。",
+ "operationId": "sendChatMessageCn",
+ "tags": ["对话消息"],
+ "requestBody": {
+ "description": "发送对话消息的请求体。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatRequestCn"
+ },
+ "examples": {
+ "streaming_with_file": {
+ "summary": "包含文件和自定义输入的流式请求示例",
+ "value": {
+ "inputs": {
+ "name": "dify"
+ },
+ "query": "iPhone 13 Pro Max 的规格是什么?",
+ "response_mode": "streaming",
+ "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
+ "user": "abc-123",
+ "files": [
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://cloud.dify.ai/logo/logo-site.png"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "请求成功。响应的内容类型和结构取决于请求中的 `response_mode` 参数。\n- 当 `response_mode` 为 `blocking` 时,返回 `application/json` 格式的 `ChatCompletionResponseCn` 对象。\n- 当 `response_mode` 为 `streaming` 时,返回 `text/event-stream` 格式的 `ChunkChatEventCn` 对象流式序列。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponseCn"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkChatEventCn`。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestGenericCn" },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "上传文件",
+ "description": "上传文件并在发送消息时使用,可实现图文多模态理解。支持您的应用程序所支持的所有格式。上传的文件仅供当前终端用户使用。",
+ "operationId": "uploadFileCn",
+ "tags": ["文件操作"],
+ "requestBody": {
+ "description": "文件上传请求。需使用 `multipart/form-data` 进行请求。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "要上传的文件。"
+ },
+ "user": {
+ "type": "string",
+ "description": "用户标识,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "文件上传成功。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponseCn"
+ }
+ }
+ }
+ },
+ "201": {
+ "description": "文件创建成功 (备选成功状态码)。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFileCn" },
+ "413": { "$ref": "#/components/responses/FileTooLargeCn" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileCn" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/chat-messages/{task_id}/stop": {
+ "post": {
+ "summary": "停止响应",
+ "description": "停止生成对话消息。仅支持流式模式。",
+ "operationId": "stopChatMessageGenerationCn",
+ "tags": ["对话消息"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "任务 ID,可在流式返回 Chunk 中获取。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "用户标识,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultCn" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "消息反馈(点赞)",
+ "description": "消息终端用户反馈、点赞,方便应用开发者优化输出预期。",
+ "operationId": "postMessageFeedbackCn",
+ "tags": ["消息反馈"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "消息 ID。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestCn" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultCn" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "获取APP的消息点赞和反馈",
+ "description": "获取应用的终端用户反馈、点赞。",
+ "operationId": "getAppFeedbacksCn",
+ "tags": ["消息反馈"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取应用的反馈列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages/{message_id}/suggested": {
+ "get": {
+ "summary": "获取下一轮建议问题列表",
+ "description": "获取当前消息的下一轮建议问题列表。",
+ "operationId": "getSuggestedQuestionsCn",
+ "tags": ["对话消息"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "消息 ID。",
+ "schema": { "type": "string", "format": "uuid" }
+ },
+ { "$ref": "#/components/parameters/UserQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取建议问题列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/messages": {
+ "get": {
+ "summary": "获取会话历史消息",
+ "description": "滚动加载形式返回历史聊天记录,第一页返回最新 `limit` 条,即倒序返回。",
+ "operationId": "getConversationHistoryCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdQueryParamCn" },
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ {
+ "name": "first_id",
+ "in": "query",
+ "description": "当前页第一条聊天记录的 ID,默认 null。",
+ "schema": { "type": "string", "format": "uuid", "nullable": true }
+ },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Cn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取会话历史消息。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationHistoryResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations": {
+ "get": {
+ "summary": "获取会话列表",
+ "description": "获取当前用户的会话列表,默认返回最近的 20 条。",
+ "operationId": "getConversationsListCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ { "$ref": "#/components/parameters/LastIdQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" },
+ { "$ref": "#/components/parameters/SortByQueryParamCn" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取会话列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ConversationsListResponseCn" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/conversations/{conversation_id}": {
+ "delete": {
+ "summary": "删除会话",
+ "description": "删除一个指定的会话。",
+ "operationId": "deleteConversationCn",
+ "tags": ["会话管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object", "required": ["user"],
+ "properties": { "user": { "type": "string", "description": "用户标识。" } }
+ }
+ }
+ }
+ },
+ "responses": { "204": { "description": "会话删除成功,无内容返回。" } }
+ }
+ },
+ "/conversations/{conversation_id}/name": {
+ "post": {
+ "summary": "会话重命名",
+ "description": "对会话进行重命名。",
+ "operationId": "renameConversationCn",
+ "tags": ["会话管理"],
+ "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestCn" } } }
+ },
+ "responses": {
+ "200": { "description": "会话重命名成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseCn" } } } }
+ }
+ }
+ },
+ "/conversations/{conversation_id}/variables": {
+ "get": {
+ "summary": "获取对话变量",
+ "description": "从特定对话中检索变量。此端点对于提取对话过程中捕获的结构化数据非常有用。",
+ "operationId": "getConversationVariablesCn",
+ "tags": ["会话管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/ConversationIdPathParamCn" },
+ { "$ref": "#/components/parameters/UserQueryParamCn" },
+ { "$ref": "#/components/parameters/LastIdQueryParamCn" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" },
+ { "$ref": "#/components/parameters/VariableNameQueryParamCn" }
+ ],
+ "responses": {
+ "200": { "description": "成功获取对话变量。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseCn" } } } },
+ "404": { "$ref": "#/components/responses/ConversationNotFoundCn" }
+ }
+ }
+ },
+ "/audio-to-text": {
+ "post": {
+ "summary": "语音转文字",
+ "description": "将语音文件转换为文字。支持格式:mp3, mp4, mpeg, mpga, m4a, wav, webm。文件大小限制:15MB。",
+ "operationId": "audioToTextCn",
+ "tags": ["语音与文字转换"],
+ "requestBody": {
+ "required": true,
+ "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestCn" } } }
+ },
+ "responses": {
+ "200": { "description": "成功将语音转换为文字。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseCn" } } } }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "文字转语音",
+ "description": "将文字内容转换为语音。",
+ "operationId": "textToAudioCn",
+ "tags": ["语音与文字转换"],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioJsonRequestCn" } } }
+ },
+ "responses": {
+ "200": {
+ "description": "成功生成语音文件。",
+ "content": { "audio/wav": { "schema": { "type": "string", "format": "binary" } }, "audio/mp3": { "schema": { "type": "string", "format": "binary" } } },
+ "headers": { "Content-Type": { "schema": { "type": "string", "example": "audio/wav" } } }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "获取应用基本信息",
+ "operationId": "getAppInfoCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "获取应用参数",
+ "description": "用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。",
+ "operationId": "getAppParametersCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseCn" } } } } }
+ }
+ },
+ "/meta": {
+ "get": {
+ "summary": "获取应用Meta信息",
+ "description": "用于获取工具 icon。",
+ "operationId": "getAppMetaCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "成功获取应用 Meta 信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseCn" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "获取应用 WebApp 设置",
+ "description": "用于获取应用的 WebApp 设置。",
+ "operationId": "getWebAppSettingsCn",
+ "tags": ["应用配置"],
+ "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseCn" } } } } }
+ }
+ },
+ "/apps/annotations": {
+ "get": {
+ "summary": "获取标注列表",
+ "operationId": "getAnnotationListCn",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/PageQueryParamCn" }, { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" } ],
+ "responses": { "200": { "description": "成功获取标注列表。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationListResponseCn" } } } } }
+ },
+ "post": {
+ "summary": "创建标注",
+ "operationId": "createAnnotationCn",
+ "tags": ["标注管理"],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAnnotationRequestCn" } } } },
+ "responses": {
+ "200": { "description": "标注创建成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItemCn" } } } },
+ "201": { "description": "标注创建成功 (备选)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItemCn" } } } }
+ }
+ }
+ },
+ "/apps/annotations/{annotation_id}": {
+ "put": {
+ "summary": "更新标注",
+ "operationId": "updateAnnotationCn",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParamCn" } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnnotationRequestCn" } } } },
+ "responses": { "200": { "description": "标注更新成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItemCn" } } } } }
+ },
+ "delete": {
+ "summary": "删除标注",
+ "operationId": "deleteAnnotationCn",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParamCn" } ],
+ "responses": { "204": { "description": "标注删除成功。" } }
+ }
+ },
+ "/apps/annotation-reply/{action}": {
+ "post": {
+ "summary": "标注回复初始设置",
+ "description": "启用或禁用标注回复功能,并配置相关的嵌入模型和阈值。此接口异步执行。",
+ "operationId": "initialAnnotationReplySettingsCn",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationActionPathParamCn" } ],
+ "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequestCn" } } } },
+ "responses": {
+ "200": { "description": "任务已启动。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponseCn" } } } },
+ "202": { "description": "任务已接受处理。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponseCn" } } } }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}/status/{job_id}": {
+ "get": {
+ "summary": "查询标注回复初始设置任务状态",
+ "operationId": "getInitialAnnotationReplySettingsStatusCn",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationActionPathParamCn" }, { "$ref": "#/components/parameters/JobIdPathParamCn" } ],
+ "responses": { "200": { "description": "任务状态。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponseCn" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含您的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。" }
+ },
+ "parameters": {
+ "PageQueryParamCn": { "name": "page", "in": "query", "description": "页码,(选填)默认值:1。", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParamCn": { "name": "limit", "in": "query", "description": "每页数量,(选填)默认值:20。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Cn": { "name": "limit", "in": "query", "description": "一次请求返回多少条记录,默认 20 条。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamDefault20Max100Cn": { "name": "limit", "in": "query", "description": "一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "UserQueryParamCn": { "name": "user", "in": "query", "required": true, "description": "用户标识,由开发者定义规则,需保证用户标识在应用内唯一。", "schema": { "type": "string" } },
+ "ConversationIdQueryParamCn": { "name": "conversation_id", "in": "query", "required": true, "description": "会话 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "LastIdQueryParamCn": { "name": "last_id", "in": "query", "description": "(选填)当前页最后面一条记录的 ID,默认 null。", "schema": { "type": "string", "format": "uuid", "nullable": true } },
+ "SortByQueryParamCn": { "name": "sort_by", "in": "query", "description": "(选填)排序字段,默认 -updated_at (按更新时间倒序排列)。可选值:created_at, -created_at, updated_at, -updated_at。'-' 代表倒序。", "schema": { "type": "string", "enum": ["created_at", "-created_at", "updated_at", "-updated_at"], "default": "-updated_at" } },
+ "ConversationIdPathParamCn": { "name": "conversation_id", "in": "path", "required": true, "description": "会话 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "VariableNameQueryParamCn": { "name": "variable_name", "in": "query", "description": "(选填)按变量名称筛选。", "schema": { "type": "string" } },
+ "AnnotationIdPathParamCn": { "name": "annotation_id", "in": "path", "required": true, "description": "标注 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "AnnotationActionPathParamCn": { "name": "action", "in": "path", "required": true, "description": "动作,只能是 'enable' 或 'disable'。", "schema": { "type": "string", "enum": ["enable", "disable"] } },
+ "JobIdPathParamCn": { "name": "job_id", "in": "path", "required": true, "description": "任务 ID,从标注回复初始设置接口返回的 job_id。", "schema": { "type": "string", "format": "uuid" } }
+ },
+ "responses": {
+ "BadRequestGenericCn": { "description": "请求参数错误。可能原因:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, completion_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "BadRequestFileCn": { "description": "文件操作请求错误。可能原因:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "FileTooLargeCn": { "description": "文件太大 (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "UnsupportedFileTypeFileCn": { "description": "不支持的文件类型 (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "S3ErrorFileCn": { "description": "S3 存储服务错误。可能原因:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "InternalServerErrorCn": { "description": "服务内部异常。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "SuccessResultCn": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } },
+ "ConversationNotFoundCn": { "description": "对话不存在。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } }
+ },
+ "schemas": {
+ "ChatRequestCn": {
+ "type": "object",
+ "required": ["query", "user"],
+ "properties": {
+ "query": { "type": "string", "description": "用户输入/提问内容。" },
+ "inputs": {
+ "type": "object",
+ "description": "允许传入 App 定义的各变量值。如果变量是文件类型,请指定一个 InputFileObjectCn 对象。",
+ "additionalProperties": {
+ "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "$ref": "#/components/schemas/InputFileObjectCn" } ]
+ },
+ "default": {}
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制)。" },
+ "user": { "type": "string", "description": "用户标识,应用内唯一。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "(选填)会话 ID,用于继续之前的对话。" },
+ "files": { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectCn" }, "description": "(选填)文件列表,仅当模型支持 Vision 能力时可用。" },
+ "auto_generate_name": { "type": "boolean", "default": true, "description": "(选填)自动生成会话标题,默认 true。" }
+ }
+ },
+ "InputFileObjectCn": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "文件类型。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: 其他。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" },
+ "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" },
+ "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "ChatCompletionResponseCn": {
+ "type": "object", "description": "阻塞模式下的完整 App 结果。",
+ "properties": {
+ "event": { "type": "string", "example": "message", "description": "事件类型,固定为 `message`。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" },
+ "id": { "type": "string", "format": "uuid", "description": "唯一ID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" },
+ "mode": { "type": "string", "example": "chat", "description": "App 模式,固定为 `chat`。" },
+ "answer": { "type": "string", "description": "完整回复内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadataCn" },
+ "created_at": { "type": "integer", "format": "int64", "description": "消息创建时间戳。" }
+ }
+ },
+ "ResponseMetadataCn": {
+ "type": "object", "description": "元数据。",
+ "properties": { "usage": { "$ref": "#/components/schemas/UsageCn" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceCn" }, "description": "引用和归属分段列表。" } }
+ },
+ "ChunkChatEventCn": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["message", "message_file", "message_end", "tts_message", "tts_message_end", "message_replace", "workflow_started", "node_started", "node_finished", "workflow_finished", "error", "ping"], "description": "事件类型。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "message": "#/components/schemas/StreamEventChatMessageCn", "message_file": "#/components/schemas/StreamEventMessageFileCn",
+ "message_end": "#/components/schemas/StreamEventMessageEndCn", "tts_message": "#/components/schemas/StreamEventTtsMessageCn",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEndCn", "message_replace": "#/components/schemas/StreamEventMessageReplaceCn",
+ "workflow_started": "#/components/schemas/StreamEventWorkflowStartedCn", "node_started": "#/components/schemas/StreamEventNodeStartedCn",
+ "node_finished": "#/components/schemas/StreamEventNodeFinishedCn", "workflow_finished": "#/components/schemas/StreamEventWorkflowFinishedCn",
+ "error": "#/components/schemas/StreamEventErrorCn", "ping": "#/components/schemas/StreamEventPingCn"
+ }}
+ },
+ "StreamEventBaseChatCn": {
+ "type": "object", "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" }
+ }
+ },
+ "StreamEventChatMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLM 返回文本块内容。" } } } ] },
+ "StreamEventMessageFileCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["id", "type", "belongs_to", "url", "conversation_id"], "properties": { "id": { "type": "string", "format": "uuid", "description": "文件唯一ID。" }, "type": { "type": "string", "enum": ["image"], "description": "文件类型,目前仅为 image。" }, "belongs_to": { "type": "string", "enum": ["assistant"], "description": "文件归属,仅为 assistant。" }, "url": { "type": "string", "format": "url", "description": "文件访问地址。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会话ID。" } } } ] },
+ "StreamEventMessageEndCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadataCn" } } } ] },
+ "StreamEventTtsMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 编码的音频块。" } } } ] },
+ "StreamEventTtsMessageEndCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空字符串。" } } } ] },
+ "StreamEventMessageReplaceCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseChatCn" }, { "type": "object", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "替换内容(直接替换 LLM 所有回复文本)。" } } } ] },
+ "StreamEventWorkflowStartedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/WorkflowStartedDataCn" } } } ] },
+ "WorkflowStartedDataCn": { "type": "object", "required": ["id", "workflow_id", "sequence_number", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "关联 Workflow ID。" }, "sequence_number": { "type": "integer", "description": "自增序号,App 内自增,从 1 开始。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "StreamEventNodeStartedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/NodeStartedDataCn" } } } ] },
+ "NodeStartedDataCn": { "type": "object", "required": ["id", "node_id", "node_type", "title", "index", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID (应为 node 执行 ID,根据上下文修正)。" }, "node_id": { "type": "string", "format": "uuid", "description": "节点 ID。" }, "node_type": { "type": "string", "description": "节点类型。" }, "title": { "type": "string", "description": "节点名称。" }, "index": { "type": "integer", "description": "执行序号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "前置节点 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "节点使用的前置变量内容。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "StreamEventNodeFinishedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/NodeFinishedDataCn" } } } ] },
+ "NodeFinishedDataCn": { "type": "object", "required": ["id", "node_id", "index", "status", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "node 执行 ID。" }, "node_id": { "type": "string", "format": "uuid", "description": "节点 ID。" }, "index": { "type": "integer", "description": "执行序号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "(可选)前置节点 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "节点使用的前置变量内容。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)节点过程数据 (JSON)。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)输出内容 (JSON)。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" }, "error": { "type": "string", "nullable": true, "description": "(可选)错误原因。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(可选)耗时(秒)。" }, "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadataCn" , "nullable": true, "description":"元数据"}, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "NodeExecutionMetadataCn": { "type": "object", "description": "节点执行元数据。", "properties": { "total_tokens": { "type": "integer", "nullable": true, "description": "(可选)总使用 tokens。" }, "total_price": { "type": "number", "format": "float", "nullable": true, "description": "(可选)总费用 (使用 float 兼容 decimal)。" }, "currency": { "type": "string", "nullable": true, "example": "USD", "description": "(可选)货币。" } } },
+ "StreamEventWorkflowFinishedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["task_id", "workflow_run_id", "data"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "workflow_run_id": { "type": "string", "format": "uuid" }, "data": { "$ref": "#/components/schemas/WorkflowFinishedDataCn" } } } ] },
+ "WorkflowFinishedDataCn": { "type": "object", "required": ["id", "workflow_id", "status", "created_at", "finished_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "关联 Workflow ID。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)输出内容 (JSON)。" }, "error": { "type": "string", "nullable": true, "description": "(可选)错误原因。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(可选)耗时(秒)。" }, "total_tokens": { "type": "integer", "nullable": true, "description": "(可选)总使用 tokens。" }, "total_steps": { "type": "integer", "default": 0, "description": "总步数,默认 0。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" }, "finished_at": { "type": "integer", "format": "int64", "description": "结束时间。" } } },
+ "StreamEventErrorCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "required": ["task_id", "status", "code", "message"], "properties": { "task_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "消息唯一 ID(错误事件中可能不存在)。" }, "status": { "type": "integer", "description": "HTTP 状态码。" }, "code": { "type": "string", "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } } } ] },
+ "StreamEventPingCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEventCn" }, { "type": "object", "description": "每 10s 一次的 ping 事件,保持连接存活。" } ] },
+ "UsageCn": { "type": "object", "description": "模型用量信息。", "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } } },
+ "RetrieverResourceCn": { "type": "object", "description": "引用和归属分段信息。", "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } } },
+ "FileUploadResponseCn": { "type": "object", "description": "文件上传成功后的响应。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "文件名。" }, "size": { "type": "integer", "description": "文件大小 (byte)。" }, "extension": { "type": "string", "description": "文件后缀。" }, "mime_type": { "type": "string", "description": "文件 mime-type。" }, "created_by": { "type": "string", "format": "uuid", "description": "上传人 ID (应为 uuid,示例中为 int,已修正)。" }, "created_at": { "type": "integer", "format": "int64", "description": "上传时间。" } } },
+ "MessageFeedbackRequestCn": { "type": "object", "required": ["user"], "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "点赞 'like', 点踩 'dislike', 撤销点赞 null。" }, "user": { "type": "string", "description": "用户标识。" }, "content": { "type": "string", "nullable": true, "description": "消息反馈的具体信息。" } } },
+ "AppFeedbacksResponseCn": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItemCn" }, "description": "返回该APP的点赞、反馈列表。" } } },
+ "FeedbackItemCn": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid" }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string" }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } },
+ "SuggestedQuestionsResponseCn": { "type": "object", "properties": { "result": { "type": "string", "example": "success" }, "data": { "type": "array", "items": { "type": "string" }, "description": "建议问题列表。" } } },
+ "ConversationHistoryResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返回条数。" }, "has_more": { "type": "boolean", "description": "是否存在下一页。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationMessageItemCn" }, "description": "消息列表。" } } },
+ "ConversationMessageItemCn": { "type": "object", "description": "会话中的单条消息。", "properties": { "id": { "type": "string", "format": "uuid", "description": "消息 ID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会话 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "用户输入参数。" }, "query": { "type": "string", "description": "用户输入/提问内容。" }, "answer": { "type": "string", "description": "回答消息内容。" }, "message_files": { "type": "array", "items": { "$ref": "#/components/schemas/MessageFileItemCn" }, "description": "消息文件列表。" }, "feedback": { "type": "object", "nullable": true, "properties": { "rating": { "type": "string", "enum": ["like", "dislike"], "description": "点赞 'like' / 点踩 'dislike'。" } }, "description": "反馈信息。" }, "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResourceCn" }, "description": "引用和归属分段列表。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" } } },
+ "MessageFileItemCn": { "type": "object", "description": "消息中的文件项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "type": { "type": "string", "description": "文件类型,例如 'image'。" }, "url": { "type": "string", "format": "url", "description": "预览图片地址。" }, "belongs_to": { "type": "string", "enum": ["user", "assistant"], "description": "文件归属方。" } } },
+ "ConversationsListResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "返回条数。" }, "has_more": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationListItemCn" }, "description": "会话列表。" } } },
+ "ConversationListItemCn": { "type": "object", "description": "会话列表中的单项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "会话 ID。" }, "name": { "type": "string", "description": "会话名称。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "用户输入参数。" }, "status": { "type": "string", "description": "会话状态。" }, "introduction": { "type": "string", "nullable": true, "description": "开场白。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" }, "updated_at": { "type": "integer", "format": "int64", "description": "更新时间。" } } },
+ "ConversationRenameRequestCn": { "type": "object", "required": ["user"], "properties": { "name": { "type": "string", "nullable": true, "description": "(选填)名称,若 auto_generate 为 true 时可不传。" }, "auto_generate": { "type": "boolean", "default": false, "description": "(选填)自动生成标题,默认 false。" }, "user": { "type": "string", "description": "用户标识。" } } },
+ "ConversationRenameResponseCn": { "$ref": "#/components/schemas/ConversationListItemCn" },
+ "ConversationVariablesResponseCn": { "type": "object", "properties": { "limit": { "type": "integer", "description": "每页项目数。" }, "has_more": { "type": "boolean", "description": "是否有更多项目。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ConversationVariableItemCn" }, "description": "变量列表。" } } },
+ "ConversationVariableItemCn": { "type": "object", "description": "对话中的变量项。", "properties": { "id": { "type": "string", "format": "uuid", "description": "变量ID。" }, "name": { "type": "string", "description": "变量名称。" }, "value_type": { "type": "string", "description": "变量类型 (string, number, boolean 等)。" }, "value": { "type": "string", "description": "变量值。" }, "description": { "type": "string", "nullable": true, "description": "变量描述。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最后更新时间戳。" } } },
+ "AudioToTextRequestCn": { "type": "object", "required": ["file", "user"], "properties": { "file": { "type": "string", "format": "binary", "description": "语音文件。支持格式:['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']。大小限制:15MB。" }, "user": { "type": "string", "description": "用户标识。" } } },
+ "AudioToTextResponseCn": { "type": "object", "properties": { "text": { "type": "string", "description": "输出文字。" } } },
+ "TextToAudioJsonRequestCn": { "type": "object", "required": ["user"], "properties": { "message_id": { "type": "string", "format": "uuid", "description": "消息ID (优先)。" }, "text": { "type": "string", "description": "语音生成内容。" }, "user": { "type": "string", "description": "用户标识。" } }, "description": "需要 `user`。提供 `message_id` 或 `text`。" },
+ "AppInfoResponseCn": { "type": "object", "description": "应用基本信息。", "properties": { "name": { "type": "string", "description": "应用名称。" }, "description": { "type": "string", "description": "应用描述。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "应用标签。" } } },
+ "ChatAppParametersResponseCn": { "type": "object", "description": "应用参数信息。", "properties": { "opening_statement": { "type": "string", "description": "开场白。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "开场推荐问题列表。" }, "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "启用回答后给出推荐问题。" }, "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "语音转文本。" }, "text_to_speech": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" }, "voice": { "type": "string", "description": "语音类型。" }, "language": { "type": "string", "description": "语言。" }, "autoPlay": { "type": "string", "enum": ["enabled", "disabled"], "description": "自动播放:enabled 开启, disabled 关闭。" } }, "description": "文本转语音。" }, "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "引用和归属。" }, "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" } }, "description": "标记回复。" }, "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemCn" }, "description": "用户输入表单配置。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "图片设置。支持 png, jpg, jpeg, webp, gif。" } }, "description": "文件上传配置。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "文档上传大小限制 (MB)。" }, "image_file_size_limit": { "type": "integer", "description": "图片文件上传大小限制 (MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "音频文件上传大小限制 (MB)。" }, "video_file_size_limit": { "type": "integer", "description": "视频文件上传大小限制 (MB)。" } }, "description": "系统参数。" } } },
+ "UserInputFormItemCn": { "type": "object", "description": "用户输入表单中的控件项。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperCn" }, { "$ref": "#/components/schemas/ParagraphControlWrapperCn" }, { "$ref": "#/components/schemas/SelectControlWrapperCn" } ] },
+ "TextInputControlWrapperCn": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlCn" } }, "required":["text-input"] },
+ "ParagraphControlWrapperCn": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlCn" } }, "required":["paragraph"] },
+ "SelectControlWrapperCn": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlCn" } }, "required":["select"] },
+ "TextInputControlCn": { "type": "object", "description": "文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "ParagraphControlCn": { "type": "object", "description": "段落文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "SelectControlCn": { "type": "object", "description": "下拉控件。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "选项值。" } } },
+ "AppMetaResponseCn": { "type": "object", "description": "应用 Meta 信息。", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "type": "string", "format": "url", "description": "图标 URL。" }, { "$ref": "#/components/schemas/ToolIconDetailCn" } ] }, "description": "工具图标,键为工具名称。" } } },
+ "ToolIconDetailCn": { "type": "object", "description": "工具图标详情。", "properties": { "background": { "type": "string", "description": "hex 格式的背景色。" }, "content": { "type": "string", "description": "emoji。" } } },
+ "WebAppSettingsResponseCn": { "type": "object", "description": "应用 WebApp 设置。", "properties": { "title": { "type": "string", "description": "WebApp 名称。" }, "chat_color_theme": { "type": "string", "description": "聊天颜色主题, hex 格式。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "聊天颜色主题是否反转。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "图标类型。" }, "icon": { "type": "string", "description": "图标内容 (emoji 或图片 URL)。" }, "icon_background": { "type": "string", "description": "hex 格式的背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "图标 URL。" }, "description": { "type": "string", "description": "描述。" }, "copyright": { "type": "string", "description": "版权信息。" }, "privacy_policy": { "type": "string", "description": "隐私政策链接。" }, "custom_disclaimer": { "type": "string", "description": "自定义免责声明。" }, "default_language": { "type": "string", "description": "默认语言。" }, "show_workflow_steps": { "type": "boolean", "description": "是否显示工作流详情。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "是否使用 WebApp 图标替换聊天中的机器人图标。" } } },
+ "AnnotationListResponseCn": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AnnotationItemCn" } }, "has_more": { "type": "boolean" }, "limit": { "type": "integer" }, "total": { "type": "integer" }, "page": { "type": "integer" } } },
+ "AnnotationItemCn": { "type": "object", "description": "标注项。", "properties": { "id": { "type": "string", "format": "uuid" }, "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" }, "hit_count": { "type": "integer", "description": "命中次数。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" } } },
+ "CreateAnnotationRequestCn": { "type": "object", "required": ["question", "answer"], "properties": { "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" } } },
+ "UpdateAnnotationRequestCn": { "type": "object", "required": ["question", "answer"], "properties": { "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" } } },
+ "InitialAnnotationReplySettingsRequestCn": { "type": "object", "required": ["score_threshold"], "properties": { "embedding_provider_name": { "type": "string", "nullable": true, "description": "指定的嵌入模型提供商名称。" }, "embedding_model_name": { "type": "string", "nullable": true, "description": "指定的嵌入模型名称。" }, "score_threshold": { "type": "number", "format": "float", "description": "相似度阈值。" } } },
+ "InitialAnnotationReplySettingsResponseCn": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid", "description": "任务 ID。" }, "job_status": { "type": "string", "description": "任务状态。" } } },
+ "InitialAnnotationReplySettingsStatusResponseCn": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid", "description": "任务 ID。" }, "job_status": { "type": "string", "description": "任务状态。" }, "error_msg": { "type": "string", "nullable": true, "description": "错误信息。" } } },
+ "ErrorResponseCn": { "type": "object", "description": "错误响应。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTP 状态码。" }, "code": { "type": "string", "nullable": true, "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } } }
+ }
+ },
+ "tags": [
+ { "name": "对话消息", "description": "与对话消息和交互相关的操作。" },
+ { "name": "文件操作", "description": "文件上传相关的操作。" },
+ { "name": "消息反馈", "description": "用户对消息的反馈操作。" },
+ { "name": "会话管理", "description": "管理对话会话相关的操作。" },
+ { "name": "语音与文字转换", "description": "文本转语音和语音转文本操作。" },
+ { "name": "应用配置", "description": "获取应用设置和信息相关的操作。" },
+ { "name": "标注管理", "description": "管理用于直接回复的标注数据。" }
+ ]
+}
\ No newline at end of file
diff --git a/zh-hans/openapi_completion.json b/zh-hans/openapi_completion.json
new file mode 100644
index 00000000..1ef3c47c
--- /dev/null
+++ b/zh-hans/openapi_completion.json
@@ -0,0 +1,643 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "文本生成型应用 API",
+ "description": "文本生成应用无会话支持,适合用于翻译/文章写作/总结 AI 等等。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "API 的基础 URL。请将 {api_base_url} 替换为您的应用提供的实际 API 基础 URL。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "实际的 API 基础 URL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/completion-messages": {
+ "post": {
+ "summary": "发送消息",
+ "description": "发送请求给文本生成型应用。",
+ "operationId": "createCompletionMessage",
+ "tags": ["文本生成"],
+ "requestBody": {
+ "description": "创建完成消息的请求体。",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CompletionRequest"
+ },
+ "examples": {
+ "streaming_example": {
+ "summary": "流式模式示例",
+ "value": {
+ "inputs": {"query": "你好,世界!"},
+ "response_mode": "streaming",
+ "user": "abc-123"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "成功响应。内容类型和结构取决于请求中的 `response_mode` 参数。\n- 若 `response_mode` 为 `blocking`,返回 `application/json` 及 `ChatCompletionResponse` 对象。\n- 若 `response_mode` 为 `streaming`,返回 `text/event-stream` 及 `ChunkChatCompletionResponse` 流式序列。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ChatCompletionResponse"
+ },
+ "examples": {
+ "blockingResponse": {
+ "summary": "阻塞模式响应示例",
+ "value": {
+ "id": "0b089b9a-24d9-48cc-94f8-762677276261",
+ "message_id": "0b089b9a-24d9-48cc-94f8-762677276261",
+ "mode": "chat",
+ "answer": "how are you?",
+ "metadata": {},
+ "created_at": 1679586667
+ }
+ }
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "服务器发送事件 (SSE) 流。每个事件都是以 'data: ' 开头,以 '\\n\\n' 结尾的 JSON 对象。详见 `ChunkEvent` 的可能结构。"
+ },
+ "examples": {
+ "streamingResponse": {
+ "summary": "流式模式响应示例",
+ "value": "data: {\"event\": \"message\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"id\": \"663c5084-a254-4040-8ad3-51f2a3c1a77c\", \"message_id\": \"663c5084-a254-4040-8ad3-51f2a3c1a77c\", \"answer\": \"Hi\", \"created_at\": 1705398420}\n\ndata: {\"event\": \"tts_message\", \"task_id\": \"3bf8a0bb-e73b-4690-9e66-4e429bad8ee7\", \"message_id\": \"a8bdc41c-13b2-4c18-bfd9-054b9803038c\", \"audio\": \"base64encodedaudio...\", \"created_at\": 1721205487}\n\n"
+ }
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestCompletion" },
+ "404": { "$ref": "#/components/responses/ConversationNotFound" },
+ "500": { "$ref": "#/components/responses/InternalServerError" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "上传文件",
+ "description": "上传文件(目前仅支持图片)并在发送消息时使用,可实现图文多模态理解。支持 png, jpg, jpeg, webp, gif 格式。上传的文件仅供当前终端用户使用。",
+ "operationId": "uploadFile",
+ "tags": ["文件管理"],
+ "requestBody": {
+ "description": "文件上传请求,需使用 `multipart/form-data`。",
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "要上传的文件。支持的图片类型:png, jpg, jpeg, webp, gif。"
+ },
+ "user": {
+ "type": "string",
+ "description": "用户标识,由开发者定义规则,需保证用户标识在应用内唯一,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "文件上传成功。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponse"
+ }
+ }
+ }
+ },
+ "201": {
+ "description": "文件创建成功 (备选成功状态码)。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FileUploadResponse"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestFile" },
+ "413": { "$ref": "#/components/responses/FileTooLarge" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFile" },
+ "503": { "$ref": "#/components/responses/S3ErrorFile" }
+ }
+ }
+ },
+ "/completion-messages/{task_id}/stop": {
+ "post": {
+ "summary": "停止响应",
+ "description": "停止生成任务,仅支持流式模式。",
+ "operationId": "stopCompletionGeneration",
+ "tags": ["文本生成"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "任务 ID,可在流式返回 Chunk 中获取。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": {
+ "type": "string",
+ "description": "用户标识,必须和发送消息接口传入 user 保持一致。"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/messages/{message_id}/feedbacks": {
+ "post": {
+ "summary": "消息反馈(点赞)",
+ "description": "消息终端用户反馈、点赞,方便应用开发者优化输出预期。",
+ "operationId": "postMessageFeedback",
+ "tags": ["反馈"],
+ "parameters": [
+ {
+ "name": "message_id",
+ "in": "path",
+ "required": true,
+ "description": "消息 ID。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/MessageFeedbackRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResult" }
+ }
+ }
+ },
+ "/app/feedbacks": {
+ "get": {
+ "summary": "获取应用反馈列表",
+ "description": "获取应用的反馈信息。",
+ "operationId": "getAppFeedbacks",
+ "tags": ["反馈"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParamDefault20" }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取应用反馈列表。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AppFeedbacksResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/text-to-audio": {
+ "post": {
+ "summary": "文字转语音",
+ "description": "将文本内容转换为语音。",
+ "operationId": "textToAudio",
+ "tags": ["语音服务"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/TextToAudioRequest" }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "语音文件生成成功。",
+ "content": {
+ "audio/wav": { "schema": { "type": "string", "format": "binary", "description": "生成的 WAV 格式音频文件。" } },
+ "audio/mp3": { "schema": { "type": "string", "format": "binary", "description": "生成的 MP3 格式音频文件。" } }
+ },
+ "headers": {
+ "Content-Type": { "schema": { "type": "string", "example": "audio/wav" }, "description": "响应的内容类型,通常为 `audio/wav` 或 `audio/mp3`。" }
+ }
+ }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "获取应用基本信息",
+ "description": "用于获取此应用的基本信息。",
+ "operationId": "getAppInfo",
+ "tags": ["应用设置"],
+ "responses": {
+ "200": {
+ "description": "应用的基本信息。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponse" } } }
+ }
+ }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "获取应用参数",
+ "description": "用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。",
+ "operationId": "getAppParameters",
+ "tags": ["应用设置"],
+ "responses": {
+ "200": {
+ "description": "应用的参数信息。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppParametersResponseCompletion" } } }
+ }
+ }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "获取应用 WebApp 设置",
+ "description": "用于获取应用的 WebApp 设置。",
+ "operationId": "getWebAppSettings",
+ "tags": ["应用设置"],
+ "responses": {
+ "200": {
+ "description": "应用的 WebApp 设置信息。",
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponse" } } }
+ }
+ }
+ }
+ },
+ "/apps/annotations": {
+ "get": {
+ "summary": "获取标注列表",
+ "description": "获取应用的标注列表。",
+ "operationId": "getAnnotationList",
+ "tags": ["标注管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/PageQueryParam" },
+ { "$ref": "#/components/parameters/LimitQueryParamAnnotation" }
+ ],
+ "responses": {
+ "200": { "description": "成功获取标注列表。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationListResponse" } } } }
+ }
+ },
+ "post": {
+ "summary": "创建标注",
+ "description": "创建一个新的标注。",
+ "operationId": "createAnnotation",
+ "tags": ["标注管理"],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAnnotationRequest" } } }
+ },
+ "responses": {
+ "200": { "description": "标注创建成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } },
+ "201": { "description": "标注创建成功 (备选)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } }
+ }
+ }
+ },
+ "/apps/annotations/{annotation_id}": {
+ "put": {
+ "summary": "更新标注",
+ "description": "更新一个已存在的标注。",
+ "operationId": "updateAnnotation",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParam" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnnotationRequest" } } }
+ },
+ "responses": {
+ "200": { "description": "标注更新成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" } } } }
+ }
+ },
+ "delete": {
+ "summary": "删除标注",
+ "description": "删除一个标注。",
+ "operationId": "deleteAnnotation",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationIdPathParam" } ],
+ "responses": { "204": { "description": "标注删除成功,无内容返回。" } }
+ }
+ },
+ "/apps/annotation-reply/{action}": {
+ "post": {
+ "summary": "标注回复初始设置",
+ "description": "启用或禁用标注回复设置,并配置嵌入模型。此接口异步执行。嵌入模型的提供商和模型名称可通过 v1/workspaces/current/models/model-types/text-embedding 接口获取(使用 Dataset API Token 鉴权)。",
+ "operationId": "initialAnnotationReplySettings",
+ "tags": ["标注管理"],
+ "parameters": [ { "$ref": "#/components/parameters/AnnotationActionPathParam" } ],
+ "requestBody": {
+ "required": true,
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" } } }
+ },
+ "responses": {
+ "200": { "description": "标注回复设置任务已启动。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AsyncJobResponse" } } } },
+ "202": { "description": "标注回复设置任务已接受。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AsyncJobResponse" } } } }
+ }
+ }
+ },
+ "/apps/annotation-reply/{action}/status/{job_id}": {
+ "get": {
+ "summary": "查询标注回复初始设置任务状态",
+ "description": "查询异步执行的标注回复初始设置任务的状态。",
+ "operationId": "getInitialAnnotationReplySettingsStatus",
+ "tags": ["标注管理"],
+ "parameters": [
+ { "$ref": "#/components/parameters/AnnotationActionPathParam" },
+ { "$ref": "#/components/parameters/JobIdPathParam" }
+ ],
+ "responses": {
+ "200": { "description": "成功获取任务状态。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AsyncJobStatusResponse" } } } }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "API_KEY",
+ "description": "API-Key 鉴权。所有 API 请求都应在 `Authorization` HTTP Header 中包含您的 API-Key,格式为 `Bearer {API_KEY}`。**强烈建议开发者把 API-Key 放在后端存储,而非分享或者放在客户端存储,以免 API-Key 泄露,导致财产损失。**"
+ }
+ },
+ "parameters": {
+ "PageQueryParam": { "name": "page", "in": "query", "description": "(可选)分页页码,默认:1。", "schema": { "type": "integer", "default": 1 } },
+ "LimitQueryParamDefault20": { "name": "limit", "in": "query", "description": "(可选)每页记录数,默认:20。", "schema": { "type": "integer", "default": 20 } },
+ "LimitQueryParamAnnotation": { "name": "limit", "in": "query", "description": "每页数量,默认 20,范围 1-100。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } },
+ "AnnotationIdPathParam": { "name": "annotation_id", "in": "path", "required": true, "description": "标注 ID。", "schema": { "type": "string", "format": "uuid" } },
+ "AnnotationActionPathParam": { "name": "action", "in": "path", "required": true, "description": "动作,只能是 'enable' 或 'disable'。", "schema": { "type": "string", "enum": ["enable", "disable"] } },
+ "JobIdPathParam": { "name": "job_id", "in": "path", "required": true, "description": "任务 ID,从标注回复初始设置接口返回。", "schema": { "type": "string", "format": "uuid" } }
+ },
+ "responses": {
+ "BadRequestCompletion": { "description": "错误的请求。可能原因:`invalid_param`(参数异常),`app_unavailable`(App 配置不可用),`provider_not_initialize`(无可用模型凭据),`provider_quota_exceeded`(额度不足),`model_currently_not_support`(模型不可用),`completion_request_error`(文本生成失败)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "BadRequestFile": { "description": "文件操作相关的错误请求。可能原因:`no_file_uploaded`,`too_many_files`,`unsupported_preview`,`unsupported_estimate`。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "ConversationNotFound": { "description": "对话不存在。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "FileTooLarge": { "description": "文件太大 (`file_too_large`)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "UnsupportedFileTypeFile": { "description": "不支持的文件类型 (`unsupported_file_type`)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "S3ErrorFile": { "description": "S3 存储服务错误。可能原因:`s3_connection_failed`,`s3_permission_denied`,`s3_file_too_large`。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "InternalServerError": { "description": "服务内部异常。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } },
+ "SuccessResult": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } }
+ },
+ "schemas": {
+ "CompletionRequest": {
+ "type": "object",
+ "required": ["inputs", "response_mode", "user"],
+ "properties": {
+ "inputs": {
+ "type": "object",
+ "description": "(选填)允许传入 App 定义的各变量值。inputs 参数包含了多组键值对,每组的键对应一个特定变量,值则是该变量的具体值。文本生成型应用要求至少传入一组键值对。",
+ "required": ["query"],
+ "properties": {
+ "query": { "type": "string", "description": "用户输入的文本内容。" }
+ },
+ "additionalProperties": true
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "description": "响应返回模式。`streaming`:流式模式(推荐),基于 SSE 实现打字机输出。`blocking`:阻塞模式,等待执行完毕后返回(长流程可能中断)。Cloudflare 限制为 100 秒超时。" },
+ "user": { "type": "string", "description": "用户标识,用于定义终端用户的身份,方便检索、统计。由开发者定义规则,需保证用户标识在应用内唯一。" },
+ "files": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/InputFileObject" },
+ "description": "上传的文件列表(目前仅支持图片)。"
+ }
+ }
+ },
+ "InputFileObject": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["image"], "description": "支持类型:图片 `image`。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式:`remote_url` (图片地址) 或 `local_file` (上传文件)。" },
+ "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 `remote_url` 时)。" },
+ "upload_file_id": { "type": "string", "description": "上传文件 ID(当传递方式为 `local_file` 时,需通过文件上传 API 预先获取)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "ChatCompletionResponse": {
+ "type": "object",
+ "description": "阻塞模式下的完整 App 结果。",
+ "properties": {
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "mode": { "type": "string", "description": "App 模式,固定为 `chat`。", "example": "chat" },
+ "answer": { "type": "string", "description": "完整回复内容。" },
+ "metadata": { "$ref": "#/components/schemas/ResponseMetadata" },
+ "created_at": { "type": "integer", "format": "int64", "description": "消息创建时间戳,如:1705395332。" }
+ }
+ },
+ "ResponseMetadata": {
+ "type": "object", "description": "元数据。",
+ "properties": {
+ "usage": { "$ref": "#/components/schemas/Usage" },
+ "retriever_resources": { "type": "array", "items": { "$ref": "#/components/schemas/RetrieverResource" }, "description": "引用和归属分段列表。" }
+ }
+ },
+ "ChunkEvent": {
+ "type": "object",
+ "description": "流式响应中的事件块结构。",
+ "required": ["event"],
+ "properties": {
+ "event": { "type": "string", "enum": ["message", "message_end", "tts_message", "tts_message_end", "message_replace", "error", "ping"], "description": "事件类型。" }
+ },
+ "discriminator": {
+ "propertyName": "event",
+ "mapping": {
+ "message": "#/components/schemas/StreamEventMessage",
+ "message_end": "#/components/schemas/StreamEventMessageEnd",
+ "tts_message": "#/components/schemas/StreamEventTtsMessage",
+ "tts_message_end": "#/components/schemas/StreamEventTtsMessageEnd",
+ "message_replace": "#/components/schemas/StreamEventMessageReplace",
+ "error": "#/components/schemas/StreamEventError",
+ "ping": "#/components/schemas/StreamEventPing"
+ }
+ }
+ },
+ "StreamEventBase": {
+ "type": "object",
+ "properties": {
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID,用于请求跟踪和停止响应接口。" },
+ "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳,如:1705395332。" }
+ }
+ },
+ "StreamEventMessage": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "LLM 返回文本块事件。", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "LLM 返回文本块内容。" } } }
+ ]
+ },
+ "StreamEventMessageEnd": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "消息结束事件。", "required": ["metadata"], "properties": { "metadata": { "$ref": "#/components/schemas/ResponseMetadata" } } }
+ ]
+ },
+ "StreamEventTtsMessage": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "TTS 音频流事件 (Mp3格式, Base64编码)。开启自动播放时可用。", "required": ["audio"], "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 编码的音频块。" } } }
+ ]
+ },
+ "StreamEventTtsMessageEnd": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "TTS 音频流结束事件。", "required": ["audio"], "properties": { "audio": { "type": "string", "description": "空字符串。" } } }
+ ]
+ },
+ "StreamEventMessageReplace": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "消息内容替换事件(内容审查触发)。", "required": ["answer"], "properties": { "answer": { "type": "string", "description": "替换内容(直接替换所有 LLM 回复)。" } } }
+ ]
+ },
+ "StreamEventError": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "$ref": "#/components/schemas/StreamEventBase" },
+ { "type": "object", "description": "流式输出过程中的异常事件。", "required": ["status", "code", "message"],
+ "properties": { "status": { "type": "integer", "description": "HTTP 状态码。" }, "code": { "type": "string", "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } }
+ }
+ ]
+ },
+ "StreamEventPing": {
+ "allOf": [ { "$ref": "#/components/schemas/ChunkEvent" }, { "type": "object", "description": "每 10s 一次的 ping 事件,保持连接存活。" } ]
+ },
+ "Usage": {
+ "type": "object", "description": "模型用量信息。",
+ "properties": { "prompt_tokens": { "type": "integer" }, "prompt_unit_price": { "type": "string" }, "prompt_price_unit": { "type": "string" }, "prompt_price": { "type": "string" }, "completion_tokens": { "type": "integer" }, "completion_unit_price": { "type": "string" }, "completion_price_unit": { "type": "string" }, "completion_price": { "type": "string" }, "total_tokens": { "type": "integer" }, "total_price": { "type": "string" }, "currency": { "type": "string" }, "latency": { "type": "number", "format": "double" } }
+ },
+ "RetrieverResource": {
+ "type": "object", "description": "引用和归属分段信息。",
+ "properties": { "position": { "type": "integer" }, "dataset_id": { "type": "string", "format": "uuid" }, "dataset_name": { "type": "string" }, "document_id": { "type": "string", "format": "uuid" }, "document_name": { "type": "string" }, "segment_id": { "type": "string", "format": "uuid" }, "score": { "type": "number", "format": "float" }, "content": { "type": "string" } }
+ },
+ "FileUploadResponse": {
+ "type": "object", "description": "文件上传成功后的响应。",
+ "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "文件名。" }, "size": { "type": "integer", "description": "文件大小(byte)。" }, "extension": { "type": "string", "description": "文件后缀。" }, "mime_type": { "type": "string", "description": "文件 mime-type。" }, "created_by": { "type": "string", "format": "uuid", "description": "上传人 ID (示例中为integer,规范为uuid)。" }, "created_at": { "type": "integer", "format": "int64", "description": "上传时间。" } }
+ },
+ "MessageFeedbackRequest": {
+ "type": "object", "required": ["user"], "description": "消息反馈请求体。",
+ "properties": { "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true, "description": "点赞 `like`, 点踩 `dislike`, 撤销 `null`。" }, "user": { "type": "string", "description": "用户标识,应用内唯一。" }, "content": { "type": "string", "nullable": true, "description": "消息反馈的具体信息。" } }
+ },
+ "AppFeedbacksResponse": {
+ "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/FeedbackItem" }, "description": "应用反馈列表。" } }
+ },
+ "FeedbackItem": {
+ "type": "object", "description": "单个反馈条目。",
+ "properties": { "id": { "type": "string", "format": "uuid" }, "app_id": { "type": "string", "format": "uuid" }, "conversation_id": { "type": "string", "format": "uuid", "nullable": true }, "message_id": { "type": "string", "format": "uuid" }, "rating": { "type": "string", "enum": ["like", "dislike", null], "nullable": true }, "content": { "type": "string", "nullable": true }, "from_source": { "type": "string" }, "from_end_user_id": { "type": "string", "format": "uuid" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }
+ },
+ "TextToAudioRequest": {
+ "type": "object", "required": ["user"], "description": "文字转语音请求体。",
+ "properties": { "message_id": { "type": "string", "format": "uuid", "description": "Dify 生成的消息 ID(优先使用)。" }, "text": { "type": "string", "description": "语音生成内容(若无 message_id)。" }, "user": { "type": "string", "description": "用户标识,应用内唯一。" }, "streaming": {"type": "boolean", "default": false, "description": "是否流式返回音频。"} },
+ "example": { "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "text": "你好Dify", "user": "abc-123", "streaming": false }
+ },
+ "AppInfoResponse": {
+ "type": "object", "description": "应用基本信息。",
+ "properties": { "name": { "type": "string", "description": "应用名称。" }, "description": { "type": "string", "description": "应用描述。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "应用标签。" } }
+ },
+ "AppParametersResponseCompletion": {
+ "type": "object", "description": "应用参数信息。",
+ "properties": {
+ "opening_statement": { "type": "string", "description": "开场白。", "example": "nice to meet you" },
+ "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "开场推荐问题列表。" },
+ "suggested_questions_after_answer": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启回答后推荐问题。" } } },
+ "speech_to_text": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启语音转文本。" } } },
+ "retriever_resource": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启引用和归属。" } } },
+ "annotation_reply": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "是否开启标记回复。" } } },
+ "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItem" }, "description": "用户输入表单配置。" },
+ "file_upload": { "$ref": "#/components/schemas/FileUploadSetting" },
+ "system_parameters": { "$ref": "#/components/schemas/SystemParameters" }
+ }
+ },
+ "UserInputFormItem": { "type": "object", "description": "用户输入表单中的一个控件。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapper" }, { "$ref": "#/components/schemas/ParagraphControlWrapper" }, { "$ref": "#/components/schemas/SelectControlWrapper" } ] },
+ "TextInputControlWrapper": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControl" } }, "required":["text-input"] },
+ "ParagraphControlWrapper": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControl" } }, "required":["paragraph"] },
+ "SelectControlWrapper": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControl" } }, "required":["select"] },
+ "TextInputControl": { "type": "object", "description": "文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "description": "默认值。" }, "max_length": {"type": "integer", "description": "最大长度 (来自示例)。", "nullable": true} } },
+ "ParagraphControl": { "type": "object", "description": "段落文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "description": "默认值。" } } },
+ "SelectControl": { "type": "object", "description": "下拉控件。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "description": "默认值。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "选项值。" } } },
+ "FileUploadSetting": {
+ "type": "object", "description": "文件上传配置。",
+ "properties": { "image": { "type": "object", "description": "图片设置。当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。", "properties": { "enabled": { "type": "boolean", "description": "是否开启。" }, "number_limits": { "type": "integer", "description": "图片数量限制,默认 3。" }, "detail": {"type": "string", "description": "图片细节 (来自示例)。", "nullable": true}, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] }, "description": "传递方式列表,remote_url , local_file,必选一个。" } } } }
+ },
+ "SystemParameters": {
+ "type": "object", "description": "系统参数。",
+ "properties": { "file_size_limit": { "type": "integer", "description": "文档上传大小限制 (MB)。" }, "image_file_size_limit": { "type": "integer", "description": "图片文件上传大小限制(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "音频文件上传大小限制 (MB)。" }, "video_file_size_limit": { "type": "integer", "description": "视频文件上传大小限制 (MB)。" } }
+ },
+ "WebAppSettingsResponse": {
+ "type": "object", "description": "应用的 WebApp 设置。",
+ "properties": { "title": { "type": "string", "description": "WebApp 名称。" }, "chat_color_theme": { "type": "string", "description": "聊天颜色主题, hex 格式。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "聊天颜色主题是否反转。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "图标类型, `emoji`-表情, `image`-图片。" }, "icon": { "type": "string", "description": "图标, emoji 或图片 URL。" }, "icon_background": { "type": "string", "description": "hex 格式的背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "图标 URL。" }, "description": { "type": "string", "description": "描述。" }, "copyright": { "type": "string", "description": "版权信息。" }, "privacy_policy": { "type": "string", "description": "隐私政策链接。" }, "custom_disclaimer": { "type": "string", "description": "自定义免责声明。" }, "default_language": { "type": "string", "description": "默认语言。" }, "show_workflow_steps": { "type": "boolean", "description": "是否显示工作流详情。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "是否使用 WebApp 图标替换聊天中的 机器人图标。" } }
+ },
+ "AnnotationListResponse": {
+ "type": "object", "description": "标注列表响应。",
+ "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AnnotationItem" } }, "has_more": { "type": "boolean" }, "limit": { "type": "integer" }, "total": { "type": "integer" }, "page": { "type": "integer" } }
+ },
+ "AnnotationItem": {
+ "type": "object", "description": "单个标注条目。",
+ "properties": { "id": { "type": "string", "format": "uuid" }, "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" }, "hit_count": { "type": "integer", "description": "命中次数。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" } }
+ },
+ "CreateAnnotationRequest": {
+ "type": "object", "required": ["question", "answer"], "description": "创建标注请求体。",
+ "properties": { "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" } }
+ },
+ "UpdateAnnotationRequest": {
+ "type": "object", "required": ["question", "answer"], "description": "更新标注请求体。",
+ "properties": { "question": { "type": "string", "description": "问题。" }, "answer": { "type": "string", "description": "答案内容。" } }
+ },
+ "InitialAnnotationReplySettingsRequest": {
+ "type": "object", "required": ["score_threshold"], "description": "标注回复初始设置请求体。",
+ "properties": { "embedding_provider_name": { "type": "string", "nullable": true, "description": "(可选)指定的嵌入模型提供商名称。" }, "embedding_model_name": { "type": "string", "nullable": true, "description": "(可选)指定的嵌入模型名称。" }, "score_threshold": { "type": "number", "format": "float", "description": "相似度阈值。" } }
+ },
+ "AsyncJobResponse": {
+ "type": "object", "description": "异步任务响应。",
+ "properties": { "job_id": { "type": "string", "format": "uuid", "description": "任务 ID。" }, "job_status": { "type": "string", "description": "任务状态。" } }
+ },
+ "AsyncJobStatusResponse": {
+ "allOf": [ { "$ref": "#/components/schemas/AsyncJobResponse" }, { "type": "object", "properties": { "error_msg": { "type": "string", "nullable": true, "description": "错误信息(如果任务失败)。" } } } ]
+ },
+ "ErrorResponse": {
+ "type": "object", "description": "错误响应结构。",
+ "properties": { "status": { "type": "integer", "description": "HTTP 状态码。", "nullable": true }, "code": { "type": "string", "description": "错误码。", "nullable": true }, "message": { "type": "string", "description": "错误消息。" } }
+ }
+ }
+ },
+ "tags": [
+ { "name": "文本生成", "description": "与文本生成和完成相关的操作。" },
+ { "name": "文件管理", "description": "与文件上传和管理相关的操作。" },
+ { "name": "反馈", "description": "与用户反馈相关的操作。" },
+ { "name": "语音服务", "description": "与文本转语音相关的操作。" },
+ { "name": "应用设置", "description": "获取应用基本信息和参数配置的操作。" },
+ { "name": "标注管理", "description": "与标注(用于直接回复)相关的操作。" }
+ ]
+}
\ No newline at end of file
diff --git a/zh-hans/openapi_workflow.json b/zh-hans/openapi_workflow.json
new file mode 100644
index 00000000..4d265375
--- /dev/null
+++ b/zh-hans/openapi_workflow.json
@@ -0,0 +1,384 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "Workflow 应用 API",
+ "description": "Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等等。",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "{api_base_url}",
+ "description": "API 的基础 URL。请将 {api_base_url} 替换为您的应用提供的实际 API 基础 URL。",
+ "variables": {
+ "api_base_url": {
+ "default": "https://example.com/api/v1",
+ "description": "实际的 API 基础 URL"
+ }
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "paths": {
+ "/workflows/run": {
+ "post": {
+ "summary": "执行 workflow",
+ "description": "执行 workflow,没有已发布的 workflow,不可执行。",
+ "operationId": "executeWorkflowCn",
+ "tags": ["工作流执行"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowExecutionRequestCn"
+ },
+ "examples": {
+ "basic_execution_cn": {
+ "summary": "基础工作流执行示例",
+ "value": {
+ "inputs": {
+ "query": "请总结这段文字:..."
+ },
+ "response_mode": "streaming",
+ "user": "workflow_user_001"
+ }
+ },
+ "with_file_array_variable_cn":{
+ "summary": "包含文件列表变量的输入示例",
+ "value": {
+ "inputs": {
+ "my_documents": [
+ {
+ "type": "document",
+ "transfer_method": "local_file",
+ "upload_file_id": "已上传的文件ID_abc"
+ },
+ {
+ "type": "image",
+ "transfer_method": "remote_url",
+ "url": "https://example.com/image.jpg"
+ }
+ ]
+ },
+ "response_mode": "blocking",
+ "user": "workflow_user_002"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "工作流执行成功。响应结构取决于 `response_mode`。\n- `blocking`: `application/json` 格式,包含 `WorkflowCompletionResponseCn` 对象。\n- `streaming`: `text/event-stream` 格式,包含 `ChunkWorkflowEventCn` 事件流。",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorkflowCompletionResponseCn"
+ }
+ },
+ "text/event-stream": {
+ "schema": {
+ "type": "string",
+ "description": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkWorkflowEventCn`。"
+ }
+ }
+ }
+ },
+ "400": { "$ref": "#/components/responses/BadRequestWorkflowCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/workflows/run/{workflow_run_id}": {
+ "get": {
+ "summary": "获取workflow执行情况",
+ "description": "根据 workflow 执行 ID 获取 workflow 任务当前执行结果。",
+ "operationId": "getWorkflowRunDetailCn",
+ "tags": ["工作流执行"],
+ "parameters": [
+ {
+ "name": "workflow_run_id",
+ "in": "path",
+ "required": true,
+ "description": "workflow 执行 ID,可在流式返回 Chunk 或阻塞模式响应中获取。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "成功获取 workflow 执行详情。",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponseCn" }
+ }
+ }
+ },
+ "404": {"description": "Workflow 执行记录未找到。"}
+ }
+ }
+ },
+ "/workflows/tasks/{task_id}/stop": {
+ "post": {
+ "summary": "停止响应 (Workflow Task)",
+ "description": "停止 workflow 任务的生成。仅支持流式模式。",
+ "operationId": "stopWorkflowTaskGenerationCn",
+ "tags": ["工作流执行"],
+ "parameters": [
+ {
+ "name": "task_id",
+ "in": "path",
+ "required": true,
+ "description": "任务 ID,可在流式返回 Chunk 中获取。",
+ "schema": { "type": "string", "format": "uuid" }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": ["user"],
+ "properties": {
+ "user": { "type": "string", "description": "用户标识,必须和执行 workflow 接口传入的 user 保持一致。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "$ref": "#/components/responses/SuccessResultCn" }
+ }
+ }
+ },
+ "/files/upload": {
+ "post": {
+ "summary": "上传文件 (Workflow)",
+ "description": "上传文件并在执行 workflow 时使用。支持您的工作流程所支持的任何格式。上传的文件仅供当前终端用户使用。",
+ "operationId": "uploadWorkflowFileCn",
+ "tags": ["文件操作 (Workflow)"],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": ["file", "user"],
+ "properties": {
+ "file": { "type": "string", "format": "binary", "description": "要上传的文件。" },
+ "user": { "type": "string", "description": "用户标识。" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": { "description": "文件上传成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } } },
+ "201": { "description": "文件创建成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } } },
+ "400": { "$ref": "#/components/responses/BadRequestFileCn" },
+ "413": { "$ref": "#/components/responses/FileTooLargeCn" },
+ "415": { "$ref": "#/components/responses/UnsupportedFileTypeFileCn" },
+ "503": { "$ref": "#/components/responses/S3ErrorFileCn" },
+ "500": { "$ref": "#/components/responses/InternalServerErrorCn" }
+ }
+ }
+ },
+ "/workflows/logs": {
+ "get": {
+ "summary": "获取 workflow 日志",
+ "description": "倒序返回 workflow 日志。",
+ "operationId": "getWorkflowLogsCn",
+ "tags": ["工作流执行"],
+ "parameters": [
+ { "name": "keyword", "in": "query", "description": "(可选)关键字。", "schema": { "type": "string" } },
+ { "name": "status", "in": "query", "description": "(可选)执行状态:succeeded, failed, stopped, running。", "schema": { "type": "string", "enum": ["succeeded", "failed", "stopped", "running"] } },
+ { "name": "page", "in": "query", "description": "(可选)当前页码, 默认1。", "schema": { "type": "integer", "default": 1 } },
+ { "name": "limit", "in": "query", "description": "(可选)每页条数, 默认20。", "schema": { "type": "integer", "default": 20 } }
+ ],
+ "responses": {
+ "200": { "description": "成功获取 workflow 日志。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowLogsResponseCn" } } } }
+ }
+ }
+ },
+ "/info": {
+ "get": {
+ "summary": "获取应用基本信息 (Workflow)",
+ "operationId": "getWorkflowAppInfoCn",
+ "tags": ["应用配置 (Workflow)"],
+ "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } }
+ }
+ },
+ "/parameters": {
+ "get": {
+ "summary": "获取应用参数 (Workflow)",
+ "operationId": "getWorkflowAppParametersCn",
+ "tags": ["应用配置 (Workflow)"],
+ "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowAppParametersResponseCn" } } } } }
+ }
+ },
+ "/site": {
+ "get": {
+ "summary": "获取应用 WebApp 设置 (Workflow)",
+ "operationId": "getWorkflowWebAppSettingsCn",
+ "tags": ["应用配置 (Workflow)"],
+ "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowWebAppSettingsResponseCn" } } } } }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含您的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。" }
+ },
+ "responses": {
+ "BadRequestWorkflowCn": { "description": "请求参数错误或工作流执行失败。可能错误码:invalid_param, app_unavailable, provider_not_initialize, provider_quota_exceeded, model_currently_not_support, workflow_request_error。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "BadRequestFileCn": { "description": "文件操作请求错误。可能错误码:no_file_uploaded, too_many_files, unsupported_preview, unsupported_estimate。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "FileTooLargeCn": { "description": "文件太大 (file_too_large)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "UnsupportedFileTypeFileCn": { "description": "不支持的文件类型 (unsupported_file_type)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "S3ErrorFileCn": { "description": "S3 存储服务错误。可能错误码:s3_connection_failed, s3_permission_denied, s3_file_too_large。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "InternalServerErrorCn": { "description": "服务内部异常。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } },
+ "SuccessResultCn": { "description": "操作成功。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } } } } }
+ },
+ "schemas": {
+ "WorkflowExecutionRequestCn": {
+ "type": "object",
+ "required": ["inputs", "response_mode", "user"],
+ "properties": {
+ "inputs": {
+ "type": "object",
+ "description": "允许传入 App 定义的各变量值。如果变量是文件列表类型,该变量对应的值应是 InputFileObjectWorkflowCn 对象的列表。",
+ "additionalProperties": {
+ "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" }, { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectWorkflowCn" } } ]
+ },
+ "example": { "user_query": "请帮我翻译这句话。", "target_language": "法语" }
+ },
+ "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "description": "返回响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制)。" },
+ "user": { "type": "string", "description": "用户标识,应用内唯一。" }
+ }
+ },
+ "InputFileObjectWorkflowCn": {
+ "type": "object",
+ "required": ["type", "transfer_method"],
+ "properties": {
+ "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "文件类型。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: 其他。" },
+ "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" },
+ "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" },
+ "upload_file_id": { "type": "string", "format": "uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" }
+ },
+ "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ]
+ },
+ "WorkflowCompletionResponseCn": {
+ "type": "object", "description": "阻塞模式下的 workflow 执行结果。",
+ "properties": {
+ "workflow_run_id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" },
+ "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" },
+ "data": { "$ref": "#/components/schemas/WorkflowFinishedDataCn" }
+ }
+ },
+ "ChunkWorkflowEventCn": {
+ "type": "object", "required": ["event"],
+ "properties": { "event": { "type": "string", "enum": ["workflow_started", "node_started", "text_chunk", "node_finished", "workflow_finished", "tts_message", "tts_message_end", "ping"], "description": "事件类型。" } },
+ "discriminator": { "propertyName": "event", "mapping": {
+ "workflow_started": "#/components/schemas/StreamEventWfWorkflowStartedCn", "node_started": "#/components/schemas/StreamEventWfNodeStartedCn",
+ "text_chunk": "#/components/schemas/StreamEventWfTextChunkCn", "node_finished": "#/components/schemas/StreamEventWfNodeFinishedCn",
+ "workflow_finished": "#/components/schemas/StreamEventWfWorkflowFinishedCn", "tts_message": "#/components/schemas/StreamEventWfTtsMessageCn",
+ "tts_message_end": "#/components/schemas/StreamEventWfTtsMessageEndCn", "ping": "#/components/schemas/StreamEventWfPingCn"
+ }}
+ },
+ "StreamEventBaseWfCn": {
+ "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "任务 ID。" }, "workflow_run_id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" } }
+ },
+ "StreamEventWfWorkflowStartedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowStartedDataCn" } } } ] },
+ "WorkflowStartedDataCn": { "type": "object", "description": "Workflow 开始执行事件的详细内容。", "required": ["id", "workflow_id", "sequence_number", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "关联 Workflow ID。" }, "sequence_number": { "type": "integer", "description": "自增序号,App 内自增,从 1 开始。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "StreamEventWfNodeStartedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeStartedDataCn" } } } ] },
+ "NodeStartedDataCn": { "type": "object", "description": "Node 开始执行事件的详细内容。", "required": ["id", "node_id", "node_type", "title", "index", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID (应为 node 执行 ID,根据上下文修正)。" }, "node_id": { "type": "string", "format": "uuid", "description": "节点 ID。" }, "node_type": { "type": "string", "description": "节点类型。" }, "title": { "type": "string", "description": "节点名称。" }, "index": { "type": "integer", "description": "执行序号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "前置节点 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "节点中所有使用到的前置节点变量内容。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "StreamEventWfTextChunkCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/TextChunkDataCn" } } } ] },
+ "TextChunkDataCn": { "type": "object", "description": "文本片段事件的详细内容。", "required": ["text", "from_variable_selector"], "properties": { "text": { "type": "string", "description": "文本内容。" }, "from_variable_selector": { "type": "array", "items": { "type": "string" }, "description": "文本来源路径,帮助开发者了解文本是由哪个节点的哪个变量生成的。" } } },
+ "StreamEventWfNodeFinishedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/NodeFinishedDataCn" } } } ] },
+ "NodeFinishedDataCn": { "type": "object", "description": "Node 执行结束事件的详细内容。", "required": ["id", "node_id", "index", "status", "created_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "node 执行 ID。" }, "node_id": { "type": "string", "format": "uuid", "description": "节点 ID。" }, "index": { "type": "integer", "description": "执行序号。" }, "predecessor_node_id": { "type": "string", "format": "uuid", "nullable": true, "description": "(可选)前置节点 ID。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "节点中所有使用到的前置节点变量内容。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)节点过程数据 (JSON)。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)输出内容 (JSON)。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" }, "error": { "type": "string", "nullable": true, "description": "(可选)错误原因。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(可选)耗时(秒)。" }, "execution_metadata": { "$ref": "#/components/schemas/NodeExecutionMetadataCn" , "nullable": true, "description":"元数据"}, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" } } },
+ "NodeExecutionMetadataCn": { "type": "object", "description": "节点执行元数据。", "properties": { "total_tokens": { "type": "integer", "nullable": true, "description": "(可选)总使用 tokens。" }, "total_price": { "type": "number", "format": "float", "nullable": true, "description": "(可选)总费用 (使用 float 兼容 decimal)。" }, "currency": { "type": "string", "nullable": true, "example": "USD", "description": "(可选)货币,如 USD / RMB。" } } },
+ "StreamEventWfWorkflowFinishedCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/WorkflowFinishedDataCn" } } } ] },
+ "WorkflowFinishedDataCn": { "type": "object", "description": "Workflow 执行结束事件的详细内容。", "required": ["id", "workflow_id", "status", "created_at", "finished_at"], "properties": { "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "关联 Workflow ID。" }, "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "(可选)输出内容 (JSON)。" }, "error": { "type": "string", "nullable": true, "description": "(可选)错误原因。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "(可选)耗时(秒)。" }, "total_tokens": { "type": "integer", "nullable": true, "description": "(可选)总使用 tokens。" }, "total_steps": { "type": "integer", "default": 0, "description": "总步数,默认 0。" }, "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" }, "finished_at": { "type": "integer", "format": "int64", "description": "结束时间。" } } },
+ "StreamEventWfTtsMessageCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string", "format": "byte", "description": "语音合成之后的音频块 Base64 编码文本。" }, "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" } } } ] },
+ "StreamEventWfTtsMessageEndCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "$ref": "#/components/schemas/StreamEventBaseWfCn" }, { "type": "object", "required": ["audio", "message_id", "created_at"], "properties": { "audio": { "type": "string", "description": "结束事件音频为空字符串。" }, "message_id": { "type": "string", "format": "uuid", "description": "消息唯一 ID。" }, "created_at": { "type": "integer", "format": "int64", "description": "创建时间戳。" } } } ] },
+ "StreamEventWfPingCn": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEventCn" }, { "type": "object", "description": "每 10s 一次的 ping 事件,保持连接存活。" } ] },
+ "WorkflowRunDetailResponseCn": {
+ "type": "object", "description": "Workflow 执行详情。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "workflow 执行 ID。" },
+ "workflow_id": { "type": "string", "format": "uuid", "description": "关联的 Workflow ID。" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" },
+ "inputs": { "type": "string", "description": "任务输入内容的 JSON 字符串。" },
+ "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "任务输出内容的 JSON 对象。" },
+ "error": { "type": "string", "nullable": true, "description": "错误原因。" },
+ "total_steps": { "type": "integer", "description": "任务执行总步数。" },
+ "total_tokens": { "type": "integer", "description": "任务执行总 tokens。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "任务开始时间。" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "任务结束时间。" },
+ "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "耗时(秒)。" }
+ }
+ },
+ "FileUploadResponseCn": { "type": "object", "description": "文件上传成功响应。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ID。" }, "name": { "type": "string", "description": "文件名。" }, "size": { "type": "integer", "description": "文件大小 (byte)。" }, "extension": { "type": "string", "description": "文件后缀。" }, "mime_type": { "type": "string", "description": "文件 mime-type。" }, "created_by": { "type": "string", "format": "uuid", "description": "上传人 ID (应为 uuid,示例中为 int,已修正)。" }, "created_at": { "type": "integer", "format": "int64", "description": "上传时间。" } } },
+ "WorkflowLogsResponseCn": {
+ "type": "object", "description": "Workflow 日志列表响应。",
+ "properties": {
+ "page": { "type": "integer", "description": "当前页码。" }, "limit": { "type": "integer", "description": "每页条数。" },
+ "total": { "type": "integer", "description": "总条数。" }, "has_more": { "type": "boolean", "description": "是否还有更多数据。" },
+ "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowLogItemCn" }, "description": "当前页码的数据。" }
+ }
+ },
+ "WorkflowLogItemCn": {
+ "type": "object", "description": "单条 Workflow 日志。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "标识。" },
+ "workflow_run": { "$ref": "#/components/schemas/WorkflowRunSummaryCn", "description": "Workflow 执行日志。" },
+ "created_from": { "type": "string", "description": "来源。" },
+ "created_by_role": { "type": "string", "description": "角色。" },
+ "created_by_account": { "type": "string", "format": "uuid", "nullable": true, "description": "(可选)帐号。" },
+ "created_by_end_user": { "$ref": "#/components/schemas/EndUserSummaryCn", "description": "用户。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "创建时间。" }
+ }
+ },
+ "WorkflowRunSummaryCn": {
+ "type": "object", "description": "Workflow 执行摘要信息。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "标识。" }, "version": { "type": "string", "description": "版本。" },
+ "status": { "type": "string", "enum": ["running", "succeeded", "failed", "stopped"], "description": "执行状态。" },
+ "error": { "type": "string", "nullable": true, "description": "(可选)错误。" },
+ "elapsed_time": { "type": "number", "format": "float", "description": "耗时,单位秒。" },
+ "total_tokens": { "type": "integer", "description": "消耗的token数量。" },
+ "total_steps": { "type": "integer", "description": "执行步骤长度。" },
+ "created_at": { "type": "integer", "format": "int64", "description": "开始时间。" },
+ "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "结束时间。" }
+ }
+ },
+ "EndUserSummaryCn": {
+ "type": "object", "description": "终端用户信息摘要。",
+ "properties": {
+ "id": { "type": "string", "format": "uuid", "description": "标识。" }, "type": { "type": "string", "description": "类型。" },
+ "is_anonymous": { "type": "boolean", "description": "是否匿名。" }, "session_id": { "type": "string", "description": "会话标识。" }
+ }
+ },
+ "AppInfoResponseCn": { "type": "object", "description": "应用基本信息。", "properties": { "name": { "type": "string", "description": "应用名称。" }, "description": { "type": "string", "description": "应用描述。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "应用标签。" } } },
+ "WorkflowAppParametersResponseCn": { "type": "object", "description": "Workflow 应用参数信息。", "properties": { "user_input_form": { "type": "array", "items": { "$ref": "#/components/schemas/UserInputFormItemCn" }, "description": "用户输入表单配置。" }, "file_upload": { "type": "object", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "number_limits": { "type": "integer" }, "detail": { "type": "string" }, "transfer_methods": { "type": "array", "items": { "type": "string", "enum": ["remote_url", "local_file"] } } }, "description": "图片设置。当前仅支持图片类型:png, jpg, jpeg, webp, gif。" } }, "description": "文件上传配置。" }, "system_parameters": { "type": "object", "properties": { "file_size_limit": { "type": "integer", "description": "文档上传大小限制 (MB)。" }, "image_file_size_limit": { "type": "integer", "description": "图片文件上传大小限制(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "音频文件上传大小限制 (MB)。" }, "video_file_size_limit": { "type": "integer", "description": "视频文件上传大小限制 (MB)。" } }, "description": "系统参数。" } } },
+ "UserInputFormItemCn": { "type": "object", "description": "用户输入表单中的控件项。", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapperCn" }, { "$ref": "#/components/schemas/ParagraphControlWrapperCn" }, { "$ref": "#/components/schemas/SelectControlWrapperCn" } ] },
+ "TextInputControlWrapperCn": { "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControlCn" } }, "required":["text-input"] },
+ "ParagraphControlWrapperCn": { "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControlCn" } }, "required":["paragraph"] },
+ "SelectControlWrapperCn": { "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControlCn" } }, "required":["select"] },
+ "TextInputControlCn": { "type": "object", "description": "文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "ParagraphControlCn": { "type": "object", "description": "段落文本输入控件。", "required": ["label", "variable", "required"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" } } },
+ "SelectControlCn": { "type": "object", "description": "下拉控件。", "required": ["label", "variable", "required", "options"], "properties": { "label": { "type": "string", "description": "控件展示标签名。" }, "variable": { "type": "string", "description": "控件 ID。" }, "required": { "type": "boolean", "description": "是否必填。" }, "default": { "type": "string", "nullable": true, "description": "默认值。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "选项值。" } } },
+ "WorkflowWebAppSettingsResponseCn": { "type": "object", "description": "Workflow 应用 WebApp 设置。", "properties": { "title": { "type": "string", "description": "WebApp 名称。" }, "icon_type": { "type": "string", "enum": ["emoji", "image"], "description": "图标类型。" }, "icon": { "type": "string", "description": "图标内容 (emoji 或图片 URL)。" }, "icon_background": { "type": "string", "description": "hex 格式的背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "图标 URL。" }, "description": { "type": "string", "description": "描述。" }, "copyright": { "type": "string", "description": "版权信息。" }, "privacy_policy": { "type": "string", "description": "隐私政策链接。" }, "custom_disclaimer": { "type": "string", "description": "自定义免责声明。" }, "default_language": { "type": "string", "description": "默认语言。" }, "show_workflow_steps": { "type": "boolean", "description": "是否显示工作流详情。" } } },
+ "ErrorResponseCn": { "type": "object", "description": "错误响应。", "properties": { "status": { "type": "integer", "nullable": true, "description": "HTTP 状态码。" }, "code": { "type": "string", "nullable": true, "description": "错误码。" }, "message": { "type": "string", "description": "错误消息。" } } }
+ }
+ },
+ "tags": [
+ { "name": "工作流执行", "description": "与执行和管理工作流相关的操作。" },
+ { "name": "文件操作 (Workflow)", "description": "特定于工作流的文件上传操作。" },
+ { "name": "应用配置 (Workflow)", "description": "工作流应用的应用设置和信息。" }
+ ]
+}
\ No newline at end of file