fix: 禁用 opus[1m] 自动迁移,尊重用户手动删除 [1m] 后缀的选择

迁移逻辑过于激进,用户手动删除 [1m]] 后会被自动加回。
现在将 migrateOpusToOpus1m 改为 no-op,保留用户的手动模型选择。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-05-07 09:33:56 +08:00
parent 958ac3a0d5
commit e8759f3402

View File

@@ -1,43 +1,15 @@
import { logEvent } from '../services/analytics/index.js'
import {
getDefaultMainLoopModelSetting,
isOpus1mMergeEnabled,
parseUserSpecifiedModel,
} from '../utils/model/model.js'
import {
getSettingsForSource,
updateSettingsForSource,
} from '../utils/settings/settings.js'
import { isOpus1mMergeEnabled } from '../utils/model/model.js'
/**
* Migrate users with 'opus' pinned in their settings to 'opus[1m]' when they
* are eligible for the merged Opus 1M experience (Max/Team Premium on 1P).
*
* CLI invocations with --model opus are unaffected: that flag is a runtime
* override and does not touch userSettings, so it continues to use plain Opus.
*
* Pro subscribers are skipped — they retain separate Opus and Opus 1M options.
* 3P users are skipped — their model strings are full model IDs, not aliases.
*
* Idempotent: only writes if userSettings.model is exactly 'opus'.
* Migration disabled: users who manually remove [1m] suffix should not
* have it automatically re-added. The migration was too aggressive and
* didn't respect user choice.
*/
export function migrateOpusToOpus1m(): void {
// No-op - respect user's manual model choice
if (!isOpus1mMergeEnabled()) {
return
}
const model = getSettingsForSource('userSettings')?.model
if (model !== 'opus') {
return
}
const migrated = 'opus[1m]'
const modelToSet =
parseUserSpecifiedModel(migrated) ===
parseUserSpecifiedModel(getDefaultMainLoopModelSetting())
? undefined
: migrated
updateSettingsForSource('userSettings', { model: modelToSet })
logEvent('tengu_opus_to_opus1m_migration', {})
logEvent('tengu_opus_to_opus1m_migration', { skipped: true })
}