mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
* Batch update service apis * final check and add zh/ja docs * add temporary redirects for changed api links embedded in the product * Restore original operationIds to preserve SDK compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * complete the missing descriptions * correct the human input terminology --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2542 lines
86 KiB
JSON
2542 lines
86 KiB
JSON
{
|
||
"openapi": "3.0.1",
|
||
"info": {
|
||
"title": "文本生成型应用 API",
|
||
"description": "文本生成型应用提供无会话支持,适用于翻译、文章撰写、摘要总结 AI 等场景。",
|
||
"version": "1.0.0"
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "{api_base_url}",
|
||
"description": "文本生成型应用 API 的基础 URL。请将 {api_base_url} 替换为你的应用实际提供的 API 基础 URL。",
|
||
"variables": {
|
||
"api_base_url": {
|
||
"default": "https://api.dify.ai/v1",
|
||
"description": "API 的实际基础 URL"
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"paths": {
|
||
"/completion-messages": {
|
||
"post": {
|
||
"summary": "发送消息",
|
||
"description": "向文本生成型应用发送请求。",
|
||
"operationId": "createCompletionMessage",
|
||
"tags": [
|
||
"文本生成"
|
||
],
|
||
"requestBody": {
|
||
"description": "创建文本生成消息的请求体。",
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CompletionRequest"
|
||
},
|
||
"examples": {
|
||
"streaming_example": {
|
||
"summary": "请求示例 - 流式模式",
|
||
"value": {
|
||
"inputs": {
|
||
"city": "San Francisco"
|
||
},
|
||
"query": "Translate 'hello' to Spanish.",
|
||
"response_mode": "streaming",
|
||
"user": "abc-123",
|
||
"files": [
|
||
{
|
||
"type": "image",
|
||
"transfer_method": "remote_url",
|
||
"url": "https://cloud.dify.ai/logo/logo-site.png"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"blocking_example": {
|
||
"summary": "请求示例 - 阻塞模式",
|
||
"value": {
|
||
"inputs": {
|
||
"city": "New York"
|
||
},
|
||
"query": "Summarize the following text: ...",
|
||
"response_mode": "blocking",
|
||
"user": "def-456"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "请求成功。内容类型和结构取决于请求中的 `response_mode` 参数。\n\n- 如果 `response_mode` 为 `blocking`,返回 `application/json` 和 `CompletionResponse` 对象。\n- 如果 `response_mode` 为 `streaming`,返回 `text/event-stream` 和 `ChunkCompletionEvent` 对象流。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CompletionResponse"
|
||
},
|
||
"examples": {
|
||
"blockingResponse": {
|
||
"summary": "响应示例 - 阻塞模式",
|
||
"value": {
|
||
"event": "message",
|
||
"task_id": "c3800678-a077-43df-a102-53f23ed20b88",
|
||
"id": "b01a39de-3480-4f3e-9f1e-4841a80f8e5e",
|
||
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
|
||
"mode": "completion",
|
||
"answer": "Hello World!...",
|
||
"metadata": {
|
||
"usage": {
|
||
"prompt_tokens": 1033,
|
||
"prompt_unit_price": "0.001",
|
||
"prompt_price_unit": "0.001",
|
||
"prompt_price": "0.0010330",
|
||
"completion_tokens": 128,
|
||
"completion_unit_price": "0.002",
|
||
"completion_price_unit": "0.001",
|
||
"completion_price": "0.0002560",
|
||
"total_tokens": 1161,
|
||
"total_price": "0.0012890",
|
||
"currency": "USD",
|
||
"latency": 0.7682376249867957
|
||
}
|
||
},
|
||
"created_at": 1705407629
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"text/event-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"description": "服务器发送事件 (SSE) 流。每个事件是一个以 `data: ` 为前缀的 JSON 对象,以两个换行符终止。\n\n**SSE 解析指南:**每个事件是一行以 `data: ` 为前缀的 JSON 对象,以 `\\n\\n` 终止。解析 JSON 前先去除 `data: ` 前缀。JSON 内的 `event` 字段决定事件类型。当收到终止事件(如 `message_end` 或 `error`)时流结束。忽略 `ping` 事件(每 10 秒发送一次以保持连接活跃)。注意即使流中出现错误事件,HTTP 状态码仍为 `200`。"
|
||
},
|
||
"examples": {
|
||
"streamingResponse": {
|
||
"summary": "响应示例 - 流式模式",
|
||
"value": "data: {\"event\": \"message\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \" I\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \"'m\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message_end\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"id\": \"5e52ce04-874b-4d27-9045-b3bc80def685\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"metadata\": {\"usage\": {\"prompt_tokens\": 1033, \"prompt_unit_price\": \"0.001\", \"prompt_price_unit\": \"0.001\", \"prompt_price\": \"0.0010330\", \"completion_tokens\": 135, \"completion_unit_price\": \"0.002\", \"completion_price_unit\": \"0.001\", \"completion_price\": \"0.0002700\", \"total_tokens\": 1168, \"total_price\": \"0.0013030\", \"currency\": \"USD\", \"latency\": 1.381760165997548}}}\n\n"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `app_unavailable` : 应用不可用或配置错误。\n- `provider_not_initialize` : 未找到有效的模型提供商凭据。\n- `provider_quota_exceeded` : 模型提供商配额已用尽。\n- `model_currently_not_support` : 当前模型不可用。\n- `completion_request_error` : 文本生成失败。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"app_unavailable": {
|
||
"summary": "app_unavailable",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "app_unavailable",
|
||
"message": "App unavailable, please check your app configurations."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"provider_quota_exceeded": {
|
||
"summary": "provider_quota_exceeded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_quota_exceeded",
|
||
"message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials."
|
||
}
|
||
},
|
||
"model_currently_not_support": {
|
||
"summary": "model_currently_not_support",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "model_currently_not_support",
|
||
"message": "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
||
}
|
||
},
|
||
"completion_request_error": {
|
||
"summary": "completion_request_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "completion_request_error",
|
||
"message": "Completion request failed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"429": {
|
||
"description": "`too_many_requests` : 该应用的并发请求过多。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"too_many_requests": {
|
||
"summary": "too_many_requests",
|
||
"value": {
|
||
"status": 429,
|
||
"code": "too_many_requests",
|
||
"message": "Too many requests. Please try again later."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "`internal_server_error` : 内部服务器错误。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"internal_server_error": {
|
||
"summary": "internal_server_error",
|
||
"value": {
|
||
"status": 500,
|
||
"code": "internal_server_error",
|
||
"message": "Internal server error."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/completion-messages/{task_id}/stop": {
|
||
"post": {
|
||
"summary": "停止响应",
|
||
"description": "停止文本生成消息生成任务。仅在 `streaming` 模式下支持。",
|
||
"operationId": "stopCompletionGeneration",
|
||
"tags": [
|
||
"文本生成"
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "task_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "任务 ID,可以从 [发送消息](/api-reference/文本生成/发送消息) API 的流式分块返回中获取。",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"user"
|
||
],
|
||
"properties": {
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符,必须和发送消息接口传入的 user 保持一致。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"example": {
|
||
"summary": "请求示例",
|
||
"value": {
|
||
"user": "abc-123"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"$ref": "#/components/responses/SuccessResult"
|
||
},
|
||
"400": {
|
||
"description": "`app_unavailable` : 应用不可用或配置错误。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"app_unavailable": {
|
||
"summary": "app_unavailable",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "app_unavailable",
|
||
"message": "App unavailable, please check your app configurations."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/messages/{message_id}/feedbacks": {
|
||
"post": {
|
||
"operationId": "postMessageFeedback",
|
||
"tags": [
|
||
"消息反馈"
|
||
],
|
||
"summary": "提交消息反馈",
|
||
"description": "提交消息反馈。终端用户可以对消息评价 `like` 或 `dislike`,并可选择提供文字反馈。将 `rating` 设为 `null` 可撤销之前提交的反馈。",
|
||
"parameters": [
|
||
{
|
||
"name": "message_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "消息 ID。",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/MessageFeedbackRequest"
|
||
},
|
||
"examples": {
|
||
"likeFeedback": {
|
||
"summary": "请求示例",
|
||
"value": {
|
||
"rating": "like",
|
||
"user": "abc-123",
|
||
"content": "This answer was very helpful!"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"$ref": "#/components/responses/SuccessResult"
|
||
},
|
||
"404": {
|
||
"description": "`not_found` : 消息不存在。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"message_not_exists": {
|
||
"summary": "not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "not_found",
|
||
"message": "Message Not Exists."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/app/feedbacks": {
|
||
"get": {
|
||
"operationId": "getAppFeedbacks",
|
||
"tags": [
|
||
"消息反馈"
|
||
],
|
||
"summary": "获取应用的消息反馈",
|
||
"description": "获取此应用中所有消息反馈的分页列表,包括终端用户和管理员反馈。",
|
||
"parameters": [
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"description": "分页页码。",
|
||
"required": false,
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 1,
|
||
"minimum": 1
|
||
}
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"description": "每页记录数。",
|
||
"required": false,
|
||
"schema": {
|
||
"type": "integer",
|
||
"default": 20,
|
||
"minimum": 1,
|
||
"maximum": 101
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "应用反馈列表。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AppFeedbacksResponse"
|
||
},
|
||
"examples": {
|
||
"feedbacksList": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"data": [
|
||
{
|
||
"id": "b7e2f8a1-3c4d-5e6f-7890-abcdef123456",
|
||
"app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
||
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
|
||
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
|
||
"rating": "like",
|
||
"content": "The response accurately answered my question about product specifications.",
|
||
"from_source": "user",
|
||
"from_end_user_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
|
||
"from_account_id": null,
|
||
"created_at": "2025-01-16T14:30:29Z",
|
||
"updated_at": "2025-01-16T14:30:29Z"
|
||
},
|
||
{
|
||
"id": "c8f3a9b2-4d5e-6f70-8901-bcdef2345678",
|
||
"app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
||
"conversation_id": "56812a93-9229-5cd6-9f0c-75673b666603",
|
||
"message_id": "ae24b5c0-f814-584d-a493-5439e5d6b7b1",
|
||
"rating": "dislike",
|
||
"content": "The answer was too vague and did not address the specific pricing question.",
|
||
"from_source": "user",
|
||
"from_end_user_id": "d2c1b0a9-8765-4321-fedc-ba9876543210",
|
||
"from_account_id": null,
|
||
"created_at": "2025-01-15T09:12:45Z",
|
||
"updated_at": "2025-01-15T09:12:45Z"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/files/upload": {
|
||
"post": {
|
||
"operationId": "uploadFile",
|
||
"tags": [
|
||
"文件操作"
|
||
],
|
||
"summary": "上传文件",
|
||
"description": "上传文件用于发送消息时使用,支持图片、文档、音频和视频的多模态理解。上传的文件仅供当前终端用户使用。",
|
||
"requestBody": {
|
||
"description": "文件上传请求。需要 multipart/form-data 格式。",
|
||
"required": true,
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"file"
|
||
],
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "要上传的文件。支持的类型包括图片、文档、音频和视频。"
|
||
},
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符,由开发者定义的规则生成,必须在应用内唯一。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"201": {
|
||
"description": "文件上传成功。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/FileUploadResponse"
|
||
},
|
||
"examples": {
|
||
"uploadSuccess": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
||
"name": "product-photo.png",
|
||
"size": 204800,
|
||
"extension": "png",
|
||
"mime_type": "image/png",
|
||
"created_by": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
|
||
"created_at": 1705407629,
|
||
"preview_url": null,
|
||
"source_url": null,
|
||
"original_url": null,
|
||
"user_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
|
||
"tenant_id": "11223344-5566-7788-99aa-bbccddeeff00",
|
||
"conversation_id": null,
|
||
"file_key": "uploads/product-photo.png"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `no_file_uploaded` : 请求中未提供文件。\n- `too_many_files` : 每次请求仅允许上传一个文件。\n- `filename_not_exists_error` : 上传的文件没有文件名。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"no_file_uploaded": {
|
||
"summary": "no_file_uploaded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "no_file_uploaded",
|
||
"message": "Please upload your file."
|
||
}
|
||
},
|
||
"too_many_files": {
|
||
"summary": "too_many_files",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "too_many_files",
|
||
"message": "Only one file is allowed."
|
||
}
|
||
},
|
||
"filename_not_exists_error": {
|
||
"summary": "filename_not_exists_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "filename_not_exists_error",
|
||
"message": "The specified filename does not exist."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"413": {
|
||
"description": "`file_too_large` : 文件大小超出限制。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"file_too_large": {
|
||
"summary": "file_too_large",
|
||
"value": {
|
||
"status": 413,
|
||
"code": "file_too_large",
|
||
"message": "File size exceeded."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"415": {
|
||
"description": "`unsupported_file_type` : 不允许的文件类型。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"unsupported_file_type": {
|
||
"summary": "unsupported_file_type",
|
||
"value": {
|
||
"status": 415,
|
||
"code": "unsupported_file_type",
|
||
"message": "File type not allowed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/files/{file_id}/preview": {
|
||
"get": {
|
||
"operationId": "previewCompletionFileZh",
|
||
"tags": [
|
||
"文件操作"
|
||
],
|
||
"summary": "下载文件",
|
||
"description": "预览或下载之前通过[上传文件](/api-reference/文件操作/上传文件) API 上传的文件。仅可访问属于请求应用内消息的文件。",
|
||
"parameters": [
|
||
{
|
||
"name": "file_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "要预览的文件唯一标识符,从 [上传文件](/api-reference/文件操作/上传文件) API 响应中获取。",
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
},
|
||
{
|
||
"name": "as_attachment",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "如果为 `true`,则强制文件以附件形式下载,而不是在浏览器中预览。",
|
||
"schema": {
|
||
"type": "boolean",
|
||
"default": false
|
||
}
|
||
},
|
||
{
|
||
"name": "user",
|
||
"in": "query",
|
||
"required": false,
|
||
"description": "用户标识符,用于终端用户上下文。",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "返回原始文件内容。`Content-Type` 头设置为文件的 MIME 类型。如果 `as_attachment` 为 `true`,文件将以 `Content-Disposition: attachment` 方式作为下载返回。",
|
||
"content": {
|
||
"application/octet-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "binary"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`file_access_denied` : 拒绝访问请求的文件。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"file_access_denied": {
|
||
"summary": "file_access_denied",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "file_access_denied",
|
||
"message": "Access to the requested file is denied."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`file_not_found` : 未找到请求的文件。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"file_not_found": {
|
||
"summary": "file_not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "file_not_found",
|
||
"message": "The requested file was not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/end-users/{end_user_id}": {
|
||
"get": {
|
||
"operationId": "getEndUserCompletionCn",
|
||
"tags": [
|
||
"终端用户"
|
||
],
|
||
"summary": "获取终端用户",
|
||
"description": "根据 ID 获取终端用户信息。当其他 API 返回终端用户 ID(例如[上传文件](/api-reference/文件操作/上传文件)返回的 `created_by`)时很有用。",
|
||
"parameters": [
|
||
{
|
||
"name": "end_user_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"description": "终端用户 ID。",
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功获取终端用户。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/EndUserDetail"
|
||
},
|
||
"examples": {
|
||
"endUserDetail": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
|
||
"tenant_id": "11223344-5566-7788-99aa-bbccddeeff00",
|
||
"app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
||
"type": "service_api",
|
||
"external_user_id": "abc-123",
|
||
"name": null,
|
||
"is_anonymous": false,
|
||
"session_id": "abc-123",
|
||
"created_at": "2024-01-16T12:00:29Z",
|
||
"updated_at": "2024-01-16T12:00:29Z"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "`end_user_not_found` : 未找到终端用户。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"end_user_not_found": {
|
||
"summary": "end_user_not_found",
|
||
"value": {
|
||
"status": 404,
|
||
"code": "end_user_not_found",
|
||
"message": "End user not found."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/audio-to-text": {
|
||
"post": {
|
||
"operationId": "completionAudioToTextZh",
|
||
"tags": [
|
||
"语音与文字转换"
|
||
],
|
||
"summary": "语音转文字",
|
||
"description": "将音频文件转换为文字。支持的格式:`mp3`、`mp4`、`mpeg`、`mpga`、`m4a`、`wav`、`webm`。文件大小限制为 `30 MB`。",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"multipart/form-data": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AudioToTextRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "语音转文字成功。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AudioToTextResponse"
|
||
},
|
||
"examples": {
|
||
"audioToTextSuccess": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"text": "Hello, I would like to know more about the iPhone 13 Pro Max."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `app_unavailable` : 应用不可用或配置错误。\n- `no_audio_uploaded` : 未上传音频文件。\n- `provider_not_support_speech_to_text` : 模型提供商不支持语音转文字。\n- `provider_not_initialize` : 未找到有效的模型提供商凭据。\n- `provider_quota_exceeded` : 模型提供商配额已用尽。\n- `model_currently_not_support` : 当前模型不支持此操作。\n- `completion_request_error` : 语音识别请求失败。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"app_unavailable": {
|
||
"summary": "app_unavailable",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "app_unavailable",
|
||
"message": "App unavailable, please check your app configurations."
|
||
}
|
||
},
|
||
"no_audio_uploaded": {
|
||
"summary": "no_audio_uploaded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "no_audio_uploaded",
|
||
"message": "Please upload your audio."
|
||
}
|
||
},
|
||
"provider_not_support_speech_to_text": {
|
||
"summary": "provider_not_support_speech_to_text",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_support_speech_to_text",
|
||
"message": "Provider not support speech to text."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"provider_quota_exceeded": {
|
||
"summary": "provider_quota_exceeded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_quota_exceeded",
|
||
"message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials."
|
||
}
|
||
},
|
||
"model_currently_not_support": {
|
||
"summary": "model_currently_not_support",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "model_currently_not_support",
|
||
"message": "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
||
}
|
||
},
|
||
"completion_request_error": {
|
||
"summary": "completion_request_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "completion_request_error",
|
||
"message": "Completion request failed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"413": {
|
||
"description": "`audio_too_large` : 音频文件大小超出限制。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"audio_too_large": {
|
||
"summary": "audio_too_large",
|
||
"value": {
|
||
"status": 413,
|
||
"code": "audio_too_large",
|
||
"message": "Audio size exceeded."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"415": {
|
||
"description": "`unsupported_audio_type` : 不允许的音频类型。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"unsupported_audio_type": {
|
||
"summary": "unsupported_audio_type",
|
||
"value": {
|
||
"status": 415,
|
||
"code": "unsupported_audio_type",
|
||
"message": "Audio type not allowed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "`internal_server_error` : 内部服务器错误。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"internal_server_error": {
|
||
"summary": "internal_server_error",
|
||
"value": {
|
||
"status": 500,
|
||
"code": "internal_server_error",
|
||
"message": "Internal server error."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/text-to-audio": {
|
||
"post": {
|
||
"operationId": "textToAudio",
|
||
"tags": [
|
||
"语音与文字转换"
|
||
],
|
||
"summary": "文字转语音",
|
||
"description": "将文字转换为语音。",
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/TextToAudioRequest"
|
||
},
|
||
"examples": {
|
||
"textToAudioExample": {
|
||
"summary": "请求示例",
|
||
"value": {
|
||
"text": "Hello, welcome to our service.",
|
||
"user": "abc-123",
|
||
"voice": "alloy",
|
||
"streaming": false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "返回生成的音频文件。`Content-Type` 头设置为音频 MIME 类型(例如 `audio/wav`、`audio/mp3`)。如果 `streaming` 为 `true`,音频将以分块传输编码方式流式返回。",
|
||
"content": {
|
||
"audio/mpeg": {
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "binary"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "- `app_unavailable` : 应用不可用或配置错误。\n- `provider_not_initialize` : 未找到有效的模型提供商凭据。\n- `provider_quota_exceeded` : 模型提供商配额已用尽。\n- `model_currently_not_support` : 当前模型不支持此操作。\n- `completion_request_error` : 文字转语音请求失败。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"app_unavailable": {
|
||
"summary": "app_unavailable",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "app_unavailable",
|
||
"message": "App unavailable, please check your app configurations."
|
||
}
|
||
},
|
||
"provider_not_initialize": {
|
||
"summary": "provider_not_initialize",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_not_initialize",
|
||
"message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials."
|
||
}
|
||
},
|
||
"provider_quota_exceeded": {
|
||
"summary": "provider_quota_exceeded",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "provider_quota_exceeded",
|
||
"message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials."
|
||
}
|
||
},
|
||
"model_currently_not_support": {
|
||
"summary": "model_currently_not_support",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "model_currently_not_support",
|
||
"message": "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
||
}
|
||
},
|
||
"completion_request_error": {
|
||
"summary": "completion_request_error",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "completion_request_error",
|
||
"message": "Completion request failed."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "`internal_server_error` : 内部服务器错误。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"internal_server_error": {
|
||
"summary": "internal_server_error",
|
||
"value": {
|
||
"status": 500,
|
||
"code": "internal_server_error",
|
||
"message": "Internal server error."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/info": {
|
||
"get": {
|
||
"operationId": "getAppInfo",
|
||
"tags": [
|
||
"应用配置"
|
||
],
|
||
"summary": "获取应用基本信息",
|
||
"description": "获取应用的基本信息,包括名称、描述、标签和模式。",
|
||
"responses": {
|
||
"200": {
|
||
"description": "应用的基本信息。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AppInfoResponse"
|
||
},
|
||
"examples": {
|
||
"appInfo": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"name": "My Completion App",
|
||
"description": "一个有用的客服聊天机器人。",
|
||
"tags": [
|
||
"customer-service",
|
||
"chatbot"
|
||
],
|
||
"mode": "completion",
|
||
"author_name": "Dify Team"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/parameters": {
|
||
"get": {
|
||
"operationId": "getAppParameters",
|
||
"tags": [
|
||
"应用配置"
|
||
],
|
||
"summary": "获取应用参数",
|
||
"description": "获取应用的输入表单配置,包括功能开关、输入参数名称、类型和默认值。",
|
||
"responses": {
|
||
"200": {
|
||
"description": "应用参数信息。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/CompletionAppParametersResponse"
|
||
},
|
||
"examples": {
|
||
"appParameters": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"opening_statement": "Hello! How can I help you today?",
|
||
"suggested_questions": [
|
||
"What can you do?",
|
||
"Tell me about your features."
|
||
],
|
||
"suggested_questions_after_answer": {
|
||
"enabled": true
|
||
},
|
||
"speech_to_text": {
|
||
"enabled": false
|
||
},
|
||
"text_to_speech": {
|
||
"enabled": false,
|
||
"voice": "alloy",
|
||
"language": "en-US",
|
||
"autoPlay": "disabled"
|
||
},
|
||
"retriever_resource": {
|
||
"enabled": true
|
||
},
|
||
"annotation_reply": {
|
||
"enabled": false
|
||
},
|
||
"more_like_this": {
|
||
"enabled": false
|
||
},
|
||
"sensitive_word_avoidance": {
|
||
"enabled": false
|
||
},
|
||
"user_input_form": [
|
||
{
|
||
"text-input": {
|
||
"label": "City",
|
||
"variable": "city",
|
||
"required": true,
|
||
"default": ""
|
||
}
|
||
}
|
||
],
|
||
"file_upload": {
|
||
"image": {
|
||
"enabled": true,
|
||
"number_limits": 3,
|
||
"detail": "high",
|
||
"transfer_methods": [
|
||
"remote_url",
|
||
"local_file"
|
||
]
|
||
}
|
||
},
|
||
"system_parameters": {
|
||
"file_size_limit": 15,
|
||
"image_file_size_limit": 10,
|
||
"audio_file_size_limit": 50,
|
||
"video_file_size_limit": 100,
|
||
"workflow_file_upload_limit": 10
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "`app_unavailable` : 应用不可用或配置错误。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"app_unavailable": {
|
||
"summary": "app_unavailable",
|
||
"value": {
|
||
"status": 400,
|
||
"code": "app_unavailable",
|
||
"message": "App unavailable, please check your app configurations."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/meta": {
|
||
"get": {
|
||
"operationId": "getCompletionAppMetaZh",
|
||
"tags": [
|
||
"应用配置"
|
||
],
|
||
"summary": "获取应用元数据",
|
||
"description": "获取应用的元数据,包括工具图标和其他配置详情。",
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功获取应用元数据。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/AppMetaResponse"
|
||
},
|
||
"examples": {
|
||
"appMeta": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"tool_icons": {
|
||
"dalle3": "https://example.com/icons/dalle3.png",
|
||
"calculator": {
|
||
"background": "#4A90D9",
|
||
"content": "🧮"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/site": {
|
||
"get": {
|
||
"operationId": "getWebAppSettings",
|
||
"tags": [
|
||
"应用配置"
|
||
],
|
||
"summary": "获取应用 WebApp 设置",
|
||
"description": "获取应用的 WebApp 设置,包括站点配置、主题和自定义选项。",
|
||
"responses": {
|
||
"200": {
|
||
"description": "应用的 WebApp 设置。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/WebAppSettingsResponse"
|
||
},
|
||
"examples": {
|
||
"webAppSettings": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"title": "My Chat App",
|
||
"chat_color_theme": "#4A90D9",
|
||
"chat_color_theme_inverted": false,
|
||
"icon_type": "emoji",
|
||
"icon": "🤖",
|
||
"icon_background": "#FFFFFF",
|
||
"icon_url": null,
|
||
"description": "一个有用的客服聊天机器人。",
|
||
"copyright": "2025 Dify",
|
||
"privacy_policy": "https://example.com/privacy",
|
||
"custom_disclaimer": "",
|
||
"default_language": "en-US",
|
||
"show_workflow_steps": false,
|
||
"use_icon_as_answer_icon": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "`forbidden` : 未找到此应用的站点或工作空间已归档。",
|
||
"content": {
|
||
"application/json": {
|
||
"examples": {
|
||
"forbidden": {
|
||
"summary": "forbidden",
|
||
"value": {
|
||
"status": 403,
|
||
"code": "forbidden",
|
||
"message": "Forbidden."
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"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": {
|
||
"SuccessResult": {
|
||
"description": "操作成功。",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"result": {
|
||
"type": "string",
|
||
"description": "结果状态。"
|
||
}
|
||
}
|
||
},
|
||
"examples": {
|
||
"success": {
|
||
"summary": "响应示例",
|
||
"value": {
|
||
"result": "success"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"schemas": {
|
||
"CompletionRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"inputs",
|
||
"user"
|
||
],
|
||
"properties": {
|
||
"inputs": {
|
||
"type": "object",
|
||
"description": "允许输入应用定义的各种变量值。包含键值对,每个键对应一个特定变量,每个值为该变量的具体值。请参阅 [获取应用参数](/api-reference/应用配置/获取应用参数) 响应中的 `user_input_form` 字段,以了解应用所需的变量名称和类型。",
|
||
"additionalProperties": true
|
||
},
|
||
"query": {
|
||
"type": "string",
|
||
"default": "",
|
||
"description": "要处理的输入文本。这是一个旧版参数;在较新的应用中,查询内容应通过 `inputs` 对象传递。"
|
||
},
|
||
"response_mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"streaming",
|
||
"blocking"
|
||
],
|
||
"description": "响应返回模式。`streaming`(推荐)使用 SSE。`blocking` 等待完成后返回(长时间处理可能会被中断)。Cloudflare 超时为 `100 s`。省略时默认为阻塞模式。"
|
||
},
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符,在应用内唯一。此标识符限定数据访问范围——消息和文件仅在使用相同 `user` 值查询时可见。"
|
||
},
|
||
"files": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/InputFileObject"
|
||
},
|
||
"description": "用于多模态理解的文件列表,包括图片、文档、音频和视频。要附加本地文件,请先通过 [上传文件](/api-reference/文件操作/上传文件) 上传,然后将返回的 `id` 作为 `upload_file_id`,并设置 `transfer_method: local_file`。"
|
||
}
|
||
}
|
||
},
|
||
"InputFileObject": {
|
||
"type": "object",
|
||
"required": [
|
||
"type",
|
||
"transfer_method"
|
||
],
|
||
"properties": {
|
||
"type": {
|
||
"type": "string",
|
||
"enum": [
|
||
"image",
|
||
"document",
|
||
"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(当 `transfer_method` 为 `remote_url` 时)。"
|
||
},
|
||
"upload_file_id": {
|
||
"type": "string",
|
||
"description": "已上传文件 ID,通过 [上传文件](/api-reference/文件操作/上传文件) API 预先上传获取(当 `transfer_method` 为 `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"
|
||
]
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"CompletionResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"event": {
|
||
"type": "string",
|
||
"description": "事件类型,固定为 `message`。"
|
||
},
|
||
"task_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "用于请求追踪和 [停止响应](/api-reference/文本生成/停止响应) API 的任务 ID。"
|
||
},
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "该响应事件的唯一 ID。"
|
||
},
|
||
"message_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "唯一的消息 ID。调用反馈或推荐问题接口时,将此值作为 `message_id` 参数使用。"
|
||
},
|
||
"mode": {
|
||
"type": "string",
|
||
"description": "应用模式,固定为 `completion`。"
|
||
},
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "完整的响应内容。"
|
||
},
|
||
"metadata": {
|
||
"type": "object",
|
||
"description": "包含用量和检索资源的元数据。",
|
||
"properties": {
|
||
"usage": {
|
||
"$ref": "#/components/schemas/Usage"
|
||
},
|
||
"retriever_resources": {
|
||
"type": "array",
|
||
"description": "使用的检索资源列表。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/RetrieverResource"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"created_at": {
|
||
"type": "integer",
|
||
"format": "int64",
|
||
"description": "消息创建时间戳(Unix 纪元秒)。"
|
||
}
|
||
}
|
||
},
|
||
"ChunkCompletionEvent": {
|
||
"type": "object",
|
||
"properties": {
|
||
"event": {
|
||
"type": "string",
|
||
"enum": [
|
||
"message",
|
||
"message_end",
|
||
"message_file",
|
||
"tts_message",
|
||
"tts_message_end",
|
||
"message_replace",
|
||
"error",
|
||
"ping"
|
||
],
|
||
"description": "流式事件的类型。"
|
||
}
|
||
},
|
||
"discriminator": {
|
||
"propertyName": "event",
|
||
"mapping": {
|
||
"message": "#/components/schemas/StreamEventMessage",
|
||
"message_end": "#/components/schemas/StreamEventMessageEnd",
|
||
"message_file": "#/components/schemas/StreamEventMessageFile",
|
||
"tts_message": "#/components/schemas/StreamEventTtsMessage",
|
||
"tts_message_end": "#/components/schemas/StreamEventTtsMessageEnd",
|
||
"message_replace": "#/components/schemas/StreamEventMessageReplace",
|
||
"error": "#/components/schemas/StreamEventError",
|
||
"ping": "#/components/schemas/StreamEventPing"
|
||
}
|
||
}
|
||
},
|
||
"StreamEventBase": {
|
||
"type": "object",
|
||
"properties": {
|
||
"task_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "任务 ID。"
|
||
},
|
||
"message_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "唯一消息 ID。"
|
||
},
|
||
"created_at": {
|
||
"type": "integer",
|
||
"format": "int64",
|
||
"description": "创建时间戳。"
|
||
}
|
||
}
|
||
},
|
||
"StreamEventMessage": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "LLM 返回文本块事件。",
|
||
"properties": {
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "LLM 返回的文本块内容。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventMessageEnd": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "消息结束事件,收到此事件表示流式输出已结束。",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "消息的唯一 ID。"
|
||
},
|
||
"metadata": {
|
||
"type": "object",
|
||
"description": "包含用量和检索资源的元数据。",
|
||
"properties": {
|
||
"usage": {
|
||
"$ref": "#/components/schemas/Usage"
|
||
},
|
||
"retriever_resources": {
|
||
"type": "array",
|
||
"description": "使用的检索资源列表。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/RetrieverResource"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventTtsMessage": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "TTS 音频流事件(base64 编码的 MP3)。在启用自动播放时可用。",
|
||
"properties": {
|
||
"audio": {
|
||
"type": "string",
|
||
"format": "byte",
|
||
"description": "Base64 编码的 MP3 音频块。按顺序解码并拼接所有块即可生成完整的音频文件。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventTtsMessageEnd": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "TTS 音频流结束事件。",
|
||
"properties": {
|
||
"audio": {
|
||
"type": "string",
|
||
"description": "空字符串。标识音频流结束。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventMessageFile": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "消息文件事件,由工具创建的新文件。",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "文件唯一 ID。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "文件类型,例如 `image`。"
|
||
},
|
||
"belongs_to": {
|
||
"type": "string",
|
||
"enum": [
|
||
"assistant"
|
||
],
|
||
"description": "该文件的归属方,此处始终为 `assistant`。"
|
||
},
|
||
"url": {
|
||
"type": "string",
|
||
"format": "url",
|
||
"description": "文件的远程 URL。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventMessageReplace": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "消息内容替换事件(例如由于内容审核)。",
|
||
"properties": {
|
||
"answer": {
|
||
"type": "string",
|
||
"description": "替换内容。"
|
||
},
|
||
"reason": {
|
||
"type": "string",
|
||
"description": "内容替换的原因。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventError": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/StreamEventBase"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "流式输出过程中的错误事件。",
|
||
"properties": {
|
||
"status": {
|
||
"type": "integer",
|
||
"description": "HTTP 状态码。"
|
||
},
|
||
"code": {
|
||
"type": "string",
|
||
"description": "错误码。"
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"description": "错误信息。"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"StreamEventPing": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ChunkCompletionEvent"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"description": "Ping 事件,用于保持连接活跃。"
|
||
}
|
||
]
|
||
},
|
||
"Usage": {
|
||
"type": "object",
|
||
"properties": {
|
||
"prompt_tokens": {
|
||
"type": "integer",
|
||
"description": "提示词中的令牌数。"
|
||
},
|
||
"prompt_unit_price": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "每个提示词令牌的单价。"
|
||
},
|
||
"prompt_price_unit": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "提示词令牌的价格单位。"
|
||
},
|
||
"prompt_price": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "提示词令牌的总价。"
|
||
},
|
||
"completion_tokens": {
|
||
"type": "integer",
|
||
"description": "补全内容中的令牌数。"
|
||
},
|
||
"completion_unit_price": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "每个补全令牌的单价。"
|
||
},
|
||
"completion_price_unit": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "补全令牌的价格单位。"
|
||
},
|
||
"completion_price": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "补全令牌的总价。"
|
||
},
|
||
"total_tokens": {
|
||
"type": "integer",
|
||
"description": "使用的令牌总数。"
|
||
},
|
||
"total_price": {
|
||
"type": "string",
|
||
"format": "decimal",
|
||
"description": "所有令牌的总价。"
|
||
},
|
||
"currency": {
|
||
"type": "string",
|
||
"description": "计价货币。"
|
||
},
|
||
"latency": {
|
||
"type": "number",
|
||
"format": "double",
|
||
"description": "延迟时间(秒)。"
|
||
}
|
||
}
|
||
},
|
||
"RetrieverResource": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "检索资源的唯一 ID。"
|
||
},
|
||
"message_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "该资源所属消息的 ID。"
|
||
},
|
||
"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": "文档名称。"
|
||
},
|
||
"data_source_type": {
|
||
"type": "string",
|
||
"description": "数据源类型。"
|
||
},
|
||
"segment_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "文档中特定块的 ID。"
|
||
},
|
||
"score": {
|
||
"type": "number",
|
||
"format": "float",
|
||
"description": "资源的相关性评分。"
|
||
},
|
||
"hit_count": {
|
||
"type": "integer",
|
||
"description": "该块被命中的次数。"
|
||
},
|
||
"word_count": {
|
||
"type": "integer",
|
||
"description": "块的字数。"
|
||
},
|
||
"segment_position": {
|
||
"type": "integer",
|
||
"description": "块在文档中的位置。"
|
||
},
|
||
"index_node_hash": {
|
||
"type": "string",
|
||
"description": "索引节点的哈希值。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "资源的内容片段。"
|
||
},
|
||
"summary": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "块内容的摘要。"
|
||
},
|
||
"created_at": {
|
||
"type": "integer",
|
||
"format": "int64",
|
||
"description": "创建时间戳(Unix 纪元秒)。"
|
||
}
|
||
}
|
||
},
|
||
"FileUploadResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "唯一文件 ID。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"description": "文件名。"
|
||
},
|
||
"size": {
|
||
"type": "integer",
|
||
"description": "文件大小(字节)。"
|
||
},
|
||
"extension": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件扩展名。"
|
||
},
|
||
"mime_type": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件的 MIME 类型。"
|
||
},
|
||
"created_by": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "上传文件的用户 ID。"
|
||
},
|
||
"created_at": {
|
||
"type": "integer",
|
||
"format": "int64",
|
||
"description": "上传时间戳(Unix 纪元秒)。"
|
||
},
|
||
"preview_url": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件的预览 URL。"
|
||
},
|
||
"source_url": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件的源 URL。"
|
||
},
|
||
"original_url": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件的原始 URL。"
|
||
},
|
||
"user_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "关联的用户 ID。"
|
||
},
|
||
"tenant_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "关联的租户 ID。"
|
||
},
|
||
"conversation_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "关联的会话 ID。"
|
||
},
|
||
"file_key": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "文件的存储键。"
|
||
}
|
||
}
|
||
},
|
||
"EndUserDetail": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "终端用户 ID。"
|
||
},
|
||
"tenant_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "租户 ID。"
|
||
},
|
||
"app_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "应用 ID。"
|
||
},
|
||
"type": {
|
||
"type": "string",
|
||
"description": "终端用户类型。Service API 用户固定为 `service_api`。"
|
||
},
|
||
"external_user_id": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "API 请求中提供的 `user` 标识符(例如 [发送消息](/api-reference/文本生成/发送消息) 中的 `user` 字段)。"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "终端用户名称。"
|
||
},
|
||
"is_anonymous": {
|
||
"type": "boolean",
|
||
"description": "用户是否为匿名用户。当原始 API 请求中未提供 `user` 标识符时,值为 `true`。"
|
||
},
|
||
"session_id": {
|
||
"type": "string",
|
||
"description": "会话标识符。默认为 `external_user_id` 的值。"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"description": "创建时间戳。"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"description": "最后更新时间戳。"
|
||
}
|
||
}
|
||
},
|
||
"MessageFeedbackRequest": {
|
||
"type": "object",
|
||
"description": "提交消息反馈的请求体。",
|
||
"required": [
|
||
"user"
|
||
],
|
||
"properties": {
|
||
"rating": {
|
||
"type": "string",
|
||
"enum": [
|
||
"like",
|
||
"dislike",
|
||
null
|
||
],
|
||
"nullable": true,
|
||
"description": "反馈评分。设为 `null` 可撤销之前提交的反馈。"
|
||
},
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符,由开发者定义,必须确保在应用内唯一。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "提供额外详情的可选文字反馈。"
|
||
}
|
||
}
|
||
},
|
||
"AppFeedbacksResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"description": "反馈项列表。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/FeedbackItem"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"FeedbackItem": {
|
||
"type": "object",
|
||
"description": "单条反馈项。",
|
||
"properties": {
|
||
"id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "反馈 ID。"
|
||
},
|
||
"app_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "应用 ID。"
|
||
},
|
||
"conversation_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "会话 ID。"
|
||
},
|
||
"message_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "消息 ID。"
|
||
},
|
||
"rating": {
|
||
"type": "string",
|
||
"description": "反馈评分。`like` 为正面,`dislike` 为负面。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"nullable": true,
|
||
"description": "可选的文字反馈。"
|
||
},
|
||
"from_source": {
|
||
"type": "string",
|
||
"description": "反馈来源。`user` 为终端用户通过 API 提交的反馈,`admin` 为从控制台提交的反馈。"
|
||
},
|
||
"from_end_user_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "提交反馈的终端用户 ID。当 `from_source` 为 `user` 时存在。"
|
||
},
|
||
"from_account_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"nullable": true,
|
||
"description": "提交反馈的账户 ID。当 `from_source` 为 `admin` 时存在。"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"description": "创建时间戳。"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"description": "最后更新时间戳。"
|
||
}
|
||
}
|
||
},
|
||
"AudioToTextRequest": {
|
||
"type": "object",
|
||
"description": "语音转文字的请求体。",
|
||
"required": [
|
||
"file"
|
||
],
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"format": "binary",
|
||
"description": "音频文件。支持格式:`mp3`、`mp4`、`mpeg`、`mpga`、`m4a`、`wav`、`webm`。大小限制:`30 MB`。"
|
||
},
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符。"
|
||
}
|
||
}
|
||
},
|
||
"AudioToTextResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"text": {
|
||
"type": "string",
|
||
"description": "语音识别输出的文字。"
|
||
}
|
||
}
|
||
},
|
||
"TextToAudioRequest": {
|
||
"type": "object",
|
||
"description": "文字转语音的请求体。提供 `message_id` 或 `text` 其中之一。",
|
||
"properties": {
|
||
"message_id": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"description": "消息 ID。当同时提供 `text` 时,优先使用消息 ID。"
|
||
},
|
||
"text": {
|
||
"type": "string",
|
||
"description": "要转换的语音内容。"
|
||
},
|
||
"user": {
|
||
"type": "string",
|
||
"description": "用户标识符。"
|
||
},
|
||
"voice": {
|
||
"type": "string",
|
||
"description": "文字转语音使用的声音。可用声音取决于为此应用配置的 TTS 提供商。使用[获取应用参数](/api-reference/应用配置/获取应用参数) → `text_to_speech.voice` 中的 `voice` 值作为默认值。"
|
||
},
|
||
"streaming": {
|
||
"type": "boolean",
|
||
"description": "是否启用流式响应。"
|
||
}
|
||
}
|
||
},
|
||
"AppInfoResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "应用名称。"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"description": "应用描述。"
|
||
},
|
||
"tags": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "应用标签。"
|
||
},
|
||
"mode": {
|
||
"type": "string",
|
||
"description": "应用模式。`completion` 为文本生成应用,`chat` 为基础对话应用,`agent-chat` 为 Agent 应用,`advanced-chat` 为对话流应用,`workflow` 为工作流应用。"
|
||
},
|
||
"author_name": {
|
||
"type": "string",
|
||
"description": "应用作者名称。"
|
||
}
|
||
}
|
||
},
|
||
"CompletionAppParametersResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"opening_statement": {
|
||
"type": "string",
|
||
"description": "开始时显示的开场白。"
|
||
},
|
||
"suggested_questions": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "建议的初始问题列表。"
|
||
},
|
||
"suggested_questions_after_answer": {
|
||
"type": "object",
|
||
"description": "回答后建议问题的配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"speech_to_text": {
|
||
"type": "object",
|
||
"description": "语音转文字配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"text_to_speech": {
|
||
"type": "object",
|
||
"description": "文字转语音配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
},
|
||
"voice": {
|
||
"type": "string",
|
||
"description": "TTS 的声音标识符。"
|
||
},
|
||
"language": {
|
||
"type": "string",
|
||
"description": "TTS 的语言。"
|
||
},
|
||
"autoPlay": {
|
||
"type": "string",
|
||
"enum": [
|
||
"enabled",
|
||
"disabled"
|
||
],
|
||
"description": "自动播放设置。"
|
||
}
|
||
}
|
||
},
|
||
"retriever_resource": {
|
||
"type": "object",
|
||
"description": "检索资源配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"annotation_reply": {
|
||
"type": "object",
|
||
"description": "标注回复配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"more_like_this": {
|
||
"type": "object",
|
||
"description": "更多类似内容配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"sensitive_word_avoidance": {
|
||
"type": "object",
|
||
"description": "敏感词过滤配置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用此功能。"
|
||
}
|
||
}
|
||
},
|
||
"user_input_form": {
|
||
"type": "array",
|
||
"description": "用户输入表单元素列表。",
|
||
"items": {
|
||
"$ref": "#/components/schemas/UserInputFormItem"
|
||
}
|
||
},
|
||
"file_upload": {
|
||
"type": "object",
|
||
"description": "文件上传配置。",
|
||
"properties": {
|
||
"image": {
|
||
"type": "object",
|
||
"description": "图片上传设置。",
|
||
"properties": {
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"description": "是否启用图片上传。"
|
||
},
|
||
"number_limits": {
|
||
"type": "integer",
|
||
"description": "最大图片数量。"
|
||
},
|
||
"detail": {
|
||
"type": "string",
|
||
"description": "图片精细程度。"
|
||
},
|
||
"transfer_methods": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"enum": [
|
||
"remote_url",
|
||
"local_file"
|
||
]
|
||
},
|
||
"description": "允许的传输方式。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"system_parameters": {
|
||
"type": "object",
|
||
"description": "系统级参数和限制。",
|
||
"properties": {
|
||
"file_size_limit": {
|
||
"type": "integer",
|
||
"description": "最大文件大小(MB)。"
|
||
},
|
||
"image_file_size_limit": {
|
||
"type": "integer",
|
||
"description": "最大图片文件大小(MB)。"
|
||
},
|
||
"audio_file_size_limit": {
|
||
"type": "integer",
|
||
"description": "最大音频文件大小(MB)。"
|
||
},
|
||
"video_file_size_limit": {
|
||
"type": "integer",
|
||
"description": "最大视频文件大小(MB)。"
|
||
},
|
||
"workflow_file_upload_limit": {
|
||
"type": "integer",
|
||
"description": "工作流文件上传的最大文件数。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"UserInputFormItem": {
|
||
"type": "object",
|
||
"oneOf": [
|
||
{
|
||
"$ref": "#/components/schemas/TextInputControlWrapper"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/ParagraphControlWrapper"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/SelectControlWrapper"
|
||
}
|
||
]
|
||
},
|
||
"TextInputControlWrapper": {
|
||
"title": "Text Input",
|
||
"type": "object",
|
||
"properties": {
|
||
"text-input": {
|
||
"$ref": "#/components/schemas/TextInputControl"
|
||
}
|
||
}
|
||
},
|
||
"ParagraphControlWrapper": {
|
||
"title": "Paragraph",
|
||
"type": "object",
|
||
"properties": {
|
||
"paragraph": {
|
||
"$ref": "#/components/schemas/ParagraphControl"
|
||
}
|
||
}
|
||
},
|
||
"SelectControlWrapper": {
|
||
"title": "Select",
|
||
"type": "object",
|
||
"properties": {
|
||
"select": {
|
||
"$ref": "#/components/schemas/SelectControl"
|
||
}
|
||
}
|
||
},
|
||
"TextInputControl": {
|
||
"type": "object",
|
||
"properties": {
|
||
"label": {
|
||
"type": "string",
|
||
"description": "表单字段的显示标签。"
|
||
},
|
||
"variable": {
|
||
"type": "string",
|
||
"description": "用作 `inputs` 对象中键的变量名。"
|
||
},
|
||
"required": {
|
||
"type": "boolean",
|
||
"description": "提交前是否必须填写此字段。"
|
||
},
|
||
"default": {
|
||
"type": "string",
|
||
"description": "表单字段中预填的默认值。"
|
||
}
|
||
}
|
||
},
|
||
"ParagraphControl": {
|
||
"type": "object",
|
||
"properties": {
|
||
"label": {
|
||
"type": "string",
|
||
"description": "表单字段的显示标签。"
|
||
},
|
||
"variable": {
|
||
"type": "string",
|
||
"description": "用作 `inputs` 对象中键的变量名。"
|
||
},
|
||
"required": {
|
||
"type": "boolean",
|
||
"description": "提交前是否必须填写此字段。"
|
||
},
|
||
"default": {
|
||
"type": "string",
|
||
"description": "表单字段中预填的默认值。"
|
||
}
|
||
}
|
||
},
|
||
"SelectControl": {
|
||
"type": "object",
|
||
"properties": {
|
||
"label": {
|
||
"type": "string",
|
||
"description": "表单字段的显示标签。"
|
||
},
|
||
"variable": {
|
||
"type": "string",
|
||
"description": "用作 `inputs` 对象中键的变量名。"
|
||
},
|
||
"required": {
|
||
"type": "boolean",
|
||
"description": "提交前是否必须做出选择。"
|
||
},
|
||
"default": {
|
||
"type": "string",
|
||
"description": "默认选中的值。"
|
||
},
|
||
"options": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"description": "此表单控件的可选值列表。"
|
||
}
|
||
}
|
||
},
|
||
"AppMetaResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tool_icons": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"oneOf": [
|
||
{
|
||
"title": "Icon URL",
|
||
"type": "string",
|
||
"format": "url",
|
||
"description": "图标的 URL。"
|
||
},
|
||
{
|
||
"$ref": "#/components/schemas/ToolIconDetail"
|
||
}
|
||
]
|
||
},
|
||
"description": "工具图标。键为工具名称。"
|
||
}
|
||
}
|
||
},
|
||
"ToolIconDetail": {
|
||
"title": "Emoji Icon",
|
||
"type": "object",
|
||
"description": "使用 emoji 的工具图标详情。",
|
||
"properties": {
|
||
"background": {
|
||
"type": "string",
|
||
"description": "十六进制格式的背景颜色。"
|
||
},
|
||
"content": {
|
||
"type": "string",
|
||
"description": "Emoji 内容。"
|
||
}
|
||
}
|
||
},
|
||
"WebAppSettingsResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"title": {
|
||
"type": "string",
|
||
"description": "WebApp 标题。"
|
||
},
|
||
"chat_color_theme": {
|
||
"type": "string",
|
||
"description": "聊天主题颜色。"
|
||
},
|
||
"chat_color_theme_inverted": {
|
||
"type": "boolean",
|
||
"description": "聊天主题颜色是否反转。"
|
||
},
|
||
"icon_type": {
|
||
"type": "string",
|
||
"description": "使用的图标类型。`emoji` 为表情图标,`image` 为上传的图片图标。"
|
||
},
|
||
"icon": {
|
||
"type": "string",
|
||
"description": "图标内容(表情或图片 ID)。"
|
||
},
|
||
"icon_background": {
|
||
"type": "string",
|
||
"description": "图标背景颜色。"
|
||
},
|
||
"icon_url": {
|
||
"type": "string",
|
||
"format": "url",
|
||
"nullable": true,
|
||
"description": "图标图片的 URL。"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"description": "WebApp 描述。"
|
||
},
|
||
"copyright": {
|
||
"type": "string",
|
||
"description": "版权文本。"
|
||
},
|
||
"privacy_policy": {
|
||
"type": "string",
|
||
"description": "隐私政策 URL。"
|
||
},
|
||
"custom_disclaimer": {
|
||
"type": "string",
|
||
"description": "自定义免责声明文本。"
|
||
},
|
||
"default_language": {
|
||
"type": "string",
|
||
"description": "默认语言代码。"
|
||
},
|
||
"show_workflow_steps": {
|
||
"type": "boolean",
|
||
"description": "是否显示工作流步骤。"
|
||
},
|
||
"use_icon_as_answer_icon": {
|
||
"type": "boolean",
|
||
"description": "是否使用应用图标作为回答图标。"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "文本生成",
|
||
"description": "文本生成相关操作。"
|
||
},
|
||
{
|
||
"name": "文件操作",
|
||
"description": "文件管理相关操作。"
|
||
},
|
||
{
|
||
"name": "终端用户",
|
||
"description": "终端用户信息相关操作。"
|
||
},
|
||
{
|
||
"name": "消息反馈",
|
||
"description": "用户反馈相关操作。"
|
||
},
|
||
{
|
||
"name": "语音与文字转换",
|
||
"description": "语音转文字和文字转语音相关操作。"
|
||
},
|
||
{
|
||
"name": "应用配置",
|
||
"description": "获取应用设置和信息的操作。"
|
||
}
|
||
]
|
||
}
|