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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using ClaudeDo.Data.Models;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Modals.Settings;
|
||||
@@ -5,11 +6,11 @@ namespace ClaudeDo.Ui.ViewModels.Modals.Settings;
|
||||
public sealed partial class GeneralSettingsTabViewModel : ViewModelBase
|
||||
{
|
||||
[ObservableProperty] private string _defaultClaudeInstructions = "";
|
||||
[ObservableProperty] private string _defaultModel = "sonnet";
|
||||
[ObservableProperty] private string _defaultModel = ModelRegistry.DefaultAlias;
|
||||
[ObservableProperty] private int _defaultMaxTurns = 100;
|
||||
[ObservableProperty] private string _defaultPermissionMode = "auto";
|
||||
|
||||
public IReadOnlyList<string> Models { get; } = new[] { "opus", "sonnet", "haiku" };
|
||||
public IReadOnlyList<string> Models { get; } = ModelRegistry.Aliases;
|
||||
public IReadOnlyList<string> PermissionModes { get; } = new[]
|
||||
{ "auto", "bypassPermissions", "acceptEdits", "plan", "default" };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user