增加远程链接项

This commit is contained in:
yangwx
2025-03-12 23:13:02 +08:00
parent 3ccd6d9a39
commit cb5c895d33
16 changed files with 103 additions and 249 deletions

View File

@@ -1,10 +1,9 @@
<UserControl x:Class="YwxApp.AiChat.Views.ChatMdView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources >
@@ -15,11 +14,11 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#0F000F">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="200" />
<RowDefinition Height="120" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
@@ -29,15 +28,13 @@
<!--Bind event command to the ScrollViewer-->
<i:Interaction.Triggers>
<i:EventTrigger EventName="ScrollChanged">
<i:InvokeCommandAction Command = "{Binding ScrollToEndCommand}"
CommandParameter="{Binding ElementName=MarkDownScrollViewer}" />
<i:InvokeCommandAction Command = "{Binding ScrollToEndCommand}" CommandParameter="{Binding ElementName=MarkDownScrollViewer}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<!--scrollviewer internal container-->
<markdig:MarkdownViewer x:Name="MarkdownOutputBox" Markdown="{Binding MarkdownContent}" />
</ScrollViewer>
</Grid>
</Grid>
<!-- the second line -->
<Grid Grid.Row="1">
<TextBox x:Name="InputBox"

View File

@@ -15,44 +15,43 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#FFFFFF" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- The first line -->
<WrapPanel Grid.Row="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left">
<Label Content="Ollama路径:" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBox x:Name="Tbx_OllamaAppPath" FontSize="12"
Text="{Binding OllamaAppPath}"
Style="{StaticResource SearchBoxStyle}" Margin="5" />
</WrapPanel>
<!--The second line-->
<WrapPanel Grid.Row="1" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left">
<Label Content="Ollama" VerticalAlignment="Center" Margin="5" />
<Label Name="Label_State" Style="{StaticResource RoundLabelStyle}" />
<Button Content="打开" Style="{StaticResource RoundCornerButtonStyle}"
Command="{Binding StartOllamaServerCommand}"/>
</WrapPanel>
<!--The third line-->
<WrapPanel Grid.Row="2" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left">
<GroupBox Header="本地模式" >
<WrapPanel Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" >
<Label Content="Ollama路径:" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBox x:Name="Tbx_OllamaAppPath" FontSize="12" Text="{Binding OllamaAppPath}" Style="{StaticResource SearchBoxStyle}" Margin="5"
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
<Label Name="Label_State" Style="{StaticResource RoundLabelStyle}" />
<Button Content="打开" Style="{StaticResource RoundCornerButtonStyle}" Command="{Binding StartOllamaServerCommand}"/>
</WrapPanel>
</GroupBox>
<GroupBox Header="远程模式" Grid.Row="1">
<WrapPanel Orientation="Horizontal" Grid.Row="0" >
<TextBlock Text="Host:" FontSize="14" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox Text="{Binding RemoteHost}" MinWidth="120" FontSize="14" Margin="5"/>
<TextBlock Text="Port:" FontSize="14" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox Text="{Binding RemotePort}" MinWidth="60" FontSize="14" Margin="5" Padding="5"/>
<Button Content="运行" FontSize="12" Command="{Binding ConnectRemotelyOllamaServerCommand}"/>
</WrapPanel>
</GroupBox>
<WrapPanel Grid.Row="2" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.ColumnSpan="2">
<Label Content="模型:" VerticalAlignment="Center" Margin="5" />
<ComboBox x:Name="Cbx_ModelList" Style="{StaticResource RoundComboBoxStyle}"
ItemsSource="{Binding ModelList}"
SelectedItem="{Binding SelectedModel}">
</ComboBox>
<Button Content="刷新" Margin="5" Grid.Row="1"
Style="{StaticResource RoundCornerButtonStyle}"
Command="{Binding ModelListUpdateCommand}"/>
<ComboBox x:Name="Cbx_ModelList" Style="{StaticResource RoundComboBoxStyle}" ItemsSource="{Binding ModelList}" SelectedItem="{Binding SelectedModel}"
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
<Button Content="刷新" Margin="5" Grid.Row="1" Style="{StaticResource RoundCornerButtonStyle}" Command="{Binding ModelListUpdateCommand}"/>
</WrapPanel>
<TextBox x:Name="ModelDesciption" Grid.Row="3" IsReadOnly="True"
TextWrapping="WrapWithOverflow" Text="{Binding ModelInformation,Mode=OneWay}"/>
<TextBox x:Name="ModelDesciption" Grid.Row="3" IsReadOnly="True" TextWrapping="WrapWithOverflow" Text="{Binding ModelInformation,Mode=OneWay}" Grid.ColumnSpan="2"/>
</Grid>
</UserControl>
</UserControl>

View File

@@ -1,6 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Button">
<Setter Property="Button.Padding" Value="3,5"/>
</Style>
<Style x:Key="IconButtonStyle">
<Setter Property="Button.Background" Value="Transparent"/>
@@ -9,9 +13,8 @@
<Setter Property="Button.Foreground" Value="White"/>
<Setter Property="Button.FontSize" Value="12"/>
<Setter Property="Button.FontWeight" Value="Bold"/>
<Setter Property="Button.Padding" Value="5"/>
<Setter Property="Button.Padding" Value="3,5"/>
<Setter Property="Button.Margin" Value="5"/>
<Setter Property="Button.Width" Value="150"/>
<Setter Property="Button.Height" Value="50"/>
<Setter Property="Button.HorizontalAlignment" Value="Left"/>
<Setter Property="Button.VerticalAlignment" Value="Center"/>

View File

@@ -1,4 +1,9 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TextBox">
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</ResourceDictionary>