feat(voice): 语音参数移入 config.js + 设置页男女声切换

- config: 新增 tts.female/male 两组参数(voiceType/volume/speed),
  直接改数字即可调音色,无需改逻辑代码
- storage: getSettings 兜底 voiceGender(旧用户迁移为女声)
- voice: 新增 _getTtsParams 读 config+性别;缓存 key 含完整参数,
  改音色/音量/性别自动重新合成,无需手动清缓存
- settings: 训练偏好加"语音音色"segmented(女声/男声)
- tts 云函数: _synthesize 用传入 opts 合成;_upload 路径含 voiceType
  (男/女不同文件);需重新部署

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-09 10:08:09 +08:00
parent dd9cd1859c
commit a7ed017267
7 changed files with 118 additions and 20 deletions
+14 -4
View File
@@ -164,10 +164,20 @@ const getTotalStats = () => {
return { totalDuration, totalSessions, maxDuration }
}
const getSettings = () => wx.getStorageSync(SETTINGS_KEY) || {
planId: 'beginner',
voiceGuide: true,
vibrate: true
const getSettings = () => {
const s = wx.getStorageSync(SETTINGS_KEY)
if (s) {
// Backfill voiceGender for existing users (added with the male/female
// voice option). Defaults to female, the prior behavior.
if (!s.voiceGender) s.voiceGender = 'female'
return s
}
return {
planId: 'beginner',
voiceGuide: true,
vibrate: true,
voiceGender: 'female'
}
}
const saveSettings = (settings) => {