refactor(config): consolidate model aliases into ModelRegistry

Replaces three scattered model lists (ListSettingsModalViewModel,
DetailsIslandViewModel, GeneralSettingsTabViewModel) and the hardcoded
planning model with a single source. Planning launcher now uses the
opus alias instead of pinning claude-opus-4-7.
This commit is contained in:
mika kuns
2026-05-19 08:58:43 +02:00
parent 623ebf147b
commit a62ef240d1
6 changed files with 31 additions and 21 deletions

View File

@@ -16,14 +16,12 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
[ObservableProperty] private string _workingDir = "";
[ObservableProperty] private string _defaultCommitType = "chore";
[ObservableProperty] private string _selectedModel = "(default)";
[ObservableProperty] private string _selectedModel = ModelRegistry.ListDefaultSentinel;
[ObservableProperty] private string _systemPrompt = "";
[ObservableProperty] private AgentInfo? _selectedAgent;
public ObservableCollection<string> ModelOptions { get; } = new()
{
"(default)", "sonnet", "opus", "haiku",
};
public ObservableCollection<string> ModelOptions { get; } = new(
new[] { ModelRegistry.ListDefaultSentinel }.Concat(ModelRegistry.Aliases));
public ObservableCollection<string> CommitTypeOptions { get; } = new()
{
@@ -57,7 +55,7 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
foreach (var a in agents) Agents.Add(a);
var config = await _worker.GetListConfigAsync(listId);
SelectedModel = string.IsNullOrWhiteSpace(config?.Model) ? "(default)" : config!.Model!;
SelectedModel = string.IsNullOrWhiteSpace(config?.Model) ? ModelRegistry.ListDefaultSentinel : config!.Model!;
SystemPrompt = config?.SystemPrompt ?? "";
SelectedAgent = string.IsNullOrWhiteSpace(config?.AgentPath)
? Agents[0]
@@ -67,7 +65,7 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
[RelayCommand]
private async Task SaveAsync()
{
var model = SelectedModel == "(default)" ? null : SelectedModel;
var model = SelectedModel == ModelRegistry.ListDefaultSentinel ? null : SelectedModel;
var sp = string.IsNullOrWhiteSpace(SystemPrompt) ? null : SystemPrompt;
var ap = SelectedAgent is null || string.IsNullOrWhiteSpace(SelectedAgent.Path) ? null : SelectedAgent.Path;
@@ -89,7 +87,7 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
[RelayCommand]
private void ResetAgentSettings()
{
SelectedModel = "(default)";
SelectedModel = ModelRegistry.ListDefaultSentinel;
SystemPrompt = "";
SelectedAgent = Agents.Count > 0 ? Agents[0] : null;
}