回归ChatGPT聊天与聊天API接口相关

This commit is contained in:
ZouJin 2023-09-04 18:19:48 +08:00
parent 88649bb146
commit 419283342b
6 changed files with 33 additions and 4 deletions

View File

@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VPet_Simulator.Windows.Interface"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" mc:Ignorable="d"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500" VerticalAlignment="Top">
<Border Background="{DynamicResource PrimaryLighter}" BorderBrush="{DynamicResource Primary}" BorderThickness="5"

View File

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO.Packaging;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -8,6 +10,7 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
@ -20,9 +23,23 @@ namespace VPet_Simulator.Windows.Interface
/// </summary>
public abstract partial class TalkBox : UserControl, ITalkAPI
{
MainPlugin MainPlugin;
/// <summary>
/// 插件主体
/// </summary>
protected MainPlugin MainPlugin;
public TalkBox(MainPlugin mainPlugin)
{
var baseUri = "/VPet-Simulator.Windows.Interface;component/talkbox.xaml";
var resourceLocater = new Uri(baseUri, UriKind.Relative);
var exprCa = (PackagePart)typeof(Application).GetMethod("GetResourceOrContentPart", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { resourceLocater });
var stream = exprCa.GetStream();
var uri = new Uri((Uri)typeof(BaseUriHelper).GetProperty("PackAppBaseUri", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null, null), resourceLocater);
var parserContext = new ParserContext
{
BaseUri = uri
};
typeof(XamlReader).GetMethod("LoadBaml", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { stream, parserContext, this, true });
InitializeComponent();
MainPlugin = mainPlugin;
}

View File

@ -1238,5 +1238,17 @@ namespace VPet_Simulator.Windows
MessageBoxX.Show("重置成功".Translate());
}
}
private void cbChatAPISelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange)
return;
mw.TalkAPIIndex = cbChatAPISelect.SelectedIndex;
mw.Set["CGPT"][(gstr)"DIY"] = mw.TalkBoxCurr?.APIName ?? "";
if (RBCGPTDIY.IsChecked == true)
mw.LoadTalkDIY();
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
}
}
}

View File

@ -1 +1 @@
C:/Users/ZouJin/Documents/Visual Studio 2022/Project/VPet.Plugin.DemoClock/VPet.Plugin.DemoClock/1100_DemoClock
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.DemoClock/1100_DemoClock

View File

@ -1 +1 @@
C:/Users/ZouJin/Documents/Visual Studio 2022/Project/VPet.Plugin.DemoClock/VPet.Plugin.EdgeTTS/1101_EdgeTTS
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.EdgeTTS/1101_EdgeTTS

View File

@ -0,0 +1 @@
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.ChatGPT/1110_ChatGPT