andrewnguonly / Lumos

A RAG LLM co-pilot for browsing the web, powered by local LLMs
MIT License
1.36k stars 97 forks source link

Set default model to first model available, not `llama2`. Refactor API connectivity check. #127

Closed andrewnguonly closed 6 months ago

andrewnguonly commented 6 months ago

Summary

This PR resolves https://github.com/andrewnguonly/Lumos/issues/126.

If a user never opens the Options page, then the default model is hardcoded to llama2. If llama2 isn't available, then no error is displayed and the app hangs when calling /api/generate (which returns a 404).

Solution: Set the default model to the first model returned from /api/tags and persist the model even if the user never visits the Options page. The API connectivity check logic is also refactored into a common function.