From edab972b3ec4957241b06f3ef3c2a2af320578b4 Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Sun, 8 Jun 2025 11:53:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0deepseek=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E6=A8=A1=E5=9E=8B=E5=8F=8A=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dockpane/DialogDockpane.xaml | 5 ++++ ui/dockpane/DialogDockpane.xaml.cs | 44 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/ui/dockpane/DialogDockpane.xaml b/ui/dockpane/DialogDockpane.xaml index 31542f5..b62fab7 100644 --- a/ui/dockpane/DialogDockpane.xaml +++ b/ui/dockpane/DialogDockpane.xaml @@ -43,6 +43,11 @@ + + + + + diff --git a/ui/dockpane/DialogDockpane.xaml.cs b/ui/dockpane/DialogDockpane.xaml.cs index 278944c..5dec4a0 100644 --- a/ui/dockpane/DialogDockpane.xaml.cs +++ b/ui/dockpane/DialogDockpane.xaml.cs @@ -118,8 +118,52 @@ namespace LinkToolAddin.ui.dockpane borderItemsDict[timestamp.ToString()] = userMsgBoder; ChatHistoryStackPanel.Children.Add(userMsgBoder); string model = (ModelComboBox.SelectedItem as ComboBoxItem).Content.ToString() is null ? "qwen3-235b-a22b" : (ModelComboBox.SelectedItem as ComboBoxItem).Content.ToString(); + if (model == "自定义") + { + model = ShowInputBox("自定义模型", "请输入模型名称:", ""); + } Gateway.SendMessageStream(question,model,defaultGdbPath,NewMessage_Recall); } + + private string ShowInputBox(string title, string message, string defaultValue = "") + { + // 创建一个自定义的输入对话框 + var dialog = new System.Windows.Window + { + Title = title, + Width = 300, + Height = 150, + WindowStyle = WindowStyle.ToolWindow, + ResizeMode = ResizeMode.NoResize, + Topmost = true, + WindowStartupLocation = WindowStartupLocation.CenterOwner + }; + + // 设置对话框内容 + var stackPanel = new StackPanel { Margin = new Thickness(10) }; + stackPanel.Children.Add(new TextBlock { Text = message, Margin = new Thickness(0, 0, 0, 5) }); + + var textBox = new TextBox { Text = defaultValue, Margin = new Thickness(0, 0, 0, 10) }; + stackPanel.Children.Add(textBox); + + var buttonPanel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right }; + + var okButton = new Button { Content = "确定", Width = 75, Margin = new Thickness(0, 0, 5, 0) }; + okButton.Click += (sender, e) => dialog.Close(); + + var cancelButton = new Button { Content = "取消", Width = 75 }; + cancelButton.Click += (sender, e) => { textBox.Text = null; dialog.Close(); }; + + buttonPanel.Children.Add(okButton); + buttonPanel.Children.Add(cancelButton); + stackPanel.Children.Add(buttonPanel); + + dialog.Content = stackPanel; + + // 显示对话框并获取结果 + dialog.ShowDialog(); + return textBox.Text; + } public void NewMessage_Recall(MessageListItem msg) {