mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
feat: unify Codex third-party providers into stable "custom" history bucket
Codex filters resume history by `model_provider`, so switching between provider-specific ids like `rightcode` and `aihubmix` made past sessions appear to vanish. Collapse all third-party providers into a single stable bucket so cross-switch history stays visible. - Normalize live `model_provider` to "custom" on every Codex write (reserved built-in ids like openai/ollama are preserved). - Add device-level one-shot migration that rewrites historical JSONL session files and the `state_5.sqlite` threads table from legacy provider ids into the "custom" bucket. Backs up originals under `~/.cc-switch/backups/codex-history-provider-migration-v1/` and uses the SQLite Backup API for the state DB. - Record completion in `settings.json` under `localMigrations` so the migration is strictly idempotent across launches. - Update Codex provider preset templates to emit `model_provider = "custom"` out of the box.
This commit is contained in:
@@ -56,6 +56,21 @@ export const settingsSchema = z.object({
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
|
||||
// 本机自动迁移状态(后端维护,前端保存设置时应透传)
|
||||
localMigrations: z
|
||||
.object({
|
||||
codexThirdPartyHistoryProviderBucketV1: z
|
||||
.object({
|
||||
completedAt: z.string(),
|
||||
targetProviderId: z.string(),
|
||||
sourceProviderIds: z.array(z.string()).optional(),
|
||||
migratedJsonlFiles: z.number().optional(),
|
||||
migratedStateRows: z.number().optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export type SettingsFormData = z.infer<typeof settingsSchema>;
|
||||
|
||||
Reference in New Issue
Block a user