Skip to content

feat: multi-provider media generation and voice TTS (siliconflow / openai-compatible / local piper) - #600

Open
angri450 wants to merge 1 commit into
TencentCloud:developfrom
angri450:feature/media-providers
Open

angri450 wants to merge 1 commit into
TencentCloud:developfrom
angri450:feature/media-providers

Conversation

@angri450

@angri450 angri450 commented Sep 7, 2026

Copy link
Copy Markdown

概要

让模型配置页(Settings → Models)支持多服务商与免费本地 TTS:

  • 媒体生成(Generation 页):服务商从写死火山方舟放开为 volcengine / siliconflow / openai-compatible 三选,base_url 可编辑(中转站填自己的地址)。生图模型预置 Qwen/Qwen-Image、Kwai-Kolors/Kolors、dall-e-3;视频预置 Wan2.2 T2V/I2V。
  • 语音(Voice 页):新增三个预置——SiliconFlow(CosyVoice2 TTS + SenseVoice STT)、OpenAI Compatible(任意 OpenAI 兼容中转站/网关,endpoint/模型/音色可配)、本地 Piper(127.0.0.1:8081 qwerty 服务,免费零 token,中文华妍 / 英文 Lessac / 中英 mix 自动切换)。

设计要点

  • 预设 id 与适配器 kind 解耦:siliconflow / openai-compatible 均映射到已有的 openai wire 协议(/v1/audio/speech/v1/audio/transcriptions),复用现成 adapter 零重复;piper 是独立本地 adapter(HTTP GET 到本机服务,WAV 直出,无 key、无 SSRF 担忧——固定 localhost 默认地址可被 base_url 覆盖)。
  • STT / TTS 模型分开存(extra.stt_model / extra.model),顺带修正 OpenAI 官方卡片此前只存 whisper-1 导致 TTS 拿到错误模型的缺陷。
  • 媒体生成按 provider 方言探测:volcengine size=2K / siliconflow image_size=1024x1024 / openai-compatible size+n+response_format=url;凭证验证 volcengine 走 /ping、其余走 GET /models(不产生费用)。视频在 openai-compatible 上如实报不支持(OpenAI 协议无标准),引导换 provider。
  • harness 端 provider 选择通过 MediaGenerationConfig.provider 透传(本仓只传配置;harness-agent 侧在 PyPI 包维护,上游仓库未公开,PR 合并后需同步发布)。

测试

  • 新增/更新 22 个单测(media settings provider 保存与方言探测、voice preset 解析、piper 激活/STT 拒绝),相关文件 33 passed
  • 本机实测:硅基凭证验证、Qwen-Image 真实生图(12.5s)、CosyVoice2 中文合成(mp3)、本地 Piper 合成(WAV 22050Hz)全部通过

前端构建

dashboard/ 三处(MediaGeneration / Voice 面板 + locales zh/en),vite build 产物不入库(.gitignore),部署时构建。

…enai-compatible / local piper)

- media generation: provider + base_url configurable (volcengine / siliconflow /
  openai-compatible relay); provider-aware API-key verification (/ping vs /models)
  and model probes with per-dialect payloads; harness_config passes provider through
- voice: new presets siliconflow (CosyVoice2 TTS + SenseVoice STT) and
  openai-compatible (custom endpoint/model/voice); preset id may carry an adapter
  kind different from its id (both speak the openai wire protocol); STT model
  configurable separately (extra.stt_model); OpenAI preset stores tts-1 + whisper-1
- voice: new local piper preset (127.0.0.1:8081, zero cost); zh / en / mix voices;
  wav media type; STT rejects with capability mismatch
- tests: media settings provider save/probe dispatch; voice manager preset
  resolution and piper behavior
Copilot AI lite review requested due to automatic review settings September 7, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants