feat(models): Add filters support and auto-validation for model-specific filters

This commit is contained in:
cogwheel0
2025-12-05 22:19:31 +05:30
parent f676f50c85
commit c630ce8c27
18 changed files with 469 additions and 4 deletions

View File

@@ -63,3 +63,26 @@ class SelectedToolIds extends _$SelectedToolIds {
void set(List<String> ids) => state = List<String>.from(ids);
}
/// Provider for selected filter IDs (toggle filters enabled by user).
///
/// These filters are dynamically created by OpenWebUI filters with
/// `toggle = True` set in their module. They appear as toggleable
/// buttons in the chat input UI.
@Riverpod(keepAlive: true)
class SelectedFilterIds extends _$SelectedFilterIds {
@override
List<String> build() => [];
void set(List<String> ids) => state = List<String>.from(ids);
void toggle(String id) {
if (state.contains(id)) {
state = state.where((i) => i != id).toList();
} else {
state = [...state, id];
}
}
void clear() => state = [];
}