feat(web): 角色与音频工作台 - 完善素材选择、生成参数与同步交互
This commit is contained in:
1 parent
5650da6d31
commit
22e7331d04
77 files changed
+3641
-721
No files matched your search
@@ -0,0 +1,381 @@
|
||||
{
|
||||
"apiVersion": "yingce.plugin/v2",
|
||||
"id": "doubao-streaming-tts",
|
||||
"name": "豆包音频生成",
|
||||
"version": "2.0.0",
|
||||
"author": "Volcengine / 影策",
|
||||
"description": "豆包音频生成 独立请求协议插件。",
|
||||
"documentation": "# 豆包音频生成\n\n该目录是独立官方协议插件源码。后端从生成的 `doubao-streaming-tts.yingce-plugin` 包加载,不依赖系统内置 `host:` 适配器。\n\n完整接口见 [docs/interface.md](docs/interface.md)。\n\n---\n\n# 豆包音频生成 接口字段\n\n## 协议身份\n\n- 插件 ID:`doubao-streaming-tts`。\n- Provider ID:`doubao-streaming-tts`。\n- 能力:`audio`。\n- 默认 Base URL:`https://openspeech.bytedance.com`。\n- 鉴权驱动:`header`。\n- 创建:`POST /api/v3/tts/create`。\n- 生命周期:同步响应。\n\n## 配置字段\n\n| 字段 | 类型 | 必填 | 含义 |\n| --- | --- | --- | --- |\n| `apiKey` | secret | 是 | API Key |\n\n## 统一字段映射\n\n| 统一字段 | 类型 | 必填 | 上游映射 | 说明 |\n| --- | --- | --- | --- | --- |\n| `model` | string | 是 | `model` | 音频模型 ID。 |\n| `prompt` | string | 是 | `input` | 待合成文本。 |\n| `providerOptions` | object | 否 | `provider-specific fields` | 插件命名空间内的厂商扩展字段。 |\n\n## 上游请求模板逐字段清单\n\n下表由插件请求模板生成,覆盖 body、query、headers 和 multipart 文件声明中的每个字段。\n\n| 上游位置 | 值或转换表达式 |\n| --- | --- |\n| `create.method` | `\"POST\"` |\n| `create.path` | `\"/api/v3/tts/create\"` |\n| `create.contentType` | `\"application/json\"` |\n| `create.body.model` | `{\"$ref\":\"request.model\"}` |\n| `create.body.text_prompt` | `{\"$ref\":\"request.prompt\"}` |\n| `create.body.references` | `{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$gt\":[{\"$len\":{\"$ref\":\"request.images\"}},0]},\"then\":{\"$map\":{\"from\":{\"$ref\":\"request.images\"},\"as\":\"media\",\"in\":{\"image_url\":{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"media.source.type\"},\"url\"]},\"then\":{\"$ref\":\"media.url\"},\"else\":null}}},\"image_data\":{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"media.source.type\"},\"data\"]},\"then\":{\"$dataPayload\":{\"$ref\":\"media.value\"}},\"else\":null}}}}}},\"else\":{\"$if\":{\"condition\":{\"$gt\":[{\"$len\":{\"$ref\":\"request.audios\"}},0]},\"then\":{\"$concatArrays\":[{\"$map\":{\"from\":{\"$ref\":\"request.audios\"},\"as\":\"media\",\"in\":{\"audio_url\":{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"media.source.type\"},\"url\"]},\"then\":{\"$ref\":\"media.url\"},\"else\":null}}},\"audio_data\":{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"media.source.type\"},\"data\"]},\"then\":{\"$dataPayload\":{\"$ref\":\"media.value\"}},\"else\":null}}}}}},{\"$if\":{\"condition\":{\"$and\":[{\"$ref\":\"request.extra.audioVoice\"},{\"$lt\":[{\"$len\":{\"$ref\":\"request.audios\"}},3]}]},\"then\":[{\"speaker\":{\"$ref\":\"request.extra.audioVoice\"}}],\"else\":[]}}]},\"else\":{\"$if\":{\"condition\":{\"$ref\":\"request.extra.audioVoice\"},\"then\":[{\"speaker\":{\"$ref\":\"request.extra.audioVoice\"}}],\"else\":null}}}}}}}` |\n| `create.body.audio_config.format` | `{\"$coalesce\":[{\"$ref\":\"request.extra.audioFormat\"},\"mp3\"]}` |\n| `create.body.audio_config.speech_rate` | `{\"$omitEmpty\":{\"$if\":{\"condition\":{\"$ne\":[{\"$toFloat\":{\"$ref\":\"request.extra.audioSpeed\"}},0]},\"then\":{\"$add\":[{\"$multiply\":[{\"$toFloat\":{\"$ref\":\"request.extra.audioSpeed\"}},100]},-100]},\"else\":null}}}` |\n| `create.headers.X-Api-Request-Id` | `{\"$ref\":\"request.extra.idempotencyKey\"}` |\n\n## Provider 扩展键\n\n- 无额外扩展键。\n\n动态模型或工作流允许使用文档声明的完整 `parameters/input/extra_body` 对象;该对象是协议本身的开放 schema,不会被宿主裁剪。\n\n## 响应映射逐字段清单\n\n| 映射位置 | 上游路径或转换表达式 |\n| --- | --- |\n| `response.errorPaths[0]` | `\"code\"` |\n| `response.messagePaths[0]` | `\"message\"` |\n| `response.status` | `\"succeeded\"` |\n| `response.resultKind` | `\"audio\"` |\n| `response.audios` | `{\"$if\":{\"condition\":{\"$ref\":\"response.url\"},\"then\":{\"url\":{\"$ref\":\"response.url\"},\"ephemeral\":true},\"else\":{\"$if\":{\"condition\":{\"$ref\":\"response.audio\"},\"then\":{\"dataUrl\":{\"$ref\":\"response.audio\"},\"mimeType\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"request.extra.audioFormat\"},\"wav\"]},\"then\":\"audio/wav\",\"else\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"request.extra.audioFormat\"},\"pcm\"]},\"then\":\"audio/pcm\",\"else\":{\"$if\":{\"condition\":{\"$eq\":[{\"$ref\":\"request.extra.audioFormat\"},\"ogg_opus\"]},\"then\":\"audio/ogg\",\"else\":\"audio/mpeg\"}}}}}}},\"else\":null}}}}` |\n\n## 响应与错误\n\n插件把上游 task/status/text/media/usage 映射为统一结果。临时媒体 URL 标记为 ephemeral,由宿主立即下载持久化。HTTP 错误、业务 code 和 error object 保持失败语义,不包装成成功。\n\n## 兼容边界\n\n火山引擎 seed-audio-1.0 非流式音频生成。POST /api/v3/tts/create。Line truncated
|
||||
"permissions": [
|
||||
"generation.run",
|
||||
"media.read"
|
||||
],
|
||||
"configuration": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "apiKey",
|
||||
"type": "secret",
|
||||
"label": "API Key",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"contributes": {
|
||||
"providers": [
|
||||
{
|
||||
"id": "doubao-streaming-tts",
|
||||
"label": "豆包音频生成",
|
||||
"capabilities": [
|
||||
"audio"
|
||||
],
|
||||
"scopes": [
|
||||
"admin.system-channel",
|
||||
"user.custom-channel",
|
||||
"canvas",
|
||||
"creation",
|
||||
"agent"
|
||||
],
|
||||
"baseUrl": "https://openspeech.bytedance.com",
|
||||
"requiresPublicMediaUrls": false,
|
||||
"auth": {
|
||||
"type": "header",
|
||||
"field": "apiKey",
|
||||
"header": "X-Api-Key"
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "model",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"mapping": "model",
|
||||
"description": "音频模型 ID。"
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"mapping": "input",
|
||||
"description": "待合成文本。"
|
||||
},
|
||||
{
|
||||
"name": "providerOptions",
|
||||
"type": "object",
|
||||
"required": false,
|
||||
"mapping": "provider-specific fields",
|
||||
"description": "插件命名空间内的厂商扩展字段。"
|
||||
}
|
||||
],
|
||||
"create": {
|
||||
"method": "POST",
|
||||
"path": "/api/v3/tts/create",
|
||||
"contentType": "application/json",
|
||||
"body": {
|
||||
"model": {
|
||||
"$ref": "request.model"
|
||||
},
|
||||
"text_prompt": {
|
||||
"$ref": "request.prompt"
|
||||
},
|
||||
"references": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$gt": [
|
||||
{
|
||||
"$len": {
|
||||
"$ref": "request.images"
|
||||
}
|
||||
},
|
||||
0
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$map": {
|
||||
"from": {
|
||||
"$ref": "request.images"
|
||||
},
|
||||
"as": "media",
|
||||
"in": {
|
||||
"image_url": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "media.source.type"
|
||||
},
|
||||
"url"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$ref": "media.url"
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"image_data": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "media.source.type"
|
||||
},
|
||||
"data"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$dataPayload": {
|
||||
"$ref": "media.value"
|
||||
}
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$gt": [
|
||||
{
|
||||
"$len": {
|
||||
"$ref": "request.audios"
|
||||
}
|
||||
},
|
||||
0
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$concatArrays": [
|
||||
{
|
||||
"$map": {
|
||||
"from": {
|
||||
"$ref": "request.audios"
|
||||
},
|
||||
"as": "media",
|
||||
"in": {
|
||||
"audio_url": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "media.source.type"
|
||||
},
|
||||
"url"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$ref": "media.url"
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"audio_data": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "media.source.type"
|
||||
},
|
||||
"data"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$dataPayload": {
|
||||
"$ref": "media.value"
|
||||
}
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$and": [
|
||||
{
|
||||
"$ref": "request.extra.audioVoice"
|
||||
},
|
||||
{
|
||||
"$lt": [
|
||||
{
|
||||
"$len": {
|
||||
"$ref": "request.audios"
|
||||
}
|
||||
},
|
||||
3
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"then": [
|
||||
{
|
||||
"speaker": {
|
||||
"$ref": "request.extra.audioVoice"
|
||||
}
|
||||
}
|
||||
],
|
||||
"else": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"else": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$ref": "request.extra.audioVoice"
|
||||
},
|
||||
"then": [
|
||||
{
|
||||
"speaker": {
|
||||
"$ref": "request.extra.audioVoice"
|
||||
}
|
||||
}
|
||||
],
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"audio_config": {
|
||||
"format": {
|
||||
"$coalesce": [
|
||||
{
|
||||
"$ref": "request.extra.audioFormat"
|
||||
},
|
||||
"mp3"
|
||||
]
|
||||
},
|
||||
"speech_rate": {
|
||||
"$omitEmpty": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$ne": [
|
||||
{
|
||||
"$toFloat": {
|
||||
"$ref": "request.extra.audioSpeed"
|
||||
}
|
||||
},
|
||||
0
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"$add": [
|
||||
{
|
||||
"$multiply": [
|
||||
{
|
||||
"$toFloat": {
|
||||
"$ref": "request.extra.audioSpeed"
|
||||
}
|
||||
},
|
||||
100
|
||||
]
|
||||
},
|
||||
-100
|
||||
]
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"headers": {
|
||||
"X-Api-Request-Id": {
|
||||
"$ref": "request.extra.idempotencyKey"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"errorPaths": [
|
||||
"code"
|
||||
],
|
||||
"messagePaths": [
|
||||
"message"
|
||||
],
|
||||
"status": "succeeded",
|
||||
"resultKind": "audio",
|
||||
"audios": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$ref": "response.url"
|
||||
},
|
||||
"then": {
|
||||
"url": {
|
||||
"$ref": "response.url"
|
||||
},
|
||||
"ephemeral": true
|
||||
},
|
||||
"else": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$ref": "response.audio"
|
||||
},
|
||||
"then": {
|
||||
"dataUrl": {
|
||||
"$ref": "response.audio"
|
||||
},
|
||||
"mimeType": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "request.extra.audioFormat"
|
||||
},
|
||||
"wav"
|
||||
]
|
||||
},
|
||||
"then": "audio/wav",
|
||||
"else": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "request.extra.audioFormat"
|
||||
},
|
||||
"pcm"
|
||||
]
|
||||
},
|
||||
"then": "audio/pcm",
|
||||
"else": {
|
||||
"$if": {
|
||||
"condition": {
|
||||
"$eq": [
|
||||
{
|
||||
"$ref": "request.extra.audioFormat"
|
||||
},
|
||||
"ogg_opus"
|
||||
]
|
||||
},
|
||||
"then": "audio/ogg",
|
||||
"else": "audio/mpeg"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user