Skip to content

Commit bbecd98

Browse files
author
Antonio Maiolo
authored
fix(app): filter embedding models from chat dropdown and add suggested models (#77)
1 parent 8a0f4fc commit bbecd98

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"think-app": patch
3+
---
4+
5+
Fix Ollama chat models display in settings
6+
7+
- Add all-minilm to embedding models list to filter it from chat dropdown
8+
- Add suggested Ollama chat models (llama3.2, mistral, phi3, etc.) as downloadable options

backend/app/routes/settings.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,25 @@ def _format_size(size_bytes: int | None) -> str | None:
208208
OLLAMA_EMBEDDING_MODELS = [
209209
"mxbai-embed-large",
210210
"snowflake-arctic-embed",
211+
"all-minilm",
211212
]
212213

213214
# Models that should never be shown (known to be broken or impractical)
214215
# nomic-embed-text crashes with EOF on content >5000 chars
215216
# all-minilm has 256 token context - too small for real documents
216217
BLOCKED_EMBEDDING_MODELS = ["nomic-embed-text", "all-minilm"]
217218

219+
# Popular Ollama chat models to suggest for download
220+
OLLAMA_CHAT_MODELS = [
221+
"llama3.2",
222+
"llama3.1",
223+
"mistral",
224+
"phi3",
225+
"gemma2",
226+
"qwen2.5",
227+
"deepseek-coder",
228+
]
229+
218230

219231
@router.get("/settings/models")
220232
async def get_available_models(provider: str | None = None) -> ModelsResponse:
@@ -246,6 +258,17 @@ async def get_available_models(provider: str | None = None) -> ModelsResponse:
246258
except Exception as e:
247259
print(f"Error fetching Ollama models: {e}")
248260

261+
# Add suggested chat models that aren't downloaded yet
262+
downloaded_base_names = {m.name.split(":")[0] for m in models}
263+
for model_name in OLLAMA_CHAT_MODELS:
264+
if model_name not in downloaded_base_names:
265+
models.append(ModelInfo(
266+
name=model_name,
267+
size=None,
268+
is_downloaded=False,
269+
context_window=get_context_window(model_name),
270+
))
271+
249272
return ModelsResponse(
250273
models=models,
251274
current_model=config.settings.ollama_model,

0 commit comments

Comments
 (0)