Added local Ollama model listing in the U

This commit is contained in:
larssand
2026-06-30 09:15:03 +02:00
parent d7b8c494e9
commit 9c6c08b5ec
3 changed files with 82 additions and 1 deletions

28
tests/test_dashboard.py Normal file
View File

@@ -0,0 +1,28 @@
import json
import unittest
from unittest.mock import patch
from fgai.dashboard import _ollama_models
class DashboardTests(unittest.TestCase):
def test_ollama_models_returns_sorted_model_names(self):
class Response:
def __enter__(self):
return self
def __exit__(self, *_args):
return False
def read(self):
return json.dumps({"models": [{"name": "qwen3:8b", "size": 2}, {"name": "llama3.1", "size": 1}]}).encode("utf-8")
with patch("fgai.dashboard.request.urlopen", return_value=Response()):
result = _ollama_models()
self.assertEqual(result["status"], "ok")
self.assertEqual([item["name"] for item in result["models"]], ["llama3.1", "qwen3:8b"])
if __name__ == "__main__":
unittest.main()