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) {