From 7beb2de4c5f8e60f9fdc7a93aa82504854b9ed4a Mon Sep 17 00:00:00 2001 From: token <239573049@qq.com> Date: Wed, 1 Jan 2025 03:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ChatBox/Controls/ChatWelcome.axaml | 20 +++++++++++++++----- src/ChatBox/Pages/Setting.axaml | 22 +++++++++++++++------- src/ChatBox/Pages/Setting.axaml.cs | 24 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/src/ChatBox/Controls/ChatWelcome.axaml b/src/ChatBox/Controls/ChatWelcome.axaml index ccdf4ef..272eae9 100644 --- a/src/ChatBox/Controls/ChatWelcome.axaml +++ b/src/ChatBox/Controls/ChatWelcome.axaml @@ -4,14 +4,24 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ChatBox.Controls.ChatWelcome"> - - + 嗨🖖,我是 AI Chat!欢迎使用AI Chat! - - + + + + 请在输入框输入您的问题,我会尽力回答您的问题! + + + \ No newline at end of file diff --git a/src/ChatBox/Pages/Setting.axaml b/src/ChatBox/Pages/Setting.axaml index e8d1a7a..598e194 100644 --- a/src/ChatBox/Pages/Setting.axaml +++ b/src/ChatBox/Pages/Setting.axaml @@ -13,7 +13,9 @@ - + + RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto"> + Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,0,10,10"> - + - + Name="MaxTokenTextBox" Grid.Row="2" Grid.Column="1" Margin="0,0,0,10" /> + \ No newline at end of file diff --git a/src/ChatBox/Pages/Setting.axaml.cs b/src/ChatBox/Pages/Setting.axaml.cs index e792a7e..9b7e3c3 100644 --- a/src/ChatBox/Pages/Setting.axaml.cs +++ b/src/ChatBox/Pages/Setting.axaml.cs @@ -3,7 +3,9 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Notifications; +using Avalonia.Input; using Avalonia.Interactivity; +using Avalonia.VisualTree; using ChatBox.Service; using ChatBox.ViewModels; using ChatBox.Views; @@ -63,4 +65,26 @@ private void InitializeSetting() ViewModel.SelectedModelProvider = item ?? models.FirstOrDefault(); } + + private void OnPointerPressed(object? sender, PointerPressedEventArgs e) + { + // 获取当前窗口并调用 BeginMoveDrag + var window = this.GetVisualRoot() as Window; + if (window != null) + { + window.BeginMoveDrag(e); + } + } + + private void Logout(object? sender, RoutedEventArgs e) + { + // 如果返回401,清空ApiKey + var settings = HostApplication.Services.GetRequiredService().LoadSetting(); + + settings.ApiKey = string.Empty; + HostApplication.Services.GetRequiredService().SaveSetting(settings); + + HostApplication.Logout?.Invoke(); + + } } \ No newline at end of file