fix: wrong migration in #10727 (#11151)

This commit is contained in:
Phantom 2025-11-05 14:33:07 +08:00 committed by GitHub
parent 56c7a7f066
commit 1103449a4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2797,9 +2797,21 @@ const migrateConfig = {
},
'171': (state: RootState) => {
try {
addProvider(state, 'sophnet')
state.llm.providers = moveProvider(state.llm.providers, 'sophnet', 17)
state.settings.defaultPaintingProvider = 'cherryin'
// Ensure aws-bedrock provider exists
addProvider(state, 'aws-bedrock')
// Ensure awsBedrock settings exist and have all required fields
if (!state.llm.settings.awsBedrock) {
state.llm.settings.awsBedrock = llmInitialState.settings.awsBedrock
} else {
// For users who have awsBedrock but missing new fields (authType and apiKey)
if (!state.llm.settings.awsBedrock.authType) {
state.llm.settings.awsBedrock.authType = 'iam'
}
if (state.llm.settings.awsBedrock.apiKey === undefined) {
state.llm.settings.awsBedrock.apiKey = ''
}
}
return state
} catch (error) {
logger.error('migrate 171 error', error as Error)