diff --git a/ToolsForm/.idea/.idea.ToolsForm/.idea/workspace.xml b/ToolsForm/.idea/.idea.ToolsForm/.idea/workspace.xml
index 95b8125..cfdca45 100644
--- a/ToolsForm/.idea/.idea.ToolsForm/.idea/workspace.xml
+++ b/ToolsForm/.idea/.idea.ToolsForm/.idea/workspace.xml
@@ -8,30 +8,26 @@
-
-
-
-
-
+
+
+
+
-
-
-
+
-
@@ -55,6 +51,8 @@
+
+
{
@@ -149,6 +147,7 @@
+
@@ -226,6 +225,32 @@
+
+ file://$PROJECT_DIR$/ToolsForm/Views/AIWindow.axaml.cs
+ 49
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/ToolsForm/Views/AIWindow.axaml.cs
+ 23
+
+
+
+
+
+
+
+
+
+
diff --git a/ToolsForm/ToolsForm/App.axaml b/ToolsForm/ToolsForm/App.axaml
index 3f0c45a..8111d0b 100644
--- a/ToolsForm/ToolsForm/App.axaml
+++ b/ToolsForm/ToolsForm/App.axaml
@@ -22,6 +22,7 @@
+
diff --git a/ToolsForm/ToolsForm/ViewModels/ImageAlignmentConverter.cs b/ToolsForm/ToolsForm/ViewModels/ImageAlignmentConverter.cs
index aff9bf8..458d6fe 100644
--- a/ToolsForm/ToolsForm/ViewModels/ImageAlignmentConverter.cs
+++ b/ToolsForm/ToolsForm/ViewModels/ImageAlignmentConverter.cs
@@ -17,3 +17,43 @@ public class ImageAlignmentConverter : IValueConverter
throw new NotImplementedException();
}
}
+
+public class BooleanToOpacityConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value is bool && (bool)value ? 1.0 : 0.0; // 可见时为1,不可见时为0
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
+
+
+public class InverseBooleanToHitTestVisibleConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value is bool && !(bool)value; // 反转布尔值
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
+
+public class InverseBooleanToOpacityConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value is bool booleanValue && !booleanValue ? 1.0 : 0.0; // 反转布尔值,返回 1.0 或 0.0
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/ToolsForm/ToolsForm/Views/AIWindow.axaml b/ToolsForm/ToolsForm/Views/AIWindow.axaml
index ee108eb..3d5788c 100644
--- a/ToolsForm/ToolsForm/Views/AIWindow.axaml
+++ b/ToolsForm/ToolsForm/Views/AIWindow.axaml
@@ -10,6 +10,7 @@
xmlns:global="clr-namespace:"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:ToolsForm.Models"
+ xmlns:viewModels="clr-namespace:ToolsForm.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -29,6 +30,11 @@
+
+
+
+
+
-
+
+
+
+ Width="18" />
+
+
+
@@ -73,14 +93,21 @@
Width="637" />
+
+
-
+
\ No newline at end of file
diff --git a/ToolsForm/ToolsForm/Views/AIWindow.axaml.cs b/ToolsForm/ToolsForm/Views/AIWindow.axaml.cs
index 2088487..42c3441 100644
--- a/ToolsForm/ToolsForm/Views/AIWindow.axaml.cs
+++ b/ToolsForm/ToolsForm/Views/AIWindow.axaml.cs
@@ -1,5 +1,6 @@
using System.Linq;
using Avalonia.Controls;
+ using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using ToolsForm.Models; // 引入模型命名空间
@@ -11,17 +12,25 @@
private DialogueModel dialogueModel;
private TextBox inputTextBox;
private ItemsControl dialogueItems;
-
+ private ScrollViewer dialogueScrollViewer;
public AIWindow()
{
InitializeComponent();
// 初始化控件
inputTextBox = this.FindControl("InputTextBox");
dialogueItems = this.FindControl("DialogueItems");
+ dialogueScrollViewer= this.FindControl("DialogueScrollViewer");
dialogueModel = new DialogueModel(); // 创建模型实例
DataContext = dialogueModel; // 将数据上下文设置为模型
}
-
+ private void OnInputTextBoxKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) // 检查是否按下 Enter 键
+ {
+ OnSendButtonClick(sender, e); // 调用发送按钮的点击事件处理程序
+ e.Handled = true; // 标记事件已处理,防止进一步处理
+ }
+ }
private void OnSendButtonClick(object sender, RoutedEventArgs e)
{
var userMessage = inputTextBox.Text;
@@ -34,8 +43,13 @@
var aiResponse = GenerateAIResponse(userMessage);
dialogueModel.AddAIResponse(aiResponse);
- // 自动滚动到最新消息
- dialogueItems.ScrollIntoView(dialogueModel.Dialogues.Last());
+ // // 自动滚动到最新消息
+ // dialogueItems.ScrollIntoView(dialogueModel.Dialogues.Last());
+ }
+
+ if (dialogueScrollViewer != null)
+ {
+ dialogueScrollViewer.ScrollToEnd();
}
}
diff --git a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.dll b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.dll
index f5c8c73..23548ed 100644
Binary files a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.dll and b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.dll differ
diff --git a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.exe b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.exe
index b94858c..de613dc 100644
Binary files a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.exe and b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.exe differ
diff --git a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb
index ada4d23..682a60d 100644
Binary files a/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb and b/ToolsForm/ToolsForm/bin/Debug/net8.0/ToolsForm.pdb differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.dll b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.dll
index f5c8c73..23548ed 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.dll and b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.dll differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.pdb b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.pdb
index ada4d23..682a60d 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.pdb and b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/ToolsForm.pdb differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/resources b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/resources
index b0fa7ed..43520b1 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/resources and b/ToolsForm/ToolsForm/obj/Debug/net8.0/Avalonia/resources differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfo.cs b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfo.cs
index 71c0e5e..85d4eba 100644
--- a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfo.cs
+++ b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfo.cs
@@ -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+9335c4bddabcf0a09ea3730f2caaa72cced78e17")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b5da1a7f7c82dcd20f0b21f742568b806e389d75")]
[assembly: System.Reflection.AssemblyProductAttribute("ToolsForm")]
[assembly: System.Reflection.AssemblyTitleAttribute("ToolsForm")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfoInputs.cache b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfoInputs.cache
index c2009e1..5cc89f5 100644
--- a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfoInputs.cache
+++ b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.AssemblyInfoInputs.cache
@@ -1 +1 @@
-fd2cbd09e17ab485ea9afa360ac92eea22ec11693359a777e90c575aec824f0d
+7b96760f001b2471081ba691dfa0e836b351bee82672791a362c10b30535dedd
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.csproj.FileListAbsolute.txt b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.csproj.FileListAbsolute.txt
index db300cf..3645bc9 100644
--- a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.csproj.FileListAbsolute.txt
+++ b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.csproj.FileListAbsolute.txt
@@ -154,6 +154,3 @@ 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
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.dll b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.dll
index 3ceb81e..989b914 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.dll and b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.dll differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.pdb b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.pdb
index 0b15da5..813a6f2 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.pdb and b/ToolsForm/ToolsForm/obj/Debug/net8.0/ToolsForm.pdb differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/apphost.exe b/ToolsForm/ToolsForm/obj/Debug/net8.0/apphost.exe
index b94858c..de613dc 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/apphost.exe and b/ToolsForm/ToolsForm/obj/Debug/net8.0/apphost.exe differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll b/ToolsForm/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll
index d28b7b0..2f79b94 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll and b/ToolsForm/ToolsForm/obj/Debug/net8.0/ref/ToolsForm.dll differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll b/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll
index d28b7b0..2f79b94 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll and b/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/Avalonia/ToolsForm.dll differ
diff --git a/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll b/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll
index 4fccc6f..aeb950d 100644
Binary files a/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll and b/ToolsForm/ToolsForm/obj/Debug/net8.0/refint/ToolsForm.dll differ