Introduce l'astrazione Engine (Claude Code, Codex) con argomenti e parser propri e EngineRunner come unico punto di avvio, al posto di Claude.cs. Il JSON delle chat salva motore e id di sessione (i file vecchi restano chat di Claude Code). Cambiare CLI apre una nuova chat; modelli ed effort seguono il motore; un motore non installato non è selezionabile. La CLI accetta --engine <id>. Codex gira in sola lettura e la sessione si legge da thread.started. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
179 lines
11 KiB
XML
179 lines
11 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:gui="using:AgentWikiUi.Gui"
|
|
xmlns:core="using:AgentWikiUi.Core"
|
|
x:Class="AgentWikiUi.Gui.MainWindow"
|
|
x:DataType="gui:MainViewModel"
|
|
Title="{x:Static core:AppInfo.Name}"
|
|
MinWidth="900" MinHeight="600">
|
|
|
|
<Grid ColumnDefinitions="Auto,*">
|
|
|
|
<!-- Barra laterale -->
|
|
<Border Grid.Column="0" Width="272" IsVisible="{Binding SidebarOpen}"
|
|
Background="{DynamicResource Muted}" BorderBrush="{DynamicResource Border}" BorderThickness="0,0,1,0">
|
|
<DockPanel>
|
|
<StackPanel DockPanel.Dock="Top" Margin="14,16,14,10" Spacing="14">
|
|
<StackPanel Orientation="Horizontal" Spacing="10" Margin="4,0">
|
|
<Border Width="28" Height="28" CornerRadius="8" Background="{DynamicResource Accent}">
|
|
<Viewbox Width="16" Height="16">
|
|
<Path Data="M12 2L14.4 8.6L21 11L14.4 13.4L12 20L9.6 13.4L3 11L9.6 8.6Z" Fill="{DynamicResource OnAccent}" />
|
|
</Viewbox>
|
|
</Border>
|
|
<TextBlock Text="{x:Static core:AppInfo.Name}" FontWeight="SemiBold" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
<Button Classes="ghost" Command="{Binding NewChatCommand}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
|
|
Background="{DynamicResource Bg}" AutomationProperties.Name="Nuova chat">
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<Viewbox Width="16" Height="16"><Path Data="M12 5V19M5 12H19" Stroke="{DynamicResource Fg}" StrokeThickness="2" StrokeLineCap="Round" /></Viewbox>
|
|
<TextBlock Text="Nuova chat" />
|
|
</StackPanel>
|
|
</Button>
|
|
</StackPanel>
|
|
<TextBlock DockPanel.Dock="Top" Text="CHAT" FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource FgMuted}" Margin="22,8,14,4" />
|
|
<TextBlock DockPanel.Dock="Top" Text="Nessuna chat salvata" Foreground="{DynamicResource FgMuted}" FontSize="13.5" Margin="22,6"
|
|
IsVisible="{Binding !Chats.Count}" />
|
|
<ScrollViewer>
|
|
<ItemsControl ItemsSource="{Binding Chats}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="gui:ChatItem">
|
|
<Border Classes="item" Classes.active="{Binding IsActive}">
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<Button Grid.ColumnSpan="2" Background="Transparent" BorderThickness="0" HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Left" Padding="12,8,40,8"
|
|
Command="{Binding $parent[ItemsControl].((gui:MainViewModel)DataContext).OpenCommand}" CommandParameter="{Binding}"
|
|
AutomationProperties.Name="{Binding Title, StringFormat='Apri chat: {0}'}">
|
|
<StackPanel>
|
|
<TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" FontSize="14" />
|
|
<TextBlock Text="{Binding When}" FontSize="12" Foreground="{DynamicResource FgMuted}" />
|
|
</StackPanel>
|
|
</Button>
|
|
<Button Grid.Column="1" Background="Transparent" BorderThickness="0" Width="32" Height="32" Margin="0,0,4,0"
|
|
VerticalAlignment="Center" Padding="0" HorizontalContentAlignment="Center"
|
|
Command="{Binding $parent[ItemsControl].((gui:MainViewModel)DataContext).DeleteCommand}" CommandParameter="{Binding}"
|
|
AutomationProperties.Name="Elimina chat">
|
|
<Viewbox Width="12" Height="12"><Path Data="M6 6L18 18M18 6L6 18" Stroke="{DynamicResource FgMuted}" StrokeThickness="2.4" StrokeLineCap="Round" /></Viewbox>
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<!-- Area principale -->
|
|
<Grid Grid.Column="1" RowDefinitions="*,Auto">
|
|
|
|
<ScrollViewer Grid.Row="0" x:Name="Scroll">
|
|
<StackPanel MaxWidth="780" Margin="24,56,24,16" Spacing="20">
|
|
|
|
<!-- Schermata iniziale -->
|
|
<StackPanel IsVisible="{Binding ShowEmpty}" Spacing="10" Margin="0,40,0,0" HorizontalAlignment="Center">
|
|
<Border Width="44" Height="44" CornerRadius="12" Background="{DynamicResource Accent}" HorizontalAlignment="Center">
|
|
<Viewbox Width="24" Height="24">
|
|
<Path Data="M12 2L14.4 8.6L21 11L14.4 13.4L12 20L9.6 13.4L3 11L9.6 8.6Z" Fill="{DynamicResource OnAccent}" />
|
|
</Viewbox>
|
|
</Border>
|
|
<TextBlock Text="Come posso aiutarti?" FontSize="28" FontWeight="SemiBold" HorizontalAlignment="Center" />
|
|
<TextBlock Text="Scrivi un messaggio per iniziare." Foreground="{DynamicResource FgMuted}" HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<!-- Conversazione -->
|
|
<ItemsControl ItemsSource="{Binding Messages}" AutomationProperties.Name="Conversazione">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate><StackPanel Spacing="22" /></ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="gui:MessageVm">
|
|
<Panel>
|
|
<Border IsVisible="{Binding IsUser}" HorizontalAlignment="Right" MaxWidth="620" CornerRadius="18,18,4,18"
|
|
Background="{DynamicResource AccentSoft}" Padding="16,10">
|
|
<SelectableTextBlock Text="{Binding Text}" TextWrapping="Wrap" />
|
|
</Border>
|
|
<StackPanel IsVisible="{Binding IsAi}" Spacing="6">
|
|
<TextBlock Text="{Binding Author}" FontWeight="SemiBold" FontSize="13.5" Foreground="{DynamicResource Accent}" />
|
|
<gui:MarkdownView Source="{Binding Text}" />
|
|
<Button Classes="ghost" HorizontalAlignment="Left" MinHeight="30" Padding="10,0" FontSize="13" Content="Copia"
|
|
Command="{Binding $parent[ItemsControl].((gui:MainViewModel)DataContext).CopyCommand}" CommandParameter="{Binding Text}"
|
|
AutomationProperties.Name="Copia la risposta" />
|
|
</StackPanel>
|
|
<SelectableTextBlock IsVisible="{Binding IsErr}" Text="{Binding Text}" TextWrapping="Wrap" Foreground="{DynamicResource Err}" />
|
|
</Panel>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<!-- Attesa -->
|
|
<StackPanel IsVisible="{Binding IsBusy}" Orientation="Horizontal" Spacing="12">
|
|
<ProgressBar IsIndeterminate="True" Width="80" Height="4" Foreground="{DynamicResource Accent}" VerticalAlignment="Center" />
|
|
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource FgMuted}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
|
|
<Button Grid.Row="0" Classes="ghost" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="12" Padding="0" Width="36"
|
|
HorizontalContentAlignment="Center" Command="{Binding ToggleSidebarCommand}" AutomationProperties.Name="Mostra o nascondi le chat">
|
|
<Viewbox Width="16" Height="16"><Path Data="M4 6H20M4 12H20M4 18H20" Stroke="{DynamicResource Fg}" StrokeThickness="2" StrokeLineCap="Round" /></Viewbox>
|
|
</Button>
|
|
|
|
<!-- Impostazioni: modello ed effort -->
|
|
<Button Grid.Row="0" Classes="ghost" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="12" Padding="0" Width="36"
|
|
HorizontalContentAlignment="Center" AutomationProperties.Name="Impostazioni" ToolTip.Tip="Impostazioni">
|
|
<Button.Flyout>
|
|
<Flyout Placement="BottomEdgeAlignedRight">
|
|
<StackPanel Width="300" Spacing="6" Margin="4">
|
|
<TextBlock Text="Impostazioni" FontWeight="SemiBold" Margin="0,0,0,6" />
|
|
<TextBlock Text="CLI" FontSize="13" Foreground="{DynamicResource FgMuted}" />
|
|
<ComboBox ItemsSource="{Binding EngineChoices}" SelectedItem="{Binding SelectedEngine}" IsEnabled="{Binding CanSwitchEngine}"
|
|
HorizontalAlignment="Stretch" AutomationProperties.Name="CLI (motore)">
|
|
<ComboBox.Styles>
|
|
<Style Selector="ComboBoxItem" x:DataType="gui:EngineChoice">
|
|
<Setter Property="IsEnabled" Value="{Binding Installed}" />
|
|
</Style>
|
|
</ComboBox.Styles>
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate x:DataType="gui:EngineChoice"><TextBlock Text="{Binding Label}" /></DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
<TextBlock Text="Modello" FontSize="13" Foreground="{DynamicResource FgMuted}" Margin="0,8,0,0" />
|
|
<ComboBox ItemsSource="{Binding ModelChoices}" SelectedItem="{Binding SelectedModel}" HorizontalAlignment="Stretch"
|
|
AutomationProperties.Name="Modello">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate x:DataType="core:ModelOption"><TextBlock Text="{Binding Label}" /></DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
<TextBox Text="{Binding CustomModel}" IsVisible="{Binding IsCustomModel}" PlaceholderText="es. claude-opus-5-5"
|
|
AutomationProperties.Name="ID modello personalizzato" />
|
|
<TextBlock Text="Effort" FontSize="13" Foreground="{DynamicResource FgMuted}" Margin="0,8,0,0" />
|
|
<ComboBox ItemsSource="{Binding EffortChoices}" SelectedItem="{Binding SelectedEffort}" HorizontalAlignment="Stretch"
|
|
AutomationProperties.Name="Effort di ragionamento" />
|
|
</StackPanel>
|
|
</Flyout>
|
|
</Button.Flyout>
|
|
<Viewbox Width="16" Height="16">
|
|
<Path Data="M4 7H11M17 7H20M4 17H7M13 17H20 M11 7A3 3 0 1 0 17 7A3 3 0 1 0 11 7Z M7 17A3 3 0 1 0 13 17A3 3 0 1 0 7 17Z"
|
|
Stroke="{DynamicResource Fg}" StrokeThickness="2" StrokeLineCap="Round" />
|
|
</Viewbox>
|
|
</Button>
|
|
|
|
<!-- Composer -->
|
|
<StackPanel Grid.Row="1" MaxWidth="780" Margin="24,0,24,12">
|
|
<Border Classes="composer" Background="{DynamicResource Surface}" BorderBrush="{DynamicResource Border}" BorderThickness="1" CornerRadius="20" Padding="14,10">
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<TextBox x:Name="InputBox" Classes="bare" Text="{Binding Input, Mode=TwoWay}" AcceptsReturn="True" TextWrapping="Wrap" MaxHeight="200"
|
|
PlaceholderText="{Binding InputPlaceholder}" BorderThickness="0" Background="Transparent"
|
|
VerticalContentAlignment="Center" AutomationProperties.Name="Messaggio" />
|
|
<Button Grid.Column="1" Classes="send" VerticalAlignment="Bottom" Margin="8,0,0,0" Command="{Binding SendCommand}" AutomationProperties.Name="Invia messaggio">
|
|
<Viewbox Width="18" Height="18"><Path Data="M12 19V5M5 12L12 5L19 12" Stroke="{Binding $parent[Button].Foreground}" StrokeThickness="2.2" StrokeLineCap="Round" StrokeJoin="Round" /></Viewbox>
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
<TextBlock Text="Invio per inviare · Maiusc+Invio per andare a capo" FontSize="12" Foreground="{DynamicResource FgMuted}"
|
|
HorizontalAlignment="Center" Margin="0,8,0,0" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</Grid>
|
|
</Window>
|