Commit de8f2ec
fix(voice): 自动平移废弃的免费 YUI 预设音色,避免存量用户掉档到 qingchunshaonv (#1665)
* fix(voice): 自动平移废弃的免费 YUI 预设音色,避免存量用户掉档到 qingchunshaonv
#1639 把 free_voices["yui_cn"] 从 voice-tone-R6NtLH3Hk0 换成 voice-tone-RcH2svtsrw,
但只改了 config 模板和解析源,没迁移已写进存量 characters.json 的旧 tone ID。旧值已
不在 free_voices 白名单 → cleanup_invalid_voice_ids 判 invalid 清空 → 空 voice 落到
free/step 的 default_voice(qingchunshaonv),导致「一直吃默认 YUI、从没手动选过音色」
的免费用户在音色 ID 更替后无声掉档到通用女声。
在 cleanup 判 invalid 前先把废弃 YUI tone 平移到现役 yui_cn:
- 新增 _DEPRECATED_FREE_YUI_VOICE_IDS 集合 + is_deprecated_free_yui_voice_id /
remap_deprecated_free_yui_voice_id(对偶既有 is_legacy_cosyvoice_id)
- 现役值解析不出(或仍落废弃集合)时不乱换,交既有清空兜底,绝不废弃换废弃
- 迁移命中触发存盘;覆盖 app 初始化与每次 start_session 两条 cleanup 路径
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(voice): remap 只认 yui_cn 且非废弃值原样返回,堵两个 reviewer 指出的漏洞
CodeRabbit/Codex: remap 对非废弃值做了 strip 归一化,带前后空白的无效 voice_id 会
因 remapped != voice_id 被误当「已迁移」continue,漏掉本轮 invalid 清理 → 改为非废弃
值原样返回原值(strip 收口在 _get_voice_id 源头,不是 remap 的职责)。
Codex: 复用 _get_default_yui_free_voice_id 会在 free_voices 缺 yui_cn 时 fallback 到
cuteGirl/首个 preset,把废弃 YUI 串成别的音色 → 改为直接读 free_voices["yui_cn"],
缺失/为空/仍落废弃集合时不迁移,交既有清空兜底。
新增「带空白废弃仍迁移」「带空白非废弃 invalid 仍清空」「缺 yui_cn 不借替身」三条回归。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(voice): 给带空白废弃值迁移用例补存盘断言(CodeRabbit nitpick)
与 test_cleanup_migrates_deprecated_yui_voice 对偶,验证带前后空白的废弃值迁移
路径同样触发 save_characters,而非只改了内存对象。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(voice): 废弃 YUI remap 按线路分流,海外 free 绑 yui sentinel(Codex P2)
Codex: 海外 free(lanlan.app→free_intl)用户若残留国内 StepFun YUI tone,无条件
remap 成 voice-tone yui_cn 仍是国内 preset;海外不认 voice-tone-*,非空 voice_id 会
从海外 native/default(yui) 路径 regress 到 external TTS(_resolve_session_use_tts 仅
在 lanlan.tech 把 free preset 当 native)。改前 stale id 本会被 validation 清空。
remap 改为对偶 ensure_default_yui_voice_for_free_api 的线路二分:
- 仅 core=free 才迁移;非 free 路由原样返回交清空兜底
- 海外 free(lanlan.app / _check_non_mainland 兜底)→ 品牌 sentinel "yui"
- 国内 free(lanlan.tech)→ 现役 free_voices["yui_cn"]
新增「海外绑 yui」「URL 仍 tech 但地理判海外兜底」「非 free 不迁移」三条用例。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(voice): 海外 free 废弃 YUI 不注入 yui,交服务端默认(遵 PR #1643 契约)
af8e26e 让海外 free 把废弃 StepFun YUI tone remap 成 "yui" sentinel,违反 PR #1643
确立的设计原则:海外 free(lanlan.app→free_intl)下未知/stale voice id 应交服务端默认
音色 fallback,客户端不得注入 yui 或 native alias(free_intl 继承 Gemini-native
provider,不能把 StepFun magic id/alias 漏进该 catalog)。
remap 改为只有国内 free(lanlan.tech)才迁移到现役 yui_cn;海外 free 与非 free 路由均
原样返回,交既有 validate 判 invalid 清空 → 落服务端默认。两种线路运行时都得到正确 YUI
音色,且 cross-region 往返更稳(切回国内由 ensure_default 兜底重绑)。
测试相应改为海外不 remap(原样返回 / cleanup 清空),删掉 "yui" sentinel 断言。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 1c9e0d6 commit de8f2ec
2 files changed
Lines changed: 256 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
160 | 170 | | |
161 | 171 | | |
162 | 172 | | |
| |||
2358 | 2368 | | |
2359 | 2369 | | |
2360 | 2370 | | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
2361 | 2417 | | |
2362 | 2418 | | |
2363 | 2419 | | |
| |||
2859 | 2915 | | |
2860 | 2916 | | |
2861 | 2917 | | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
2862 | 2922 | | |
2863 | 2923 | | |
2864 | 2924 | | |
2865 | 2925 | | |
2866 | 2926 | | |
| 2927 | + | |
2867 | 2928 | | |
2868 | 2929 | | |
2869 | 2930 | | |
2870 | 2931 | | |
2871 | 2932 | | |
2872 | 2933 | | |
2873 | 2934 | | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
2874 | 2948 | | |
2875 | 2949 | | |
2876 | 2950 | | |
| |||
2885 | 2959 | | |
2886 | 2960 | | |
2887 | 2961 | | |
2888 | | - | |
| 2962 | + | |
2889 | 2963 | | |
2890 | | - | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
2891 | 2968 | | |
2892 | 2969 | | |
2893 | 2970 | | |
| |||
0 commit comments