This commit is contained in:
parent
9335c4bdda
commit
b5da1a7f7c
|
|
@ -4,6 +4,7 @@
|
|||
<option name="projectPerEditor">
|
||||
<map>
|
||||
<entry key="ToolsForm/App.axaml" value="ToolsForm/ToolsForm.csproj" />
|
||||
<entry key="ToolsForm/Views/AIWindow.axaml" value="ToolsForm/ToolsForm.csproj" />
|
||||
<entry key="ToolsForm/Views/DownCodeWindow.axaml" value="ToolsForm/ToolsForm.csproj" />
|
||||
<entry key="ToolsForm/Views/ExperimentMainWindow.axaml" value="ToolsForm/ToolsForm.csproj" />
|
||||
<entry key="ToolsForm/Views/ExperimentWindow.axaml" value="ToolsForm/ToolsForm.csproj" />
|
||||
|
|
|
|||
|
|
@ -8,26 +8,12 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="0ae961c9-2aa8-4465-9e53-e04d62044e0d" name="更改" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Assets/img/UploadExperimentMessage/成功.png" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Assets/img/UploadExperimentMessage/提交成功.png" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentMessageWindow.axaml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentMessageWindow.axaml.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2023-11-13_09-38-20_1600x900.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2023-11-14_14-33-14_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2023-11-14_14-33-16_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_14-08-47_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_14-08-48_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_17-48-17_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_17-48-24_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_17-48-29_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/Captures/ScreenCapture_2024-10-24_17-51-32_1584x892.mp4" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Views/AIWindow.axaml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ToolsForm/Views/AIWindow.axaml.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/avalonia.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/avalonia.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.ToolsForm/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/Manager/AppWindowManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Manager/AppWindowManager.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/ToolsForm.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/ToolsForm.csproj" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/IDEWindow2.axaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/IDEWindow2.axaml.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/Views/UploadExperimentWindow.axaml.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.exe" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.exe" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb" afterDir="false" />
|
||||
|
|
@ -45,6 +31,7 @@
|
|||
<change beforePath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ToolsForm/obj/rider.project.model.nuget.info" beforeDir="false" afterPath="$PROJECT_DIR$/ToolsForm/obj/rider.project.model.nuget.info" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -82,32 +69,32 @@
|
|||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
".NET 项目.ToolsForm.executor": "Run",
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"XThreadsFramesViewSplitterKey": "0.5078125",
|
||||
"git-widget-placeholder": "main",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true",
|
||||
"发布到文件夹.Publish ToolsForm to folder (1).executor": "Run",
|
||||
"发布到文件夹.Publish ToolsForm to folder (2).executor": "Run",
|
||||
"发布到文件夹.Publish ToolsForm to folder.executor": "Run"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
".NET 项目.ToolsForm.executor": "Run",
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"XThreadsFramesViewSplitterKey": "0.5078125",
|
||||
"git-widget-placeholder": "main",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true",
|
||||
"发布到文件夹.Publish ToolsForm to folder (1).executor": "Run",
|
||||
"发布到文件夹.Publish ToolsForm to folder (2).executor": "Run",
|
||||
"发布到文件夹.Publish ToolsForm to folder.executor": "Run"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\PC\\AppData\\Local\\Symbols\\src"
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\PC\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RunManager" selected=".NET 项目.ToolsForm">
|
||||
<configuration name="Publish ToolsForm to folder (1)" type="DotNetFolderPublish" factoryName="Publish to folder">
|
||||
<riderPublish configuration="Release" platform="Any CPU" produce_single_file="true" runtime="win-x64" self_contained="true" target_folder="$PROJECT_DIR$/ToolsForm/bin/Release/net8.0/win-x64/publish" target_framework="net8.0" uuid_high="8004843969109443341" uuid_low="-5534705942332332484" />
|
||||
|
|
@ -159,7 +146,9 @@
|
|||
<workItem from="1729819752329" duration="7261000" />
|
||||
<workItem from="1729835370931" duration="39273000" />
|
||||
<workItem from="1730253804607" duration="6537000" />
|
||||
<workItem from="1730270228361" duration="34212000" />
|
||||
<workItem from="1730270228361" duration="42741000" />
|
||||
<workItem from="1730681938757" duration="3441000" />
|
||||
<workItem from="1730699973923" duration="388000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:global="clr-namespace:"
|
||||
xmlns:local="using:ToolsForm"
|
||||
xmlns:viewModels="clr-namespace:ToolsForm.ViewModels"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
|
|
@ -18,11 +19,18 @@
|
|||
<Application.Resources>
|
||||
<global:BoolToImageConverter x:Key="BoolToImageConverter" />
|
||||
<global:ImagePathConverter x:Key="ImagePathConverter" />
|
||||
<global:MessageBackgroundConverter x:Key="MessageBackgroundConverter" />
|
||||
<global:MessageAlignmentConverter x:Key="MessageAlignmentConverter" />
|
||||
<viewModels:ImageAlignmentConverter x:Key="ImageAlignmentConverter" />
|
||||
|
||||
|
||||
|
||||
|
||||
<FontFamily x:Key="SourceBold">avares://ToolsForm/Assets/Fonts/SourceHanSansSC-Bold.otf#Source Han Sans SC</FontFamily>
|
||||
<FontFamily x:Key="SourceLight">avares://ToolsForm/Assets/Fonts/SourceHanSansSC-Light.otf#Source Han Sans SC</FontFamily>
|
||||
<FontFamily x:Key="SourceMedium">avares://ToolsForm/Assets/Fonts/SourceHanSansSC-Medium.otf#Source Han Sans SC</FontFamily>
|
||||
<FontFamily x:Key="SourceRegular">avares://ToolsForm/Assets/Fonts/SOURCEHANSANSSC-REGULAR.OTF#Source Han Sans SC</FontFamily>
|
||||
<FontFamily x:Key="SourceNormal">avares://ToolsForm/Assets/Fonts/SOURCEHANSANSSC-NORMAL.OTF#Source Han Sans SC</FontFamily>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 675 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
Binary file not shown.
|
After Width: | Height: | Size: 619 B |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
|
|
@ -33,6 +33,7 @@ namespace ToolsForm.Models
|
|||
public static ExperimentWindow? ExperimentWindow; //暂存
|
||||
public static UploadExperimentWindow? UploadExperimentWindow; //暂存
|
||||
public static UploadExperimentMessageWindow? UploadExperimentMessageWindow; //暂存
|
||||
public static AIWindow? AiWindow; //AI
|
||||
|
||||
/// <summary>
|
||||
/// 创建窗口
|
||||
|
|
@ -41,7 +42,7 @@ namespace ToolsForm.Models
|
|||
/// <param name="createWindowFunc"></param>
|
||||
/// <param name="isUpdatePos"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static void ToggleWindow<T>(ref T? windowRef, Func<T> createWindowFunc, bool isUpdatePos, bool isAnima=true, MainType mainType = MainType.主窗口) where T : Window
|
||||
public static void ToggleWindow<T>(ref T? windowRef, Func<T> createWindowFunc, bool isUpdatePos, bool isAnima = true, MainType mainType = MainType.主窗口) where T : Window
|
||||
{
|
||||
if (windowRef == null)
|
||||
{
|
||||
|
|
@ -157,8 +158,7 @@ namespace ToolsForm.Models
|
|||
CloseWindow(ref DownCodeWindow);
|
||||
CloseWindow(ref IdeErrorWindow);
|
||||
CloseWindow(ref UploadExperimentMessageWindow);
|
||||
CloseWindow(ref AiWindow);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
using Avalonia.Media.Imaging;
|
||||
|
||||
namespace ToolsForm.Models;
|
||||
|
||||
public class Dialogue
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public bool IsUserMessage { get; set; }
|
||||
public Bitmap ImageSource { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
public class DialogueMessage
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public bool IsUserMessage { get; set; } // 用于判断是用户消息还是 AI 回复
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\Fonts\"/>
|
||||
<Folder Include="Assets\img\AI\" />
|
||||
<Folder Include="Assets\img\background\"/>
|
||||
<Folder Include="Assets\img\Experiment\" />
|
||||
<Folder Include="Assets\img\IDE\"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using ToolsForm.Models;
|
||||
|
||||
public class DialogueModel : INotifyPropertyChanged
|
||||
{
|
||||
public ObservableCollection<Dialogue> Dialogues { get; set; } = new ObservableCollection<Dialogue>();
|
||||
|
||||
public DialogueModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void AddUserMessage(string message)
|
||||
{
|
||||
Dialogues.Add(new Dialogue { Text = message, IsUserMessage = true, ImageSource = new Bitmap(AssetLoader.Open(new Uri("avares://ToolsForm/Assets/img/AI/头像.png"))) });
|
||||
}
|
||||
|
||||
public void AddAIResponse(string message)
|
||||
{
|
||||
Dialogues.Add(new Dialogue { Text = message, IsUserMessage = false, ImageSource = new Bitmap(AssetLoader.Open(new Uri("avares://ToolsForm/Assets/img/AI/ai.png" ))) });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Layout;
|
||||
|
||||
namespace ToolsForm.ViewModels;
|
||||
|
||||
public class ImageAlignmentConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using Avalonia.Data.Converters;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
public class MessageBackgroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? Colors.LightBlue : Colors.LightGreen; // 用户消息蓝色,AI 回复绿色
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class MessageAlignmentConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? HorizontalAlignment.Right : HorizontalAlignment.Left; // 用户消息靠右,AI 回复靠左
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<Window
|
||||
Title="AIWindow"
|
||||
d:DesignHeight="283"
|
||||
d:DesignWidth="705"
|
||||
mc:Ignorable="d"
|
||||
x:Class="ToolsForm.Views.AIWindow"
|
||||
x:DataType="global:DialogueModel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:global="clr-namespace:"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:ToolsForm.Models"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Window.Styles>
|
||||
<Style Selector="Window">
|
||||
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
|
||||
<Setter Property="ExtendClientAreaChromeHints" Value="NoChrome" />
|
||||
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="-1" />
|
||||
<Setter Property="SystemDecorations" Value="None" />
|
||||
<Setter Property="CanResize" Value="False" />
|
||||
<Setter Property="Background" />
|
||||
<Setter Property="Width" Value="705" />
|
||||
<Setter Property="Height" Value="283" />
|
||||
</Style>
|
||||
</Window.Styles>
|
||||
|
||||
<Window.Background>
|
||||
<ImageBrush Source="../Assets/img/AI/对话框.png" />
|
||||
</Window.Background>
|
||||
|
||||
|
||||
<Grid
|
||||
Height="150"
|
||||
Margin="0,-70,0,0"
|
||||
Width="654">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding Dialogues}" Name="DialogueItems">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel HorizontalAlignment="{Binding IsUserMessage, Converter={StaticResource MessageAlignmentConverter}}" Orientation="Horizontal">
|
||||
<Image
|
||||
Height="20"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="5"
|
||||
Source="{Binding ImageSource}"
|
||||
Width="20" />
|
||||
|
||||
<TextBlock
|
||||
Background="{Binding IsUserMessage, Converter={StaticResource MessageBackgroundConverter}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="5"
|
||||
MaxWidth="300"
|
||||
Padding="10"
|
||||
Text="{Binding Text}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</ScrollViewer>
|
||||
|
||||
<Grid Grid.Row="1" Margin="0,0,0,-70">
|
||||
<Image
|
||||
Height="54"
|
||||
Source="../Assets/img/AI/输入框.png"
|
||||
Width="637" />
|
||||
|
||||
<TextBox
|
||||
Height="54"
|
||||
Name="InputTextBox"
|
||||
Padding="10,5,50,5"
|
||||
Width="637" />
|
||||
<Button
|
||||
Click="OnSendButtonClick"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,20,-10,0"
|
||||
Name="SendButton"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="50">
|
||||
<Image
|
||||
Height="13"
|
||||
Source="../Assets/img/AI/发送.png"
|
||||
Width="13" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using ToolsForm.Models; // 引入模型命名空间
|
||||
|
||||
namespace ToolsForm.Views
|
||||
{
|
||||
public partial class AIWindow : Window
|
||||
{
|
||||
private DialogueModel dialogueModel;
|
||||
private TextBox inputTextBox;
|
||||
private ItemsControl dialogueItems;
|
||||
|
||||
public AIWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 初始化控件
|
||||
inputTextBox = this.FindControl<TextBox>("InputTextBox");
|
||||
dialogueItems = this.FindControl<ItemsControl>("DialogueItems");
|
||||
dialogueModel = new DialogueModel(); // 创建模型实例
|
||||
DataContext = dialogueModel; // 将数据上下文设置为模型
|
||||
}
|
||||
|
||||
private void OnSendButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var userMessage = inputTextBox.Text;
|
||||
if (!string.IsNullOrWhiteSpace(userMessage))
|
||||
{
|
||||
dialogueModel.AddUserMessage(userMessage);
|
||||
inputTextBox.Clear();
|
||||
|
||||
// 发送 AI 回复
|
||||
var aiResponse = GenerateAIResponse(userMessage);
|
||||
dialogueModel.AddAIResponse(aiResponse);
|
||||
|
||||
// 自动滚动到最新消息
|
||||
dialogueItems.ScrollIntoView(dialogueModel.Dialogues.Last());
|
||||
}
|
||||
}
|
||||
|
||||
private string GenerateAIResponse(string message)
|
||||
{
|
||||
// TODO: 这里实现AI生成回复的逻辑
|
||||
return "这是AI的回复"; // 示例回复
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,6 +73,7 @@ namespace ToolsForm.Views
|
|||
AppWindowManager.UpdateWindowPosition(AppWindowManager.IdeErrorWindow, 0, 0);
|
||||
AppWindowManager.UpdateWindowPosition(AppWindowManager.IdeWindow2, 0, 0);
|
||||
AppWindowManager.UpdateWindowPosition(AppWindowManager.UploadExperimentWindow, 0, 0);
|
||||
AppWindowManager.UpdateWindowPosition(AppWindowManager.AiWindow, 0, 0);
|
||||
}
|
||||
|
||||
// 打开总览窗口
|
||||
|
|
@ -80,7 +81,8 @@ namespace ToolsForm.Views
|
|||
{
|
||||
ResetOtherButtons("Overview");
|
||||
|
||||
AppWindowManager.ToggleWindow(ref AppWindowManager.OverviewWindow, () => new OverviewWindow(), true);
|
||||
// AppWindowManager.ToggleWindow(ref AppWindowManager.OverviewWindow, () => new OverviewWindow(), true);
|
||||
AppWindowManager.ToggleWindow(ref AppWindowManager.AiWindow, () => new AIWindow(), true);
|
||||
}
|
||||
|
||||
// 打开 IDE 窗口
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
5479303a6418e30b605a4107a549349c374423315bbff523b59ebdd51fcc4c78
|
||||
4a5a1716e3da100771dd999f3310d502a0248642532e880b7ce035b3ca04d50e
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
|||
[assembly: System.Reflection.AssemblyCompanyAttribute("ToolsForm")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0698dce205e4a109d2ff15ef97eae71bd9fff225")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9335c4bddabcf0a09ea3730f2caaa72cced78e17")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("ToolsForm")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("ToolsForm")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
eca466b9201f5b5247773811670bbfa7b937a465bb127f8b014c605527d25043
|
||||
fd2cbd09e17ab485ea9afa360ac92eea22ec11693359a777e90c575aec824f0d
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ build_property.EnableGeneratedComInterfaceComImportInterop =
|
|||
[E:/Unity Projects/GitLab/2024/ICT_ToolsForm/ToolsForm/ToolsForm/App.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[E:/Unity Projects/GitLab/2024/ICT_ToolsForm/ToolsForm/ToolsForm/Views/AIWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
[E:/Unity Projects/GitLab/2024/ICT_ToolsForm/ToolsForm/ToolsForm/Views/DownCodeWindow.axaml]
|
||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
053cff6f51e40f43c4a777dbb1a1a00a4f7588cc9e9b5460b95a793d1e7dc86a
|
||||
bf3fd6b20c8cdf001539f535b65b0d319f4b4f7c5c43d09955e03b2516849197
|
||||
|
|
|
|||
|
|
@ -154,3 +154,6 @@ E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0
|
|||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\ToolsForm.csproj.Up2Date
|
||||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\ToolsForm.genruntimeconfig.cache
|
||||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\ref\ToolsForm.dll
|
||||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\ToolsForm.dll
|
||||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\refint\ToolsForm.dll
|
||||
E:\Unity Projects\GitLab\2024\ICT_ToolsForm\ToolsForm\ToolsForm\obj\Debug\net8.0\ToolsForm.pdb
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
17301864870168797
|
||||
17302702315650109
|
||||
Loading…
Reference in New Issue