Skip to content

Commit cb85785

Browse files
committed
feat(Ollama): fallback list of recommended models if API down
1 parent e8cc17a commit cb85785

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

admin/app/services/openwebui_service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import fs from 'node:fs/promises'
77
import path from 'node:path'
88
import { PassThrough } from 'node:stream'
99
import { DownloadModelJob } from '#jobs/download_model_job'
10+
import { FALLBACK_RECOMMENDED_OLLAMA_MODELS } from '../../constants/ollama.js'
1011

1112
const NOMAD_MODELS_API_BASE_URL = 'https://api.projectnomad.us/api/v1/ollama/models'
1213
const MODELS_CACHE_FILE = path.join(process.cwd(), 'storage', 'ollama-models-cache.json')
@@ -352,7 +353,11 @@ export class OpenWebUIService {
352353
try {
353354
const models = await this.retrieveAndRefreshModels(sort)
354355
if (!models) {
355-
return null
356+
// If we fail to get models from the API, return the fallback recommended models
357+
logger.warn(
358+
'[OpenWebUIService] Returning fallback recommended models due to failure in fetching available models'
359+
)
360+
return FALLBACK_RECOMMENDED_OLLAMA_MODELS;
356361
}
357362

358363
if (!recommendedOnly) {

admin/constants/ollama.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { NomadOllamaModel } from '../types/ollama.js'
2+
3+
/**
4+
* Fallback basic recommended Ollama models in case fetching from the service fails.
5+
*/
6+
export const FALLBACK_RECOMMENDED_OLLAMA_MODELS: NomadOllamaModel[] = [
7+
{
8+
name: 'llama3.1',
9+
description:
10+
'Llama 3.1 is a new state-of-the-art model from Meta available in 8B, 70B and 405B parameter sizes.',
11+
estimated_pulls: '109.3M',
12+
id: '9fe9c575-e77e-4a51-a743-07359458ee71',
13+
first_seen: '2026-01-28T23:37:31.000+00:00',
14+
model_last_updated: '1 year ago',
15+
tags: [
16+
{
17+
name: 'llama3.1:8b-text-q4_1',
18+
size: '5.1 GB',
19+
context: '128k',
20+
input: 'Text',
21+
},
22+
],
23+
},
24+
{
25+
name: 'deepseek-r1',
26+
description:
27+
'DeepSeek-R1 is a family of open reasoning models with performance approaching that of leading models, such as O3 and Gemini 2.5 Pro.',
28+
estimated_pulls: '77.2M',
29+
id: '0b566560-68a6-4964-b0d4-beb3ab1ad694',
30+
first_seen: '2026-01-28T23:37:31.000+00:00',
31+
model_last_updated: '7 months ago',
32+
tags: [
33+
{
34+
name: 'deepseek-r1:1.5b',
35+
size: '1.1 GB',
36+
context: '128k',
37+
input: 'Text',
38+
},
39+
],
40+
},
41+
{
42+
name: 'llama3.2',
43+
description: "Meta's Llama 3.2 goes small with 1B and 3B models.",
44+
estimated_pulls: '54.7M',
45+
id: 'c9a1bc23-b290-4501-a913-f7c9bb39c3ad',
46+
first_seen: '2026-01-28T23:37:31.000+00:00',
47+
model_last_updated: '1 year ago',
48+
tags: [
49+
{
50+
name: 'llama3.2:1b-text-q2_K',
51+
size: '581 MB',
52+
context: '128k',
53+
input: 'Text',
54+
},
55+
],
56+
},
57+
]

0 commit comments

Comments
 (0)