diff --git a/ja/api-reference/openapi_chat.json b/ja/api-reference/openapi_chat.json index ee41edfa1..7b1930041 100644 --- a/ja/api-reference/openapi_chat.json +++ b/ja/api-reference/openapi_chat.json @@ -1,18 +1,18 @@ { "openapi": "3.0.1", "info": { - "title": "チャットアプリAPI", - "description": "チャットアプリケーションはセッションの持続性をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これは、チャットボットやカスタマーサービスAIなどに適用できます。", + "title": "チャットアプリ API", + "description": "チャットアプリケーションはセッションの永続化をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これはチャットボット、カスタマーサービス AI などに適用できます。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "APIのベースURL。{api_base_url}をアプリケーション提供の実際のAPIベースURLに置き換えてください。", + "description": "チャットアプリ API のベース URL。{api_base_url} を、アプリケーション用に提供された実際の API ベース URL(例:props.appDetail.api_base_url から取得)に置き換えてください。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "実際のAPIベースURL" + "description": "API の実際のベース URL" } } } @@ -27,26 +27,26 @@ "post": { "summary": "チャットメッセージを送信", "description": "チャットアプリケーションにリクエストを送信します。", - "operationId": "sendBasicChatMessageJa", - "tags": ["チャットメッセージ"], + "operationId": "sendChatMessage", + "tags": [ + "Chat" + ], "requestBody": { - "description": "チャットメッセージ送信リクエストボディ。", + "description": "チャットメッセージを送信するためのリクエストボディ。", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BasicChatRequestJa" + "$ref": "#/components/schemas/ChatRequest" }, "examples": { - "streaming_with_file_ja": { - "summary": "ファイルとカスタム入力を含むストリーミングリクエストの例", + "streaming_example": { + "summary": "ファイル付きストリーミングモードの例", "value": { - "inputs": { - "name": "dify" - }, - "query": "iPhone 13 Pro Maxの仕様は何ですか?", + "inputs": {}, + "query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "streaming", - "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", + "conversation_id": "", "user": "abc-123", "files": [ { @@ -63,101 +63,224 @@ }, "responses": { "200": { - "description": "リクエスト成功。応答のコンテンツタイプと構造はリクエストの`response_mode`パラメータに依存します。\n- `response_mode`が`blocking`の場合、`application/json`形式の`ChatCompletionResponseJa`オブジェクトを返します。\n- `response_mode`が`streaming`の場合、`text/event-stream`形式の`ChunkBasicChatEventJa`オブジェクトストリームを返します。", + "description": "成功レスポンス。コンテンツタイプと構造は、リクエストの `response_mode` パラメータによって異なります。\n- `response_mode` が `blocking` の場合、`ChatCompletionResponse` オブジェクトを含む `application/json` を返します。\n- `response_mode` が `streaming` の場合、`ChunkChatEvent` オブジェクトのストリームを含む `text/event-stream` を返します。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatCompletionResponseJa" + "$ref": "#/components/schemas/ChatCompletionResponse" + }, + "examples": { + "blockingResponse": { + "summary": "ブロッキングモードレスポンスの例", + "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": "SSEイベントストリーム。各イベントは'data: 'で始まり、'\\n\\n'で終わります。詳細な構造は`ChunkBasicChatEventJa`を参照してください。" + "description": "Server-Sent Events のストリーム。各イベントは 'data: ' で始まり '\\n\\n' で終わる JSON オブジェクトです。可能なイベント構造については `ChunkChatEvent` を参照してください。" + }, + "examples": { + "streamingResponseBasic": { + "summary": "ストリーミングモードレスポンスの例(基本アシスタント)", + "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": "ストリーミングモードレスポンスの例(agent_thought と 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。可能なエラーコード:\n- `invalid_param`: パラメータ入力が異常です。\n- `app_unavailable`: アプリ設定が利用できません。\n- `provider_not_initialize`: 利用可能なモデル認証情報の設定がありません。\n- `provider_quota_exceeded`: モデル呼び出しクォータが不足しています。\n- `model_currently_not_support`: 現在のモデルが利用できません。\n- `completion_request_error`: テキスト生成に失敗しました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "会話が存在しません。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "400": { "$ref": "#/components/responses/BadRequestGenericJa" }, - "404": { "$ref": "#/components/responses/ConversationNotFoundJa" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJa" } + "500": { + "description": "内部サーバーエラー。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } } } }, "/files/upload": { "post": { "summary": "ファイルアップロード", - "description": "メッセージ送信時に使用するためのファイルをアップロードします(現在は画像のみサポート)。画像とテキストのマルチモーダル理解を可能にします。png、jpg、jpeg、webp、gif形式をサポートしています。アップロードされたファイルは現在のエンドユーザーのみが使用できます。", - "operationId": "uploadBasicChatFileJa", - "tags": ["ファイル操作"], + "description": "メッセージ送信時に使用するファイル(現在は画像のみサポート)をアップロードし、画像とテキストのマルチモーダル理解を可能にします。png、jpg、jpeg、webp、gif 形式をサポートしています。アップロードされたファイルは現在のエンドユーザーのみが使用できます。", + "operationId": "uploadChatFile", + "tags": [ + "Files" + ], "requestBody": { - "description": "ファイルアップロードリクエスト。`multipart/form-data`リクエストが必要です。", + "description": "ファイルアップロードリクエスト。multipart/form-data が必要です。", "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { - "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。" }, - "user": { "type": "string", "description": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致している必要があります。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" } + "file": { + "type": "string", + "format": "binary", + "description": "アップロードするファイル。サポートされている画像タイプ:png、jpg、jpeg、webp、gif。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子、開発者のルールで定義され、アプリケーション内で一意である必要があります。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。" + } } } } } }, "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" } + "200": { + "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" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { - "summary": "エンドユーザー取得", - "description": "IDでエンドユーザーを取得します。\n\n他のAPIがエンドユーザーID(例:ファイルアップロードの `created_by`)を返す場合に利用できます。", - "operationId": "getEndUserChatJa", - "tags": ["エンドユーザー"], + "summary": "エンドユーザーを取得", + "description": "ID でエンドユーザーを取得します。\nこれは、他の API がエンドユーザー ID を返す場合(例:ファイルアップロードの `created_by`)に便利です。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, - "description": "エンドユーザーID。", - "schema": { "type": "string", "format": "uuid" } + "description": "エンドユーザー ID。", + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { "200": { - "description": "エンドユーザーの取得に成功しました。", + "description": "エンドユーザーが正常に取得されました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailJa" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundJa" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJa" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/{file_id}/preview": { "get": { "summary": "ファイルプレビュー", - "description": "アップロードされたファイルのプレビューまたはダウンロード。このエンドポイントは、ファイルアップロードAPIを通じて事前にアップロードされたファイルにアクセスすることができます。ファイルは、リクエストしているアプリケーション内のメッセージに属している場合のみアクセス可能です。", - "operationId": "previewBasicChatFileJa", - "tags": ["ファイル操作"], + "description": "アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントでは、ファイルアップロード API を介して以前にアップロードされたファイルにアクセスできます。ファイルは、リクエストしているアプリケーション内のメッセージに属している場合にのみアクセスできます。", + "operationId": "previewChatFile", + "tags": [ + "Files" + ], "parameters": [ { "name": "file_id", "in": "path", "required": true, - "description": "プレビューするファイルの一意識別子、ファイルアップロードAPIのレスポンスから取得されます。", + "description": "プレビューするファイルの一意識別子。ファイルアップロード API レスポンスから取得します。", "schema": { "type": "string", "format": "uuid" @@ -167,7 +290,7 @@ "name": "as_attachment", "in": "query", "required": false, - "description": "ファイルを添付ファイルとして強制ダウンロードするかどうか。デフォルトは`false`(ブラウザでプレビュー)です。", + "description": "ファイルを添付ファイルとして強制的にダウンロードするかどうか。デフォルトは `false`(ブラウザでプレビュー)。", "schema": { "type": "boolean", "default": false @@ -211,7 +334,7 @@ }, "headers": { "Content-Type": { - "description": "ファイルのMIMEタイプ", + "description": "ファイルの MIME タイプ", "schema": { "type": "string" } @@ -223,20 +346,20 @@ } }, "Content-Disposition": { - "description": "as_attachment=trueの場合、'attachment'に設定されます", + "description": "as_attachment=true の場合 'attachment' に設定", "schema": { "type": "string" } }, "Cache-Control": { - "description": "パフォーマンス用キャッシュヘッダー", + "description": "パフォーマンス用のキャッシュヘッダー", "schema": { "type": "string", "example": "public, max-age=3600" } }, "Accept-Ranges": { - "description": "オーディオ/ビデオファイルの場合は'bytes'に設定されます", + "description": "オーディオ/ビデオファイルの場合 'bytes' に設定", "schema": { "type": "string", "example": "bytes" @@ -245,26 +368,32 @@ } }, "400": { - "description": "不正なリクエスト。可能なエラーコード:\n- `invalid_param`: 異常なパラメータ入力。", + "description": "Bad Request。可能なエラーコード:\n- `invalid_param`: パラメータ入力が異常です。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "403": { - "description": "禁止。可能なエラーコード:\n- `file_access_denied`: ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません。", + "description": "Forbidden。可能なエラーコード:\n- `file_access_denied`: ファイルアクセスが拒否されたか、ファイルが現在のアプリケーションに属していません。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "404": { - "description": "見つかりません。可能なエラーコード:\n- `file_not_found`: ファイルが見つからないか削除されています。", + "description": "Not Found。可能なエラーコード:\n- `file_not_found`: ファイルが見つからないか、削除されています。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, @@ -272,7 +401,9 @@ "description": "内部サーバーエラー。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJa" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } } @@ -281,356 +412,2634 @@ }, "/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": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致している必要があります。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" } } } } } }, - "responses": { "200": { "$ref": "#/components/responses/SuccessResultJa" } } + "summary": "チャットメッセージ生成を停止", + "description": "チャットメッセージ生成タスクを停止します。ストリーミングモードでのみサポートされています。", + "operationId": "stopChatMessageGeneration", + "tags": [ + "Chat" + ], + "parameters": [ + { + "name": "task_id", + "in": "path", + "required": true, + "description": "タスク ID。`/chat-messages` リクエストのストリーミングチャンク戻り値から取得できます。", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string", + "description": "ユーザー識別子。メッセージ送信インターフェースで渡されたユーザーと一致している必要があります。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。" + } + } + }, + "examples": { + "example": { + "value": { + "user": "abc-123" + } + } + } + } + } + }, + "responses": { + "200": { + "$ref": "#/components/responses/SuccessResult" + } + } } }, "/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" } } + "description": "エンドユーザーがメッセージにフィードバックを提供でき、アプリケーション開発者が期待される出力を最適化するのに役立ちます。", + "operationId": "postChatMessageFeedback", + "tags": [ + "Feedback" + ], + "parameters": [ + { + "name": "message_id", + "in": "path", + "required": true, + "description": "フィードバックを提供するメッセージ 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": "アプリのメッセージの「いいね」とフィードバックを取得", - "description": "アプリのエンドユーザーからのフィードバックや「いいね」を取得します。", - "operationId": "getBasicChatAppFeedbacksJa", - "tags": ["メッセージフィードバック"], - "parameters": [ { "$ref": "#/components/parameters/PageQueryParamJa" }, { "$ref": "#/components/parameters/LimitQueryParamJa" } ], - "responses": { "200": { "description": "アプリのフィードバックリストを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseJa" } } } } } + "summary": "アプリケーションのフィードバックを取得", + "description": "アプリケーションのフィードバックを取得します。", + "operationId": "getChatAppFeedbacks", + "tags": [ + "Feedback" + ], + "parameters": [ + { + "name": "page", + "in": "query", + "description": "(オプション)ページネーションのページ番号。デフォルト:1", + "required": false, + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "limit", + "in": "query", + "description": "(オプション)ページあたりのレコード数。デフォルト:20", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "アプリケーションフィードバックのリスト。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppFeedbacksResponse" + } + } + } + } + } } }, "/messages/{message_id}/suggested": { "get": { - "summary": "次の推奨質問", + "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" } } } } } + "operationId": "getSuggestedQuestions", + "tags": [ + "Chat" + ], + "parameters": [ + { + "name": "message_id", + "in": "path", + "required": true, + "description": "メッセージ ID。", + "schema": { + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "提案された質問が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuggestedQuestionsResponse" + } + } + } + } + } } }, "/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" } } } } } + "description": "スクロールロード形式で過去のチャット記録を返します。最初のページでは最新の `{limit}` 件のメッセージを返します(つまり逆順)。", + "operationId": "getConversationHistory", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "query", + "required": true, + "description": "会話 ID。", + "schema": { + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。", + "schema": { + "type": "string" + } + }, + { + "name": "first_id", + "in": "query", + "required": false, + "description": "現在のページの最初のチャット記録の ID、デフォルトは null(最新を取得する場合)。後続のページでは、現在のリストの最初のメッセージの ID を使用して、より古いメッセージを取得します。", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "1 回のリクエストで返すチャット履歴メッセージの数、デフォルトは 20。", + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "会話履歴が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationHistoryResponse" + } + } + } + } + } } }, "/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" } } } } } + "description": "現在のユーザーの会話リストを取得します。デフォルトでは最新の 20 件を返します。", + "operationId": "getConversationsList", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。", + "schema": { + "type": "string" + } + }, + { + "name": "last_id", + "in": "query", + "required": false, + "description": "(オプション)現在のページの最後のレコードの ID(ページネーション用)。", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "(オプション)返すレコード数。デフォルト 20、最小 1、最大 100。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "sort_by", + "in": "query", + "required": false, + "description": "ソートフィールド。デフォルト:-updated_at。'-' プレフィックスで降順。", + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ], + "default": "-updated_at" + } + } + ], + "responses": { + "200": { + "description": "会話リストが正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationsListResponse" + } + } + } + } + } } }, "/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": "ユーザー識別子。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" } } } } } }, - "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": { + "description": "会話を削除します。", + "operationId": "deleteConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "会話 ID。", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string", + "description": "ユーザー識別子。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。" + } + } + } + } + } + }, + "responses": { + "204": { + "description": "会話が正常に削除されました。コンテンツなし。" + } + } + } + }, + "/conversations/{conversation_id}/name": { + "post": { + "summary": "会話の名前を変更", + "description": "セッションの名前を変更します。セッション名は、複数のセッションをサポートするクライアントでの表示に使用されます。", + "operationId": "renameConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "会話 ID。", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameRequest" + } + } + } + }, + "responses": { + "200": { + "description": "会話の名前が正常に変更されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameResponse" + } + } + } + } + } + } + }, + "/conversations/{conversation_id}/variables": { + "get": { + "summary": "会話変数を取得", + "description": "特定の会話から変数を取得します。", + "operationId": "getConversationVariables", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "変数を取得する会話の ID。", + "schema": { + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子。", + "schema": { + "type": "string" + } + }, + { + "name": "last_id", + "in": "query", + "required": false, + "description": "(オプション)現在のページの最後のレコードの ID(ページネーション用)。", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "(オプション)返すレコード数。デフォルト 20、最小 1、最大 100。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "variable_name", + "in": "query", + "required": false, + "description": "(オプション)特定の名前で変数をフィルタリング。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "会話変数が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationVariablesResponse" + } + } + } + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + } + } + } + }, + "/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" } } } } } + "description": "オーディオファイルをテキストに変換します。サポート形式:mp3、mp4、mpeg、mpga、m4a、wav、webm。ファイルサイズ制限:15MB。", + "operationId": "audioToText", + "tags": [ + "TTS" + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/AudioToTextRequest" + } + } + } + }, + "responses": { + "200": { + "description": "オーディオからテキストへの変換が正常に完了しました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AudioToTextResponse" + } + } + } + } + } } }, "/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" } } } } } + "description": "テキストを音声に変換します。", + "operationId": "textToAudioChat", + "tags": [ + "TTS" + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/TextToAudioFormRequest" + } + } + } + }, + "responses": { + "200": { + "description": "オーディオファイルが正常に生成されました。", + "content": { + "audio/wav": { + "schema": { + "type": "string", + "format": "binary", + "description": "生成されたオーディオファイル。" + } + } + }, + "headers": { + "Content-Type": { + "description": "レスポンスのコンテンツタイプ、通常は `audio/wav` または `audio/mp3`。", + "schema": { + "type": "string", + "example": "audio/wav" + } + } + } + } + } } }, "/info": { "get": { - "summary": "アプリケーションの基本情報を取得", - "operationId": "getBasicChatAppInfoJa", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJa" } } } } } + "summary": "アプリケーション基本情報を取得", + "description": "このアプリケーションの基本情報を取得するために使用されます。", + "operationId": "getChatAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションの基本情報。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "アプリケーションのパラメータ情報を取得", - "description": "ページに入る際に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。", - "operationId": "getBasicChatAppParametersJa", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BasicChatAppParametersResponseJa" } } } } } + "summary": "アプリケーションパラメータ情報を取得", + "description": "ページに入る開始時に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。", + "operationId": "getChatAppParameters", + "tags": [ + "Application" + ], + "parameters": [ + { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子、開発者のルールで定義され、アプリケーション内で一意である必要があります。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "アプリケーションパラメータ情報。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatAppParametersResponse" + } + } + } + } + } } }, "/meta": { "get": { - "summary": "アプリケーションのメタ情報を取得", - "description": "このアプリケーションのツールのアイコンを取得するために使用されます。", - "operationId": "getBasicChatAppMetaJa", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "アプリケーションのメタ情報を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseJa" } } } } } + "summary": "アプリケーションメタ情報を取得", + "description": "このアプリケーション内のツールのアイコンを取得するために使用されます。", + "operationId": "getChatAppMeta", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションメタ情報が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppMetaResponse" + } + } + } + } + } } }, "/site": { "get": { - "summary": "アプリのWebApp設定を取得", - "description": "アプリのWebApp設定を取得するために使用します。", - "operationId": "getBasicChatWebAppSettingsJa", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "WebApp設定。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseJa" } } } } } + "summary": "アプリケーション WebApp 設定を取得", + "description": "アプリケーションの WebApp 設定を取得するために使用されます。", + "operationId": "getChatWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションの WebApp 設定。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAppSettingsResponse" + } + } + } + } + } } - } - }, - "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": "ユーザー識別子。アプリケーション内で開発者によって一意に定義される必要があります。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。", "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" } } } }, - "EndUserNotFoundJa": { "description": "エンドユーザーが見つかりません。エラーコード:`end_user_not_found`", "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": "ユーザー識別子、アプリケーション内で一意である必要があります。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" }, - "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": "転送方法。remote_url は画像URL / local_file はファイルアップロード用" }, - "url": { "type": "string", "format": "url", "description": "画像URL(転送方法が remote_url の場合)" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "アップロードされたファイルID、事前にファイルアップロードAPIで取得する必要があります(転送方法が local_file の場合)" } - }, - "anyOf": [ + "/apps/annotations": { + "get": { + "summary": "アノテーションリストを取得", + "description": "アプリケーションのアノテーションリストを取得します。", + "operationId": "getAnnotationList", + "tags": [ + "Annotations" + ], + "parameters": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } - }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "name": "page", + "in": "query", + "description": "ページ番号。", + "required": false, + "schema": { + "type": "integer", + "default": 1 + } }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string", "format":"uuid" } - }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "name": "limit", + "in": "query", + "description": "返されるアイテム数、デフォルト 20、範囲 1-100。", + "required": false, + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } } - ] - }, - "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。" } + ], + "responses": { + "200": { + "description": "アノテーションリストが正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationListResponse" + } + } } } - ] + } }, - "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": "作成タイムスタンプ。" } } }, - "EndUserDetailJa": { - "type": "object", - "properties": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "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": "テキストから音声、音声からテキストへの変換操作。" }, - { "name": "アプリケーション設定", "description": "アプリケーション設定と情報の取得に関連する操作。" } + "post": { + "summary": "アノテーションを作成", + "description": "新しいアノテーションを作成します。", + "operationId": "createAnnotation", + "tags": [ + "Annotations" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAnnotationRequest" + } + } + } + }, + "responses": { + "200": { + "description": "アノテーションが正常に作成されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationItem" + } + } + } + } + } + } + }, + "/apps/annotations/{annotation_id}": { + "put": { + "summary": "アノテーションを更新", + "description": "既存のアノテーションを更新します。", + "operationId": "updateAnnotation", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "annotation_id", + "in": "path", + "required": true, + "description": "アノテーション ID。", + "schema": { + "type": "string" + } + } + ], + "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": [ + "Annotations" + ], + "parameters": [ + { + "name": "annotation_id", + "in": "path", + "required": true, + "description": "アノテーション ID。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "アノテーションが正常に削除されました。コンテンツなし。" + } + } + } + }, + "/apps/annotation-reply/{action}": { + "post": { + "summary": "アノテーション返信設定の初期化", + "description": "アノテーション返信設定を有効または無効にし、埋め込みモデルを設定します。このインターフェースは非同期で実行されます。", + "operationId": "initialAnnotationReplySettings", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "アクション、'enable' または 'disable' のみ可能。", + "schema": { + "type": "string", + "enum": [ + "enable", + "disable" + ] + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "アノテーション返信設定タスクが開始されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" + } + } + } + } + } + } + }, + "/apps/annotation-reply/{action}/status/{job_id}": { + "get": { + "summary": "アノテーション返信設定タスク状態を照会", + "description": "非同期で実行されたアノテーション返信設定タスクの状態を照会します。", + "operationId": "getInitialAnnotationReplySettingsStatus", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "アクション、初期設定呼び出しと同じである必要があります('enable' または 'disable')。", + "schema": { + "type": "string", + "enum": [ + "enable", + "disable" + ] + } + }, + { + "name": "job_id", + "in": "path", + "required": true, + "description": "初期設定呼び出しから取得したジョブ ID。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "タスク状態が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" + } + } + } + } + } + } + } + }, + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "API キー認証。すべての API リクエストに対して、`Authorization` HTTP ヘッダーに 'Bearer ' プレフィックスを付けて API キーを含めてください。例:`Authorization: Bearer {API_KEY}`。**API キーはサーバー側に保存し、クライアント側で共有または保存しないことを強くお勧めします。API キーの漏洩は深刻な結果を招く可能性があります。**" + } + }, + "responses": { + "BadRequestFile": { + "description": "ファイル操作の Bad Request。可能なエラーコード:\n- `no_file_uploaded`: ファイルを提供する必要があります。\n- `too_many_files`: 現在、1 つのファイルのみ受け付けています。\n- `unsupported_preview`: ファイルはプレビューをサポートしていません。\n- `unsupported_estimate`: ファイルは推定をサポートしていません。", + "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`: サポートされていない拡張子。(注:`/files/upload` の説明は画像タイプを挙げていますが、この汎用エラーはドキュメントファイルに言及しています。これはバックエンドからのコンテキスト固有のメッセージを示している可能性があります)。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3 操作の Service Unavailable。可能なエラーコード:\n- `s3_connection_failed`: S3 サービスに接続できません。\n- `s3_permission_denied`: S3 にファイルをアップロードする権限がありません。\n- `s3_file_too_large`: ファイルが S3 のサイズ制限を超えています。", + "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" + } + } + } + } + } + }, + "ConversationNotFound": { + "description": "会話が見つかりません。エラーコード:`conversation_not_exists`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "EndUserNotFound": { + "description": "エンドユーザーが見つかりません。エラーコード:`end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "schemas": { + "ChatRequest": { + "type": "object", + "required": [ + "query", + "user" + ], + "properties": { + "query": { + "type": "string", + "description": "ユーザー入力/質問内容。" + }, + "inputs": { + "type": "object", + "description": "アプリで定義されたさまざまな変数値の入力を許可します。キー/値ペアを含みます。デフォルト {}。", + "additionalProperties": true, + "default": {} + }, + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "description": "レスポンス返却モード。`streaming`(推奨)は SSE を使用します。`blocking` は完了後に返します(長いプロセスでは中断される可能性があり、エージェントアシスタントモードではサポートされていません)。Cloudflare タイムアウトは 100 秒です。", + "default": "streaming" + }, + "user": { + "type": "string", + "description": "ユーザー識別子、アプリケーション内で一意。**注意**: Service API は WebApp で作成された会話を共有しません。API を通じて作成された会話は、WebApp インターフェースで作成されたものとは分離されています。" + }, + "conversation_id": { + "type": "string", + "description": "会話を継続するための会話 ID。以前のメッセージの conversation_id を渡します。" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObject" + }, + "description": "Vision 対応モデル用のファイルリスト(画像)。" + }, + "auto_generate_name": { + "type": "boolean", + "description": "会話タイトルを自動生成。デフォルト `true`。`false` の場合、非同期タイトル生成には `auto_generate: true` で会話名前変更 API を使用してください。", + "default": true + } + } + }, + "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": "転送方法、画像 URL の場合は `remote_url` / ファイルアップロードの場合は `local_file`" + }, + "url": { + "type": "string", + "format": "url", + "description": "画像 URL(転送方法が `remote_url` の場合)" + }, + "upload_file_id": { + "type": "string", + "description": "アップロードされたファイル ID。事前にファイルアップロード API を通じてアップロードして取得する必要があります(転送方法が `local_file` の場合)" + } + }, + "anyOf": [ + { + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } + }, + { + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } + }, + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } + } + ] + }, + "ChatCompletionResponse": { + "type": "object", + "description": "ブロッキングモードチャット完了のレスポンスオブジェクト。", + "properties": { + "event": { + "type": "string", + "description": "イベントタイプ、`message` で固定。", + "example": "message" + }, + "task_id": { + "type": "string", + "format": "uuid", + "description": "リクエスト追跡および停止レスポンス API 用のタスク 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", + "description": "アプリモード、`chat` で固定。", + "example": "chat" + }, + "answer": { + "type": "string", + "description": "完全なレスポンス内容。" + }, + "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": "メッセージ作成タイムスタンプ(Unix エポック秒)。" + } + } + }, + "ChunkChatEvent": { + "type": "object", + "description": "ストリーミングモードにおける Server-Sent Event チャンクの基本スキーマ。", + "required": [ + "event" + ], + "properties": { + "event": { + "type": "string", + "description": "イベントのタイプ。", + "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": "タスク ID。" + }, + "message_id": { + "type": "string", + "format": "uuid", + "description": "一意のメッセージ ID。" + }, + "conversation_id": { + "type": "string", + "format": "uuid", + "description": "会話 ID。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "作成タイムスタンプ。" + } + } + }, + "StreamEventChatMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "LLM が返したテキストチャンク。" + } + } + } + ] + }, + "StreamEventChatAgentMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "LLM が返したテキストチャンク(エージェントモード)。" + } + } + } + ] + }, + "StreamEventChatTtsMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "TTS オーディオストリームイベント(base64 エンコードされた Mp3)。自動再生が有効な場合に利用可能。", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "format": "byte", + "description": "Base64 エンコードされたオーディオチャンク。" + } + } + } + ] + }, + "StreamEventChatTtsMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "TTS オーディオストリーム終了イベント。", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "description": "終了イベント用の空の文字列。" + } + } + } + ] + }, + "StreamEventChatAgentThought": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "エージェントの思考、LLM の思考、ツール呼び出しの詳細(エージェントモード)。", + "required": [ + "id", + "position" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "エージェント思考 ID。" + }, + "position": { + "type": "integer", + "description": "メッセージ内のシーケンスにおけるこの思考の位置。" + }, + "thought": { + "type": "string", + "description": "LLM が考えていること。" + }, + "observation": { + "type": "string", + "description": "ツール呼び出しからのレスポンス。" + }, + "tool": { + "type": "string", + "description": "呼び出されたツールのリスト、';' で区切り。" + }, + "tool_input": { + "type": "string", + "description": "JSON 形式でのツールの入力。例:{\"dalle3\": {\"prompt\": \"a cute cat\"}}。" + }, + "message_files": { + "type": "array", + "items": { + "type": "string", + "format": "uuid" + }, + "description": "この思考に関連するファイルのファイル ID(例:ツールによって生成されたもの)。" + } + } + } + ] + }, + "StreamEventChatMessageFile": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "type": "object", + "description": "メッセージファイルイベント、ツールによって作成された新しいファイル。", + "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。" + } + } + } + ] + }, + "StreamEventChatMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "メッセージ終了イベント、ストリーミングが終了しました。", + "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": "メッセージ内容置換イベント(例:コンテンツモデレーションによる)。", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "置換内容。" + } + } + } + ] + }, + "StreamEventChatError": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$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": "エラーメッセージ。" + } + } + } + ] + }, + "StreamEventChatPing": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "type": "object", + "description": "接続を維持するための Ping イベント。" + } + ] + }, + "Usage": { + "type": "object", + "description": "モデル使用状況情報。", + "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": "リソースの引用および帰属情報。", + "properties": { + "position": { + "type": "integer", + "description": "リスト内のリソースの位置。" + }, + "dataset_id": { + "type": "string", + "format": "uuid", + "description": "データセットの ID。" + }, + "dataset_name": { + "type": "string", + "description": "データセットの名前。" + }, + "document_id": { + "type": "string", + "format": "uuid", + "description": "ドキュメントの ID。" + }, + "document_name": { + "type": "string", + "description": "ドキュメントの名前。" + }, + "segment_id": { + "type": "string", + "format": "uuid", + "description": "ドキュメント内の特定のセグメントの ID。" + }, + "score": { + "type": "number", + "format": "float", + "description": "リソースの関連性スコア。" + }, + "content": { + "type": "string", + "description": "リソースからのコンテンツスニペット。" + } + } + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "ファイルタイプ、例:'image'。" + }, + "url": { + "type": "string", + "format": "url", + "description": "プレビュー画像 URL。" + }, + "belongs_to": { + "type": "string", + "enum": [ + "user", + "assistant" + ], + "description": "このファイルが属する対象。" + } + } + }, + "AgentThoughtItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "エージェント思考 ID。" + }, + "message_id": { + "type": "string", + "format": "uuid", + "description": "この思考が属する一意のメッセージ ID。" + }, + "position": { + "type": "integer", + "description": "この思考の位置。" + }, + "thought": { + "type": "string", + "description": "LLM が考えていること。" + }, + "tool": { + "type": "string", + "description": "呼び出されたツール、';' で区切り。" + }, + "tool_input": { + "type": "string", + "description": "JSON 形式でのツールの入力。" + }, + "observation": { + "type": "string", + "description": "ツール呼び出しからのレスポンス。" + }, + "files": { + "type": "array", + "items": { + "type": "string", + "format": "uuid" + }, + "description": "この思考に関連するファイル ID(例から、Markdown テキストは 'message_files' と言っています)。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "作成タイムスタンプ。" + } + } + }, + "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": "(オプション)会話の名前。auto_generate が true の場合は省略。" + }, + "auto_generate": { + "type": "boolean", + "default": false, + "description": "(オプション)タイトルを自動生成。デフォルト false。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子。" + } + } + }, + "ConversationRenameResponse": { + "$ref": "#/components/schemas/ConversationListItem" + }, + "ConversationVariablesResponse": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "ページあたりのアイテム数。" + }, + "has_more": { + "type": "boolean", + "description": "次のページがあるかどうか。" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ConversationVariableItem" + } + } + } + }, + "ConversationVariableItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "変数 ID。" + }, + "name": { + "type": "string", + "description": "変数名。" + }, + "value_type": { + "type": "string", + "description": "変数タイプ(string、number、object、json など)。" + }, + "value": { + "type": "string", + "description": "変数値(複雑なタイプの場合は JSON 文字列になることがあります)。" + }, + "description": { + "type": "string", + "description": "変数の説明。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "作成タイムスタンプ。" + }, + "updated_at": { + "type": "integer", + "format": "int64", + "description": "最終更新タイムスタンプ。" + } + } + }, + "AudioToTextRequest": { + "type": "object", + "required": [ + "file", + "user" + ], + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "オーディオファイル。サポート:mp3、mp4、mpeg、mpga、m4a、wav、webm。制限:15MB。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子。" + } + } + }, + "AudioToTextResponse": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "音声認識からの出力テキスト。" + } + } + }, + "TextToAudioFormRequest": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "message_id": { + "type": "string", + "format": "uuid", + "description": "メッセージ ID(text と message_id の両方が提供された場合は優先)。" + }, + "text": { + "type": "string", + "description": "音声コンテンツ。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子。" + } + }, + "description": "`user` が必要です。`message_id` または `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。" + }, + { + "$ref": "#/components/schemas/ToolIconDetail" + } + ] + }, + "description": "ツールアイコン。キーはツール名です。" + } + } + }, + "ToolIconDetail": { + "type": "object", + "properties": { + "background": { + "type": "string", + "description": "16 進形式での背景色。" + }, + "content": { + "type": "string", + "description": "絵文字コンテンツ。" + } + } + }, + "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": "指定された埋め込みモデルプロバイダー名(オプション)。" + }, + "embedding_model_name": { + "type": "string", + "description": "指定された埋め込みモデル名(オプション)。" + }, + "score_threshold": { + "type": "number", + "format": "float", + "description": "アノテーション返信のマッチングの類似度しきい値。" + } + } + }, + "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": "チャットメッセージとインタラクションに関連する操作。" + }, + { + "name": "Files", + "description": "ファイルアップロードおよびプレビュー操作。" + }, + { + "name": "End Users", + "description": "エンドユーザー情報に関連する操作。" + }, + { + "name": "Feedback", + "description": "ユーザーフィードバック操作。" + }, + { + "name": "Conversations", + "description": "会話の管理に関連する操作。" + }, + { + "name": "TTS", + "description": "テキスト読み上げおよび音声認識操作。" + }, + { + "name": "Application", + "description": "アプリケーション設定と情報を取得する操作。" + }, + { + "name": "Annotations", + "description": "直接返信用のアノテーション管理に関連する操作。" + } ] } \ No newline at end of file diff --git a/ja/api-reference/openapi_chatflow.json b/ja/api-reference/openapi_chatflow.json index eb6d60708..b3eedc6ed 100644 --- a/ja/api-reference/openapi_chatflow.json +++ b/ja/api-reference/openapi_chatflow.json @@ -1,18 +1,18 @@ { "openapi": "3.0.1", "info": { - "title": "高度なチャットアプリAPI (Chatflow API)", - "description": "チャットアプリケーションはセッションの持続性をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これは、チャットボットやカスタマーサービスAIなどに適用できます。", + "title": "Advanced Chat App API", + "description": "チャットアプリケーションはセッションの永続化をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これはチャットボット、カスタマーサービスAIなどに適用できます。このバージョンには、ワークフローイベントやより詳細なファイルタイプサポートなどの高度な機能が含まれています。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "APIのベースURL。 {api_base_url} をアプリケーション提供の実際のAPIベースURLに置き換えてください。", + "description": "Advanced Chat App APIのベースURL。{api_base_url}をアプリケーションに提供された実際のAPIベースURL(例:props.appDetail.api_base_urlから)に置き換えてください。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "実際のAPIベースURL" + "description": "APIの実際のベースURL" } } } @@ -26,35 +26,38 @@ "/chat-messages": { "post": { "summary": "チャットメッセージを送信", - "description": "チャットアプリケーションにリクエストを送信します。", - "operationId": "sendChatflowMessageJp", - "tags": ["チャットメッセージ"], + "description": "様々なファイルタイプとワークフローイベントをサポートする高度なチャットアプリケーションにリクエストを送信します。", + "operationId": "sendAdvancedChatMessage", + "tags": [ + "Chatflow" + ], "requestBody": { - "description": "チャットメッセージ送信のリクエストボディ。", + "description": "高度なチャットメッセージを送信するためのリクエストボディ。", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatflowRequestJp" + "$ref": "#/components/schemas/AdvancedChatRequest" }, "examples": { - "streaming_with_file": { - "summary": "ファイルとカスタム入力を含むストリーミングリクエストの例", + "streaming_with_file_and_workflow": { + "summary": "画像ファイル付きストリーミングモードの例", "value": { "inputs": { - "name": "dify" + "user_name": "Alice" }, - "query": "iPhone 13 Pro Maxの仕様は何ですか?", + "query": "Analyze this document and tell me its sentiment.", "response_mode": "streaming", - "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", - "user": "abc-123", + "conversation_id": "conv_12345", + "user": "user_alice", "files": [ { - "type": "image", + "type": "document", "transfer_method": "remote_url", - "url": "https://cloud.dify.ai/logo/logo-site.png" + "url": "https://example.com/mydoc.pdf" } - ] + ], + "auto_generate_name": true } } } @@ -63,41 +66,58 @@ }, "responses": { "200": { - "description": "リクエスト成功。応答のコンテントタイプと構造はリクエストの `response_mode` パラメータに依存します。\n- `response_mode` が `blocking` の場合、`application/json` 形式の `ChatCompletionResponseJp` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、`text/event-stream` 形式の `ChunkChatflowEventJp` オブジェクトのストリームを返します。", + "description": "成功レスポンス。コンテンツタイプと構造は`response_mode`によって異なります。\n- `blocking`: `ChatCompletionResponse`を含む`application/json`。\n- `streaming`: `ChunkAdvancedChatEvent`ストリームを含む`text/event-stream`。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatCompletionResponseJp" + "$ref": "#/components/schemas/ChatCompletionResponse" } }, "text/event-stream": { "schema": { "type": "string", - "description": "SSEイベントストリーム。各イベントは 'data: ' で始まり、'\\n\\n' で終わります。詳細な構造は `ChunkChatflowEventJp` を参照してください。" + "description": "Server-Sent Eventsのストリーム。構造については`ChunkAdvancedChatEvent`を参照してください。" + }, + "examples": { + "workflow_events_example": { + "summary": "ワークフローイベントを含むストリームの例", + "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/BadRequestGenericJp" }, - "404": { "$ref": "#/components/responses/ConversationNotFoundJp" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJp" } + "400": { + "$ref": "#/components/responses/BadRequestGeneric" + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/upload": { "post": { "summary": "ファイルアップロード", - "description": "メッセージ送信時に使用するファイルをアップロードし、画像とテキストのマルチモーダル理解を可能にします。アプリケーションでサポートされている形式をサポートします。アップロードされたファイルは現在のエンドユーザーのみが使用できます。", - "operationId": "uploadChatflowFileJp", - "tags": ["ファイル操作"], + "description": "メッセージ送信時に使用するファイルをアップロードし、マルチモーダル理解を可能にします。アプリケーションがサポートする任意の形式をサポートします。アップロードされたファイルは現在のエンドユーザーのみが使用できます。", + "operationId": "uploadAdvancedChatFile", + "tags": [ + "Files" + ], "requestBody": { - "description": "ファイルアップロードリクエスト。`multipart/form-data` リクエストが必要です。", + "description": "ファイルアップロードリクエスト。multipart/form-dataが必要です。", "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { "file": { "type": "string", @@ -106,7 +126,7 @@ }, "user": { "type": "string", - "description": "ユーザー識別子。開発者のルールによって定義され、アプリケーション内で一意でなければなりません。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" + "description": "ユーザー識別子、アプリケーション内で一意です。**注意**: Service APIはWebAppで作成された会話を共有しません。APIを通じて作成された会話は、WebAppインターフェースで作成された会話とは分離されています。" } } } @@ -115,68 +135,87 @@ }, "responses": { "200": { - "description": "ファイルアップロード成功。", + "description": "ファイルが正常にアップロードされました。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FileUploadResponseJp" + "$ref": "#/components/schemas/FileUploadResponse" } } } }, - "201": { - "description": "ファイル作成成功(代替成功コード)。", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseJp" } } } + "400": { + "$ref": "#/components/responses/BadRequestFile" + }, + "413": { + "$ref": "#/components/responses/FileTooLarge" }, - "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" } + "415": { + "$ref": "#/components/responses/UnsupportedFileTypeFile" + }, + "503": { + "$ref": "#/components/responses/S3ErrorFile" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { - "summary": "エンドユーザー取得", - "description": "IDでエンドユーザーを取得します。\n\n他のAPIがエンドユーザーID(例:ファイルアップロードの `created_by`)を返す場合に利用できます。", - "operationId": "getEndUserChatflowJp", - "tags": ["エンドユーザー"], + "summary": "エンドユーザーを取得", + "description": "IDでエンドユーザーを取得します。\nこれは他のAPIがエンドユーザーID(例:ファイルアップロードからの`created_by`)を返す場合に便利です。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "エンドユーザーID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { "200": { - "description": "エンドユーザーの取得に成功しました。", + "description": "エンドユーザーが正常に取得されました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailJp" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundJp" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJp" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/{file_id}/preview": { "get": { "summary": "ファイルプレビュー", - "description": "アップロードされたファイルのプレビューまたはダウンロード。このエンドポイントは、ファイルアップロードAPIを通じて事前にアップロードされたファイルにアクセスすることができます。ファイルは、リクエストしているアプリケーション内のメッセージに属している場合のみアクセス可能です。", - "operationId": "previewChatflowFileJp", - "tags": ["ファイル操作"], + "description": "アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントでは、ファイルアップロードAPIを通じて以前にアップロードされたファイルにアクセスできます。ファイルは、リクエストしているアプリケーション内のメッセージに属している場合のみアクセスできます。", + "operationId": "previewChatFlowFile", + "tags": [ + "Files" + ], "parameters": [ { "name": "file_id", "in": "path", "required": true, - "description": "プレビューするファイルの一意識別子、ファイルアップロードAPIのレスポンスから取得されます。", + "description": "プレビューするファイルの一意の識別子。ファイルアップロードAPIのレスポンスから取得します。", "schema": { "type": "string", "format": "uuid" @@ -242,20 +281,20 @@ } }, "Content-Disposition": { - "description": "as_attachment=trueの場合、'attachment'に設定されます", + "description": "as_attachment=trueの場合、'attachment'に設定", "schema": { "type": "string" } }, "Cache-Control": { - "description": "パフォーマンス用キャッシュヘッダー", + "description": "パフォーマンスのためのキャッシュヘッダー", "schema": { "type": "string", "example": "public, max-age=3600" } }, "Accept-Ranges": { - "description": "オーディオ/ビデオファイルの場合は'bytes'に設定されます", + "description": "音声/動画ファイルの場合、'bytes'に設定", "schema": { "type": "string", "example": "bytes" @@ -264,26 +303,32 @@ } }, "400": { - "description": "不正なリクエスト。可能なエラーコード:\n- `invalid_param`: 異常なパラメータ入力。", + "description": "Bad Request。考えられるエラーコード:\n- `invalid_param`: パラメータ入力が異常です。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "403": { - "description": "禁止。可能なエラーコード:\n- `file_access_denied`: ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません。", + "description": "Forbidden。考えられるエラーコード:\n- `file_access_denied`: ファイルアクセスが拒否されたか、ファイルが現在のアプリケーションに属していません。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "404": { - "description": "見つかりません。可能なエラーコード:\n- `file_not_found`: ファイルが見つからないか削除されています。", + "description": "Not Found。考えられるエラーコード:\n- `file_not_found`: ファイルが見つからないか、削除されています。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, @@ -291,7 +336,9 @@ "description": "内部サーバーエラー。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } } @@ -300,17 +347,21 @@ }, "/chat-messages/{task_id}/stop": { "post": { - "summary": "生成を停止", - "description": "チャットメッセージの生成を停止します。ストリーミングモードでのみサポートされています。", - "operationId": "stopChatflowMessageGenerationJp", - "tags": ["チャットメッセージ"], + "summary": "高度なチャットメッセージ生成を停止", + "description": "高度なチャットメッセージ生成タスクを停止します。ストリーミングモードでのみサポートされています。", + "operationId": "stopAdvancedChatMessageGeneration", + "tags": [ + "Chatflow" + ], "parameters": [ { "name": "task_id", "in": "path", "required": true, - "description": "タスクID、ストリーミングチャンクの返り値から取得できます。", - "schema": { "type": "string", "format": "uuid" } + "description": "ストリーミングチャンクからのタスクID。", + "schema": { + "type": "string" + } } ], "requestBody": { @@ -319,11 +370,13 @@ "application/json": { "schema": { "type": "object", - "required": ["user"], + "required": [ + "user" + ], "properties": { "user": { "type": "string", - "description": "ユーザー識別子。送信メッセージインターフェースで渡されたユーザーと一致している必要があります。" + "description": "ユーザー識別子、メッセージ送信呼び出しと一致している必要があります。**注意**: Service APIはWebAppで作成された会話を共有しません。APIを通じて作成された会話は、WebAppインターフェースで作成された会話とは分離されています。" } } } @@ -331,54 +384,72 @@ } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultJp" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/messages/{message_id}/feedbacks": { "post": { "summary": "メッセージフィードバック", - "description": "エンドユーザーはフィードバックメッセージを提供でき、アプリケーション開発者が期待される出力を最適化するのを支援します。", - "operationId": "postChatflowMessageFeedbackJp", - "tags": ["メッセージフィードバック"], + "description": "メッセージにフィードバックを提供します。", + "operationId": "postAdvancedChatMessageFeedback", + "tags": [ + "Feedback" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "メッセージID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestJp" } + "schema": { + "$ref": "#/components/schemas/MessageFeedbackRequest" + } } } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultJp" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/app/feedbacks": { "get": { - "summary": "アプリのメッセージの「いいね」とフィードバックを取得", - "description": "アプリのエンドユーザーからのフィードバックや「いいね」を取得します。", - "operationId": "getChatflowAppFeedbacksJp", - "tags": ["メッセージフィードバック"], + "summary": "アプリケーションのフィードバックを取得", + "description": "アプリケーションのフィードバックを取得します。", + "operationId": "getAdvancedChatAppFeedbacks", + "tags": [ + "Feedback" + ], "parameters": [ - { "$ref": "#/components/parameters/PageQueryParamJp" }, - { "$ref": "#/components/parameters/LimitQueryParamJp" } + { + "$ref": "#/components/parameters/PageQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParam" + } ], "responses": { "200": { - "description": "アプリのフィードバックリストを正常に取得しました。", + "description": "アプリケーションフィードバックのリスト。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseJp" } + "schema": { + "$ref": "#/components/schemas/AppFeedbacksResponse" + } } } } @@ -387,26 +458,34 @@ }, "/messages/{message_id}/suggested": { "get": { - "summary": "次の推奨質問", + "summary": "次の提案質問", "description": "現在のメッセージに対する次の質問の提案を取得します。", - "operationId": "getChatflowSuggestedQuestionsJp", - "tags": ["チャットメッセージ"], + "operationId": "getAdvancedSuggestedQuestions", + "tags": [ + "Chatflow" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "メッセージID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/UserQueryParamJp" } + { + "$ref": "#/components/parameters/UserQueryParam" + } ], "responses": { "200": { - "description": "推奨質問リストを正常に取得しました。", + "description": "提案質問が正常に取得されました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseJp" } + "schema": { + "$ref": "#/components/schemas/SuggestedQuestionsResponse" + } } } } @@ -416,26 +495,38 @@ "/messages": { "get": { "summary": "会話履歴メッセージを取得", - "description": "スクロールロード形式で履歴チャット記録を返し、最初のページは最新の`{limit}`メッセージを返します。つまり、逆順です。", - "operationId": "getChatflowConversationHistoryJp", - "tags": ["会話管理"], + "description": "スクロールロード形式で過去のチャット記録を返します。", + "operationId": "getAdvancedConversationHistory", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdQueryParamJp" }, - { "$ref": "#/components/parameters/UserQueryParamJp" }, + { + "$ref": "#/components/parameters/ConversationIdQueryParam" + }, + { + "$ref": "#/components/parameters/UserQueryParam" + }, { "name": "first_id", "in": "query", - "description": "現在のページの最初のチャット記録のID、デフォルトはnullです。", - "schema": { "type": "string", "format": "uuid", "nullable": true } + "description": "現在のページの最初のチャット記録のID(ページネーション用)。", + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Jp" } + { + "$ref": "#/components/parameters/LimitQueryParamDefault20" + } ], "responses": { "200": { - "description": "会話履歴メッセージを正常に取得しました。", + "description": "会話履歴が正常に取得されました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ConversationHistoryResponseJp" } + "schema": { + "$ref": "#/components/schemas/ConversationHistoryResponse" + } } } } @@ -445,21 +536,33 @@ "/conversations": { "get": { "summary": "会話を取得", - "description": "現在のユーザーの会話リストを取得し、デフォルトで最新の20件を返します。", - "operationId": "getChatflowConversationsListJp", - "tags": ["会話管理"], + "description": "現在のユーザーの会話リストを取得します。", + "operationId": "getAdvancedConversationsList", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/UserQueryParamJp" }, - { "$ref": "#/components/parameters/LastIdQueryParamJp" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Jp" }, - { "$ref": "#/components/parameters/SortByQueryParamJp" } + { + "$ref": "#/components/parameters/UserQueryParam" + }, + { + "$ref": "#/components/parameters/LastIdQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" + }, + { + "$ref": "#/components/parameters/SortByQueryParam" + } ], "responses": { "200": { - "description": "会話リストを正常に取得しました。", + "description": "会話リストが正常に取得されました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ConversationsListResponseJp" } + "schema": { + "$ref": "#/components/schemas/ConversationsListResponse" + } } } } @@ -469,314 +572,2537 @@ "/conversations/{conversation_id}": { "delete": { "summary": "会話を削除", - "description": "指定された会話を削除します。", - "operationId": "deleteChatflowConversationJp", - "tags": ["会話管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJp" } ], + "description": "会話を削除します。", + "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": "ユーザー識別子。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" } } + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string", + "description": "ユーザー識別子。**注意**: Service APIはWebAppで作成された会話を共有しません。APIを通じて作成された会話は、WebAppインターフェースで作成された会話とは分離されています。" + } + } } } } }, - "responses": { "204": { "description": "会話が正常に削除されました。コンテンツはありません。" } } + "responses": { + "204": { + "description": "会話が正常に削除されました。コンテンツなし。" + } + } } }, "/conversations/{conversation_id}/name": { "post": { - "summary": "会話の名前を変更", + "summary": "会話の名前変更", "description": "セッションの名前を変更します。", - "operationId": "renameChatflowConversationJp", - "tags": ["会話管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamJp" } ], + "operationId": "renameAdvancedConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/ConversationIdPathParam" + } + ], "requestBody": { "required": true, - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestJp" } } } + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameRequest" + } + } + } }, "responses": { - "200": { "description": "会話の名前が正常に変更されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseJp" } } } } + "200": { + "description": "会話の名前が正常に変更されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameResponse" + } + } + } + } } } }, - "/conversations/{conversation_id}/variables": { + "/conversations/{conversation_id}/variables": { "get": { - "summary": "会話変数の取得", - "description": "特定の会話から変数を取得します。このエンドポイントは、会話中に取得された構造化データを抽出するのに役立ちます。", - "operationId": "getChatflowConversationVariablesJp", - "tags": ["会話管理"], + "summary": "会話変数を取得", + "description": "特定の会話から変数を取得します。", + "operationId": "getAdvancedConversationVariables", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdPathParamJp" }, - { "$ref": "#/components/parameters/UserQueryParamJp" }, - { "$ref": "#/components/parameters/LastIdQueryParamJp" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Jp" } + { + "$ref": "#/components/parameters/ConversationIdPathParam" + }, + { + "$ref": "#/components/parameters/UserQueryParam" + }, + { + "$ref": "#/components/parameters/LastIdQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" + } ], "responses": { - "200": { "description": "会話変数を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseJp" } } } }, - "404": { "$ref": "#/components/responses/ConversationNotFoundJp" } + "200": { + "description": "会話変数が正常に取得されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationVariablesResponse" + } + } + } + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + } } } }, "/audio-to-text": { "post": { - "summary": "音声からテキストへ", - "description": "オーディオファイルをテキストに変換します。サポートされている形式:mp3, mp4, mpeg, mpga, m4a, wav, webm。ファイルサイズ制限:15MB。", - "operationId": "chatflowAudioToTextJp", - "tags": ["音声・テキスト変換"], + "summary": "音声からテキスト", + "description": "音声ファイルをテキストに変換します。サポートされる形式:mp3、mp4、mpeg、mpga、m4a、wav、webm。ファイルサイズ制限:15MB。", + "operationId": "advancedAudioToText", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestJp" } } } + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/AudioToTextRequest" + } + } + } }, "responses": { - "200": { "description": "音声をテキストに正常に変換しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseJp" } } } } + "200": { + "description": "音声がテキストに正常に変換されました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AudioToTextResponse" + } + } + } + } } } }, "/text-to-audio": { "post": { - "summary": "テキストから音声へ", - "description": "テキストコンテンツを音声に変換します。", - "operationId": "chatflowTextToAudioJp", - "tags": ["音声・テキスト変換"], + "summary": "テキストから音声", + "description": "テキストを音声に変換します。", + "operationId": "advancedTextToAudio", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioJsonRequestJp" } } } + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TextToAudioJsonRequest" + } + } + } }, "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" } } } + "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" } } } } } + "summary": "アプリケーション基本情報を取得", + "operationId": "getAdvancedChatAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーション基本情報。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "アプリケーションのパラメータ情報を取得", - "description": "ページに入る際に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。", - "operationId": "getChatflowAppParametersJp", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseJp" } } } } } + "summary": "アプリケーションパラメータ情報を取得", + "operationId": "getAdvancedChatAppParameters", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションパラメータ。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatAppParametersResponse" + } + } + } + } + } } }, "/meta": { "get": { - "summary": "アプリケーションのメタ情報を取得", - "description": "このアプリケーションのツールのアイコンを取得するために使用されます。", - "operationId": "getChatflowAppMetaJp", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "アプリケーションのメタ情報を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseJp" } } } } } + "summary": "アプリケーションメタ情報を取得", + "operationId": "getAdvancedChatAppMeta", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションメタ情報(ツールアイコン)。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppMetaResponse" + } + } + } + } + } } }, "/site": { "get": { - "summary": "アプリのWebApp設定を取得", - "description": "アプリのWebApp設定を取得するために使用します。", - "operationId": "getChatflowWebAppSettingsJp", - "tags": ["アプリケーション設定"], - "responses": { "200": { "description": "WebAppの設定情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseJp" } } } } } + "summary": "アプリケーションWebApp設定を取得", + "operationId": "getAdvancedChatWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "WebApp設定。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAppSettingsResponse" + } + } + } + } + } } - } - }, - "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": "ユーザー識別子。アプリケーション内で開発者によって一意に定義されるべきです。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。", "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" } } - }, - "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" } } } }, - "EndUserNotFoundJp": { "description": "エンドユーザーが見つかりません。エラーコード:`end_user_not_found`", "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": "ユーザー識別子。アプリケーション内で一意であるべきです。**重要な注意事項**: Service API は WebApp で作成された対話を共有しません。API を通じて作成された対話は、WebApp インターフェースで作成されたものとは分離されています。" }, - "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": "転送方法。remote_url は画像URL / local_file はファイルアップロード用" }, - "url": { "type": "string", "format": "url", "description": "画像URL(転送方法が remote_url の場合)" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "アップロードされたファイルID、事前にファイルアップロードAPIで取得する必要があります(転送方法が local_file の場合)" } - }, - "anyOf": [ + "/apps/annotations": { + "get": { + "summary": "アノテーションリストを取得", + "operationId": "getAdvancedAnnotationList", + "tags": [ + "Annotations" + ], + "parameters": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } - }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "$ref": "#/components/parameters/PageQueryParam" }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string", "format":"uuid" } - }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" } - ] - }, - "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": "作成タイムスタンプ。" } } }, - "EndUserDetailJp": { - "type": "object", - "properties": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "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": "テキストから音声へ、音声からテキストへの変換操作。" }, - { "name": "アプリケーション設定", "description": "アプリケーション設定と情報の取得に関連する操作。" } + ], + "responses": { + "200": { + "description": "アノテーションリスト。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationListResponse" + } + } + } + } + } + }, + "post": { + "summary": "アノテーションを作成", + "operationId": "createAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "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": "アノテーションを更新", + "operationId": "updateAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "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": "アノテーションを削除", + "operationId": "deleteAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/AnnotationIdPathParam" + } + ], + "responses": { + "204": { + "description": "アノテーションが削除されました。" + } + } + } + }, + "/apps/annotation-reply/{action}": { + "post": { + "summary": "アノテーション返信設定の初期化", + "operationId": "initialAdvancedAnnotationReplySettings", + "tags": [ + "Annotations" + ], + "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/InitialAnnotationReplySettingsResponse" + } + } + } + }, + "202": { + "description": "タスクが受け入れられました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" + } + } + } + } + } + } + }, + "/apps/annotation-reply/{action}/status/{job_id}": { + "get": { + "summary": "アノテーション返信設定初期化タスクのステータスを照会", + "operationId": "getAdvancedInitialAnnotationReplySettingsStatus", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/AnnotationActionPathParam" + }, + { + "$ref": "#/components/parameters/JobIdPathParam" + } + ], + "responses": { + "200": { + "description": "タスクステータス。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" + } + } + } + } + } + } + } + }, + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "APIキー認証。" + } + }, + "parameters": { + "PageQueryParam": { + "name": "page", + "in": "query", + "description": "ページ番号。", + "schema": { + "type": "integer", + "default": 1 + } + }, + "LimitQueryParam": { + "name": "limit", + "in": "query", + "description": "ページあたりのアイテム数。", + "schema": { + "type": "integer" + } + }, + "LimitQueryParamDefault20": { + "name": "limit", + "in": "query", + "description": "ページあたりのアイテム数。", + "schema": { + "type": "integer", + "default": 20 + } + }, + "LimitQueryParamDefault20Max100": { + "name": "limit", + "in": "query", + "description": "ページあたりのアイテム数(デフォルト20、最大100)。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + "UserQueryParam": { + "name": "user", + "in": "query", + "required": true, + "description": "ユーザー識別子。**注意**: Service APIはWebAppで作成された会話を共有しません。APIを通じて作成された会話は、WebAppインターフェースで作成された会話とは分離されています。", + "schema": { + "type": "string" + } + }, + "ConversationIdQueryParam": { + "name": "conversation_id", + "in": "query", + "required": true, + "description": "会話ID。", + "schema": { + "type": "string" + } + }, + "LastIdQueryParam": { + "name": "last_id", + "in": "query", + "description": "ページネーション用の最後のレコードのID。", + "schema": { + "type": "string" + } + }, + "SortByQueryParam": { + "name": "sort_by", + "in": "query", + "description": "ソートフィールド(例:-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": "会話ID。", + "schema": { + "type": "string" + } + }, + "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": { + "BadRequestGeneric": { + "description": "Bad Request。パラメータを確認してください。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "BadRequestFile": { + "description": "ファイル操作のBad Request。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "FileTooLarge": { + "description": "ファイルが大きすぎます。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "UnsupportedFileTypeFile": { + "description": "アップロードに対してサポートされていないファイルタイプです。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3ストレージエラー。", + "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" + } + } + } + } + } + }, + "ConversationNotFound": { + "description": "会話が見つかりません。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "EndUserNotFound": { + "description": "エンドユーザーが見つかりません。エラーコード:`end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "schemas": { + "AdvancedChatRequest": { + "type": "object", + "required": [ + "query", + "user" + ], + "properties": { + "query": { + "type": "string", + "description": "ユーザー入力/質問内容。" + }, + "inputs": { + "type": "object", + "description": "アプリ変数のキー/値ペア。ファイルタイプの変数の場合、値はInputFileObjectである必要があります。", + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "$ref": "#/components/schemas/InputFileObjectAdvanced" + } + ] + }, + "default": {} + }, + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "default": "streaming", + "description": "レスポンスモード。Cloudflareのタイムアウトはblockingの場合100秒です。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子。**注意**: Service APIはWebAppで作成された会話を共有しません。APIを通じて作成された会話は、WebAppインターフェースで作成された会話とは分離されています。" + }, + "conversation_id": { + "type": "string", + "description": "続行する会話ID。" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObjectAdvanced" + }, + "description": "Vision対応モデルまたは一般的なファイル入力用のファイルリスト。" + }, + "auto_generate_name": { + "type": "boolean", + "default": true, + "description": "会話タイトルを自動生成。" + } + } + }, + "InputFileObjectAdvanced": { + "type": "object", + "required": [ + "type", + "transfer_method" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "document", + "image", + "audio", + "video", + "custom" + ], + "description": "ファイルのタイプ。'document'はTXT、MD、PDF、HTML、XLSX、DOCX、CSV、EML、MSG、PPTX、XML、EPUBをカバーします。'image'はJPG、PNG、GIF、WEBP、SVGをカバーします。'audio'はMP3、M4A、WAV、WEBM、AMRをカバーします。'video'はMP4、MOV、MPEG、MPGAをカバーします。" + }, + "transfer_method": { + "type": "string", + "enum": [ + "remote_url", + "local_file" + ], + "description": "転送方法、ファイルURLの場合は`remote_url`/ファイルアップロードの場合は`local_file`" + }, + "url": { + "type": "string", + "format": "url", + "description": "ファイルURL(転送方法が`remote_url`の場合)" + }, + "upload_file_id": { + "type": "string", + "description": "アップロードされたファイルID、事前にファイルアップロードAPIを通じてアップロードして取得する必要があります(転送方法が`local_file`の場合)" + } + }, + "anyOf": [ + { + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } + }, + { + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } + }, + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } + } + ], + "example": { + "type": "image", + "transfer_method": "remote_url", + "url": "https://example.com/image.png" + } + }, + "ChatCompletionResponse": { + "type": "object", + "description": "blockingモードチャットのレスポンス。", + "properties": { + "event": { + "type": "string", + "example": "message" + }, + "task_id": { + "type": "string", + "format": "uuid" + }, + "id": { + "type": "string", + "format": "uuid", + "description": "このレスポンスイベントの一意のID。" + }, + "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": "ファイルタイプ、例:'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エンコードされた音声。" + } + } + } + ] + }, + "StreamEventAdvTtsMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkAdvancedChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBaseAdv" + }, + { + "type": "object", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "description": "空の文字列。" + } + } + } + ] + }, + "StreamEventAdvMessageReplace": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkAdvancedChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBaseAdv" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "置換コンテンツ。" + } + } + } + ] + }, + "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": "このノード実行インスタンスの一意のID。" + }, + "node_id": { + "type": "string", + "format": "uuid", + "description": "ノード定義のID。" + }, + "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": "ノードが使用する変数。" + }, + "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": "ノード処理データ(JSON)。" + }, + "outputs": { + "type": "object", + "additionalProperties": true, + "nullable": true, + "description": "出力コンテンツ(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": "価格の互換性のためにfloatを使用、MDでは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": "出力コンテンツ(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": "一般的なエラーでは常に存在するとは限りません。" + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "音声ファイル。形式:mp3、mp4、mpeg、mpga、m4a、wav、webm。制限:15MB。" + }, + "user": { + "type": "string" + } + } + }, + "AudioToTextResponse": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + } + }, + "TextToAudioJsonRequest": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "message_id": { + "type": "string", + "format": "uuid", + "description": "メッセージID(優先)。" + }, + "text": { + "type": "string", + "description": "音声コンテンツ。" + }, + "user": { + "type": "string" + }, + "streaming": { + "type": "boolean", + "default": false, + "description": "trueの場合、レスポンスは音声チャンクのストリームになります。" + } + }, + "description": "`user`が必要です。`message_id`または`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": "ワークフローイベントを含む高度なチャット操作。" + }, + { + "name": "Files", + "description": "高度なチャット用のファイルアップロードとプレビュー操作。" + }, + { + "name": "End Users", + "description": "エンドユーザー情報に関連する操作。" + }, + { + "name": "Feedback", + "description": "高度なチャット用のユーザーフィードバック操作。" + }, + { + "name": "Conversations", + "description": "高度なチャット用の会話管理。" + }, + { + "name": "TTS", + "description": "高度なチャット用の音声とテキストの変換。" + }, + { + "name": "Application", + "description": "高度なチャット用のアプリケーション設定と情報。" + }, + { + "name": "Annotations", + "description": "高度なチャット用のアノテーション管理。" + } ] } \ No newline at end of file diff --git a/ja/api-reference/openapi_workflow.json b/ja/api-reference/openapi_workflow.json index 16269a904..e8cca12e7 100644 --- a/ja/api-reference/openapi_workflow.json +++ b/ja/api-reference/openapi_workflow.json @@ -1,18 +1,18 @@ { "openapi": "3.0.1", "info": { - "title": "ワークフローアプリAPI", - "description": "ワークフローアプリケーションは、セッションをサポートせず、翻訳、記事作成、要約AIなどに最適です。", + "title": "ワークフローアプリ API", + "description": "ワークフローアプリケーションは非セッションサポートを提供し、翻訳、記事作成、要約AIなどに最適です。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "APIのベースURL。{api_base_url}を実際のAPIベースURLに置き換えてください。", + "description": "ワークフローアプリ APIのベースURL。{api_base_url}を実際のAPIベースURLに置き換えてください。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "実際のAPIベースURL" + "description": "APIの実際のベースURL" } } } @@ -27,35 +27,37 @@ "post": { "summary": "ワークフローを実行", "description": "ワークフローを実行します。公開されたワークフローがないと実行できません。", - "operationId": "executeWorkflowJp", - "tags": ["ワークフロー実行"], + "operationId": "executeWorkflow", + "tags": [ + "Workflow Execution" + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkflowExecutionRequestJp" + "$ref": "#/components/schemas/WorkflowExecutionRequest" }, "examples": { - "basic_execution_jp": { - "summary": "基本的なワークフロー実行の例", + "basic_execution": { + "summary": "基本的なワークフロー実行", "value": { "inputs": { - "query": "このテキストを要約してください:..." + "query": "Summarize this text: ..." }, "response_mode": "streaming", - "user": "workflow_user_jp_001" + "user": "user_workflow_123" } }, - "with_file_array_variable_jp":{ - "summary": "ファイルリスト変数を含む入力の例", + "with_file_array_variable": { + "summary": "ファイル配列入力変数を使用した例", "value": { "inputs": { "my_documents": [ { "type": "document", "transfer_method": "local_file", - "upload_file_id": "アップロードされたファイルID_xyz" + "upload_file_id": "uploaded_file_id_abc" }, { "type": "image", @@ -65,7 +67,7 @@ ] }, "response_mode": "blocking", - "user": "workflow_user_jp_002" + "user": "user_workflow_456" } } } @@ -74,23 +76,27 @@ }, "responses": { "200": { - "description": "ワークフローの実行に成功しました。応答の構造は`response_mode`によって異なります。\n- `blocking`: `application/json`形式で、`WorkflowCompletionResponseJp`オブジェクトが含まれます。\n- `streaming`: `text/event-stream`形式で、`ChunkWorkflowEventJp`イベントストリームが含まれます。", + "description": "ワークフローの実行に成功しました。構造は`response_mode`によって異なります。\n- `blocking`: `WorkflowCompletionResponse`を含む`application/json`。\n- `streaming`: `ChunkWorkflowEvent`ストリームを含む`text/event-stream`。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkflowCompletionResponseJp" + "$ref": "#/components/schemas/WorkflowCompletionResponse" } }, "text/event-stream": { "schema": { "type": "string", - "description": "SSEイベントストリーム。各イベントは'data: 'で始まり、'\\n\\n'で終わります。具体的な構造は`ChunkWorkflowEventJp`を参照してください。" + "description": "Server-Sent Eventsのストリーム。構造については`ChunkWorkflowEvent`を参照してください。" } } } }, - "400": { "$ref": "#/components/responses/BadRequestWorkflowJp" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJp" } + "400": { + "$ref": "#/components/responses/BadRequestWorkflow" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, @@ -98,15 +104,20 @@ "get": { "summary": "ワークフロー実行詳細を取得", "description": "ワークフロー実行IDに基づいて、ワークフロータスクの現在の実行結果を取得します。", - "operationId": "getWorkflowRunDetailJp", - "tags": ["ワークフロー実行"], + "operationId": "getWorkflowRunDetail", + "tags": [ + "Workflow Execution" + ], "parameters": [ { "name": "workflow_run_id", "in": "path", "required": true, - "description": "ワークフロー実行ID。ワークフロー実行の応答またはストリーミングイベントから取得できます。", - "schema": { "type": "string", "format": "uuid" } + "description": "ワークフロー実行ID。ワークフロー実行レスポンスまたはストリーミングイベントから取得できます。", + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { @@ -114,27 +125,36 @@ "description": "ワークフロー実行詳細の取得に成功しました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponseJp" } + "schema": { + "$ref": "#/components/schemas/WorkflowRunDetailResponse" + } } } }, - "404": {"description": "ワークフロー実行記録が見つかりません。"} + "404": { + "description": "ワークフロー実行が見つかりません。" + } } } }, "/workflows/tasks/{task_id}/stop": { "post": { - "summary": "生成を停止 (ワークフロータスク)", + "summary": "ワークフロータスクの生成を停止", "description": "ワークフロータスクの生成を停止します。ストリーミングモードでのみサポートされています。", - "operationId": "stopWorkflowTaskGenerationJp", - "tags": ["ワークフロー実行"], + "operationId": "stopWorkflowTaskGeneration", + "tags": [ + "Workflow Execution" + ], "parameters": [ { "name": "task_id", "in": "path", "required": true, - "description": "タスクID。ストリーミングチャンクの返り値から取得可能。", - "schema": { "type": "string", "format": "uuid" } + "description": "ストリーミングチャンクからのタスクID。", + "schema": { + "type": "string", + "format": "uuid" + } } ], "requestBody": { @@ -143,64 +163,116 @@ "application/json": { "schema": { "type": "object", - "required": ["user"], + "required": [ + "user" + ], "properties": { - "user": { "type": "string", "description": "ユーザー識別子。実行ワークフローAPIに渡されたユーザーと一致する必要があります。" } + "user": { + "type": "string", + "description": "ユーザー識別子。" + } } } } } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultJp" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/files/upload": { "post": { - "summary": "ファイルアップロード (ワークフロー用)", - "description": "ワークフローで使用するファイルをアップロードします。ワークフローでサポートされている任意の形式をサポートします。アップロードされたファイルは、現在のエンドユーザーのみが使用できます。", - "operationId": "uploadWorkflowFileJp", - "tags": ["ファイル操作 (ワークフロー)"], + "summary": "ワークフロー用ファイルアップロード", + "description": "ワークフローで使用するファイルをアップロードします。ワークフローでサポートされている任意の形式をサポートします。アップロードされたファイルは現在のエンドユーザー専用です。", + "operationId": "uploadWorkflowFile", + "tags": [ + "Files" + ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { - "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。" }, - "user": { "type": "string", "description": "ユーザー識別子。" } + "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" } + "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" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { - "summary": "エンドユーザー取得", - "description": "IDでエンドユーザーを取得します。\n\n他のAPIがエンドユーザーID(例:ファイルアップロードの `created_by`)を返す場合に利用できます。", - "operationId": "getEndUserWorkflowJp", - "tags": ["エンドユーザー"], + "summary": "エンドユーザーを取得", + "description": "IDでエンドユーザーを取得します。\nこれは、他のAPIがエンドユーザーIDを返す場合(例:ファイルアップロードの`created_by`)に便利です。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "エンドユーザーID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { @@ -208,241 +280,1380 @@ "description": "エンドユーザーの取得に成功しました。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailJp" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundJp" }, - "500": { "$ref": "#/components/responses/InternalServerErrorJp" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/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" } } } } + "get": { + "summary": "ワークフローログを取得", + "description": "ワークフローログを返します。最初のページは最新の`{limit}`件のメッセージを返します(逆順)。", + "operationId": "getWorkflowLogs", + "tags": [ + "Workflow Execution" + ], + "parameters": [ + { + "name": "keyword", + "in": "query", + "description": "検索キーワード。", + "schema": { + "type": "string" + } + }, + { + "name": "status", + "in": "query", + "description": "ステータスでフィルタリング。", + "schema": { + "type": "string", + "enum": [ + "succeeded", + "failed", + "stopped", + "running" + ] + } + }, + { + "name": "page", + "in": "query", + "description": "現在のページ。", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "limit", + "in": "query", + "description": "1ページあたりのアイテム数。", + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "ワークフローログの取得に成功しました。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowLogsResponse" + } + } } + } } + } }, "/info": { "get": { - "summary": "アプリケーションの基本情報を取得 (ワークフロー)", - "operationId": "getWorkflowAppInfoJp", - "tags": ["アプリケーション設定 (ワークフロー)"], - "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseJp" } } } } } + "summary": "アプリケーション基本情報を取得", + "operationId": "getWorkflowAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションの基本情報。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "アプリケーションのパラメータ情報を取得 (ワークフロー)", - "operationId": "getWorkflowAppParametersJp", - "tags": ["アプリケーション設定 (ワークフロー)"], - "responses": { "200": { "description": "アプリケーションのパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowAppParametersResponseJp" } } } } } + "summary": "アプリケーションパラメータ情報を取得", + "operationId": "getWorkflowAppParameters", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "アプリケーションパラメータ。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowAppParametersResponse" + } + } + } + } + } } }, "/site": { "get": { - "summary": "アプリのWebApp設定を取得 (ワークフロー)", - "operationId": "getWorkflowWebAppSettingsJp", - "tags": ["アプリケーション設定 (ワークフロー)"], - "responses": { "200": { "description": "WebApp設定情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowWebAppSettingsResponseJp" } } } } } + "summary": "アプリケーションWebApp設定を取得", + "operationId": "getWorkflowWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "WebApp設定。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowWebAppSettingsResponse" + } + } + } + } + } } } }, "components": { "securitySchemes": { - "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key認証。すべてのAPIリクエストにおいて、Authorization HTTPヘッダーにAPIキーを含めてください(例:Bearer {API_KEY})。APIキーの漏洩を防ぐため、サーバー側で保存することを強くお勧めします。" } + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "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" } } } } } }, - "EndUserNotFoundJp": { "description": "エンドユーザーが見つかりません。エラーコード:`end_user_not_found`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseJp" } } } } + "BadRequestWorkflow": { + "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/ErrorResponse" + } + } + } + }, + "BadRequestFile": { + "description": "ファイル操作の不正なリクエスト。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "FileTooLarge": { + "description": "ファイルが大きすぎます。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "UnsupportedFileTypeFile": { + "description": "アップロードにサポートされていないファイルタイプです。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3ストレージエラー。", + "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" + } + } + } + } + } + }, + "EndUserNotFound": { + "description": "エンドユーザーが見つかりません。エラーコード: `end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } }, "schemas": { - "WorkflowExecutionRequestJp": { + "WorkflowExecutionRequest": { "type": "object", - "required": ["inputs", "response_mode", "user"], + "required": [ + "inputs", + "response_mode", + "user" + ], "properties": { "inputs": { "type": "object", - "description": "アプリで定義されたさまざまな変数値の入力を許可します。変数がファイルリストの場合、その値はInputFileObjectWorkflowJpオブジェクトのリストである必要があります。", + "description": "ワークフロー変数のキー/値ペア。ファイル配列タイプの変数の値は、InputFileObjectWorkflowのリストである必要があります。", "additionalProperties": { - "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" }, { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectWorkflowJp" } } ] + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObjectWorkflow" + } + } + ] }, - "example": { "user_query": "これを翻訳してください。", "target_language": "フランス語" } + "example": { + "user_query": "Translate this for me.", + "target_language": "French" + } }, - "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を使用することを推奨します。"} + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "description": "レスポンスモード。Cloudflareのタイムアウトはblockingモードで100秒です。" + }, + "user": { + "type": "string", + "description": "ユーザー識別子。" + } } }, - "InputFileObjectWorkflowJp": { + "InputFileObjectWorkflow": { "type": "object", - "required": ["type", "transfer_method"], + "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": "転送方法。remote_url は画像URL / local_file はファイルアップロード用" }, - "url": { "type": "string", "format": "url", "description": "画像URL(転送方法が remote_url の場合)" }, - "upload_file_id": { "type": "string", "format": "uuid", "description": "アップロードされたファイルID、事前にファイルアップロードAPIで取得する必要があります(転送方法が local_file の場合)" } + "type": { + "type": "string", + "enum": [ + "document", + "image", + "audio", + "video", + "custom" + ], + "description": "ファイルのタイプ。" + }, + "transfer_method": { + "type": "string", + "enum": [ + "remote_url", + "local_file" + ], + "description": "転送方法、画像URLの場合は`remote_url` / ファイルアップロードの場合は`local_file`" + }, + "url": { + "type": "string", + "format": "url", + "description": "画像URL(転送方法が`remote_url`の場合)" + }, + "upload_file_id": { + "type": "string", + "description": "アップロードされたファイルID。事前にファイルアップロードAPIを通じてアップロードして取得する必要があります(転送方法が`local_file`の場合)" + } }, "anyOf": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string", "format": "uuid" } + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } } ] }, - "WorkflowCompletionResponseJp": { - "type": "object", "description": "ブロッキングモードでのワークフロー実行結果。", + "WorkflowCompletionResponse": { + "type": "object", + "description": "blockingモードのワークフロー実行のレスポンス。", "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": "ワークフロー実行詳細。", + "workflow_run_id": { + "type": "string", + "format": "uuid" + }, + "task_id": { + "type": "string", + "format": "uuid" + }, + "data": { + "$ref": "#/components/schemas/WorkflowFinishedData" + } + } + }, + "ChunkWorkflowEvent": { + "type": "object", + "required": [ + "event" + ], "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": "作成タイムスタンプ。" } } }, - "EndUserDetailJp": { + "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": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "WorkflowLogsResponseJp": { - "type": "object", "description": "ワークフローログリストの応答。", + "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": { - "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": "現在のページのデータ。" } + "id": { + "type": "string", + "format": "uuid" + }, + "workflow_id": { + "type": "string", + "format": "uuid" + }, + "sequence_number": { + "type": "integer" + }, + "created_at": { + "type": "integer", + "format": "int64" + } } }, - "WorkflowLogItemJp": { - "type": "object", "description": "単一のワークフローログアイテム。", + "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", "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": "作成時間。" } + "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" + } } }, - "WorkflowRunSummaryJp": { - "type": "object", "description": "ワークフロー実行概要情報。", + "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": { - "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": "エンドユーザー概要情報。", + "text": { + "type": "string" + }, + "from_variable_selector": { + "type": "array", + "items": { + "type": "string" + }, + "description": "テキストソースパス。" + } + } + }, + "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", "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": "エラーメッセージ。" } } } - } - }, + "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文字列。" + }, + "outputs": { + "type": "object", + "additionalProperties": true, + "nullable": true, + "description": "出力コンテンツのJSONオブジェクト。" + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "ワークフロー実行", "description": "ワークフローの実行と管理に関連する操作。" }, - { "name": "ファイル操作 (ワークフロー)", "description": "ワークフロー固有のファイルアップロードとプレビュー操作。" }, - { "name": "エンドユーザー", "description": "エンドユーザー情報に関連する操作。" }, - { "name": "アプリケーション設定 (ワークフロー)", "description": "ワークフローアプリのアプリケーション設定と情報。" } + { + "name": "Workflow Execution", + "description": "ワークフローの実行と管理に関連する操作。" + }, + { + "name": "Files", + "description": "ワークフロー固有のファイルアップロードとプレビュー操作。" + }, + { + "name": "End Users", + "description": "エンドユーザー情報に関連する操作。" + }, + { + "name": "Application", + "description": "ワークフローアプリのアプリケーション設定と情報。" + } ] } \ No newline at end of file diff --git a/zh/api-reference/openapi_chat.json b/zh/api-reference/openapi_chat.json index 296d1855f..ae6c278ec 100644 --- a/zh/api-reference/openapi_chat.json +++ b/zh/api-reference/openapi_chat.json @@ -2,17 +2,17 @@ "openapi": "3.0.1", "info": { "title": "对话型应用 API", - "description": "对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。", + "description": "对话型应用支持会话持久化,允许将之前的聊天记录作为上下文进行响应。这适用于聊天机器人、客服 AI 等场景。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "API 的基础 URL。请将 {api_base_url} 替换为你的应用提供的实际 API 基础 URL。", + "description": "对话型应用 API 的基础 URL。请将 {api_base_url} 替换为您应用提供的实际 API 基础 URL(例如,来自 props.appDetail.api_base_url)。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "实际的 API 基础 URL" + "description": "API 的实际基础 URL" } } } @@ -26,27 +26,27 @@ "/chat-messages": { "post": { "summary": "发送对话消息", - "description": "创建会话消息。", - "operationId": "sendBasicChatMessageCn", - "tags": ["对话消息"], + "description": "向对话型应用发送请求。", + "operationId": "sendChatMessage", + "tags": [ + "Chat" + ], "requestBody": { "description": "发送对话消息的请求体。", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BasicChatRequestCn" + "$ref": "#/components/schemas/ChatRequest" }, "examples": { - "streaming_with_file": { - "summary": "包含文件和自定义输入的流式请求示例", + "streaming_example": { + "summary": "带文件的流式模式示例", "value": { - "inputs": { - "name": "dify" - }, - "query": "iPhone 13 Pro Max 的规格是什么?", + "inputs": {}, + "query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "streaming", - "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", + "conversation_id": "", "user": "abc-123", "files": [ { @@ -63,50 +63,135 @@ }, "responses": { "200": { - "description": "请求成功。响应的内容类型和结构取决于请求中的 `response_mode` 参数。\n- 当 `response_mode` 为 `blocking` 时,返回 `application/json` 格式的 `ChatCompletionResponseCn` 对象。\n- 当 `response_mode` 为 `streaming` 时,返回 `text/event-stream` 格式的 `ChunkBasicChatEventCn` 对象流式序列。", + "description": "成功响应。内容类型和结构取决于请求中的 `response_mode` 参数。\n- 如果 `response_mode` 为 `blocking`,返回 `application/json` 格式的 `ChatCompletionResponse` 对象。\n- 如果 `response_mode` 为 `streaming`,返回 `text/event-stream` 格式的 `ChunkChatEvent` 对象流。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatCompletionResponseCn" + "$ref": "#/components/schemas/ChatCompletionResponse" + }, + "examples": { + "blockingResponse": { + "summary": "阻塞模式响应示例", + "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": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkBasicChatEventCn`。" + "description": "Server-Sent Events 流。每个事件是一个 JSON 对象,以 'data: ' 为前缀,以 '\\n\\n' 为后缀。请参阅 `ChunkChatEvent` 了解可能的事件结构。" + }, + "examples": { + "streamingResponseBasic": { + "summary": "流式模式响应示例(基础助手)", + "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": "流式模式响应示例(智能体助手,包含 agent_thought 和 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": "错误请求。可能的错误代码:\n- `invalid_param`:参数输入异常。\n- `app_unavailable`:应用配置不可用。\n- `provider_not_initialize`:无可用的模型凭据配置。\n- `provider_quota_exceeded`:模型调用配额不足。\n- `model_currently_not_support`:当前模型不可用。\n- `completion_request_error`:文本生成失败。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "对话不存在。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "400": { "$ref": "#/components/responses/BadRequestGenericCn" }, - "404": { "$ref": "#/components/responses/ConversationNotFoundCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "500": { + "description": "内部服务器错误。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } } } }, "/files/upload": { "post": { - "summary": "上传文件", - "description": "上传文件(目前仅支持图片)并在发送消息时使用,可实现图文多模态理解。支持 png, jpg, jpeg, webp, gif 格式。上传的文件仅供当前终端用户使用。", - "operationId": "uploadBasicChatFileCn", - "tags": ["文件操作"], + "summary": "文件上传", + "description": "上传文件(目前仅支持图片)以便在发送消息时使用,支持图文多模态理解。支持 png、jpg、jpeg、webp、gif 格式。上传的文件仅供当前终端用户使用。", + "operationId": "uploadChatFile", + "tags": [ + "Files" + ], "requestBody": { - "description": "文件上传请求。需使用 `multipart/form-data` 进行请求。", + "description": "文件上传请求。需要 multipart/form-data 格式。", "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { "file": { "type": "string", "format": "binary", - "description": "要上传的文件。" + "description": "要上传的文件。支持的图片类型:png、jpg、jpeg、webp、gif。" }, "user": { "type": "string", - "description": "用户标识,必须和发送消息接口传入 user 保持一致。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" + "description": "用户标识符,由开发者规则定义,在应用内必须唯一。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。" } } } @@ -119,36 +204,47 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FileUploadResponseCn" + "$ref": "#/components/schemas/FileUploadResponse" } } } }, - "201": { - "description": "文件创建成功 (备选成功状态码)。", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } } + "400": { + "$ref": "#/components/responses/BadRequestFile" + }, + "413": { + "$ref": "#/components/responses/FileTooLarge" }, - "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" } + "415": { + "$ref": "#/components/responses/UnsupportedFileTypeFile" + }, + "503": { + "$ref": "#/components/responses/S3ErrorFile" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { "summary": "获取终端用户", - "description": "通过 ID 获取终端用户信息。\n\n当其他 API 返回终端用户 ID(例如文件上传接口返回的 `created_by`)时,可使用该接口查询对应的终端用户信息。", - "operationId": "getEndUserChatCn", - "tags": ["终端用户"], + "description": "通过 ID 获取终端用户信息。\n当其他 API 返回终端用户 ID 时(例如,文件上传返回的 `created_by`),此接口非常有用。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "终端用户 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { @@ -156,27 +252,35 @@ "description": "成功获取终端用户信息。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailCn" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/{file_id}/preview": { "get": { "summary": "文件预览", - "description": "预览或下载已上传的文件。此端点允许你访问之前通过文件上传API上传的文件。文件只能在所属的应用程序消息内访问。", - "operationId": "previewBasicChatFileCn", - "tags": ["文件操作"], + "description": "预览或下载已上传的文件。此端点允许您访问通过文件上传 API 上传的文件。只有属于请求应用内消息的文件才能被访问。", + "operationId": "previewChatFile", + "tags": [ + "Files" + ], "parameters": [ { "name": "file_id", "in": "path", "required": true, - "description": "要预览的文件的唯一标识符,从文件上传API响应中获取。", + "description": "要预览的文件唯一标识符,从文件上传 API 响应中获取。", "schema": { "type": "string", "format": "uuid" @@ -186,7 +290,7 @@ "name": "as_attachment", "in": "query", "required": false, - "description": "是否强制作为附件下载文件。默认为`false`(在浏览器中预览)。", + "description": "是否强制以附件形式下载文件。默认为 `false`(在浏览器中预览)。", "schema": { "type": "boolean", "default": false @@ -195,7 +299,7 @@ ], "responses": { "200": { - "description": "文件内容成功返回。根据文件类型和请求参数设置响应头。", + "description": "文件内容返回成功。根据文件类型和请求参数设置响应头。", "content": { "image/png": { "schema": { @@ -230,32 +334,32 @@ }, "headers": { "Content-Type": { - "description": "文件的MIME类型", + "description": "文件的 MIME 类型", "schema": { "type": "string" } }, "Content-Length": { - "description": "文件大小(字节)(如果可用)", + "description": "文件大小(字节,如果可用)", "schema": { "type": "integer" } }, "Content-Disposition": { - "description": "如果as_attachment=true,则设置为'attachment'", + "description": "如果 as_attachment=true,则设置为 'attachment'", "schema": { "type": "string" } }, "Cache-Control": { - "description": "用于性能的缓存头", + "description": "用于性能优化的缓存头", "schema": { "type": "string", "example": "public, max-age=3600" } }, "Accept-Ranges": { - "description": "对于音频/视频文件设置为'bytes'", + "description": "对于音频/视频文件,设置为 'bytes'", "schema": { "type": "string", "example": "bytes" @@ -264,26 +368,32 @@ } }, "400": { - "description": "错误请求。可能的错误代码:\n- `invalid_param`: 异常参数输入。", + "description": "错误请求。可能的错误代码:\n- `invalid_param`:参数输入异常。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "403": { - "description": "禁止访问。可能的错误代码:\n- `file_access_denied`: 文件访问被拒绝或文件不属于当前应用程序。", + "description": "禁止访问。可能的错误代码:\n- `file_access_denied`:文件访问被拒绝或文件不属于当前应用。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "404": { - "description": "未找到。可能的错误代码:\n- `file_not_found`: 文件未找到或已被删除。", + "description": "未找到。可能的错误代码:\n- `file_not_found`:文件未找到或已被删除。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, @@ -291,7 +401,9 @@ "description": "内部服务器错误。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } } @@ -300,17 +412,21 @@ }, "/chat-messages/{task_id}/stop": { "post": { - "summary": "停止响应", - "description": "停止生成对话消息。仅支持流式模式。", - "operationId": "stopBasicChatMessageGenerationCn", - "tags": ["对话消息"], + "summary": "停止对话消息生成", + "description": "停止对话消息生成任务。仅支持流式模式。", + "operationId": "stopChatMessageGeneration", + "tags": [ + "Chat" + ], "parameters": [ { "name": "task_id", "in": "path", "required": true, - "description": "任务 ID,可在流式返回 Chunk 中获取。", - "schema": { "type": "string", "format": "uuid" } + "description": "任务 ID,可从 `/chat-messages` 请求的流式返回块中获取。", + "schema": { + "type": "string" + } } ], "requestBody": { @@ -319,11 +435,20 @@ "application/json": { "schema": { "type": "object", - "required": ["user"], + "required": [ + "user" + ], "properties": { "user": { "type": "string", - "description": "用户标识,必须和发送消息接口传入 user 保持一致。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" + "description": "用户标识符,必须与发送消息接口中传递的用户一致。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。" + } + } + }, + "examples": { + "example": { + "value": { + "user": "abc-123" } } } @@ -331,54 +456,86 @@ } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultCn" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/messages/{message_id}/feedbacks": { "post": { - "summary": "消息反馈(点赞)", - "description": "消息终端用户反馈、点赞,方便应用开发者优化输出预期。", - "operationId": "postBasicChatMessageFeedbackCn", - "tags": ["消息反馈"], + "summary": "消息反馈", + "description": "终端用户可以对消息提供反馈,方便应用开发者优化预期输出。", + "operationId": "postChatMessageFeedback", + "tags": [ + "Feedback" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, - "description": "消息 ID。", - "schema": { "type": "string", "format": "uuid" } + "description": "要提供反馈的消息 ID。", + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestCn" } + "schema": { + "$ref": "#/components/schemas/MessageFeedbackRequest" + } } } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultCn" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/app/feedbacks": { "get": { - "summary": "获取APP的消息点赞和反馈", - "description": "获取应用的终端用户反馈、点赞。", - "operationId": "getBasicChatAppFeedbacksCn", - "tags": ["消息反馈"], + "summary": "获取应用反馈列表", + "description": "获取应用的反馈列表。", + "operationId": "getChatAppFeedbacks", + "tags": [ + "Feedback" + ], "parameters": [ - { "$ref": "#/components/parameters/PageQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamCn" } + { + "name": "page", + "in": "query", + "description": "(可选)分页页码。默认:1", + "required": false, + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "limit", + "in": "query", + "description": "(可选)每页记录数。默认:20", + "required": false, + "schema": { + "type": "integer", + "default": 20 + } + } ], "responses": { "200": { - "description": "成功获取应用的反馈列表。", + "description": "应用反馈列表。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseCn" } + "schema": { + "$ref": "#/components/schemas/AppFeedbacksResponse" + } } } } @@ -387,26 +544,40 @@ }, "/messages/{message_id}/suggested": { "get": { - "summary": "获取下一轮建议问题列表", - "description": "获取当前消息的下一轮建议问题列表。", - "operationId": "getBasicChatSuggestedQuestionsCn", - "tags": ["对话消息"], + "summary": "下一步问题建议", + "description": "获取当前消息的下一步问题建议。", + "operationId": "getSuggestedQuestions", + "tags": [ + "Chat" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "消息 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/UserQueryParamCn" } + { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。", + "schema": { + "type": "string" + } + } ], "responses": { "200": { - "description": "成功获取建议问题列表。", + "description": "成功获取建议问题。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseCn" } + "schema": { + "$ref": "#/components/schemas/SuggestedQuestionsResponse" + } } } } @@ -415,27 +586,59 @@ }, "/messages": { "get": { - "summary": "获取会话历史消息", - "description": "滚动加载形式返回历史聊天记录,第一页返回最新 `limit` 条,即倒序返回。", - "operationId": "getBasicChatConversationHistoryCn", - "tags": ["会话管理"], + "summary": "获取对话历史消息", + "description": "以滚动加载格式返回历史聊天记录,首页返回最新的 `{limit}` 条消息,即倒序排列。", + "operationId": "getConversationHistory", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdQueryParamCn" }, - { "$ref": "#/components/parameters/UserQueryParamCn" }, + { + "name": "conversation_id", + "in": "query", + "required": true, + "description": "对话 ID。", + "schema": { + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。", + "schema": { + "type": "string" + } + }, { "name": "first_id", "in": "query", - "description": "当前页第一条聊天记录的 ID,默认 null。", - "schema": { "type": "string", "format": "uuid", "nullable": true } + "required": false, + "description": "当前页第一条聊天记录的 ID,默认为空(用于获取最新记录)。后续页面使用当前列表第一条消息的 ID 来获取更早的消息。", + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Cn" } + { + "name": "limit", + "in": "query", + "required": false, + "description": "单次请求返回多少条聊天历史消息,默认为 20。", + "schema": { + "type": "integer", + "default": 20 + } + } ], "responses": { "200": { - "description": "成功获取会话历史消息。", + "description": "成功获取对话历史。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/BasicConversationHistoryResponseCn" } + "schema": { + "$ref": "#/components/schemas/ConversationHistoryResponse" + } } } } @@ -444,22 +647,68 @@ }, "/conversations": { "get": { - "summary": "获取会话列表", - "description": "获取当前用户的会话列表,默认返回最近的 20 条。", - "operationId": "getBasicChatConversationsListCn", - "tags": ["会话管理"], + "summary": "获取对话列表", + "description": "获取当前用户的对话列表,默认返回最近 20 条记录。", + "operationId": "getConversationsList", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/UserQueryParamCn" }, - { "$ref": "#/components/parameters/LastIdQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" }, - { "$ref": "#/components/parameters/SortByQueryParamCn" } + { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。", + "schema": { + "type": "string" + } + }, + { + "name": "last_id", + "in": "query", + "required": false, + "description": "(可选)当前页最后一条记录的 ID(用于分页)。", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "(可选)返回多少条记录。默认 20,最小 1,最大 100。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "sort_by", + "in": "query", + "required": false, + "description": "排序字段。默认:-updated_at。'-' 前缀表示降序。", + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ], + "default": "-updated_at" + } + } ], "responses": { "200": { - "description": "成功获取会话列表。", + "description": "成功获取对话列表。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ConversationsListResponseCn" } + "schema": { + "$ref": "#/components/schemas/ConversationsListResponse" + } } } } @@ -468,343 +717,2329 @@ }, "/conversations/{conversation_id}": { "delete": { - "summary": "删除会话", - "description": "删除一个指定的会话。", - "operationId": "deleteBasicChatConversationCn", - "tags": ["会话管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ], + "summary": "删除对话", + "description": "删除一个对话。", + "operationId": "deleteConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "对话 ID。", + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "type": "object", "required": ["user"], - "properties": { "user": { "type": "string", "description": "用户标识。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" } } + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string", + "description": "用户标识符。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。" + } + } } } } }, - "responses": { "204": { "description": "会话删除成功,无内容返回。" } } + "responses": { + "204": { + "description": "对话删除成功。无内容。" + } + } } }, "/conversations/{conversation_id}/name": { "post": { - "summary": "会话重命名", - "description": "对会话进行重命名。", - "operationId": "renameBasicChatConversationCn", - "tags": ["会话管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ], + "summary": "对话重命名", + "description": "重命名会话。会话名称用于在支持多会话的客户端上显示。", + "operationId": "renameConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "对话 ID。", + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestCn" } } } + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameRequest" + } + } + } }, "responses": { - "200": { "description": "会话重命名成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseCn" } } } } + "200": { + "description": "对话重命名成功。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameResponse" + } + } + } + } } } }, - "/conversations/{conversation_id}/variables": { + "/conversations/{conversation_id}/variables": { "get": { "summary": "获取对话变量", - "description": "从特定对话中检索变量。此端点对于提取对话过程中捕获的结构化数据非常有用。", - "operationId": "getBasicChatConversationVariablesCn", - "tags": ["会话管理"], + "description": "从特定对话中获取变量。", + "operationId": "getConversationVariables", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdPathParamCn" }, - { "$ref": "#/components/parameters/UserQueryParamCn" }, - { "$ref": "#/components/parameters/LastIdQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" }, - { "$ref": "#/components/parameters/VariableNameQueryParamCn" } + { + "name": "conversation_id", + "in": "path", + "required": true, + "description": "要获取变量的对话 ID。", + "schema": { + "type": "string" + } + }, + { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符。", + "schema": { + "type": "string" + } + }, + { + "name": "last_id", + "in": "query", + "required": false, + "description": "(可选)当前页最后一条记录的 ID(用于分页)。", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "(可选)返回多少条记录。默认 20,最小 1,最大 100。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "variable_name", + "in": "query", + "required": false, + "description": "(可选)按特定名称筛选变量。", + "schema": { + "type": "string" + } + } ], "responses": { - "200": { "description": "成功获取对话变量。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseCn" } } } }, - "404": { "$ref": "#/components/responses/ConversationNotFoundCn" } + "200": { + "description": "成功获取对话变量。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationVariablesResponse" + } + } + } + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + } } } }, "/audio-to-text": { "post": { "summary": "语音转文字", - "description": "将语音文件转换为文字。支持格式:mp3, mp4, mpeg, mpga, m4a, wav, webm。文件大小限制:15MB。", - "operationId": "basicChatAudioToTextCn", - "tags": ["语音与文字转换"], + "description": "将音频文件转换为文本。支持的格式:mp3、mp4、mpeg、mpga、m4a、wav、webm。文件大小限制:15MB。", + "operationId": "audioToText", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestCn" } } } + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/AudioToTextRequest" + } + } + } }, "responses": { - "200": { "description": "成功将语音转换为文字。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseCn" } } } } + "200": { + "description": "成功将音频转换为文本。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AudioToTextResponse" + } + } + } + } } } }, "/text-to-audio": { "post": { "summary": "文字转语音", - "description": "将文字内容转换为语音。", - "operationId": "basicChatTextToAudioCn", - "tags": ["语音与文字转换"], + "description": "将文本转换为语音。", + "operationId": "textToAudioChat", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { - "multipart/form-data": { "schema": { "$ref": "#/components/schemas/TextToAudioFormRequestCn" } } + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/TextToAudioFormRequest" + } + } } }, "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" } } } - } + "description": "音频文件生成成功。", + "content": { + "audio/wav": { + "schema": { + "type": "string", + "format": "binary", + "description": "生成的音频文件。" + } + } + }, + "headers": { + "Content-Type": { + "description": "响应的内容类型,通常为 `audio/wav` 或 `audio/mp3`。", + "schema": { + "type": "string", + "example": "audio/wav" + } + } + } + } } } }, "/info": { "get": { "summary": "获取应用基本信息", - "operationId": "getBasicChatAppInfoCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } } + "description": "用于获取此应用的基本信息。", + "operationId": "getChatAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用的基本信息。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "获取应用参数", - "description": "用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。", - "operationId": "getBasicChatAppParametersCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseCn" } } } } } + "summary": "获取应用参数信息", + "description": "用于在进入页面开始时获取功能特性、输入参数名称、类型和默认值等信息。", + "operationId": "getChatAppParameters", + "tags": [ + "Application" + ], + "parameters": [ + { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符,由开发者规则定义,在应用内必须唯一。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "应用参数信息。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatAppParametersResponse" + } + } + } + } + } } }, "/meta": { "get": { - "summary": "获取应用Meta信息", - "description": "用于获取工具 icon。", - "operationId": "getBasicChatAppMetaCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "成功获取应用 Meta 信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseCn" } } } } } + "summary": "获取应用元信息", + "description": "用于获取此应用中工具的图标。", + "operationId": "getChatAppMeta", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "成功获取应用元信息。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppMetaResponse" + } + } + } + } + } } }, "/site": { "get": { "summary": "获取应用 WebApp 设置", "description": "用于获取应用的 WebApp 设置。", - "operationId": "getBasicChatWebAppSettingsCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseCn" } } } } } + "operationId": "getChatWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用的 WebApp 设置。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAppSettingsResponse" + } + } + } + } + } } - } - }, - "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": "用户标识,由开发者定义规则,需保证用户标识在应用内唯一。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。", "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" } } } }, - "EndUserNotFoundCn": { "description": "终端用户不存在。错误码:`end_user_not_found`", "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": {} + "/apps/annotations": { + "get": { + "summary": "获取标注列表", + "description": "获取应用的标注列表。", + "operationId": "getAnnotationList", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "page", + "in": "query", + "description": "页码。", + "required": false, + "schema": { + "type": "integer", + "default": 1 + } }, - "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制;Agent模式下不允许)。" }, - "user": { "type": "string", "description": "用户标识,应用内唯一。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" }, - "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。" } + { + "name": "limit", + "in": "query", + "description": "返回条目数,默认 20,范围 1-100。", + "required": false, + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + } + ], + "responses": { + "200": { + "description": "成功获取标注列表。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationListResponse" + } + } + } + } } }, - "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": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, - "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } + "post": { + "summary": "创建标注", + "description": "创建新标注。", + "operationId": "createAnnotation", + "tags": [ + "Annotations" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAnnotationRequest" + } + } + } }, - "anyOf": [ + "responses": { + "200": { + "description": "标注创建成功。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationItem" + } + } + } + } + } + } + }, + "/apps/annotations/{annotation_id}": { + "put": { + "summary": "更新标注", + "description": "更新现有标注。", + "operationId": "updateAnnotation", + "tags": [ + "Annotations" + ], + "parameters": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } - }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "name": "annotation_id", + "in": "path", + "required": true, + "description": "标注 ID。", + "schema": { + "type": "string" + } + } + ], + "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": [ + "Annotations" + ], + "parameters": [ + { + "name": "annotation_id", + "in": "path", + "required": true, + "description": "标注 ID。", + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "标注删除成功。无内容。" + } + } + } + }, + "/apps/annotation-reply/{action}": { + "post": { + "summary": "初始化标注回复设置", + "description": "启用或禁用标注回复设置并配置嵌入模型。此接口异步执行。", + "operationId": "initialAnnotationReplySettings", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "操作,只能是 'enable' 或 'disable'。", + "schema": { + "type": "string", + "enum": [ + "enable", + "disable" + ] + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "标注回复设置任务已启动。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" + } + } + } + } + } + } + }, + "/apps/annotation-reply/{action}/status/{job_id}": { + "get": { + "summary": "查询初始化标注回复设置任务状态", + "description": "查询异步执行的标注回复设置任务的状态。", + "operationId": "getInitialAnnotationReplySettingsStatus", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "操作,必须与初始设置调用中的操作一致('enable' 或 'disable')。", + "schema": { + "type": "string", + "enum": [ + "enable", + "disable" + ] + } }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string", "format":"uuid" } - }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "name": "job_id", + "in": "path", + "required": true, + "description": "从初始设置调用中获取的任务 ID。", + "schema": { + "type": "string" + } } - ] - }, - "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)。" } + ], + "responses": { + "200": { + "description": "成功获取任务状态。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" + } + } } } - ] - }, - "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": "上传时间。" } } }, - "EndUserDetailCn": { - "type": "object", - "properties": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "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": "文本转语音和语音转文本操作。" }, - { "name": "应用配置", "description": "获取应用设置和信息相关的操作。" } + "components": { + "securitySchemes": { + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "API Key 认证。对于所有 API 请求,请在 `Authorization` HTTP 头中包含您的 API Key,并以 'Bearer ' 为前缀。示例:`Authorization: Bearer {API_KEY}`。**强烈建议将您的 API Key 存储在服务端,不要在客户端共享或存储,以避免可能的 API Key 泄露导致严重后果。**" + } + }, + "responses": { + "BadRequestFile": { + "description": "文件操作的错误请求。可能的错误代码:\n- `no_file_uploaded`:必须提供文件。\n- `too_many_files`:目前仅接受一个文件。\n- `unsupported_preview`:文件不支持预览。\n- `unsupported_estimate`:文件不支持估算。", + "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`:不支持的扩展名。(注意:`/files/upload` 的描述列出了图片类型,而此通用错误提到了文档文件。这可能表示后端返回的上下文特定消息)。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3 操作的服务不可用。可能的错误代码:\n- `s3_connection_failed`:无法连接到 S3 服务。\n- `s3_permission_denied`:没有权限上传文件到 S3。\n- `s3_file_too_large`:文件超过 S3 大小限制。", + "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" + } + } + } + } + } + }, + "ConversationNotFound": { + "description": "对话未找到。错误代码:`conversation_not_exists`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "EndUserNotFound": { + "description": "终端用户未找到。错误代码:`end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "schemas": { + "ChatRequest": { + "type": "object", + "required": [ + "query", + "user" + ], + "properties": { + "query": { + "type": "string", + "description": "用户输入/问题内容。" + }, + "inputs": { + "type": "object", + "description": "允许输入应用定义的各种变量值。包含键/值对。默认 {}。", + "additionalProperties": true, + "default": {} + }, + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "description": "响应返回模式。`streaming`(推荐)使用 SSE。`blocking` 在完成后返回(长时间处理可能会中断;智能体助手模式不支持)。Cloudflare 超时为 100 秒。", + "default": "streaming" + }, + "user": { + "type": "string", + "description": "用户标识符,在应用内唯一。**注意**:Service API 不与 WebApp 共享创建的对话。通过 API 创建的对话与 WebApp 界面创建的对话是隔离的。" + }, + "conversation_id": { + "type": "string", + "description": "对话 ID,用于继续对话。传递之前消息的 conversation_id。" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObject" + }, + "description": "文件列表(图片),用于具有视觉能力的模型。" + }, + "auto_generate_name": { + "type": "boolean", + "description": "自动生成对话标题。默认 `true`。如果为 `false`,使用对话重命名 API 并设置 `auto_generate: true` 进行异步标题生成。", + "default": true + } + } + }, + "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` 表示图片 URL / `local_file` 表示文件上传" + }, + "url": { + "type": "string", + "format": "url", + "description": "图片 URL(当传递方式为 `remote_url` 时)" + }, + "upload_file_id": { + "type": "string", + "description": "已上传的文件 ID,必须通过文件上传 API 提前获取(当传递方式为 `local_file` 时)" + } + }, + "anyOf": [ + { + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } + }, + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } + }, + { + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } + }, + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } + } + ] + }, + "ChatCompletionResponse": { + "type": "object", + "description": "阻塞模式对话完成的响应对象。", + "properties": { + "event": { + "type": "string", + "description": "事件类型,固定为 `message`。", + "example": "message" + }, + "task_id": { + "type": "string", + "format": "uuid", + "description": "任务 ID,用于请求跟踪和停止响应 API。" + }, + "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", + "description": "应用模式,固定为 `chat`。", + "example": "chat" + }, + "answer": { + "type": "string", + "description": "完整的响应内容。" + }, + "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": "消息创建时间戳(Unix 纪元秒)。" + } + } + }, + "ChunkChatEvent": { + "type": "object", + "description": "流式模式中 Server-Sent Event 块的基础 schema。", + "required": [ + "event" + ], + "properties": { + "event": { + "type": "string", + "description": "事件类型。", + "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": "任务 ID。" + }, + "message_id": { + "type": "string", + "format": "uuid", + "description": "唯一消息 ID。" + }, + "conversation_id": { + "type": "string", + "format": "uuid", + "description": "对话 ID。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "创建时间戳。" + } + } + }, + "StreamEventChatMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "LLM 返回的文本块。" + } + } + } + ] + }, + "StreamEventChatAgentMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "LLM 返回的文本块(智能体模式)。" + } + } + } + ] + }, + "StreamEventChatTtsMessage": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "TTS 音频流事件(Base64 编码的 Mp3)。在启用自动播放时可用。", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "format": "byte", + "description": "Base64 编码的音频块。" + } + } + } + ] + }, + "StreamEventChatTtsMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "TTS 音频流结束事件。", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "description": "结束事件的空字符串。" + } + } + } + ] + }, + "StreamEventChatAgentThought": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "智能体思考、LLM 推理、工具调用详情(智能体模式)。", + "required": [ + "id", + "position" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "智能体思考 ID。" + }, + "position": { + "type": "integer", + "description": "此思考在消息序列中的位置。" + }, + "thought": { + "type": "string", + "description": "LLM 正在思考的内容。" + }, + "observation": { + "type": "string", + "description": "工具调用的响应。" + }, + "tool": { + "type": "string", + "description": "调用的工具列表,以 ';' 分隔。" + }, + "tool_input": { + "type": "string", + "description": "JSON 格式的工具输入。示例:{\"dalle3\": {\"prompt\": \"a cute cat\"}}。" + }, + "message_files": { + "type": "array", + "items": { + "type": "string", + "format": "uuid" + }, + "description": "与此思考相关的文件 ID(例如,由工具生成)。" + } + } + } + ] + }, + "StreamEventChatMessageFile": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "type": "object", + "description": "消息文件事件,工具创建的新文件。", + "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。" + } + } + } + ] + }, + "StreamEventChatMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBase" + }, + { + "type": "object", + "description": "消息结束事件,流式传输已结束。", + "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": "消息内容替换事件(例如,由于内容审核)。", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "替换内容。" + } + } + } + ] + }, + "StreamEventChatError": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "$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": "错误消息。" + } + } + } + ] + }, + "StreamEventChatPing": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkChatEvent" + }, + { + "type": "object", + "description": "用于保持连接活跃的 Ping 事件。" + } + ] + }, + "Usage": { + "type": "object", + "description": "模型使用信息。", + "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": "资源的引用和归属信息。", + "properties": { + "position": { + "type": "integer", + "description": "资源在列表中的位置。" + }, + "dataset_id": { + "type": "string", + "format": "uuid", + "description": "数据集 ID。" + }, + "dataset_name": { + "type": "string", + "description": "数据集名称。" + }, + "document_id": { + "type": "string", + "format": "uuid", + "description": "文档 ID。" + }, + "document_name": { + "type": "string", + "description": "文档名称。" + }, + "segment_id": { + "type": "string", + "format": "uuid", + "description": "文档中特定段落的 ID。" + }, + "score": { + "type": "number", + "format": "float", + "description": "资源的相关性分数。" + }, + "content": { + "type": "string", + "description": "资源的内容片段。" + } + } + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "文件类型,例如 'image'。" + }, + "url": { + "type": "string", + "format": "url", + "description": "预览图片 URL。" + }, + "belongs_to": { + "type": "string", + "enum": [ + "user", + "assistant" + ], + "description": "此文件属于谁。" + } + } + }, + "AgentThoughtItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "智能体思考 ID。" + }, + "message_id": { + "type": "string", + "format": "uuid", + "description": "此思考所属的唯一消息 ID。" + }, + "position": { + "type": "integer", + "description": "此思考的位置。" + }, + "thought": { + "type": "string", + "description": "LLM 正在思考的内容。" + }, + "tool": { + "type": "string", + "description": "调用的工具,以 ';' 分隔。" + }, + "tool_input": { + "type": "string", + "description": "JSON 格式的工具输入。" + }, + "observation": { + "type": "string", + "description": "工具调用的响应。" + }, + "files": { + "type": "array", + "items": { + "type": "string", + "format": "uuid" + }, + "description": "与此思考相关的文件 ID(从示例来看,Markdown 文本中称为 'message_files')。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "创建时间戳。" + } + } + }, + "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": "(可选)对话的名称。如果 auto_generate 为 true,则省略。" + }, + "auto_generate": { + "type": "boolean", + "default": false, + "description": "(可选)自动生成标题。默认 false。" + }, + "user": { + "type": "string", + "description": "用户标识符。" + } + } + }, + "ConversationRenameResponse": { + "$ref": "#/components/schemas/ConversationListItem" + }, + "ConversationVariablesResponse": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "description": "每页条目数。" + }, + "has_more": { + "type": "boolean", + "description": "是否有下一页。" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ConversationVariableItem" + } + } + } + }, + "ConversationVariableItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "变量 ID。" + }, + "name": { + "type": "string", + "description": "变量名称。" + }, + "value_type": { + "type": "string", + "description": "变量类型(string、number、object、json 等)。" + }, + "value": { + "type": "string", + "description": "变量值(复杂类型可以是 JSON 字符串)。" + }, + "description": { + "type": "string", + "description": "变量描述。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "创建时间戳。" + }, + "updated_at": { + "type": "integer", + "format": "int64", + "description": "最后更新时间戳。" + } + } + }, + "AudioToTextRequest": { + "type": "object", + "required": [ + "file", + "user" + ], + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "音频文件。支持:mp3、mp4、mpeg、mpga、m4a、wav、webm。限制:15MB。" + }, + "user": { + "type": "string", + "description": "用户标识符。" + } + } + }, + "AudioToTextResponse": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "语音识别输出的文本。" + } + } + }, + "TextToAudioFormRequest": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "message_id": { + "type": "string", + "format": "uuid", + "description": "消息 ID(如果同时提供 text 和 message_id,则优先使用此项)。" + }, + "text": { + "type": "string", + "description": "语音内容。" + }, + "user": { + "type": "string", + "description": "用户标识符。" + } + }, + "description": "需要 `user`。提供 `message_id` 或 `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。" + }, + { + "$ref": "#/components/schemas/ToolIconDetail" + } + ] + }, + "description": "工具图标。键为工具名称。" + } + } + }, + "ToolIconDetail": { + "type": "object", + "properties": { + "background": { + "type": "string", + "description": "十六进制格式的背景颜色。" + }, + "content": { + "type": "string", + "description": "Emoji 内容。" + } + } + }, + "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": "指定的嵌入模型提供商名称(可选)。" + }, + "embedding_model_name": { + "type": "string", + "description": "指定的嵌入模型名称(可选)。" + }, + "score_threshold": { + "type": "number", + "format": "float", + "description": "匹配标注回复的相似度阈值。" + } + } + }, + "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": "与对话消息和交互相关的操作。" + }, + { + "name": "Files", + "description": "文件上传和预览操作。" + }, + { + "name": "End Users", + "description": "与终端用户信息相关的操作。" + }, + { + "name": "Feedback", + "description": "用户反馈操作。" + }, + { + "name": "Conversations", + "description": "与对话管理相关的操作。" + }, + { + "name": "TTS", + "description": "文字转语音和语音转文字操作。" + }, + { + "name": "Application", + "description": "获取应用设置和信息的操作。" + }, + { + "name": "Annotations", + "description": "与管理直接回复标注相关的操作。" + } ] } \ No newline at end of file diff --git a/zh/api-reference/openapi_chatflow.json b/zh/api-reference/openapi_chatflow.json index 341280133..5d0e9ab49 100644 --- a/zh/api-reference/openapi_chatflow.json +++ b/zh/api-reference/openapi_chatflow.json @@ -1,18 +1,18 @@ { "openapi": "3.0.1", "info": { - "title": "工作流编排对话型应用 API (Chatflow API)", - "description": "对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。", + "title": "高级对话型应用 API", + "description": "对话型应用支持会话持久化,允许将之前的聊天历史记录用作响应的上下文。这适用于聊天机器人、客服 AI 等场景。此版本包含工作流事件和更详细的文件类型支持等高级功能。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "API 的基础 URL。请将 {api_base_url} 替换为你的应用提供的实际 API 基础 URL。", + "description": "高级对话型应用 API 的基础 URL。请将 {api_base_url} 替换为您应用的实际 API 基础 URL(例如,来自 props.appDetail.api_base_url)。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "实际的 API 基础 URL" + "description": "API 的实际基础 URL" } } } @@ -26,35 +26,38 @@ "/chat-messages": { "post": { "summary": "发送对话消息", - "description": "创建会话消息。", - "operationId": "sendChatMessageCn", - "tags": ["对话消息"], + "description": "向高级对话型应用发送请求,支持多种文件类型和工作流事件。", + "operationId": "sendAdvancedChatMessage", + "tags": [ + "Chatflow" + ], "requestBody": { - "description": "发送对话消息的请求体。", + "description": "发送高级对话消息的请求体。", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatRequestCn" + "$ref": "#/components/schemas/AdvancedChatRequest" }, "examples": { - "streaming_with_file": { - "summary": "包含文件和自定义输入的流式请求示例", + "streaming_with_file_and_workflow": { + "summary": "带图片文件的流式模式示例", "value": { "inputs": { - "name": "dify" + "user_name": "Alice" }, - "query": "iPhone 13 Pro Max 的规格是什么?", + "query": "Analyze this document and tell me its sentiment.", "response_mode": "streaming", - "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", - "user": "abc-123", + "conversation_id": "conv_12345", + "user": "user_alice", "files": [ { - "type": "image", + "type": "document", "transfer_method": "remote_url", - "url": "https://cloud.dify.ai/logo/logo-site.png" + "url": "https://example.com/mydoc.pdf" } - ] + ], + "auto_generate_name": true } } } @@ -63,41 +66,58 @@ }, "responses": { "200": { - "description": "请求成功。响应的内容类型和结构取决于请求中的 `response_mode` 参数。\n- 当 `response_mode` 为 `blocking` 时,返回 `application/json` 格式的 `ChatCompletionResponseCn` 对象。\n- 当 `response_mode` 为 `streaming` 时,返回 `text/event-stream` 格式的 `ChunkChatEventCn` 对象流式序列。", + "description": "成功响应。内容类型和结构取决于 `response_mode`。\n- `blocking`:`application/json` 格式,返回 `ChatCompletionResponse`。\n- `streaming`:`text/event-stream` 格式,返回 `ChunkAdvancedChatEvent` 流。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChatCompletionResponseCn" + "$ref": "#/components/schemas/ChatCompletionResponse" } }, "text/event-stream": { "schema": { "type": "string", - "description": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkChatEventCn`。" + "description": "服务器发送事件(Server-Sent Events)流。结构详见 `ChunkAdvancedChatEvent`。" + }, + "examples": { + "workflow_events_example": { + "summary": "包含工作流事件的流示例", + "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/BadRequestGenericCn" }, - "404": { "$ref": "#/components/responses/ConversationNotFoundCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "400": { + "$ref": "#/components/responses/BadRequestGeneric" + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/upload": { "post": { - "summary": "上传文件", - "description": "上传文件并在发送消息时使用,可实现图文多模态理解。支持你的应用程序所支持的所有格式。上传的文件仅供当前终端用户使用。", - "operationId": "uploadFileCn", - "tags": ["文件操作"], + "summary": "文件上传", + "description": "上传文件以便在发送消息时使用,支持多模态理解。支持应用所支持的任何格式。上传的文件仅供当前终端用户使用。", + "operationId": "uploadAdvancedChatFile", + "tags": [ + "Files" + ], "requestBody": { - "description": "文件上传请求。需使用 `multipart/form-data` 进行请求。", + "description": "文件上传请求。需要 multipart/form-data 格式。", "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { "file": { "type": "string", @@ -106,7 +126,7 @@ }, "user": { "type": "string", - "description": "用户标识,必须和发送消息接口传入 user 保持一致。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" + "description": "用户标识符,在应用内唯一。**注意**:Service API 不共享 WebApp 创建的会话。通过 API 创建的会话与 WebApp 界面中创建的会话相互隔离。" } } } @@ -119,36 +139,47 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/FileUploadResponseCn" + "$ref": "#/components/schemas/FileUploadResponse" } } } }, - "201": { - "description": "文件创建成功 (备选成功状态码)。", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponseCn" } } } + "400": { + "$ref": "#/components/responses/BadRequestFile" + }, + "413": { + "$ref": "#/components/responses/FileTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedFileTypeFile" }, - "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" } + "503": { + "$ref": "#/components/responses/S3ErrorFile" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { "summary": "获取终端用户", - "description": "通过 ID 获取终端用户信息。\n\n当其他 API 返回终端用户 ID(例如文件上传接口返回的 `created_by`)时,可使用该接口查询对应的终端用户信息。", - "operationId": "getEndUserChatflowCn", - "tags": ["终端用户"], + "description": "通过 ID 获取终端用户信息。\n当其他 API 返回终端用户 ID 时(例如文件上传返回的 `created_by`),此接口非常有用。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "终端用户 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { @@ -156,27 +187,35 @@ "description": "成功获取终端用户信息。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailCn" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/files/{file_id}/preview": { "get": { "summary": "文件预览", - "description": "预览或下载已上传的文件。此端点允许你访问之前通过文件上传API上传的文件。文件只能在所属的应用程序消息内访问。", - "operationId": "previewChatFlowFileCn", - "tags": ["文件操作"], + "description": "预览或下载已上传的文件。此端点允许您访问之前通过文件上传 API 上传的文件。只有属于请求应用内消息的文件才能被访问。", + "operationId": "previewChatFlowFile", + "tags": [ + "Files" + ], "parameters": [ { "name": "file_id", "in": "path", "required": true, - "description": "要预览的文件的唯一标识符,从文件上传API响应中获取。", + "description": "要预览的文件唯一标识符,从文件上传 API 响应中获取。", "schema": { "type": "string", "format": "uuid" @@ -186,7 +225,7 @@ "name": "as_attachment", "in": "query", "required": false, - "description": "是否强制作为附件下载文件。默认为`false`(在浏览器中预览)。", + "description": "是否强制将文件作为附件下载。默认为 `false`(在浏览器中预览)。", "schema": { "type": "boolean", "default": false @@ -195,7 +234,7 @@ ], "responses": { "200": { - "description": "文件内容成功返回。根据文件类型和请求参数设置响应头。", + "description": "文件内容返回成功。响应头根据文件类型和请求参数设置。", "content": { "image/png": { "schema": { @@ -230,32 +269,32 @@ }, "headers": { "Content-Type": { - "description": "文件的MIME类型", + "description": "文件的 MIME 类型", "schema": { "type": "string" } }, "Content-Length": { - "description": "文件大小(字节)(如果可用)", + "description": "文件大小(字节,如可用)", "schema": { "type": "integer" } }, "Content-Disposition": { - "description": "如果as_attachment=true,则设置为'attachment'", + "description": "如果 as_attachment=true,则设置为 'attachment'", "schema": { "type": "string" } }, "Cache-Control": { - "description": "用于性能的缓存头", + "description": "用于性能优化的缓存头", "schema": { "type": "string", "example": "public, max-age=3600" } }, "Accept-Ranges": { - "description": "对于音频/视频文件设置为'bytes'", + "description": "对于音频/视频文件设置为 'bytes'", "schema": { "type": "string", "example": "bytes" @@ -264,26 +303,32 @@ } }, "400": { - "description": "错误请求。可能的错误代码:\n- `invalid_param`: 异常参数输入。", + "description": "错误请求。可能的错误代码:\n- `invalid_param`:参数输入异常。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "403": { - "description": "禁止访问。可能的错误代码:\n- `file_access_denied`: 文件访问被拒绝或文件不属于当前应用程序。", + "description": "禁止访问。可能的错误代码:\n- `file_access_denied`:文件访问被拒绝或文件不属于当前应用。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, "404": { - "description": "未找到。可能的错误代码:\n- `file_not_found`: 文件未找到或已被删除。", + "description": "未找到。可能的错误代码:\n- `file_not_found`:文件未找到或已被删除。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } }, @@ -291,7 +336,9 @@ "description": "内部服务器错误。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } } } } @@ -300,17 +347,21 @@ }, "/chat-messages/{task_id}/stop": { "post": { - "summary": "停止响应", - "description": "停止生成对话消息。仅支持流式模式。", - "operationId": "stopChatMessageGenerationCn", - "tags": ["对话消息"], + "summary": "停止高级对话消息生成", + "description": "停止高级对话消息生成任务。仅在流式模式下支持。", + "operationId": "stopAdvancedChatMessageGeneration", + "tags": [ + "Chatflow" + ], "parameters": [ { "name": "task_id", "in": "path", "required": true, - "description": "任务 ID,可在流式返回 Chunk 中获取。", - "schema": { "type": "string", "format": "uuid" } + "description": "来自流式数据块的任务 ID。", + "schema": { + "type": "string" + } } ], "requestBody": { @@ -319,11 +370,13 @@ "application/json": { "schema": { "type": "object", - "required": ["user"], + "required": [ + "user" + ], "properties": { "user": { "type": "string", - "description": "用户标识,必须和发送消息接口传入 user 保持一致。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" + "description": "用户标识符,需与发送消息调用保持一致。**注意**:Service API 不共享 WebApp 创建的会话。通过 API 创建的会话与 WebApp 界面中创建的会话相互隔离。" } } } @@ -331,54 +384,72 @@ } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultCn" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/messages/{message_id}/feedbacks": { "post": { - "summary": "消息反馈(点赞)", - "description": "消息终端用户反馈、点赞,方便应用开发者优化输出预期。", - "operationId": "postMessageFeedbackCn", - "tags": ["消息反馈"], + "summary": "消息反馈", + "description": "为消息提供反馈。", + "operationId": "postAdvancedChatMessageFeedback", + "tags": [ + "Feedback" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "消息 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string" + } } ], "requestBody": { "required": true, "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MessageFeedbackRequestCn" } + "schema": { + "$ref": "#/components/schemas/MessageFeedbackRequest" + } } } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultCn" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/app/feedbacks": { "get": { - "summary": "获取APP的消息点赞和反馈", - "description": "获取应用的终端用户反馈、点赞。", - "operationId": "getAppFeedbacksCn", - "tags": ["消息反馈"], + "summary": "获取应用反馈", + "description": "获取应用的反馈列表。", + "operationId": "getAdvancedChatAppFeedbacks", + "tags": [ + "Feedback" + ], "parameters": [ - { "$ref": "#/components/parameters/PageQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamCn" } + { + "$ref": "#/components/parameters/PageQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParam" + } ], "responses": { "200": { - "description": "成功获取应用的反馈列表。", + "description": "应用反馈列表。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/AppFeedbacksResponseCn" } + "schema": { + "$ref": "#/components/schemas/AppFeedbacksResponse" + } } } } @@ -387,26 +458,34 @@ }, "/messages/{message_id}/suggested": { "get": { - "summary": "获取下一轮建议问题列表", - "description": "获取当前消息的下一轮建议问题列表。", - "operationId": "getSuggestedQuestionsCn", - "tags": ["对话消息"], + "summary": "下一步问题建议", + "description": "获取当前消息的下一步问题建议。", + "operationId": "getAdvancedSuggestedQuestions", + "tags": [ + "Chatflow" + ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "消息 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/UserQueryParamCn" } + { + "$ref": "#/components/parameters/UserQueryParam" + } ], "responses": { "200": { - "description": "成功获取建议问题列表。", + "description": "成功获取建议问题。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponseCn" } + "schema": { + "$ref": "#/components/schemas/SuggestedQuestionsResponse" + } } } } @@ -416,26 +495,38 @@ "/messages": { "get": { "summary": "获取会话历史消息", - "description": "滚动加载形式返回历史聊天记录,第一页返回最新 `limit` 条,即倒序返回。", - "operationId": "getConversationHistoryCn", - "tags": ["会话管理"], + "description": "以滚动加载格式返回历史聊天记录。", + "operationId": "getAdvancedConversationHistory", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdQueryParamCn" }, - { "$ref": "#/components/parameters/UserQueryParamCn" }, + { + "$ref": "#/components/parameters/ConversationIdQueryParam" + }, + { + "$ref": "#/components/parameters/UserQueryParam" + }, { "name": "first_id", "in": "query", - "description": "当前页第一条聊天记录的 ID,默认 null。", - "schema": { "type": "string", "format": "uuid", "nullable": true } + "description": "当前页面第一条聊天记录的 ID(用于分页)。", + "schema": { + "type": "string" + } }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Cn" } + { + "$ref": "#/components/parameters/LimitQueryParamDefault20" + } ], "responses": { "200": { - "description": "成功获取会话历史消息。", + "description": "成功获取会话历史记录。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ConversationHistoryResponseCn" } + "schema": { + "$ref": "#/components/schemas/ConversationHistoryResponse" + } } } } @@ -445,21 +536,33 @@ "/conversations": { "get": { "summary": "获取会话列表", - "description": "获取当前用户的会话列表,默认返回最近的 20 条。", - "operationId": "getConversationsListCn", - "tags": ["会话管理"], + "description": "获取当前用户的会话列表。", + "operationId": "getAdvancedConversationsList", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/UserQueryParamCn" }, - { "$ref": "#/components/parameters/LastIdQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" }, - { "$ref": "#/components/parameters/SortByQueryParamCn" } + { + "$ref": "#/components/parameters/UserQueryParam" + }, + { + "$ref": "#/components/parameters/LastIdQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" + }, + { + "$ref": "#/components/parameters/SortByQueryParam" + } ], "responses": { "200": { "description": "成功获取会话列表。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/ConversationsListResponseCn" } + "schema": { + "$ref": "#/components/schemas/ConversationsListResponse" + } } } } @@ -469,88 +572,193 @@ "/conversations/{conversation_id}": { "delete": { "summary": "删除会话", - "description": "删除一个指定的会话。", - "operationId": "deleteConversationCn", - "tags": ["会话管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ], + "description": "删除会话。", + "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": "用户标识。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" } } + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string", + "description": "用户标识符。**注意**:Service API 不共享 WebApp 创建的会话。通过 API 创建的会话与 WebApp 界面中创建的会话相互隔离。" + } + } } } } }, - "responses": { "204": { "description": "会话删除成功,无内容返回。" } } + "responses": { + "204": { + "description": "会话删除成功。无内容返回。" + } + } } }, "/conversations/{conversation_id}/name": { "post": { "summary": "会话重命名", - "description": "对会话进行重命名。", - "operationId": "renameConversationCn", - "tags": ["会话管理"], - "parameters": [ { "$ref": "#/components/parameters/ConversationIdPathParamCn" } ], + "description": "重命名会话。", + "operationId": "renameAdvancedConversation", + "tags": [ + "Conversations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/ConversationIdPathParam" + } + ], "requestBody": { "required": true, - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequestCn" } } } + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameRequest" + } + } + } }, "responses": { - "200": { "description": "会话重命名成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameResponseCn" } } } } + "200": { + "description": "会话重命名成功。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationRenameResponse" + } + } + } + } } } }, - "/conversations/{conversation_id}/variables": { + "/conversations/{conversation_id}/variables": { "get": { - "summary": "获取对话变量", - "description": "从特定对话中检索变量。此端点对于提取对话过程中捕获的结构化数据非常有用。", - "operationId": "getConversationVariablesCn", - "tags": ["会话管理"], + "summary": "获取会话变量", + "description": "获取特定会话的变量。", + "operationId": "getAdvancedConversationVariables", + "tags": [ + "Conversations" + ], "parameters": [ - { "$ref": "#/components/parameters/ConversationIdPathParamCn" }, - { "$ref": "#/components/parameters/UserQueryParamCn" }, - { "$ref": "#/components/parameters/LastIdQueryParamCn" }, - { "$ref": "#/components/parameters/LimitQueryParamDefault20Max100Cn" } + { + "$ref": "#/components/parameters/ConversationIdPathParam" + }, + { + "$ref": "#/components/parameters/UserQueryParam" + }, + { + "$ref": "#/components/parameters/LastIdQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" + } ], "responses": { - "200": { "description": "成功获取对话变量。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponseCn" } } } }, - "404": { "$ref": "#/components/responses/ConversationNotFoundCn" } + "200": { + "description": "成功获取会话变量。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConversationVariablesResponse" + } + } + } + }, + "404": { + "$ref": "#/components/responses/ConversationNotFound" + } } } }, "/audio-to-text": { "post": { "summary": "语音转文字", - "description": "将语音文件转换为文字。支持格式:mp3, mp4, mpeg, mpga, m4a, wav, webm。文件大小限制:15MB。", - "operationId": "audioToTextCn", - "tags": ["语音与文字转换"], + "description": "将音频文件转换为文字。支持格式:mp3、mp4、mpeg、mpga、m4a、wav、webm。文件大小限制:15MB。", + "operationId": "advancedAudioToText", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequestCn" } } } + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/AudioToTextRequest" + } + } + } }, "responses": { - "200": { "description": "成功将语音转换为文字。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponseCn" } } } } + "200": { + "description": "音频转文字成功。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AudioToTextResponse" + } + } + } + } } } }, "/text-to-audio": { "post": { "summary": "文字转语音", - "description": "将文字内容转换为语音。", - "operationId": "textToAudioCn", - "tags": ["语音与文字转换"], + "description": "将文字转换为语音。", + "operationId": "advancedTextToAudio", + "tags": [ + "TTS" + ], "requestBody": { "required": true, - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioJsonRequestCn" } } } + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TextToAudioJsonRequest" + } + } + } }, "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" } } } + "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" + } + } + } } } } @@ -558,295 +766,2343 @@ "/info": { "get": { "summary": "获取应用基本信息", - "operationId": "getAppInfoCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } } + "operationId": "getAdvancedChatAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用基本信息。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "获取应用参数", - "description": "用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。", - "operationId": "getAppParametersCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatAppParametersResponseCn" } } } } } + "summary": "获取应用参数信息", + "operationId": "getAdvancedChatAppParameters", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用参数。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatAppParametersResponse" + } + } + } + } + } } }, "/meta": { "get": { - "summary": "获取应用Meta信息", - "description": "用于获取工具 icon。", - "operationId": "getAppMetaCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "成功获取应用 Meta 信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponseCn" } } } } } + "summary": "获取应用元信息", + "operationId": "getAdvancedChatAppMeta", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用元信息(工具图标)。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppMetaResponse" + } + } + } + } + } } }, "/site": { "get": { "summary": "获取应用 WebApp 设置", - "description": "用于获取应用的 WebApp 设置。", - "operationId": "getWebAppSettingsCn", - "tags": ["应用配置"], - "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponseCn" } } } } } + "operationId": "getAdvancedChatWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "WebApp 设置。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAppSettingsResponse" + } + } + } + } + } } }, "/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" } } } }, + "operationId": "getAdvancedAnnotationList", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/PageQueryParam" + }, + { + "$ref": "#/components/parameters/LimitQueryParamDefault20Max100" + } + ], "responses": { - "200": { "description": "标注创建成功。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItemCn" } } } }, - "201": { "description": "标注创建成功 (备选)。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItemCn" } } } } + "200": { + "description": "标注列表。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotationListResponse" + } + } + } + } } - } - }, - "/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" } } } } } - } - } + "summary": "创建标注", + "operationId": "createAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "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": "更新标注", + "operationId": "updateAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "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": "删除标注", + "operationId": "deleteAdvancedAnnotation", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/AnnotationIdPathParam" + } + ], + "responses": { + "204": { + "description": "标注已删除。" + } + } + } + }, + "/apps/annotation-reply/{action}": { + "post": { + "summary": "初始化标注回复设置", + "operationId": "initialAdvancedAnnotationReplySettings", + "tags": [ + "Annotations" + ], + "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/InitialAnnotationReplySettingsResponse" + } + } + } + }, + "202": { + "description": "任务已接受。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" + } + } + } + } + } + } + }, + "/apps/annotation-reply/{action}/status/{job_id}": { + "get": { + "summary": "查询初始化标注回复设置任务状态", + "operationId": "getAdvancedInitialAnnotationReplySettingsStatus", + "tags": [ + "Annotations" + ], + "parameters": [ + { + "$ref": "#/components/parameters/AnnotationActionPathParam" + }, + { + "$ref": "#/components/parameters/JobIdPathParam" + } + ], + "responses": { + "200": { + "description": "任务状态。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" + } + } + } + } + } + } + } }, "components": { "securitySchemes": { - "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含你的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。" } + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "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": "用户标识,由开发者定义规则,需保证用户标识在应用内唯一。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。", "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" } }, - "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" } } + "PageQueryParam": { + "name": "page", + "in": "query", + "description": "页码。", + "schema": { + "type": "integer", + "default": 1 + } + }, + "LimitQueryParam": { + "name": "limit", + "in": "query", + "description": "每页条目数。", + "schema": { + "type": "integer" + } + }, + "LimitQueryParamDefault20": { + "name": "limit", + "in": "query", + "description": "每页条目数。", + "schema": { + "type": "integer", + "default": 20 + } + }, + "LimitQueryParamDefault20Max100": { + "name": "limit", + "in": "query", + "description": "每页条目数(默认 20,最大 100)。", + "schema": { + "type": "integer", + "default": 20, + "minimum": 1, + "maximum": 100 + } + }, + "UserQueryParam": { + "name": "user", + "in": "query", + "required": true, + "description": "用户标识符。**注意**:Service API 不共享 WebApp 创建的会话。通过 API 创建的会话与 WebApp 界面中创建的会话相互隔离。", + "schema": { + "type": "string" + } + }, + "ConversationIdQueryParam": { + "name": "conversation_id", + "in": "query", + "required": true, + "description": "会话 ID。", + "schema": { + "type": "string" + } + }, + "LastIdQueryParam": { + "name": "last_id", + "in": "query", + "description": "用于分页的最后一条记录 ID。", + "schema": { + "type": "string" + } + }, + "SortByQueryParam": { + "name": "sort_by", + "in": "query", + "description": "排序字段(例如 -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": "会话 ID。", + "schema": { + "type": "string" + } + }, + "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": { - "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" } } } }, - "EndUserNotFoundCn": { "description": "终端用户不存在。错误码:`end_user_not_found`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } } + "BadRequestGeneric": { + "description": "错误请求。请检查参数。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "BadRequestFile": { + "description": "文件操作的错误请求。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "FileTooLarge": { + "description": "文件过大。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "UnsupportedFileTypeFile": { + "description": "不支持的上传文件类型。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3 存储错误。", + "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" + } + } + } + } + } + }, + "ConversationNotFound": { + "description": "会话未找到。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "EndUserNotFound": { + "description": "终端用户未找到。错误代码:`end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } }, "schemas": { - "ChatRequestCn": { + "AdvancedChatRequest": { "type": "object", - "required": ["query", "user"], + "required": [ + "query", + "user" + ], "properties": { - "query": { "type": "string", "description": "用户输入/提问内容。" }, + "query": { + "type": "string", + "description": "用户输入/问题内容。" + }, "inputs": { "type": "object", - "description": "允许传入 App 定义的各变量值。如果变量是文件类型,请指定一个 InputFileObjectCn 对象。", + "description": "应用变量的键值对。对于文件类型变量,值应为 InputFileObject。", "additionalProperties": { - "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "$ref": "#/components/schemas/InputFileObjectCn" } ] + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "$ref": "#/components/schemas/InputFileObjectAdvanced" + } + ] }, "default": {} }, - "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "default": "streaming", "description": "响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制)。" }, - "user": { "type": "string", "description": "用户标识,应用内唯一。**重要说明**: Service API 不共享 WebApp 创建的对话。通过 API 创建的对话与 WebApp 界面中创建的对话是相互隔离的。" }, - "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。" } + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "default": "streaming", + "description": "响应模式。Cloudflare 对阻塞模式的超时时间为 100 秒。" + }, + "user": { + "type": "string", + "description": "用户标识符。**注意**:Service API 不共享 WebApp 创建的会话。通过 API 创建的会话与 WebApp 界面中创建的会话相互隔离。" + }, + "conversation_id": { + "type": "string", + "description": "要继续的会话 ID。" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObjectAdvanced" + }, + "description": "用于支持视觉功能的模型或通用文件输入的文件列表。" + }, + "auto_generate_name": { + "type": "boolean", + "default": true, + "description": "自动生成会话标题。" + } } }, - "InputFileObjectCn": { + "InputFileObjectAdvanced": { "type": "object", - "required": ["type", "transfer_method"], + "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": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, - "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } + "type": { + "type": "string", + "enum": [ + "document", + "image", + "audio", + "video", + "custom" + ], + "description": "文件类型。'document' 涵盖 TXT、MD、PDF、HTML、XLSX、DOCX、CSV、EML、MSG、PPTX、XML、EPUB。'image' 涵盖 JPG、PNG、GIF、WEBP、SVG。'audio' 涵盖 MP3、M4A、WAV、WEBM、AMR。'video' 涵盖 MP4、MOV、MPEG、MPGA。" + }, + "transfer_method": { + "type": "string", + "enum": [ + "remote_url", + "local_file" + ], + "description": "传输方式,`remote_url` 表示文件 URL / `local_file` 表示文件上传" + }, + "url": { + "type": "string", + "format": "url", + "description": "文件 URL(当传输方式为 `remote_url` 时)" + }, + "upload_file_id": { + "type": "string", + "description": "已上传文件的 ID,必须预先通过文件上传 API 获取(当传输方式为 `local_file` 时)" + } }, "anyOf": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string", "format":"uuid" } + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } } - ] + ], + "example": { + "type": "image", + "transfer_method": "remote_url", + "url": "https://example.com/image.png" + } }, - "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": "上传时间。" } } }, - "EndUserDetailCn": { - "type": "object", - "properties": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "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": "获取应用设置和信息相关的操作。" }, - { "name": "标注管理", "description": "管理用于直接回复的标注数据。" } + "ChatCompletionResponse": { + "type": "object", + "description": "阻塞模式对话的响应。", + "properties": { + "event": { + "type": "string", + "example": "message" + }, + "task_id": { + "type": "string", + "format": "uuid" + }, + "id": { + "type": "string", + "format": "uuid", + "description": "此响应事件的唯一 ID。" + }, + "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": "文件类型,例如 '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 编码的音频。" + } + } + } + ] + }, + "StreamEventAdvTtsMessageEnd": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkAdvancedChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBaseAdv" + }, + { + "type": "object", + "required": [ + "audio" + ], + "properties": { + "audio": { + "type": "string", + "description": "空字符串。" + } + } + } + ] + }, + "StreamEventAdvMessageReplace": { + "allOf": [ + { + "$ref": "#/components/schemas/ChunkAdvancedChatEvent" + }, + { + "$ref": "#/components/schemas/StreamEventBaseAdv" + }, + { + "type": "object", + "required": [ + "answer" + ], + "properties": { + "answer": { + "type": "string", + "description": "替换内容。" + } + } + } + ] + }, + "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": "此节点执行实例的唯一 ID。" + }, + "node_id": { + "type": "string", + "format": "uuid", + "description": "节点定义的 ID。" + }, + "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": "节点使用的变量。" + }, + "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": "节点处理数据(JSON)。" + }, + "outputs": { + "type": "object", + "additionalProperties": true, + "nullable": true, + "description": "输出内容(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": "使用浮点数表示价格以保证兼容性,MD 文档中为 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": "输出内容(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": "在通用错误中可能不总是存在。" + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "音频文件。格式:mp3、mp4、mpeg、mpga、m4a、wav、webm。限制:15MB。" + }, + "user": { + "type": "string" + } + } + }, + "AudioToTextResponse": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + } + }, + "TextToAudioJsonRequest": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "message_id": { + "type": "string", + "format": "uuid", + "description": "消息 ID(优先)。" + }, + "text": { + "type": "string", + "description": "语音内容。" + }, + "user": { + "type": "string" + }, + "streaming": { + "type": "boolean", + "default": false, + "description": "如果为 true,响应将是音频块流。" + } + }, + "description": "需要 `user`。提供 `message_id` 或 `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": "带工作流事件的高级对话操作。" + }, + { + "name": "Files", + "description": "高级对话的文件上传和预览操作。" + }, + { + "name": "End Users", + "description": "与终端用户信息相关的操作。" + }, + { + "name": "Feedback", + "description": "高级对话的用户反馈操作。" + }, + { + "name": "Conversations", + "description": "高级对话的会话管理。" + }, + { + "name": "TTS", + "description": "高级对话的语音和文字转换。" + }, + { + "name": "Application", + "description": "高级对话的应用设置和信息。" + }, + { + "name": "Annotations", + "description": "高级对话的标注管理。" + } ] } \ No newline at end of file diff --git a/zh/api-reference/openapi_workflow.json b/zh/api-reference/openapi_workflow.json index ed9742e9a..25e8f8b3a 100644 --- a/zh/api-reference/openapi_workflow.json +++ b/zh/api-reference/openapi_workflow.json @@ -1,18 +1,18 @@ { "openapi": "3.0.1", "info": { - "title": "Workflow 应用 API", - "description": "Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等等。", + "title": "工作流应用 API", + "description": "工作流应用提供非会话支持,适用于翻译、文章写作、摘要 AI 等场景。", "version": "1.0.0" }, "servers": [ { "url": "{api_base_url}", - "description": "API 的基础 URL。请将 {api_base_url} 替换为你的应用提供的实际 API 基础 URL。", + "description": "工作流应用 API 的基础 URL。请将 {api_base_url} 替换为实际的 API 基础 URL。", "variables": { "api_base_url": { "default": "https://api.dify.ai/v1", - "description": "实际的 API 基础 URL" + "description": "API 的实际基础 URL" } } } @@ -25,37 +25,39 @@ "paths": { "/workflows/run": { "post": { - "summary": "执行 workflow", - "description": "执行 workflow,没有已发布的 workflow,不可执行。", - "operationId": "executeWorkflowCn", - "tags": ["工作流执行"], + "summary": "执行工作流", + "description": "执行工作流。未发布的工作流无法执行。", + "operationId": "executeWorkflow", + "tags": [ + "Workflow Execution" + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkflowExecutionRequestCn" + "$ref": "#/components/schemas/WorkflowExecutionRequest" }, "examples": { - "basic_execution_cn": { - "summary": "基础工作流执行示例", + "basic_execution": { + "summary": "基础工作流执行", "value": { "inputs": { - "query": "请总结这段文字:..." + "query": "Summarize this text: ..." }, "response_mode": "streaming", - "user": "workflow_user_001" + "user": "user_workflow_123" } }, - "with_file_array_variable_cn":{ - "summary": "包含文件列表变量的输入示例", + "with_file_array_variable": { + "summary": "包含文件数组输入变量的示例", "value": { "inputs": { "my_documents": [ { "type": "document", "transfer_method": "local_file", - "upload_file_id": "已上传的文件ID_abc" + "upload_file_id": "uploaded_file_id_abc" }, { "type": "image", @@ -65,7 +67,7 @@ ] }, "response_mode": "blocking", - "user": "workflow_user_002" + "user": "user_workflow_456" } } } @@ -74,67 +76,85 @@ }, "responses": { "200": { - "description": "工作流执行成功。响应结构取决于 `response_mode`。\n- `blocking`: `application/json` 格式,包含 `WorkflowCompletionResponseCn` 对象。\n- `streaming`: `text/event-stream` 格式,包含 `ChunkWorkflowEventCn` 事件流。", + "description": "工作流执行成功。返回结构取决于 `response_mode`。\n- `blocking`:返回 `application/json` 格式的 `WorkflowCompletionResponse`。\n- `streaming`:返回 `text/event-stream` 格式的 `ChunkWorkflowEvent` 流。", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkflowCompletionResponseCn" + "$ref": "#/components/schemas/WorkflowCompletionResponse" } }, "text/event-stream": { "schema": { "type": "string", - "description": "SSE 事件流。每个事件以 'data: ' 开头,以 '\\n\\n' 结尾。具体结构请参见 `ChunkWorkflowEventCn`。" + "description": "Server-Sent Events 流。结构详见 `ChunkWorkflowEvent`。" } } } }, - "400": { "$ref": "#/components/responses/BadRequestWorkflowCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "400": { + "$ref": "#/components/responses/BadRequestWorkflow" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/workflows/run/{workflow_run_id}": { "get": { - "summary": "获取workflow执行情况", - "description": "根据 workflow 执行 ID 获取 workflow 任务当前执行结果。", - "operationId": "getWorkflowRunDetailCn", - "tags": ["工作流执行"], + "summary": "获取工作流运行详情", + "description": "根据工作流执行 ID 获取工作流任务的当前执行结果。", + "operationId": "getWorkflowRunDetail", + "tags": [ + "Workflow Execution" + ], "parameters": [ { "name": "workflow_run_id", "in": "path", "required": true, - "description": "workflow 执行 ID,可在流式返回 Chunk 或阻塞模式响应中获取。", - "schema": { "type": "string", "format": "uuid" } + "description": "工作流运行 ID,可从工作流执行响应或流式事件中获取。", + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { "200": { - "description": "成功获取 workflow 执行详情。", + "description": "成功获取工作流运行详情。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponseCn" } + "schema": { + "$ref": "#/components/schemas/WorkflowRunDetailResponse" + } } } }, - "404": {"description": "Workflow 执行记录未找到。"} + "404": { + "description": "未找到工作流运行记录。" + } } } }, "/workflows/tasks/{task_id}/stop": { "post": { - "summary": "停止响应 (Workflow Task)", - "description": "停止 workflow 任务的生成。仅支持流式模式。", - "operationId": "stopWorkflowTaskGenerationCn", - "tags": ["工作流执行"], + "summary": "停止工作流任务生成", + "description": "停止工作流任务生成。仅支持流式模式。", + "operationId": "stopWorkflowTaskGeneration", + "tags": [ + "Workflow Execution" + ], "parameters": [ { "name": "task_id", "in": "path", "required": true, - "description": "任务 ID,可在流式返回 Chunk 中获取。", - "schema": { "type": "string", "format": "uuid" } + "description": "来自流式数据块的任务 ID。", + "schema": { + "type": "string", + "format": "uuid" + } } ], "requestBody": { @@ -143,64 +163,116 @@ "application/json": { "schema": { "type": "object", - "required": ["user"], + "required": [ + "user" + ], "properties": { - "user": { "type": "string", "description": "用户标识,必须和执行 workflow 接口传入的 user 保持一致。" } + "user": { + "type": "string", + "description": "用户标识。" + } } } } } }, "responses": { - "200": { "$ref": "#/components/responses/SuccessResultCn" } + "200": { + "$ref": "#/components/responses/SuccessResult" + } } } }, "/files/upload": { "post": { - "summary": "上传文件 (Workflow)", - "description": "上传文件并在执行 workflow 时使用。支持你的工作流程所支持的任何格式。上传的文件仅供当前终端用户使用。", - "operationId": "uploadWorkflowFileCn", - "tags": ["文件操作 (Workflow)"], + "summary": "工作流文件上传", + "description": "上传用于工作流的文件。支持工作流支持的任何格式。上传的文件仅供当前终端用户使用。", + "operationId": "uploadWorkflowFile", + "tags": [ + "Files" + ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", - "required": ["file", "user"], + "required": [ + "file", + "user" + ], "properties": { - "file": { "type": "string", "format": "binary", "description": "要上传的文件。" }, - "user": { "type": "string", "description": "用户标识。" } + "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" } + "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" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/end-users/{end_user_id}": { "get": { "summary": "获取终端用户", - "description": "通过 ID 获取终端用户信息。\n\n当其他 API 返回终端用户 ID(例如文件上传接口返回的 `created_by`)时,可使用该接口查询对应的终端用户信息。", - "operationId": "getEndUserWorkflowCn", - "tags": ["终端用户"], + "description": "根据 ID 获取终端用户信息。\n当其他 API 返回终端用户 ID 时(例如文件上传返回的 `created_by`),此接口非常有用。", + "operationId": "getEndUser", + "tags": [ + "End Users" + ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "终端用户 ID。", - "schema": { "type": "string", "format": "uuid" } + "schema": { + "type": "string", + "format": "uuid" + } } ], "responses": { @@ -208,240 +280,1380 @@ "description": "成功获取终端用户信息。", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/EndUserDetailCn" } + "schema": { + "$ref": "#/components/schemas/EndUserDetail" + } } } }, - "404": { "$ref": "#/components/responses/EndUserNotFoundCn" }, - "500": { "$ref": "#/components/responses/InternalServerErrorCn" } + "404": { + "$ref": "#/components/responses/EndUserNotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/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" } } } } + "get": { + "summary": "获取工作流日志", + "description": "返回工作流日志,第一页返回最新的 `{limit}` 条消息,即按倒序排列。", + "operationId": "getWorkflowLogs", + "tags": [ + "Workflow Execution" + ], + "parameters": [ + { + "name": "keyword", + "in": "query", + "description": "搜索关键词。", + "schema": { + "type": "string" + } + }, + { + "name": "status", + "in": "query", + "description": "按状态筛选。", + "schema": { + "type": "string", + "enum": [ + "succeeded", + "failed", + "stopped", + "running" + ] + } + }, + { + "name": "page", + "in": "query", + "description": "当前页码。", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "limit", + "in": "query", + "description": "每页条目数。", + "schema": { + "type": "integer", + "default": 20 + } + } + ], + "responses": { + "200": { + "description": "成功获取工作流日志。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowLogsResponse" + } + } } + } } + } }, "/info": { "get": { - "summary": "获取应用基本信息 (Workflow)", - "operationId": "getWorkflowAppInfoCn", - "tags": ["应用配置 (Workflow)"], - "responses": { "200": { "description": "应用基本信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponseCn" } } } } } + "summary": "获取应用基本信息", + "operationId": "getWorkflowAppInfo", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用基本信息。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfoResponse" + } + } + } + } + } } }, "/parameters": { "get": { - "summary": "获取应用参数 (Workflow)", - "operationId": "getWorkflowAppParametersCn", - "tags": ["应用配置 (Workflow)"], - "responses": { "200": { "description": "应用参数信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowAppParametersResponseCn" } } } } } + "summary": "获取应用参数信息", + "operationId": "getWorkflowAppParameters", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "应用参数。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowAppParametersResponse" + } + } + } + } + } } }, "/site": { "get": { - "summary": "获取应用 WebApp 设置 (Workflow)", - "operationId": "getWorkflowWebAppSettingsCn", - "tags": ["应用配置 (Workflow)"], - "responses": { "200": { "description": "WebApp 设置信息。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowWebAppSettingsResponseCn" } } } } } + "summary": "获取应用 WebApp 设置", + "operationId": "getWorkflowWebAppSettings", + "tags": [ + "Application" + ], + "responses": { + "200": { + "description": "WebApp 设置。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowWebAppSettingsResponse" + } + } + } + } + } } } }, "components": { "securitySchemes": { - "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含你的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。" } + "ApiKeyAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "API_KEY", + "description": "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" } } } } } }, - "EndUserNotFoundCn": { "description": "终端用户不存在。错误码:`end_user_not_found`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseCn" } } } } + "BadRequestWorkflow": { + "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/ErrorResponse" + } + } + } + }, + "BadRequestFile": { + "description": "文件操作请求错误。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "FileTooLarge": { + "description": "文件过大。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "UnsupportedFileTypeFile": { + "description": "不支持的上传文件类型。", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "S3ErrorFile": { + "description": "S3 存储错误。", + "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" + } + } + } + } + } + }, + "EndUserNotFound": { + "description": "未找到终端用户。错误代码:`end_user_not_found`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } }, "schemas": { - "WorkflowExecutionRequestCn": { + "WorkflowExecutionRequest": { "type": "object", - "required": ["inputs", "response_mode", "user"], + "required": [ + "inputs", + "response_mode", + "user" + ], "properties": { "inputs": { "type": "object", - "description": "允许传入 App 定义的各变量值。如果变量是文件列表类型,该变量对应的值应是 InputFileObjectWorkflowCn 对象的列表。", + "description": "工作流变量的键值对。文件数组类型变量的值应为 InputFileObjectWorkflow 列表。", "additionalProperties": { - "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" }, { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObjectWorkflowCn" } } ] + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/InputFileObjectWorkflow" + } + } + ] }, - "example": { "user_query": "请帮我翻译这句话。", "target_language": "法语" } + "example": { + "user_query": "Translate this for me.", + "target_language": "French" + } }, - "response_mode": { "type": "string", "enum": ["streaming", "blocking"], "description": "返回响应模式。streaming (推荐) 基于 SSE;blocking 等待执行完毕后返回 (Cloudflare 100秒超时限制)。" }, - "user": { "type": "string", "description": "用户标识,应用内唯一。" } + "response_mode": { + "type": "string", + "enum": [ + "streaming", + "blocking" + ], + "description": "响应模式。阻塞模式下 Cloudflare 超时时间为 100 秒。" + }, + "user": { + "type": "string", + "description": "用户标识。" + } } }, - "InputFileObjectWorkflowCn": { + "InputFileObjectWorkflow": { "type": "object", - "required": ["type", "transfer_method"], + "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": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, - "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, - "upload_file_id": { "type": "string", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } + "type": { + "type": "string", + "enum": [ + "document", + "image", + "audio", + "video", + "custom" + ], + "description": "文件类型。" + }, + "transfer_method": { + "type": "string", + "enum": [ + "remote_url", + "local_file" + ], + "description": "传输方式,`remote_url` 表示图片 URL / `local_file` 表示文件上传" + }, + "url": { + "type": "string", + "format": "url", + "description": "图片 URL(当传输方式为 `remote_url` 时)" + }, + "upload_file_id": { + "type": "string", + "description": "已上传文件 ID,必须事先通过文件上传 API 上传获取(当传输方式为 `local_file` 时)" + } }, "anyOf": [ { - "properties": { - "transfer_method": { "enum": ["remote_url"] }, - "url": { "type": "string", "format": "url" } + "properties": { + "transfer_method": { + "enum": [ + "remote_url" + ] + }, + "url": { + "type": "string", + "format": "url" + } }, - "required": ["url"], - "not": { "required": ["upload_file_id"] } + "required": [ + "url" + ], + "not": { + "required": [ + "upload_file_id" + ] + } }, { - "properties": { - "transfer_method": { "enum": ["local_file"] }, - "upload_file_id": { "type": "string" } + "properties": { + "transfer_method": { + "enum": [ + "local_file" + ] + }, + "upload_file_id": { + "type": "string" + } }, - "required": ["upload_file_id"], - "not": { "required": ["url"] } + "required": [ + "upload_file_id" + ], + "not": { + "required": [ + "url" + ] + } } ] }, - "WorkflowCompletionResponseCn": { - "type": "object", "description": "阻塞模式下的 workflow 执行结果。", + "WorkflowCompletionResponse": { + "type": "object", + "description": "阻塞模式工作流执行的响应。", "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 执行详情。", + "workflow_run_id": { + "type": "string", + "format": "uuid" + }, + "task_id": { + "type": "string", + "format": "uuid" + }, + "data": { + "$ref": "#/components/schemas/WorkflowFinishedData" + } + } + }, + "ChunkWorkflowEvent": { + "type": "object", + "required": [ + "event" + ], "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": "上传时间。" } } }, - "EndUserDetailCn": { + "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": { - "id": { "type": "string", "format": "uuid" }, - "tenant_id": { "type": "string", "format": "uuid" }, - "app_id": { "type": "string", "format": "uuid", "nullable": true }, - "type": { "type": "string", "example": "service_api" }, - "external_user_id": { "type": "string", "nullable": true }, - "name": { "type": "string", "nullable": true }, - "is_anonymous": { "type": "boolean" }, - "session_id": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "updated_at": { "type": "string", "format": "date-time" } - } - }, - "WorkflowLogsResponseCn": { - "type": "object", "description": "Workflow 日志列表响应。", + "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": { - "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": "当前页码的数据。" } + "id": { + "type": "string", + "format": "uuid" + }, + "workflow_id": { + "type": "string", + "format": "uuid" + }, + "sequence_number": { + "type": "integer" + }, + "created_at": { + "type": "integer", + "format": "int64" + } } }, - "WorkflowLogItemCn": { - "type": "object", "description": "单条 Workflow 日志。", + "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", "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": "创建时间。" } + "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" + } } }, - "WorkflowRunSummaryCn": { - "type": "object", "description": "Workflow 执行摘要信息。", + "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": { - "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": "终端用户信息摘要。", + "text": { + "type": "string" + }, + "from_variable_selector": { + "type": "array", + "items": { + "type": "string" + }, + "description": "文本来源路径。" + } + } + }, + "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", "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": "错误消息。" } } } - } - }, + "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 字符串。" + }, + "outputs": { + "type": "object", + "additionalProperties": true, + "nullable": true, + "description": "输出内容的 JSON 对象。" + }, + "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" + } + } + }, + "EndUserDetail": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "tenant_id": { + "type": "string", + "format": "uuid" + }, + "app_id": { + "type": "string", + "format": "uuid", + "nullable": true + }, + "type": { + "type": "string", + "example": "service_api" + }, + "external_user_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "is_anonymous": { + "type": "boolean" + }, + "session_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "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": "工作流执行", "description": "与执行和管理工作流相关的操作。" }, - { "name": "文件操作 (工作流)", "description": "特定于工作流的文件上传和预览操作。" }, - { "name": "终端用户", "description": "终端用户信息相关的操作。" }, - { "name": "应用配置 (Workflow)", "description": "工作流应用的应用设置和信息。" } + { + "name": "Workflow Execution", + "description": "与执行和管理工作流相关的操作。" + }, + { + "name": "Files", + "description": "工作流专用的文件上传和预览操作。" + }, + { + "name": "End Users", + "description": "与终端用户信息相关的操作。" + }, + { + "name": "Application", + "description": "工作流应用的应用设置和信息。" + } ] } \ No newline at end of file