chore: migration base_url anthropic

This commit is contained in:
Faisal Amir 2025-10-03 21:40:59 +07:00
parent 7bee282875
commit 651ba446bf

View File

@ -320,9 +320,32 @@ export const useModelProvider = create<ModelProviderState>()(
})
}
if (version <= 3 && state?.providers) {
state.providers.forEach((provider) => {
// Migrate Anthropic provider base URL and add custom headers
if (provider.provider === 'anthropic') {
if (provider.base_url === 'https://api.anthropic.com') {
provider.base_url = 'https://api.anthropic.com/v1'
}
if (!provider.custom_header) {
provider.custom_header = [
{
header: 'anthropic-version',
value: '2023-06-01',
},
{
header: 'anthropic-dangerous-direct-browser-access',
value: 'true',
},
]
}
}
})
}
return state
},
version: 3,
version: 4,
}
)
)