fix(config): resolve common config sync issues across frontend and backend

- Fix backfill pollution: extract custom config from live when common config enabled
- Fix proxy backup: merge common config before backup to preserve full config
- Unify null override semantics: null no longer overrides in both frontend and backend
- Add missing i18n keys for common config UI
- Hide format button in readonly JsonEditor
- Add mapGeminiWarningToI18n for user-friendly warning messages
This commit is contained in:
YoVinchen
2026-01-27 12:28:46 +08:00
parent 733605ae5c
commit 9e25ecf475
11 changed files with 200 additions and 26 deletions
+3 -3
View File
@@ -73,7 +73,7 @@ export const deepEqual = (a: unknown, b: unknown): boolean => {
* - 嵌套对象:递归合并
* - 数组:source 完全替换 target(不做元素级合并)
* - 原始值:source 覆盖 target
* - undefined:不覆盖
* - undefined/null:不覆盖(与后端 config_merge.rs 保持一致)
*/
export const deepMerge = <T extends Record<string, unknown>>(
target: T,
@@ -85,8 +85,8 @@ export const deepMerge = <T extends Record<string, unknown>>(
const sourceValue = source[key];
const targetValue = result[key];
// undefined 不覆盖
if (sourceValue === undefined) {
// undefined 和 null 都不覆盖(与后端保持一致)
if (sourceValue === undefined || sourceValue === null) {
continue;
}