feat: load and cache Ollama show data per model with clickable model details

- Add GET /api/v1/models/{model_name}/show endpoint (proxy to Ollama /api/show)
- Worker now fetches show data for each model during model list sync
- Persist show details in localStorage under llm_monitor_models.showByModel
- Make model cards clickable to display cached show details in a dedicated panel
- Keep UI updates incremental without full page reload
- Add tests for show endpoint and OpenAPI path
- Update README and PRD with show-flow and click-card behavior
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-24 19:41:46 +02:00
parent 32b1130632
commit 57663400ce
7 changed files with 217 additions and 4 deletions
+35
View File
@@ -78,6 +78,40 @@ def test_get_nonexistent_model(client, mock_models_response):
response = client.get("/api/v1/models/nonexistent")
assert response.status_code == 404
def test_get_model_show(client):
"""Test show endpoint for model details."""
with patch("requests.post") as mock_post:
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.json.return_value = {
"details": {
"family": "llama",
"parameter_size": "8B"
},
"model_info": {
"general.architecture": "llama"
}
}
mock_post.return_value = mock_response
response = client.get("/api/v1/models/llama2/show")
assert response.status_code == 200
data = response.json()
assert "details" in data
assert data["details"]["family"] == "llama"
def test_get_model_show_not_found(client):
"""Test show endpoint when model is not found."""
with patch("requests.post") as mock_post:
mock_response = MagicMock()
mock_response.status_code = 404
mock_post.return_value = mock_response
response = client.get("/api/v1/models/nonexistent/show")
assert response.status_code == 404
def test_root_endpoint(client):
"""Test root endpoint redirects to dashboard"""
response = client.get("/", follow_redirects=False)
@@ -92,6 +126,7 @@ def test_openapi_schema(client):
assert "paths" in schema
assert "/api/v1/health" in schema["paths"]
assert "/api/v1/models" in schema["paths"]
assert "/api/v1/models/{model_name}/show" in schema["paths"]
assert "/api/v1/models/{model_name}/pull" not in schema["paths"]