diff --git a/.vs/ProjectEvaluation/chatgpt-lkz4251.metadata.v7.bin b/.vs/ProjectEvaluation/chatgpt-lkz4251.metadata.v7.bin
new file mode 100644
index 0000000000000000000000000000000000000000..8c84ba514102f1cce32fc070d398e382c3a44459
Binary files /dev/null and b/.vs/ProjectEvaluation/chatgpt-lkz4251.metadata.v7.bin differ
diff --git a/.vs/ProjectEvaluation/chatgpt-lkz4251.projects.v7.bin b/.vs/ProjectEvaluation/chatgpt-lkz4251.projects.v7.bin
new file mode 100644
index 0000000000000000000000000000000000000000..113861e9317aa9af7b5b7f918c07625fa21ea9db
Binary files /dev/null and b/.vs/ProjectEvaluation/chatgpt-lkz4251.projects.v7.bin differ
diff --git a/.vs/chatgpt-LKZ4251/DesignTimeBuild/.dtbcache.v2 b/.vs/chatgpt-LKZ4251/DesignTimeBuild/.dtbcache.v2
new file mode 100644
index 0000000000000000000000000000000000000000..9b33db9ade215e73987ba06bda4eed1059c38737
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/.vs/chatgpt-LKZ4251/FileContentIndex/1a73b121-dcca-4759-9dd6-329761f02f48.vsidx b/.vs/chatgpt-LKZ4251/FileContentIndex/1a73b121-dcca-4759-9dd6-329761f02f48.vsidx
new file mode 100644
index 0000000000000000000000000000000000000000..a7d76f1a3345824dc70c9238738a19f49a5d4636
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/FileContentIndex/1a73b121-dcca-4759-9dd6-329761f02f48.vsidx differ
diff --git a/.vs/chatgpt-LKZ4251/FileContentIndex/90377076-aafe-4860-85dc-24c2044f2a16.vsidx b/.vs/chatgpt-LKZ4251/FileContentIndex/90377076-aafe-4860-85dc-24c2044f2a16.vsidx
new file mode 100644
index 0000000000000000000000000000000000000000..a7d76f1a3345824dc70c9238738a19f49a5d4636
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/FileContentIndex/90377076-aafe-4860-85dc-24c2044f2a16.vsidx differ
diff --git a/.vs/chatgpt-LKZ4251/FileContentIndex/cf14bf84-738b-4349-912d-5f203ff42585.vsidx b/.vs/chatgpt-LKZ4251/FileContentIndex/cf14bf84-738b-4349-912d-5f203ff42585.vsidx
new file mode 100644
index 0000000000000000000000000000000000000000..a7d76f1a3345824dc70c9238738a19f49a5d4636
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/FileContentIndex/cf14bf84-738b-4349-912d-5f203ff42585.vsidx differ
diff --git a/.vs/chatgpt-LKZ4251/FileContentIndex/fc64540b-9b5e-4d08-b7d7-db276f6a55d0.vsidx b/.vs/chatgpt-LKZ4251/FileContentIndex/fc64540b-9b5e-4d08-b7d7-db276f6a55d0.vsidx
new file mode 100644
index 0000000000000000000000000000000000000000..2178618a5cbdc5ff564618e4c3f352a5d3089bbc
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/FileContentIndex/fc64540b-9b5e-4d08-b7d7-db276f6a55d0.vsidx differ
diff --git a/.vs/chatgpt-LKZ4251/v17/.futdcache.v2 b/.vs/chatgpt-LKZ4251/v17/.futdcache.v2
new file mode 100644
index 0000000000000000000000000000000000000000..81425251bd4e79a8b33c3a998165c355ac42940f
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/v17/.futdcache.v2 differ
diff --git a/.vs/chatgpt-LKZ4251/v17/.suo b/.vs/chatgpt-LKZ4251/v17/.suo
new file mode 100644
index 0000000000000000000000000000000000000000..541cfd50197ed449992f5600511a4c7a21e292a3
Binary files /dev/null and b/.vs/chatgpt-LKZ4251/v17/.suo differ
diff --git a/App.xaml b/App.xaml
new file mode 100644
index 0000000000000000000000000000000000000000..16dd00c738565569306abab8f797d1ea64c1591e
--- /dev/null
+++ b/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
new file mode 100644
index 0000000000000000000000000000000000000000..43c19c91a515d9e207e28a3432e5bff9094cc637
--- /dev/null
+++ b/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace chatgpt_LKZ4251
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..8b5504ecfbb1bfbb008957f80ac70f8fcdab91dd
--- /dev/null
+++ b/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/GPTConfig.cs b/GPTConfig.cs
new file mode 100644
index 0000000000000000000000000000000000000000..17a1fc53501ce51e1c06e403676ccea3673e1dd1
--- /dev/null
+++ b/GPTConfig.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace chatgpt_LKZ4251
+{
+ public class GPTConfig : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler? PropertyChanged = delegate { };
+ private string history;
+ public string History
+ {
+ get
+ {
+ return history;
+ }
+ set
+ {
+ history = value;
+ PropertyChanged(this, new PropertyChangedEventArgs("History"));
+ }
+ }
+
+ private string question;
+ public string Question
+ {
+ get
+ {
+ return question;
+ }
+ set
+ {
+ question = value;
+ PropertyChanged(this, new PropertyChangedEventArgs("Question"));
+ }
+ }
+
+ public GPTConfig()
+ {
+ this.History = this.Question = string.Empty;
+ }
+ }
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
new file mode 100644
index 0000000000000000000000000000000000000000..9051146615742ce8444badbd6e0c182dc8a11592
--- /dev/null
+++ b/MainWindow.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4b16ebf0d94bc39d7118934a58767040829c8c69
--- /dev/null
+++ b/MainWindow.xaml.cs
@@ -0,0 +1,152 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+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;
+
+namespace chatgpt_LKZ4251
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public GPTConfig Config;
+
+ private byte[] l;
+
+ private Random random;
+
+ private long id;
+
+ private static string DefaultTitle = "chagpt-木子李(此工具由木子李提供,使用了3.5GPT接口实现,可以联合上下文提问!联系方式:wx LKZ4251)";
+ public MainWindow()
+ {
+ InitializeComponent();
+ this.Config = new GPTConfig();
+ this.DataContext = this.Config;
+ this.l = new byte[10240];
+ this.random = new Random();
+ this.id = this.random.Next();
+ this.Title = DefaultTitle;
+ }
+
+ private void HTTPRequestGPT1()
+ {
+ HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(new Uri("https://api.aichatos.cloud/api/generateStream"));
+ httpWebRequest.Method = "POST";
+ httpWebRequest.Accept = "application/json, text/plain, */*";
+ httpWebRequest.ContentType = "application/json";
+ httpWebRequest.Headers.Add("Accept-Encoding", "gzip, deflate, br");
+ httpWebRequest.Headers.Add("Accept-Language", "zh-CN,zh;q=0.9");
+ httpWebRequest.Headers.Add("Origin", "https://dev.yqcloud.top");
+ httpWebRequest.Headers.Add("Aec-ch-ua", "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not: A - Brand\";v=\"99\"");
+ httpWebRequest.Headers.Add("Sec-Ch-Ua", "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"");
+ httpWebRequest.Headers.Add("Sec-Ch-Ua-Mobile", "?0");
+ httpWebRequest.Headers.Add("Sec-ch-ua-platform", "\"Windows\"");
+ httpWebRequest.Headers.Add("Sec-Fetch-Dest", "empty");
+ httpWebRequest.Headers.Add("Sec-Fetch-Mode", "cors");
+ httpWebRequest.Headers.Add("Sec-Fetch-Site", "cross-site");
+ httpWebRequest.Referer = "https://dev.yqcloud.top/";
+ httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
+ httpWebRequest.Host = "api.aichatos.cloud";
+ Stream requestStream = httpWebRequest.GetRequestStream();
+ string text = " {\"prompt\":\"" + this.Config.Question + "\",\"userId\":\"#/chat/" + id + "\",\"network\":true,\"system\":\"\",\"withoutContext\":false,\"stream\":false}";
+ //JObject val = JObject.Parse(text);
+ //val["prompt"] = JToken.op_Implicit(content);
+ //text = ((object)val).ToString();
+ byte[] bytes = Encoding.UTF8.GetBytes(text);
+ requestStream.Write(bytes, 0, bytes.Length);
+ requestStream.Dispose();
+ WebResponse response = httpWebRequest.GetResponse();
+ Stream responseStream = response.GetResponseStream();
+ int num = 0;
+ int num2 = 0;
+ int num3 = 0;
+ this.Config.History += $"\nChatGPT:\n";
+ do
+ {
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ num2 = responseStream.Read(l, num, 10240 - num);
+ num += num2;
+ if (num - num3 >= 3)
+ {
+ this.Config.History += Encoding.UTF8.GetString(l, num3, num - num3);
+ this.sv.ScrollToBottom();
+ num3 += num - num3;
+ }
+ }));
+ Thread.Sleep(10);
+ }
+ while (num2 != 0);
+ this.Config.History += "\n";
+ this.Config.Question = string.Empty;
+
+ this.Dispatcher.Invoke(new Action(delegate
+ {
+ this.tbQ.IsReadOnly = false;
+ this.btnNew.IsEnabled = this.btnClear.IsEnabled = this.btnSend.IsEnabled = true;
+ this.Title = DefaultTitle;
+ }));
+ }
+
+ private void btnSend_Click(object sender, RoutedEventArgs e)
+ {
+ this.sendQuestion();
+ }
+
+ private void tbQ_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ this.sendQuestion();
+ }
+ }
+
+ private void sendQuestion()
+ {
+ if (string.IsNullOrEmpty(this.Config.Question)) return;
+ this.tbH.Focus();
+ ServicePointManager.Expect100Continue = true;
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+ this.Config.History += $"\n你:\n{this.Config.Question}\n";
+ this.tbQ.IsReadOnly = true;
+ this.btnNew.IsEnabled = this.btnClear.IsEnabled = this.btnSend.IsEnabled = false;
+ this.Title = "ChatGPT回答中,请稍候";
+ Thread thread = new Thread(new ThreadStart(HTTPRequestGPT1));
+ thread.IsBackground = true;
+ thread.Start();
+ }
+
+ private void btnClear_Click(object sender, RoutedEventArgs e)
+ {
+ if(MessageBox.Show("您确定要清空吗?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
+ {
+ this.Config.History = string.Empty;
+ }
+ }
+
+ private void btnNew_Click(object sender, RoutedEventArgs e)
+ {
+ if (MessageBox.Show("开始新的对话后上下文将被清空,您确定继续吗?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
+ {
+ this.Config.History = string.Empty;
+ this.id = random.Next();
+ }
+ }
+ }
+}
diff --git a/Program.cs b/Program.cs
deleted file mode 100644
index e5789f9bd7bc9d1cc9e335df92eba530202f4a34..0000000000000000000000000000000000000000
--- a/Program.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.IO;
-using System.Net;
-using System.Text;
-using Newtonsoft.Json.Linq;
-
-internal class Program
-{
- private static byte[] l = new byte[10240];
-
- private static Random random = new Random();
-
- private static long id = random.Next();
-
- private static void Main(string[] args)
- {
- id = random.Next();
- ServicePointManager.Expect100Continue = true;
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
- Console.WriteLine("此工具由木子李提供,使用了3.5GPT接口实现,可以联合上下文提问!");
- Console.WriteLine("联系方式:wx LKZ4251 ");
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("* * * ************\r\n* * * * \r\n* * * * \r\n* ** * \r\n* * * * \r\n* * * * \r\n*********** * * ************ ");
- Console.ForegroundColor = ConsoleColor.White;
- while (true)
- {
- Console.WriteLine("请输入需要请问的问题:");
- string content = Console.ReadLine();
- Console.WriteLine("下面是答案");
- Console.ForegroundColor = ConsoleColor.Cyan;
- HTTPRequestGPT1(content);
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine();
- }
- }
-
- private static void HTTPRequestGPT1(string content)
- {
- HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(new Uri("https://api.aichatos.cloud/api/generateStream"));
- httpWebRequest.Method = "POST";
- httpWebRequest.Accept = "application/json, text/plain, */*";
- httpWebRequest.ContentType = "application/json";
- httpWebRequest.Headers.Add("Accept-Encoding", "gzip, deflate, br");
- httpWebRequest.Headers.Add("Accept-Language", "zh-CN,zh;q=0.9");
- httpWebRequest.Headers.Add("Origin", "https://dev.yqcloud.top");
- httpWebRequest.Headers.Add("Aec-ch-ua", "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not: A - Brand\";v=\"99\"");
- httpWebRequest.Headers.Add("Sec-Ch-Ua", "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"");
- httpWebRequest.Headers.Add("Sec-Ch-Ua-Mobile", "?0");
- httpWebRequest.Headers.Add("Sec-ch-ua-platform", "\"Windows\"");
- httpWebRequest.Headers.Add("Sec-Fetch-Dest", "empty");
- httpWebRequest.Headers.Add("Sec-Fetch-Mode", "cors");
- httpWebRequest.Headers.Add("Sec-Fetch-Site", "cross-site");
- httpWebRequest.Referer = "https://dev.yqcloud.top/";
- httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
- httpWebRequest.Host = "api.aichatos.cloud";
- Stream requestStream = httpWebRequest.GetRequestStream();
- string text = " {\"prompt\":\"\",\"userId\":\"#/chat/" + id + "\",\"network\":true,\"system\":\"\",\"withoutContext\":false,\"stream\":false}";
- JObject val = JObject.Parse(text);
- val["prompt"] = JToken.op_Implicit(content);
- text = ((object)val).ToString();
- byte[] bytes = Encoding.UTF8.GetBytes(text);
- requestStream.Write(bytes, 0, bytes.Length);
- requestStream.Dispose();
- WebResponse response = httpWebRequest.GetResponse();
- Stream responseStream = response.GetResponseStream();
- int num = 0;
- int num2 = 0;
- int num3 = 0;
- do
- {
- num2 = responseStream.Read(l, num, 10240 - num);
- num += num2;
- if (num - num3 >= 3)
- {
- Console.Write(Encoding.UTF8.GetString(l, num3, num - num3));
- num3 += num - num3;
- }
- }
- while (num2 != 0);
- }
-}
diff --git a/chatgpt-LKZ4251.csproj b/chatgpt-LKZ4251.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..95c8c67ef9a2f490568ec04819b06b947ec4b9d4
--- /dev/null
+++ b/chatgpt-LKZ4251.csproj
@@ -0,0 +1,21 @@
+
+
+
+ WinExe
+ net6.0-windows
+ chatgpt_LKZ4251
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chatgpt-LKZ4251.csproj.user b/chatgpt-LKZ4251.csproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..644b0a6fd0475f9a0a9c31f1ad279b321cde0085
--- /dev/null
+++ b/chatgpt-LKZ4251.csproj.user
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Designer
+
+
+
+
+ Designer
+
+
+
\ No newline at end of file
diff --git a/chatgpt-LKZ4251.sln b/chatgpt-LKZ4251.sln
new file mode 100644
index 0000000000000000000000000000000000000000..daff333cc03adbf40aad1c0a53914f9427140257
--- /dev/null
+++ b/chatgpt-LKZ4251.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34018.315
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "chatgpt-LKZ4251", "chatgpt-LKZ4251.csproj", "{3B8FA47A-381F-42F3-A799-42527A021096}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3B8FA47A-381F-42F3-A799-42527A021096}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B8FA47A-381F-42F3-A799-42527A021096}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B8FA47A-381F-42F3-A799-42527A021096}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B8FA47A-381F-42F3-A799-42527A021096}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {79FD1250-0240-4932-A0EB-59ACE4B80B05}
+ EndGlobalSection
+EndGlobal