sync: ml-ui-connection delta specs to main specs

This commit is contained in:
Marko Djordjevic 2026-02-18 10:21:05 +01:00
parent 9a549b8c7a
commit c0f5654450
15 changed files with 369 additions and 6 deletions

View file

@ -0,0 +1,42 @@
## Purpose
Provide a dropdown selector component for switching between trained ML models and managing model loading.
## Requirements
### Requirement: Model selector dropdown
The system SHALL display a model selector dropdown in the prediction panel area. The dropdown SHALL list all completed training runs from the backend, showing model type, date, and key metric (F1 macro) for each entry. The currently loaded model SHALL be indicated with a checkmark or "active" badge.
#### Scenario: Display available models
- **WHEN** the user opens the model selector dropdown
- **THEN** completed training runs are listed with model type, training date, and F1 score
#### Scenario: No models available
- **WHEN** no completed training runs exist
- **THEN** the dropdown shows "No trained models available"
#### Scenario: Current model indicated
- **WHEN** a model is currently loaded
- **THEN** the corresponding entry in the dropdown shows an "active" indicator
### Requirement: Model switching
The system SHALL load a different model when the user selects a training run from the model selector. The system SHALL send the run_id to `POST /api/model/load` and update the prediction panel to reflect the newly loaded model's info. Existing cached predictions SHALL be cleared on model switch.
#### Scenario: Switch model
- **WHEN** the user selects a different model from the dropdown
- **THEN** the system sends `POST /api/model/load` with the run_id, shows a loading indicator, and upon success updates the model info display and clears prediction cache
#### Scenario: Model load failure
- **WHEN** model loading fails (e.g., model artifact not found)
- **THEN** the system shows an error message and keeps the previously loaded model active
#### Scenario: Prediction cache cleared
- **WHEN** a new model is successfully loaded
- **THEN** all cached predictions are invalidated and the chart clears any displayed predictions
### Requirement: Model info refresh on switch
The system SHALL refresh the model info display (name, version, type, per-class metrics) after a successful model switch. The prediction panel SHALL reflect the new model's capabilities and labels.
#### Scenario: Model info updates after switch
- **WHEN** a new model is loaded successfully
- **THEN** the prediction panel refreshes to show the new model's name, type, version, and per-class metrics