bug: Deleted model file from imported models blocking model loading (#6317) (#6417)

This commit is contained in:
Dinh Long Nguyen 2025-09-11 15:56:19 +07:00 committed by GitHub
parent 198955285e
commit 4856cfbfc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,18 +75,31 @@ export class TauriProvidersService extends DefaultProvidersService {
}) as ProviderSetting[],
models: await Promise.all(
models.map(
async (model) =>
({
async (model) => {
let capabilities: string[] = []
// Check for capabilities
if ('capabilities' in model) {
capabilities = model.capabilities as string[]
} else {
// Try to check tool support, but don't let failures block the model
try {
const toolSupported = await value.isToolSupported(model.id)
if (toolSupported) {
capabilities = [ModelCapabilities.TOOLS]
}
} catch (error) {
console.warn(`Failed to check tool support for model ${model.id}:`, error)
// Continue without tool capabilities if check fails
}
}
return {
id: model.id,
model: model.id,
name: model.name,
description: model.description,
capabilities:
'capabilities' in model
? (model.capabilities as string[])
: (await value.isToolSupported(model.id))
? [ModelCapabilities.TOOLS]
: [],
capabilities,
provider: providerName,
settings: Object.values(modelSettings).reduce(
(acc, setting) => {
@ -105,7 +118,8 @@ export class TauriProvidersService extends DefaultProvidersService {
},
{} as Record<string, ProviderSetting>
),
}) as Model
} as Model
}
)
),
}