fix(models): include model name as fallback for id field (#11760)

Add model's name as an additional fallback option when determining the id field in adaptSdkModel to handle cases where neither id nor modelId is available
This commit is contained in:
Phantom 2025-12-09 10:35:39 +08:00 committed by GitHub
parent 73fc74d875
commit adbadf5da6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,7 @@ function normalizeModels<T>(models: T[], transformer: (entry: T) => Model | null
}
function adaptSdkModel(provider: Provider, model: SdkModel): Model | null {
const id = pickPreferredString([(model as any)?.id, (model as any)?.modelId])
const id = pickPreferredString([(model as any)?.id, (model as any)?.modelId, (model as any)?.name])
const name = pickPreferredString([
(model as any)?.display_name,
(model as any)?.displayName,