Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

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

Dinh Long Nguyen4856cfbfc4b8
diff --git a/web-app/src/services/providers/tauri.ts b/web-app/src/services/providers/tauri.ts
index 5c5103b20..bd1751447 100644
--- a/web-app/src/services/providers/tauri.ts
+++ b/web-app/src/services/providers/tauri.ts
@@ -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
+ }
)
),
}