diff --git a/VPet-Simulator.Windows/Function/ITalkBox.cs b/VPet-Simulator.Windows/Function/ITalkBox.cs
new file mode 100644
index 0000000..f5847ca
--- /dev/null
+++ b/VPet-Simulator.Windows/Function/ITalkBox.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace VPet_Simulator.Windows
+{
+ public interface ITalkBox
+ {
+ ///
+ /// 当前UI
+ ///
+ UIElement This { get; }
+ }
+}
diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs
index 8f46baf..8a55a53 100644
--- a/VPet-Simulator.Windows/MainWindow.cs
+++ b/VPet-Simulator.Windows/MainWindow.cs
@@ -1,4 +1,5 @@
-using LinePutScript;
+using ChatGPT.API.Framework;
+using LinePutScript;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -19,6 +20,7 @@ namespace VPet_Simulator.Windows
public List CoreMODs = new List();
public GameCore Core = new GameCore();
public winGameSetting winSetting;
+ public ChatGPTClient CGPTClient;
///
/// 版本号
///
@@ -44,7 +46,8 @@ namespace VPet_Simulator.Windows
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
if (Core != null && Core.Save != null)
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
-
+ if(CGPTClient != null)
+ File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save());
}
public void LoadDIY()
{
diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs
index 9a1a5df..e49c24e 100644
--- a/VPet-Simulator.Windows/MainWindow.xaml.cs
+++ b/VPet-Simulator.Windows/MainWindow.xaml.cs
@@ -14,6 +14,7 @@ using Application = System.Windows.Application;
using System.Timers;
using LinePutScript;
using System.Diagnostics;
+using ChatGPT.API.Framework;
namespace VPet_Simulator.Windows
{
@@ -24,7 +25,7 @@ namespace VPet_Simulator.Windows
{
private NotifyIcon notifyIcon;
public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer();
- public TalkBox TalkBox;
+ public ITalkBox TalkBox;
public MainWindow()
{
//判断是不是Steam用户,因为本软件会发布到Steam
@@ -63,6 +64,8 @@ namespace VPet_Simulator.Windows
else
Set = new Setting("Setting#VPET:|\n");
+ if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json"))
+ CGPTClient = ChatGPTClient.Load(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json"));
//this.Width = 400 * ZoomSlider.Value;
//this.Height = 450 * ZoomSlider.Value;
@@ -182,10 +185,15 @@ namespace VPet_Simulator.Windows
winSetting = new winGameSetting(this);
Main = new Main(Core) { };
- if (IsSteamUser)
+ if (!Set["CGPT"][(gbol)"enable"] && IsSteamUser)
{
TalkBox = new TalkBox(this);
- Main.ToolBar.MainGrid.Children.Add(TalkBox);
+ Main.ToolBar.MainGrid.Children.Add(TalkBox.This);
+ }
+ else if (Set["CGPT"][(gbol)"enable"] && !IsSteamUser)
+ {
+ TalkBox = new TalkBoxAPI(this);
+ Main.ToolBar.MainGrid.Children.Add(TalkBox.This);
}
Main.DefaultClickAction = () =>
diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj
index f6f6359..7fa18dc 100644
--- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj
+++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj
@@ -78,9 +78,15 @@
vpeticon.ico
+
+ ..\packages\ChatGPT.API.Framework.1.0.2\lib\net462\ChatGPT.API.Framework.dll
+
..\packages\LinePutScript.1.6.1\lib\net48\LinePutScript.dll
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
..\packages\Panuon.WPF.1.0.1\lib\net48\Panuon.WPF.dll
@@ -110,6 +116,13 @@
MSBuild:Compile
Designer
+
+
+ TalkBoxAPI.xaml
+
+
+ winCGPTSetting.xaml
+
DIYViewer.xaml
@@ -135,6 +148,14 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs
index 8ff230c..95ad650 100644
--- a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs
@@ -30,10 +30,13 @@ namespace VPet_Simulator.Windows
///
/// MessageBar.xaml 的交互逻辑
///
- public partial class TalkBox : UserControl
+ public partial class TalkBox : UserControl, ITalkBox
{
Main m;
Setting set;
+
+ public UIElement This => this;
+
public TalkBox(MainWindow mw)
{
InitializeComponent();
@@ -215,7 +218,8 @@ namespace VPet_Simulator.Windows
set.Save();
btn_startup.Content = "初始化桌宠聊天程序中...";
var sid = Steamworks.SteamClient.SteamId.Value;
- var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题,请直接给出回答,不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
+ var cont = $"请使用口语化的、可爱的、女性化的、调皮的语言风格和我交流\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>";
+ //太长了记不住+太贵var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题,请直接给出回答,不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
Task.Run(() =>
{
if (OPENAI(sid, cont))
diff --git a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml
new file mode 100644
index 0000000..cb97ba2
--- /dev/null
+++ b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs
new file mode 100644
index 0000000..a2912cf
--- /dev/null
+++ b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs
@@ -0,0 +1,84 @@
+using LinePutScript;
+using Panuon.WPF.UI;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Timers;
+using System.Web;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using VPet_Simulator.Core;
+using Timer = System.Timers.Timer;
+
+namespace VPet_Simulator.Windows
+{
+ ///
+ /// MessageBar.xaml 的交互逻辑
+ ///
+ public partial class TalkBoxAPI : UserControl, ITalkBox
+ {
+ Main m;
+ MainWindow mw;
+
+ public UIElement This => this;
+
+ public TalkBoxAPI(MainWindow mw)
+ {
+ InitializeComponent();
+ this.m = mw.Main;
+ this.mw = mw;
+ }
+
+ private void SendMessage_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrEmpty(tbTalk.Text))
+ {
+ return;
+ }
+ var cont = tbTalk.Text;
+ tbTalk.Text = "";
+ Task.Run(() => OPENAI(cont));
+ }
+ ///
+ /// 使用OPENAI API进行回复
+ ///
+ /// 内容 说话内容
+ public void OPENAI(string content)
+ {
+ if (string.IsNullOrEmpty(content))
+ {
+ return;
+ }
+ if (mw.CGPTClient == null)
+ {
+ m.Say("请先前往设置中设置 ChatGPT API");
+ return;
+ }
+ Dispatcher.Invoke(() => this.IsEnabled = false);
+ try
+ {
+ m.Say(mw.CGPTClient.Ask("vpet", content).GetMessageContent());
+ }
+ catch (Exception exp)
+ {
+ m.Say("API调用失败,请检查设置和网络连接\n" + exp.ToString());
+ }
+ Dispatcher.Invoke(() => this.IsEnabled = true);
+ }
+ }
+}
diff --git a/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml b/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml
new file mode 100644
index 0000000..9c65efe
--- /dev/null
+++ b/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs
new file mode 100644
index 0000000..2f91144
--- /dev/null
+++ b/VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs
@@ -0,0 +1,63 @@
+using ChatGPT.API.Framework;
+using Newtonsoft.Json;
+using Panuon.WPF.UI;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace VPet_Simulator.Windows
+{
+ ///
+ /// winCGPTSetting.xaml 的交互逻辑
+ ///
+ public partial class winCGPTSetting : WindowX
+ {
+ MainWindow mw;
+ long totalused = 0;
+ public winCGPTSetting(MainWindow mw)
+ {
+ InitializeComponent();
+ this.mw = mw;
+ if (mw.CGPTClient != null)
+ {
+ tbAPIKey.Text = mw.CGPTClient.APIKey;
+ tbAPIURL.Text = mw.CGPTClient.APIUrl;
+ tbMaxToken.Text = mw.CGPTClient.Completions["vpet"].max_tokens.ToString();
+ tbSystem.Text = mw.CGPTClient.Completions["vpet"].messages[0].content;
+ tbTemp.Text = mw.CGPTClient.Completions["vpet"].temperature.ToString();
+ var msgs = mw.CGPTClient.Completions["vpet"].messages.ToList();
+ msgs.RemoveAt(0);
+ tbHistory.Text = JsonConvert.SerializeObject(msgs);
+ lbSpend.Content = mw.CGPTClient.TotalTokensUsage.ToString() + " Token";
+ totalused = mw.CGPTClient.TotalTokensUsage;
+ }
+ }
+
+ private void btnSave_Click(object sender, RoutedEventArgs e)
+ {
+ mw.CGPTClient = new ChatGPTClient(tbAPIKey.Text, tbAPIURL.Text)
+ {
+ TotalTokensUsage = totalused
+ };
+ mw.CGPTClient.CreateCompletions("vpet", tbSystem.Text.Replace("{Name}", mw.Core.Save.Name));
+ mw.CGPTClient.Completions["vpet"].frequency_penalty = 0.2;
+ mw.CGPTClient.Completions["vpet"].presence_penalty = 1;
+ mw.CGPTClient.Completions["vpet"].max_tokens = Math.Min(Math.Max(int.Parse(tbMaxToken.Text), 10), 4000);
+ mw.CGPTClient.Completions["vpet"].temperature = Math.Min(Math.Max(double.Parse(tbTemp.Text), 0.1), 2);
+ mw.CGPTClient.Completions["vpet"].messages.AddRange(JsonConvert.DeserializeObject>(tbHistory.Text));
+ mw.Save();
+ this.Close();
+ }
+ }
+}
diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml
index 2128181..98f230f 100644
--- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml
+++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml
@@ -4,32 +4,239 @@
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"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
- xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignHeight="450" Title="设置"
+ xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" Title="设置"
Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" Closing="WindowX_Closing"
- Width="400" Height="450">
+ Width="500" Height="550" FontSize="16">
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 自动保存频率
+ 在指定时间后自动保存游戏数据,频繁的自动保存可能会导致卡顿
+
+
+
+
+ -1
+ 关闭自动保存
+
+
+
+ 5
+ 每5分钟一次
+
+
+
+ 10
+ 每10分钟一次
+
+
+
+ 20
+ 每20分钟一次
+
+
+
+ 30
+ 每半小时一次
+
+
+
+ 60
+ 每小时一次
+
+
+
+ 操作设置
+ 游戏操作相关设置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 聊天设置
+ 使用ChatGPT进行聊天等相关设置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 互动设置
+ 游戏互动相关设置
+
@@ -44,216 +251,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 自动保存频率
- 在指定时间后自动保存游戏数据,频繁的自动保存可能会导致卡顿
-
-
-
-
- -1
- 关闭自动保存
-
-
-
- 5
- 每5分钟一次
-
-
-
- 10
- 每10分钟一次
-
-
-
- 20
- 每20分钟一次
-
-
-
- 30
- 每半小时一次
-
-
-
- 60
- 每小时一次
-
-
-
- 操作设置
- 游戏操作相关设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 聊天设置
- 使用ChatGPT进行聊天等相关设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 互动设置
- 游戏互动相关设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
- 30
- 30 秒
-
-
-
- 60
- 1 分钟
-
-
-
- 120
- 2 分钟
-
-
-
- 300
- 5 分钟
-
-
-
- 600
- 10 分钟
-
-
-
- 1200
- 20 分钟
-
-
-
- 1800
- 30 分钟
-
-
-
- 2400
- 40 分钟
-
-
-
- 3000
- 50 分钟
-
-
-
- 3600
- 60 分钟
-
-
-
-
-
-
-
-
-
- 自定义链接
- 在自定栏添加快捷方式/网页/快捷键, 可以便携启动想要的功能
- 键盘快捷键编写方法请参考 键盘快捷键 通用注解
- 右键进行排序/删除等操作
-
-
+
-
-
+
+
+
+
+ 30
+ 30 秒
+
+
+
+ 60
+ 1 分钟
+
+
+
+ 120
+ 2 分钟
+
+
+
+ 300
+ 5 分钟
+
+
+
+ 600
+ 10 分钟
+
+
+
+ 1200
+ 20 分钟
+
+
+
+ 1800
+ 30 分钟
+
+
+
+ 2400
+ 40 分钟
+
+
+
+ 3000
+ 50 分钟
+
+
+
+ 3600
+ 60 分钟
+
+
-
-
+
+
+
+
+
+
+
+ 自定义链接
+ 在自定栏添加快捷方式/网页/快捷键, 可以便携启动想要的功能
+ 键盘快捷键编写方法请参考 键盘快捷键 通用注解
+ 右键进行排序/删除等操作
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
- 诊断与反馈
+ 诊断与反馈
选择要发送给 LBGame 的诊断数据,诊断数据用于保护和及时更新 虚拟桌宠模拟器, 解决问题并改进产品.
无论选择哪个选项,游戏都可以安全正常地运行. 获取有关这些设置的更多信息
-
-
+
-
-
- 反馈频率
+ 反馈频率
VOS 应寻求我反馈按以下频率
-
-
+
- 每 五百 周期一次
- 每 一千 周期一次
- 每 两千 周期一次
- 每 五千 周期一次
- 每 一万 周期一次
- 每 两万 周期一次
-
-
-
-
-
-
-
-
-
-
- 每 五百 周期一次
+ 每 一千 周期一次
+ 每 两千 周期一次
+ 每 五千 周期一次
+ 每 一万 周期一次
+ 每 两万 周期一次
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
游戏策划
UI&程序
动画绘制
@@ -563,19 +562,19 @@
相关群
-
-
+
+
用户名
版本
激活
-
-
+
+
杨远洛里斯
v1.0 (100)
已通过Steam[uid]激活服务注册
-
-
-
+
+
+
杨远洛里斯, 广大MOD作者
洛里斯杨远, トニーちゃん Git贡献名单
叶书天, 广大MOD作者
@@ -587,13 +586,12 @@
访问Steam页面
访问Github页面
- 由于游戏暂未开发完毕,该名单并非完整名单.将在正式版完成前修改
-
-
-
-
- 由于游戏暂未开发完毕,该名单并非完整名单.将在正式版完成前修改
+
+
+
+
+
-
-
+
diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
index b695a74..ac9d2b3 100644
--- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
@@ -52,8 +52,8 @@ namespace VPet_Simulator.Windows
ZoomSlider.Maximum = 3;
}
ZoomSlider.Value = mw.Set.ZoomLevel * 2;
- this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
- this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
+ //this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
+ //this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
sDesktopAlignment.IsChecked = mw.Set.EnableFunction;
CalSlider.Value = mw.Set.LogicInterval;
@@ -110,7 +110,17 @@ namespace VPet_Simulator.Windows
{
runUserName.Text = Environment.UserName;
runActivate.Text = "尚未激活 您可能需要启动Steam或去Steam上免费领个";
+ RBCGPTUseLB.IsEnabled = false;
+ if (!mw.Set["CGPT"][(gbol)"enable"])
+ BtnCGPTReSet.IsEnabled = false;
}
+ if (mw.Set["CGPT"][(gbol)"enable"])
+ {
+ RBCGPTUseAPI.IsChecked = true;
+ BtnCGPTReSet.Content = "打开 ChatGPT API 设置";
+ }
+ else
+ BtnCGPTReSet.Content = "初始化桌宠聊天程序";
runabVer.Text = $"v{mw.Verison} ({mw.verison})";
//mod列表
@@ -119,12 +129,6 @@ namespace VPet_Simulator.Windows
ShowMod((string)((ListBoxItem)ListMod.SelectedItem).Content);
AllowChange = true;
-
- if (!mw.IsSteamUser)
- {
- RBCGPTUseLB.IsEnabled = false;
- BtnCGPTReSet.IsEnabled = false;
- }
}
public void ShowModList()
{
@@ -484,8 +488,8 @@ namespace VPet_Simulator.Windows
if (!AllowChange)
return;
mw.SetZoomLevel(ZoomSlider.Value / 2);
- this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
- this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
+ //this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
+ //this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
}
private void PressLengthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
@@ -661,19 +665,50 @@ namespace VPet_Simulator.Windows
}
mw.LoadDIY();
}
-
+
private void ChatGPT_Reset_Click(object sender, RoutedEventArgs e)
{
- string responseString = mw.TalkBox.ChatGPT_Reset();
- if (responseString == "SUCCESS")
+ if (mw.Set["CGPT"][(gbol)"enable"])
{
- mw.TalkBox.btn_startup.Visibility = Visibility.Visible;
- MessageBoxX.Show("桌宠重置成功");
+ new winCGPTSetting(mw).ShowDialog();
}
else
{
- MessageBoxX.Show(responseString, "桌宠重置失败");
+ string responseString = ((TalkBox)mw.TalkBox).ChatGPT_Reset();
+ if (responseString == "SUCCESS")
+ {
+ ((TalkBox)mw.TalkBox).btn_startup.Visibility = Visibility.Visible;
+ MessageBoxX.Show("桌宠重置成功");
+ }
+ else
+ {
+ MessageBoxX.Show(responseString, "桌宠重置失败");
+ }
+ }
+ }
+
+ private void CGPType_Checked(object sender, RoutedEventArgs e)
+ {
+ if (!AllowChange)
+ return;
+ mw.Set["CGPT"].SetBool("enable", RBCGPTUseLB.IsChecked == false);
+ if (mw.Set["CGPT"][(gbol)"enable"])
+ {
+ BtnCGPTReSet.Content = "打开 ChatGPT API 设置";
+ BtnCGPTReSet.IsEnabled = true;
+ if (mw.TalkBox != null)
+ mw.Main.ToolBar.MainGrid.Children.Remove(mw.TalkBox.This);
+ mw.TalkBox = new TalkBoxAPI(mw);
+ mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox.This);
+ }
+ else
+ {
+ BtnCGPTReSet.Content = "初始化桌宠聊天程序";
+ if (mw.TalkBox != null)
+ mw.Main.ToolBar.MainGrid.Children.Remove(mw.TalkBox.This);
+ mw.TalkBox = new TalkBox(mw);
+ mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox.This);
}
}
}
diff --git a/VPet-Simulator.Windows/WinDesign/winReport.xaml b/VPet-Simulator.Windows/WinDesign/winReport.xaml
index c93ec64..dab1e0a 100644
--- a/VPet-Simulator.Windows/WinDesign/winReport.xaml
+++ b/VPet-Simulator.Windows/WinDesign/winReport.xaml
@@ -6,8 +6,8 @@
xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" Title="反馈中心"
Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" Width="500" MinHeight="250"
Height="Auto" ResizeMode="NoResize" WindowState="Normal"
- Icon="../vpeticon.ico">
-
+ Icon="../vpeticon.ico" SizeToContent="Height">
+
+
+
\ No newline at end of file