Compare commits
2
Commits
aa3f09752e
...
8a4187720c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a4187720c | ||
|
|
92cf8fab8a |
+2
-1
@@ -155,7 +155,8 @@ func OpenaiTTSHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
opts.Text = req.Input
|
opts.Text = req.Input
|
||||||
|
|
||||||
// M3: voice 路由
|
// M3: voice 路由
|
||||||
// - voice 为空 → 用 setting.TTSOptions.Speaker (即 store 里的 default_speaker)
|
// - voice 为空 → 走 LoadRuntimeConfig 解析过的 opts.Speaker (已是真 speaker ID,
|
||||||
|
// default_speaker 是 voice 名,LoadRuntimeConfig 查 voice 表后替换)
|
||||||
// - voice 非空 → 查 voices 表,替换 opts.Speaker / ResourceID / Model
|
// - voice 非空 → 查 voices 表,替换 opts.Speaker / ResourceID / Model
|
||||||
// - 命中但 enabled=0 → 仍可用(用户显式传 voice 即覆盖 enabled 状态;若想禁用在 admin UI 关掉就行)
|
// - 命中但 enabled=0 → 仍可用(用户显式传 voice 即覆盖 enabled 状态;若想禁用在 admin UI 关掉就行)
|
||||||
// - 未命中 → 400 "unknown voice: <name>"
|
// - 未命中 → 400 "unknown voice: <name>"
|
||||||
|
|||||||
+1
-1
@@ -953,7 +953,7 @@
|
|||||||
toast('err', '保存 CORS 失败: ' + corsErr.value);
|
toast('err', '保存 CORS 失败: ' + corsErr.value);
|
||||||
} finally { savingCors.value = false; }
|
} finally { savingCors.value = false; }
|
||||||
};
|
};
|
||||||
const reloadAll = () => { loadOverview(); loadVoices(); };
|
const reloadAll = () => { loadOverview(); loadVoices(); loadSettings(); };
|
||||||
|
|
||||||
const saveSettings = async () => {
|
const saveSettings = async () => {
|
||||||
settingsErr.value = '';
|
settingsErr.value = '';
|
||||||
|
|||||||
+13
-5
@@ -202,15 +202,23 @@ func LoadRuntimeConfig(s Store) error {
|
|||||||
return TTSConfigErr
|
return TTSConfigErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// 【BUG 修复】default_speaker 是 voice **名字**(如 "chun"),
|
// 【BUG 修复 · 第二轮】default_speaker 是 voice **名字**(如 "chun"),
|
||||||
// 不是火山 speaker ID (如 "S_G8tEKnaJ1")。原代码直接把 voice 名当
|
// 不是火山 speaker ID (如 "S_G8tEKnaJ1")。原代码直接把 voice 名当
|
||||||
// speaker ID 用,导致调 /v1/audio/speech 不传 voice 时火山 55000000。
|
// speaker ID 用,导致调 /v1/audio/speech 不传 voice 时火山 55000000。
|
||||||
// 这里查 voice 表拿真正的 speaker / resource_id / model。
|
//
|
||||||
|
// 字段优先级:
|
||||||
|
// - speaker ← 从 default_speaker 这个 voice 查表拿真 ID (必查)
|
||||||
|
// - resource_id ← settings 里的(用户偏好,不被 voice 行覆盖)
|
||||||
|
// - model ← voice 行的优先,settings 里的次之
|
||||||
|
//
|
||||||
|
// 之前 f5563e6 把 resourceId 也覆盖了,导致用户在 setup 设的
|
||||||
|
// default_resource_id 永远没机会生效。这次只覆盖 speaker,不动 resourceId。
|
||||||
var voiceModel string
|
var voiceModel string
|
||||||
if vSpeaker, vResource, vModel, found, vErr := s.GetVoiceForTTS(speaker); vErr == nil && found {
|
if vSpeaker, _, vModel, found, vErr := s.GetVoiceForTTS(speaker); vErr == nil && found {
|
||||||
speaker = vSpeaker
|
speaker = vSpeaker
|
||||||
resourceId = vResource
|
if vModel != "" {
|
||||||
voiceModel = vModel
|
voiceModel = vModel
|
||||||
|
}
|
||||||
// 找不到 voice 时不报错 — 保持原值(向后兼容)
|
// 找不到 voice 时不报错 — 保持原值(向后兼容)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user