Skip to content

Commit 0a1a5a2

Browse files
patch ollama context window error when unreachable
1 parent f6f5667 commit 0a1a5a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/utils/AiProviders/ollama/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ class OllamaAILLM {
7979
headers: authToken ? { Authorization: `Bearer ${authToken}` } : {},
8080
});
8181

82-
const { models } = await client.list();
82+
const { models } = await client.list().catch(() => ({ models: [] }));
83+
if (!models.length) return;
84+
8385
const infoPromises = models.map((model) =>
8486
client
8587
.show({ model: model.name })

0 commit comments

Comments
 (0)