diff --git a/README.md b/README.md
index 3011e52..21b54c8 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,34 @@
-# YANG Chat
-**记得给我的项目点个⭐️Starred哦,让我更有动力维护它**
-
-**QQ群:568338055获取最新密钥**
-
-本项目于2023年3月4日启动,并发布第一个测试版本。
-
-这是一项AI聊天程序,本程序现已接入OpenAI ChatGPT API,
-
-您可以通过本程序帮助您写代码,写文章,以及提问。
-
-严禁将本项目涉及违法违规以及政治领域,程序将秉持公平公正客观的原则回答您所提出的问题。
-
-后期我们将为程序推出更多功能,敬请期待。
-
-**本项目已经转入QT开发,发布V6.0正式版本**
-
-**安卓版本开发完成,欢迎下载测试**
-
-https://github.com/JasonYANG170/YANG-Chat-Android
-# 使用方法
-1.在release区下载msi文件并安装。
-
-2.输入开放测试密钥73838(不定期更新,加群获取最新密钥)。
-
-3.在输入框输入您的问题。
-# 程序截图
-**V1.0.0**
-
-![屏幕截图(805)](https://user-images.githubusercontent.com/39414350/222898309-9541e3be-34a5-4def-a66e-3974b6e8c329.png)
-
-**V5.1.0**
-
-![屏幕截图(576)](https://user-images.githubusercontent.com/39414350/236625151-90034fe9-a4ff-4060-93cb-d4d2cf95bf50.png)
+# YANG Chat
+**记得给我的项目点个⭐️Starred哦,让我更有动力维护它**
+
+**QQ群:568338055获取最新密钥**
+
+本项目于2023年3月4日启动,并发布第一个测试版本。
+
+这是一项AI聊天程序,本程序现已接入OpenAI ChatGPT API,
+
+您可以通过本程序帮助您写代码,写文章,以及提问。
+
+严禁将本项目涉及违法违规以及政治领域,程序将秉持公平公正客观的原则回答您所提出的问题。
+
+后期我们将为程序推出更多功能,敬请期待。
+
+**本项目已经转入QT开发,发布V6.0正式版本**
+
+**安卓版本开发完成,欢迎下载测试**
+
+https://github.com/JasonYANG170/YANG-Chat-Android
+# 使用方法
+1.在release区下载msi文件并安装。
+
+2.输入开放测试密钥73838(不定期更新,加群获取最新密钥)。
+
+3.在输入框输入您的问题。
+# 程序截图
+**V1.0.0**
+
+![屏幕截图(805)](https://user-images.githubusercontent.com/39414350/222898309-9541e3be-34a5-4def-a66e-3974b6e8c329.png)
+
+**V5.1.0**
+
+![屏幕截图(576)](https://user-images.githubusercontent.com/39414350/236625151-90034fe9-a4ff-4060-93cb-d4d2cf95bf50.png)
diff --git a/YANG Chat.sln b/YANG Chat.sln
index d8ffd76..27b73bd 100644
--- a/YANG Chat.sln
+++ b/YANG Chat.sln
@@ -1,31 +1,31 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.4.33403.182
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YANG Chat", "YANG Chat\YANG Chat.vcxproj", "{105FD556-55C2-460A-B7CA-F0E2F437A770}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x64.ActiveCfg = Debug|x64
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x64.Build.0 = Debug|x64
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x86.ActiveCfg = Debug|Win32
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x86.Build.0 = Debug|Win32
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x64.ActiveCfg = Release|x64
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x64.Build.0 = Release|x64
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x86.ActiveCfg = Release|Win32
- {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {9EEA59B3-CEBC-4A50-BA95-E7C0E4CFBFF8}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33403.182
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YANG Chat", "YANG Chat\YANG Chat.vcxproj", "{105FD556-55C2-460A-B7CA-F0E2F437A770}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x64.ActiveCfg = Debug|x64
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x64.Build.0 = Debug|x64
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x86.ActiveCfg = Debug|Win32
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Debug|x86.Build.0 = Debug|Win32
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x64.ActiveCfg = Release|x64
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x64.Build.0 = Release|x64
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x86.ActiveCfg = Release|Win32
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {9EEA59B3-CEBC-4A50-BA95-E7C0E4CFBFF8}
+ EndGlobalSection
+EndGlobal
diff --git a/YANG-Chat.pro.user b/YANG-Chat.pro.user
new file mode 100644
index 0000000..1b233d9
--- /dev/null
+++ b/YANG-Chat.pro.user
@@ -0,0 +1,269 @@
+
+
+
+
+
+ EnvironmentId
+ {5913d737-a7b3-40d5-81b3-ef43144c2778}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 8
+ false
+
+
+
+ true
+
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop Qt 6.8.0 MinGW 64-bit
+ Desktop Qt 6.8.0 MinGW 64-bit
+ qt.qt6.dev.win64_mingw_kit
+ 1
+ 0
+ 0
+
+ 0
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Debug
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ 构建
+ 构建
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ 清除
+ 清除
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ 构建
+ 构建
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ 清除
+ 清除
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Profile
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ 构建
+ 构建
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ 清除
+ 清除
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+ true
+ true
+ 0
+ true
+
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+ YANG-Chat2
+ Qt4ProjectManager.Qt4RunConfiguration:E:/C++-QT/YANG-Chat/YANG-Chat.pro
+ E:/C++-QT/YANG-Chat/YANG-Chat.pro
+ true
+ true
+ true
+ true
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/YANG-ChatForMFC/YANG Chat.cpp b/YANG-ChatForMFC/YANG Chat.cpp
new file mode 100644
index 0000000..f95e869
--- /dev/null
+++ b/YANG-ChatForMFC/YANG Chat.cpp
@@ -0,0 +1,108 @@
+
+// YANG Chat.cpp: 定义应用程序的类行为。
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "YANG Chat.h"
+#include "YANG ChatDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CYANGChatApp
+
+BEGIN_MESSAGE_MAP(CYANGChatApp, CWinApp)
+ ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CYANGChatApp 构造
+
+CYANGChatApp::CYANGChatApp()
+{
+ // 支持重新启动管理器
+ m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+ // TODO: 在此处添加构造代码,
+ // 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的 CYANGChatApp 对象
+
+CYANGChatApp theApp;
+
+
+// CYANGChatApp 初始化
+
+BOOL CYANGChatApp::InitInstance()
+{
+ AfxInitRichEdit2();
+ // 如果一个运行在 Windows XP 上的应用程序清单指定要
+ // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
+ //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // 将它设置为包括所有要在应用程序中使用的
+ // 公共控件类。
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+ InitCommonControlsEx(&InitCtrls);
+
+ CWinApp::InitInstance();
+
+
+ AfxEnableControlContainer();
+
+ // 创建 shell 管理器,以防对话框包含
+ // 任何 shell 树视图控件或 shell 列表视图控件。
+ CShellManager *pShellManager = new CShellManager;
+
+ // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
+ CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+ // 标准初始化
+ // 如果未使用这些功能并希望减小
+ // 最终可执行文件的大小,则应移除下列
+ // 不需要的特定初始化例程
+ // 更改用于存储设置的注册表项
+ // TODO: 应适当修改该字符串,
+ // 例如修改为公司或组织名
+ SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
+
+ CYANGChatDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: 在此放置处理何时用
+ // “确定”来关闭对话框的代码
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: 在此放置处理何时用
+ // “取消”来关闭对话框的代码
+ }
+ else if (nResponse == -1)
+ {
+ TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
+ TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
+ }
+
+ // 删除上面创建的 shell 管理器。
+ if (pShellManager != nullptr)
+ {
+ delete pShellManager;
+ }
+
+#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
+ ControlBarCleanUp();
+#endif
+
+ // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
+ // 而不是启动应用程序的消息泵。
+ return FALSE;
+}
+
diff --git a/YANG-ChatForMFC/YANG Chat.h b/YANG-ChatForMFC/YANG Chat.h
new file mode 100644
index 0000000..5e1075d
--- /dev/null
+++ b/YANG-ChatForMFC/YANG Chat.h
@@ -0,0 +1,32 @@
+
+// YANG Chat.h: PROJECT_NAME 应用程序的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error "在包含此文件之前包含 'pch.h' 以生成 PCH"
+#endif
+
+#include "resource.h" // 主符号
+
+
+// CYANGChatApp:
+// 有关此类的实现,请参阅 YANG Chat.cpp
+//
+
+class CYANGChatApp : public CWinApp
+{
+public:
+ CYANGChatApp();
+
+// 重写
+public:
+ virtual BOOL InitInstance();
+
+// 实现
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CYANGChatApp theApp;
diff --git a/YANG-ChatForMFC/YANG Chat.vcxproj b/YANG-ChatForMFC/YANG Chat.vcxproj
new file mode 100644
index 0000000..52d9539
--- /dev/null
+++ b/YANG-ChatForMFC/YANG Chat.vcxproj
@@ -0,0 +1,220 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 17.0
+ {105FD556-55C2-460A-B7CA-F0E2F437A770}
+ MFCProj
+ YANGChat
+ 10.0
+
+
+
+ Application
+ true
+ v143
+ Unicode
+ Dynamic
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+ Dynamic
+
+
+ Application
+ true
+ v143
+ Unicode
+ Dynamic
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+ Dynamic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+ false
+ C:\Users\qw200\Documents\json\include;$(IncludePath)
+ C:\Users\qw200\Documents\json\lib;$(LibraryPath)
+
+
+
+ Use
+ Level3
+ true
+ _WINDOWS;_DEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+
+
+ false
+ true
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ _DEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+
+
+ false
+ true
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ _DEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ true
+ true
+ WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+ true
+ true
+
+
+ false
+ true
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ NDEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ true
+ true
+ _WINDOWS;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+ true
+ true
+ jsoncpp.lib
+
+
+ false
+ true
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ NDEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/YANG-ChatForMFC/YANG Chat.vcxproj.filters b/YANG-ChatForMFC/YANG Chat.vcxproj.filters
new file mode 100644
index 0000000..cb4a1a2
--- /dev/null
+++ b/YANG-ChatForMFC/YANG Chat.vcxproj.filters
@@ -0,0 +1,69 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+
+
+ 资源文件
+
+
+
+
+ 资源文件
+
+
+
+
+ 资源文件
+
+
+
\ No newline at end of file
diff --git a/YANG-ChatForMFC/YANG ChatDlg.cpp b/YANG-ChatForMFC/YANG ChatDlg.cpp
new file mode 100644
index 0000000..c204791
--- /dev/null
+++ b/YANG-ChatForMFC/YANG ChatDlg.cpp
@@ -0,0 +1,314 @@
+
+// YANG ChatDlg.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "YANG Chat.h"
+#include "YANG ChatDlg.h"
+#include "afxdialogex.h"
+#include "yangchatmain.h"
+#include "afxdialogex.h"
+#include
+#include
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+CString edition = _T("V1.0.0");
+
+// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
+// pass1 消息处理程序
+#include
+CString CYANGChatDlg::UTF8ToUnicode2(char* UTF8)
+{
+
+ DWORD dwUnicodeLen; //转换后Unicode的长度
+ TCHAR* pwText; //保存Unicode的指针
+ CString strUnicode; //返回值
+ //获得转换后的长度,并分配内存
+ dwUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, NULL, 0);
+ pwText = new TCHAR[dwUnicodeLen];
+ if (!pwText)
+ {
+ return strUnicode;
+ }
+ //转为Unicode
+ MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, pwText, dwUnicodeLen);
+ //转为CString
+ strUnicode.Format(_T("%s"), pwText);
+ //清除内存
+ delete[]pwText;
+ //返回转换好的Unicode字串
+ return strUnicode;
+}
+
+
+class CAboutDlg : public CDialogEx
+{
+public:
+ CAboutDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_ABOUTBOX };
+#endif
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+// 实现
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CYANGChatDlg 对话框
+
+
+
+CYANGChatDlg::CYANGChatDlg(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_YANG_CHAT_DIALOG, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CYANGChatDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CYANGChatDlg, CDialogEx)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_BN_CLICKED(IDC_BUTTON1, &CYANGChatDlg::OnBnClickedButton1)
+END_MESSAGE_MAP()
+
+
+// CYANGChatDlg 消息处理程序
+
+BOOL CYANGChatDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // 将“关于...”菜单项添加到系统菜单中。
+
+ // IDM_ABOUTBOX 必须在系统命令范围内。
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ if (pSysMenu != nullptr)
+ {
+ BOOL bNameValid;
+ CString strAboutMenu;
+ bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
+ ASSERT(bNameValid);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+ }
+
+ // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
+ // 执行此操作
+ SetIcon(m_hIcon, TRUE); // 设置大图标
+ SetIcon(m_hIcon, FALSE); // 设置小图标
+
+ // TODO: 在此添加额外的初始化代码
+
+ return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
+}
+
+void CYANGChatDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ CDialogEx::OnSysCommand(nID, lParam);
+ }
+}
+
+// 如果向对话框添加最小化按钮,则需要下面的代码
+// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
+// 这将由框架自动完成。
+
+void CYANGChatDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // 用于绘制的设备上下文
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);
+
+ // 使图标在工作区矩形中居中
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // 绘制图标
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialogEx::OnPaint();
+ }
+
+ CInternetSession session(_T("HttpClient"));
+ TCHAR* url = _T("https://api.vvhan.com/api/qqsc?key=8f2807e6a7ebfbc168f4a1ecad286283");
+ CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
+ DWORD dwStatusCode;
+ pfile->QueryInfoStatusCode(dwStatusCode);
+ if (dwStatusCode == HTTP_STATUS_OK)
+ {
+ CString content;
+ CString data;
+ while (pfile->ReadString(data))
+ {
+ content += data;
+ }
+ char* pch;
+ pch = new char[content.GetLength() * sizeof(TCHAR) + 1];
+ memcpy(pch, content, content.GetLength() * sizeof(TCHAR));
+ content = UTF8ToUnicode2(pch);//转换编码,不然就乱码了
+ //AfxMessageBox(content);
+ //CString content2;
+ // content2 = content.Left(content.Find('r'));
+ // content2 = content2.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+ //CString contenta;
+ // contenta = content.Left(content.Find('a'));
+ //contenta = content.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+
+ CString str = content;
+ Json::Reader reader;
+ Json::Value root;
+ CString temp;
+ CString temp2;
+ CString temp3;
+ CString temp4;
+ CString temp5;
+ CString temp6;
+ USES_CONVERSION;
+ char* cJson = T2A(str.GetBuffer(0));
+ str.ReleaseBuffer();
+ if (reader.parse(cJson, root)) {
+ temp = root["text"].asCString();
+ //temp2 = root["data"][0]["desc"].asCString();
+ if (edition == temp) {
+ //MessageBox(temp);
+ }
+ else {
+ CString tp = _T("已发布新版本\"");
+ CString tp2 = _T("\",为确保稳定性,请尽快更新!");
+ CString tp3 = tp + temp + tp2;
+ MessageBox(tp3);
+ }
+ //MessageBox(temp);
+
+ }
+
+ }
+ pfile->Close();
+ delete pfile;
+ session.Close();
+}
+
+//当用户拖动最小化窗口时系统调用此函数取得光标
+//显示。
+HCURSOR CYANGChatDlg::OnQueryDragIcon()
+{
+ return static_cast(m_hIcon);
+}
+
+
+
+
+void CYANGChatDlg::OnBnClickedButton1()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ int num2;
+ // TODO: 在此添加控件通知处理程序代码
+ CInternetSession session(_T("HttpClient"));
+ TCHAR* url = _T("https://api.vvhan.com/api/qqsc?key=492fa5701060de4b2f30e08cbbe2defe");
+ CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
+ DWORD dwStatusCode;
+ pfile->QueryInfoStatusCode(dwStatusCode);
+ if (dwStatusCode == HTTP_STATUS_OK)
+ {
+ CString content;
+ CString data;
+ while (pfile->ReadString(data))
+ {
+ content += data;
+ }
+ char* pch;
+ pch = new char[content.GetLength() * sizeof(TCHAR) + 1];
+ memcpy(pch, content, content.GetLength() * sizeof(TCHAR));
+ content = UTF8ToUnicode2(pch);//转换编码,不然就乱码了
+ //AfxMessageBox(content);
+ //CString content2;
+ // content2 = content.Left(content.Find('r'));
+ // content2 = content2.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+ //CString contenta;
+ // contenta = content.Left(content.Find('a'));
+ //contenta = content.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+
+ CString str = content;
+ Json::Reader reader;
+ Json::Value root;
+ CString temp;
+ CString temp2;
+ CString temp3;
+ CString temp4;
+ CString temp5;
+ CString temp6;
+ USES_CONVERSION;
+ char* cJson = T2A(str.GetBuffer(0));
+ str.ReleaseBuffer();
+ if (reader.parse(cJson, root)) {
+ temp = root["text"].asCString();
+ //temp2 = root["data"][0]["desc"].asCString();
+ // MessageBox(temp);
+ num2 = _ttoi(temp);
+ }
+
+ }
+ pfile->Close();
+ delete pfile;
+ session.Close();
+
+ CString passw1;
+ GetDlgItem(IDC_EDIT1)->GetWindowText(passw1);
+ int num = _ttoi(passw1);
+ if (num == num2) {
+ //this->ShowWindow(SW_HIDE);
+ yangchatmain dlg;
+ dlg.DoModal();
+ }
+ else {
+ MessageBox(_T("密码错误,请重新输入或寻求开发者帮助。"));
+ }
+
+
+}
diff --git a/YANG-ChatForMFC/YANG ChatDlg.h b/YANG-ChatForMFC/YANG ChatDlg.h
new file mode 100644
index 0000000..da97faa
--- /dev/null
+++ b/YANG-ChatForMFC/YANG ChatDlg.h
@@ -0,0 +1,37 @@
+
+// YANG ChatDlg.h: 头文件
+//
+
+#pragma once
+
+
+// CYANGChatDlg 对话框
+class CYANGChatDlg : public CDialogEx
+{
+// 构造
+public:
+ CYANGChatDlg(CWnd* pParent = nullptr); // 标准构造函数
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_YANG_CHAT_DIALOG };
+#endif
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+
+// 实现
+protected:
+ HICON m_hIcon;
+
+ // 生成的消息映射函数
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ CString UTF8ToUnicode2(char* UTF8);
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnBnClickedButton1();
+};
diff --git a/YANG-ChatForMFC/YANGChat.rc b/YANG-ChatForMFC/YANGChat.rc
new file mode 100644
index 0000000..5ca2031
Binary files /dev/null and b/YANG-ChatForMFC/YANGChat.rc differ
diff --git a/YANG-ChatForMFC/framework.h b/YANG-ChatForMFC/framework.h
new file mode 100644
index 0000000..fac8b6c
--- /dev/null
+++ b/YANG-ChatForMFC/framework.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
+
+// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
+#define _AFX_ALL_WARNINGS
+
+#include // MFC 核心组件和标准组件
+#include // MFC 扩展
+
+
+#include // MFC 自动化类
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include // MFC 支持功能区和控制条
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/YANG-ChatForMFC/pch.cpp b/YANG-ChatForMFC/pch.cpp
new file mode 100644
index 0000000..db1a479
--- /dev/null
+++ b/YANG-ChatForMFC/pch.cpp
@@ -0,0 +1,5 @@
+// pch.cpp: 与预编译标头对应的源文件
+
+#include "pch.h"
+
+// 当使用预编译的头时,需要使用此源文件,编译才能成功。
diff --git a/YANG-ChatForMFC/pch.h b/YANG-ChatForMFC/pch.h
new file mode 100644
index 0000000..aa4549e
--- /dev/null
+++ b/YANG-ChatForMFC/pch.h
@@ -0,0 +1,13 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+// 添加要在此处预编译的标头
+#include "framework.h"
+
+#endif //PCH_H
diff --git a/YANG-ChatForMFC/res/YANG Chat.ico b/YANG-ChatForMFC/res/YANG Chat.ico
new file mode 100644
index 0000000..d56fbcd
Binary files /dev/null and b/YANG-ChatForMFC/res/YANG Chat.ico differ
diff --git a/YANG-ChatForMFC/res/YANGChat.rc2 b/YANG-ChatForMFC/res/YANGChat.rc2
new file mode 100644
index 0000000..a7e2043
Binary files /dev/null and b/YANG-ChatForMFC/res/YANGChat.rc2 differ
diff --git a/YANG-ChatForMFC/resource.h b/YANG-ChatForMFC/resource.h
new file mode 100644
index 0000000..eccbb29
--- /dev/null
+++ b/YANG-ChatForMFC/resource.h
@@ -0,0 +1,26 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ 生成的包含文件。
+// 供 YANGChat.rc 使用
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_YANG_CHAT_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDD_DIALOG1 129
+#define IDC_BUTTON1 1000
+#define IDC_RICHEDIT21 1001
+#define IDC_EDIT1 1002
+#define IDC_BUTTON2 1003
+#define IDC_BUTTON3 1006
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 132
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1007
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/YANG-ChatForMFC/targetver.h b/YANG-ChatForMFC/targetver.h
new file mode 100644
index 0000000..47ab241
--- /dev/null
+++ b/YANG-ChatForMFC/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include
diff --git a/YANG-ChatForMFC/yangchatmain.cpp b/YANG-ChatForMFC/yangchatmain.cpp
new file mode 100644
index 0000000..c687bbf
--- /dev/null
+++ b/YANG-ChatForMFC/yangchatmain.cpp
@@ -0,0 +1,162 @@
+// yangchatmain.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "YANG Chat.h"
+#include "afxdialogex.h"
+#include "yangchatmain.h"
+#include
+#include
+#pragma warning(disable:4996)
+// yangchatmain 对话框
+
+IMPLEMENT_DYNAMIC(yangchatmain, CDialogEx)
+
+yangchatmain::yangchatmain(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG1, pParent)
+{
+
+}
+
+yangchatmain::~yangchatmain()
+{
+}
+
+void yangchatmain::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(yangchatmain, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON1, &yangchatmain::OnBnClickedButton1)
+
+END_MESSAGE_MAP()
+
+
+// yangchatmain 消息处理程序
+
+
+
+// pass1 消息处理程序
+#include
+CString yangchatmain::UTF8ToUnicode25(char* UTF8)
+{
+
+ DWORD dwUnicodeLen; //转换后Unicode的长度
+ TCHAR* pwText; //保存Unicode的指针
+ CString strUnicode; //返回值
+ //获得转换后的长度,并分配内存
+ dwUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, NULL, 0);
+ pwText = new TCHAR[dwUnicodeLen];
+ if (!pwText)
+ {
+ return strUnicode;
+ }
+ //转为Unicode
+ MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, pwText, dwUnicodeLen);
+ //转为CString
+ strUnicode.Format(_T("%s"), pwText);
+ //清除内存
+ delete[]pwText;
+ //返回转换好的Unicode字串
+ return strUnicode;
+}
+#define _UNICODE
+#include
+
+
+void yangchatmain::OnBnClickedButton1()
+{
+ CString url2;
+ GetDlgItem(IDC_EDIT1)->GetWindowText(url2);
+ wchar_t* unicodeStr = url2.GetBuffer();
+ int unicodeLen = url2.GetLength();
+
+ std::string utf8Str;
+ for (int i = 0; i < unicodeLen; i++) {
+ wchar_t ch = unicodeStr[i];
+ if (ch < 0x80) {
+ utf8Str += static_cast(ch);
+ }
+ else if (ch < 0x800) {
+ utf8Str += static_cast((ch >> 6) | 0xc0);
+ utf8Str += static_cast((ch & 0x3f) | 0x80);
+ }
+ else {
+ utf8Str += static_cast((ch >> 12) | 0xe0);
+ utf8Str += static_cast(((ch >> 6) & 0x3f) | 0x80);
+ utf8Str += static_cast((ch & 0x3f) | 0x80);
+ }
+ }
+
+ CString encodedUrl;
+ int utf8Len = utf8Str.length();
+ for (int i = 0; i < utf8Len; i++) {
+ unsigned char ch = utf8Str[i];
+ char hexStr[4];
+ sprintf_s(hexStr, 4, "%%%02X", ch);
+ encodedUrl += CString(hexStr);
+
+ }
+ // TODO: 在此添加控件通知处理程序代码
+ int num2;
+ CString asd = _T("http://www.emmapi.com/chatgpt?text=");
+ CString asd1 = asd + encodedUrl;
+ // TODO: 在此添加控件通知处理程序代码
+ CInternetSession session(_T("HttpClient"));
+ TCHAR* url = asd1.GetBuffer();;//https://v1.apigpt.cn/?q=你好&apitype=sql
+ CHttpFile* pfile = (CHttpFile*)session.OpenURL(url);
+ DWORD dwStatusCode;
+ pfile->QueryInfoStatusCode(dwStatusCode);
+ if (dwStatusCode == HTTP_STATUS_OK)
+ {
+ CString content;
+ CString data;
+ while (pfile->ReadString(data))
+ {
+ content += data;
+ }
+ char* pch;
+ pch = new char[content.GetLength() * sizeof(TCHAR) + 1];
+ memcpy(pch, content, content.GetLength() * sizeof(TCHAR));
+ content = UTF8ToUnicode25(pch);//转换编码,不然就乱码了
+ //AfxMessageBox(content);
+ //CString content2;
+ // content2 = content.Left(content.Find('r'));
+ // content2 = content2.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+ //CString contenta;
+ // contenta = content.Left(content.Find('a'));
+ //contenta = content.Right(content.GetLength() - 1 - content.ReverseFind(':'));
+
+ CString str = content;
+ Json::Reader reader;
+ Json::Value root;
+ CString temp;
+ CString temp2;
+ CString temp3;
+ CString temp4;
+ CString temp5;
+ CString temp6;
+ USES_CONVERSION;
+ char* cJson = T2A(str.GetBuffer(0));
+ str.ReleaseBuffer();
+ if (reader.parse(cJson, root)) {
+ temp = root["text"].asCString();
+ CString chatgpt = _T("YANG Chat:\n") + temp;
+ SetDlgItemText(IDC_RICHEDIT21, chatgpt);
+ //temp2 = root["data"][0]["desc"].asCString();
+
+
+ }
+
+ }
+ pfile->Close();
+ delete pfile;
+ session.Close();
+
+
+
+
+}
+
diff --git a/YANG-ChatForMFC/yangchatmain.h b/YANG-ChatForMFC/yangchatmain.h
new file mode 100644
index 0000000..152c0aa
--- /dev/null
+++ b/YANG-ChatForMFC/yangchatmain.h
@@ -0,0 +1,27 @@
+#pragma once
+#include "afxdialogex.h"
+
+
+// yangchatmain 对话框
+
+class yangchatmain : public CDialogEx
+{
+ DECLARE_DYNAMIC(yangchatmain)
+
+public:
+ yangchatmain(CWnd* pParent = nullptr); // 标准构造函数
+ virtual ~yangchatmain();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG1 };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnBnClickedButton1();
+ CString UTF8ToUnicode25(char* UTF8);
+};
diff --git a/YANG-ChatForQT/YANG-Chat.pro b/YANG-ChatForQT/YANG-Chat.pro
new file mode 100644
index 0000000..8de424a
--- /dev/null
+++ b/YANG-ChatForQT/YANG-Chat.pro
@@ -0,0 +1,37 @@
+QT += core gui
+QT += network
+QT += core gui
+QT += core gui sql
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+
+# You can make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ dialog.cpp \
+ main.cpp \
+ mainwindow.cpp
+
+HEADERS += \
+ dialog.h \
+ mainwindow.h
+
+FORMS += \
+ dialog.ui \
+ mainwindow.ui
+
+TRANSLATIONS += \
+ YANG-Chat_zh_CN.ts
+CONFIG += lrelease
+CONFIG += embed_translations
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+RESOURCES += \
+ img.qrc
diff --git a/YANG-ChatForQT/YANG-Chat.pro.user b/YANG-ChatForQT/YANG-Chat.pro.user
new file mode 100644
index 0000000..66e71f9
--- /dev/null
+++ b/YANG-ChatForQT/YANG-Chat.pro.user
@@ -0,0 +1,263 @@
+
+
+
+
+
+ EnvironmentId
+ {5913d737-a7b3-40d5-81b3-ef43144c2778}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ false
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 8
+
+
+
+ true
+
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop Qt 6.6.0 MinGW 64-bit
+ Desktop Qt 6.6.0 MinGW 64-bit
+ qt.qt6.dev.win64_mingw_kit
+ 1
+ 0
+ 0
+
+ 0
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Debug
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+
+
+ 0
+ C:\Users\qw200\Documents\C or C++ for YANG\build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Profile
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+ clean
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ 0
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+ true
+ true
+ true
+
+ 2
+
+ Qt4ProjectManager.Qt4RunConfiguration:C:/Users/qw200/Documents/C or C++ for YANG/YANG-Chat/YANG-Chat.pro
+ C:/Users/qw200/Documents/C or C++ for YANG/YANG-Chat/YANG-Chat.pro
+ false
+ true
+ true
+ false
+ true
+ C:/Users/qw200/Documents/C or C++ for YANG/build-YANG-Chat-Desktop_Qt_6_6_0_MinGW_64_bit-Release
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git a/YANG-ChatForQT/YANG-Chat_zh_CN.qm b/YANG-ChatForQT/YANG-Chat_zh_CN.qm
new file mode 100644
index 0000000..8647e77
Binary files /dev/null and b/YANG-ChatForQT/YANG-Chat_zh_CN.qm differ
diff --git a/YANG-ChatForQT/YANG-Chat_zh_CN.ts b/YANG-ChatForQT/YANG-Chat_zh_CN.ts
new file mode 100644
index 0000000..e3c5fb9
--- /dev/null
+++ b/YANG-ChatForQT/YANG-Chat_zh_CN.ts
@@ -0,0 +1,45 @@
+
+
+
+
+ Dialog
+
+
+
+
+
+
+
+
+
+
+
+
+ MainWindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YANG-ChatForQT/dialog.cpp b/YANG-ChatForQT/dialog.cpp
new file mode 100644
index 0000000..af1e37e
--- /dev/null
+++ b/YANG-ChatForQT/dialog.cpp
@@ -0,0 +1,89 @@
+#include "dialog.h"
+#include "ui_dialog.h"
+#include
+
+
+#include "mainwindow.h"
+
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+Dialog::Dialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::Dialog)
+{
+ ui->setupUi(this);
+}
+
+Dialog::~Dialog()
+{
+ delete ui;
+}
+
+void Dialog::on_pushButton_clicked()
+{
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ QUrl url("https://api.vvhan.com/api/qqsc?key=492fa5701060de4b2f30e08cbbe2defe");
+ QNetworkRequest request(url);
+
+ // Set unsafe SSL configuration
+ QSslConfiguration config = request.sslConfiguration();
+ config.setPeerVerifyMode(QSslSocket::VerifyNone);
+ request.setSslConfiguration(config);
+
+ QNetworkReply *reply = manager->get(request);
+
+ // Connect to the finished signal
+ connect(reply, &QNetworkReply::finished, [=]() {
+
+ if (reply->error() == QNetworkReply::NoError) {
+ // Read the JSON data
+ QByteArray data = reply->readAll();
+
+ // Display the JSON data in a message box
+
+ // QMessageBox::information(this, "JSON Data", QString(data));
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(QString(data).toUtf8());
+ QJsonObject jsonObj = jsonDoc.object();
+
+ // 获取数据
+ QString answer = jsonObj["text"].toString();
+ if(answer=="75842"){
+ MainWindow w;
+ w.show();
+ }
+
+
+ } else {
+ // Display an error message
+
+ QMessageBox::warning(this, "Error", reply->errorString());
+
+ }
+
+ // Clean up
+ reply->deleteLater();
+ manager->deleteLater();
+ });
+}
+
diff --git a/YANG-ChatForQT/dialog.h b/YANG-ChatForQT/dialog.h
new file mode 100644
index 0000000..897541c
--- /dev/null
+++ b/YANG-ChatForQT/dialog.h
@@ -0,0 +1,25 @@
+#ifndef DIALOG_H
+#define DIALOG_H
+
+#include
+
+namespace Ui {
+class Dialog;
+}
+
+class Dialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit Dialog(QWidget *parent = nullptr);
+ ~Dialog();
+
+private slots:
+ void on_pushButton_clicked();
+
+private:
+ Ui::Dialog *ui;
+};
+
+#endif // DIALOG_H
diff --git a/YANG-ChatForQT/dialog.ui b/YANG-ChatForQT/dialog.ui
new file mode 100644
index 0000000..1f763fa
--- /dev/null
+++ b/YANG-ChatForQT/dialog.ui
@@ -0,0 +1,171 @@
+
+
+ Dialog
+
+
+
+ 0
+ 0
+ 618
+ 428
+
+
+
+ 您的捐赠是我更新的动力
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 380
+ 180
+
+
+
+
+ 380
+ 600
+
+
+
+ QWidget{background:rgb(170, 255, 255);border:2px groove gray;border-radius:30px;padding:2px 4px;border-style: outset;font: 16pt "华文琥珀";}
+
+
+
+
+ 10
+ 10
+ 171
+ 161
+
+
+
+ border-image: url(:/Desktop/39414350.jpg);
+
+
+
+
+
+
+
+
+ 190
+ 10
+ 181
+ 41
+
+
+
+ background-color: rgb(255, 255, 0);
+
+
+ <html><head/><body><p align="center">YANG-Chat</p></body></html>
+
+
+
+
+
+ 190
+ 60
+ 181
+ 111
+
+
+
+ <html><head/><body><p><span style=" font-size:10pt;">版本号:V6.1正式版</span></p><p><span style=" font-size:10pt;">项目已接入ChatGPT,</span></p><p><span style=" font-size:10pt;">如遇问题,请在GITHUB向我提出,</span></p><p><span style=" font-size:10pt;">我将会及时修复。</span></p></body></html>
+
+
+
+
+
+ 9
+ 180
+ 361
+ 221
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ padding:5px 5px;
+
+
+ <html><head/><body><p><span style=" font-size:14pt; font-weight:700;">开发者留言:</span></p><p><span style=" font-size:14pt;">我需要自费购买代理服务器与ChatGPT API,</span></p><p><span style=" font-size:14pt;">您的支持以确保我能继续更新下去,如果可以,请为我捐赠,</span></p><p><span style=" font-size:14pt;">我将用于购买代理服务器来确保程序稳定性,感谢。</span></p><p><span style=" font-size:14pt; font-weight:700;">Donate</span></p><p><span style=" font-size:14pt;">paypal:qw200477@163.com</span></p></body></html>
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ border-image: url(:/Desktop/6b73c9ae58aaad1b631e73f3dd357e9.jpg);
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 210
+
+
+
+ border-image: url(:/Desktop/a1bf4725bee712e6916866de02eb50f.png);
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YANG-ChatForQT/img.qrc b/YANG-ChatForQT/img.qrc
new file mode 100644
index 0000000..319fa6f
--- /dev/null
+++ b/YANG-ChatForQT/img.qrc
@@ -0,0 +1,7 @@
+
+
+ ../../../Desktop/39414350.jpg
+ ../../../Desktop/6b73c9ae58aaad1b631e73f3dd357e9.jpg
+ ../../../Desktop/a1bf4725bee712e6916866de02eb50f.png
+
+
diff --git a/YANG-ChatForQT/main.cpp b/YANG-ChatForQT/main.cpp
new file mode 100644
index 0000000..257c823
--- /dev/null
+++ b/YANG-ChatForQT/main.cpp
@@ -0,0 +1,32 @@
+#include "dialog.h"
+#include "mainwindow.h"
+
+#include
+
+#include
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ QTranslator translator;
+ const QStringList uiLanguages = QLocale::system().uiLanguages();
+ for (const QString &locale : uiLanguages) {
+ const QString baseName = "YANG-Chat_" + QLocale(locale).name();
+ if (translator.load(":/i18n/" + baseName)) {
+ a.installTranslator(&translator);
+ break;
+ }
+ }
+
+ MainWindow w;
+ w.show();
+ // Dialog ws;
+ // ws.show();
+
+ //获取可用桌面大小
+ // 禁止拖动窗口大小
+
+ return a.exec();
+}
diff --git a/YANG-ChatForQT/mainwindow.cpp b/YANG-ChatForQT/mainwindow.cpp
new file mode 100644
index 0000000..9ab64f2
--- /dev/null
+++ b/YANG-ChatForQT/mainwindow.cpp
@@ -0,0 +1,424 @@
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include
+
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+QString strall;
+QString discuss;
+QString ask;
+QString answer;
+bool checked1;
+bool checked2;
+QString rev;
+int pass=1;
+int passint;
+int sgin=0;
+QString ves="V7.0";
+QString updata="您现在使用的是内部版本,严禁传播至公共网络。(每位开发者认识的用户仅可以邀请2位开发者未知的用户,违者永久删除YANG数据库信息)\n\n更新日志:\n为帮助大家期末不挂科,我再次更新了本程序,祝大家期末顺利!\n1.全面升级为ChatGPT3.5版本,提升AI智力。\n2.加入全局数据库,使用本程序需要注册YANG程序账户。\n3.使用官方大数据模型,全面提升AI运行速度。\n4.使用POST请求,不再受url进行字数限制。";
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+ , ui(new Ui::MainWindow)
+{
+
+
+ // 连接数据库
+
+ // setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint); // 禁止最大化按钮
+ // setFixedSize(1400,1400); // 禁止拖动窗口大小
+ ui->setupUi(this);
+ // QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ // QUrl url("https://apis.jxcxin.cn/api/qqcollection?url=https://sharechain.qq.com/d0bad3425fe73b651253c3dea47c759d");
+ // QNetworkRequest request(url);
+
+ // Set unsafe SSL configuration
+ // QSslConfiguration config = request.sslConfiguration();
+ // config.setPeerVerifyMode(QSslSocket::VerifyNone);
+ // request.setSslConfiguration(config);
+
+ // QNetworkReply *reply = manager->get(request);
+
+ // Connect to the finished signal
+ // connect(reply, &QNetworkReply::finished, [=]() {
+
+ // if (reply->error() == QNetworkReply::NoError) {
+ // Read the JSON data
+ // QByteArray data = reply->readAll();
+
+ // Display the JSON data in a message box
+
+ // QMessageBox::information(this, "JSON Data", QString(data));
+ // QJsonDocument jsonDoc = QJsonDocument::fromJson(QString(data).toUtf8());
+ // QJsonObject jsonObj = jsonDoc.object();
+
+ // 获取数据
+ // QJsonObject jObj2 = jsonDoc["data"].toObject();
+ //获取jObj2中指定键的值(值对应的类型直接使用对应函数转)
+ // QString key1Val = jObj2["content"].toString();
+
+ ui->textBrowser->setPlainText("当前版本:YANG-Chat V7.0 Insider Preview\n\n公告:\n"+updata);
+
+
+ // } else {
+ // Display an error message
+
+ // QMessageBox::warning(this, "Error", reply->errorString());
+
+ // }
+
+ // Clean up
+ // reply->deleteLater();
+ // manager->deleteLater();
+
+ // }
+
+ QSettings *regDataSrc=new QSettings("HKEY_CURRENT_USER\\SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources", QSettings::NativeFormat);
+ regDataSrc->setValue("jasonyang17", "MySQL ODBC 8.0 ANSI Driver");//创建数据源
+ delete regDataSrc;
+ regDataSrc = nullptr;
+
+ //配置MySQL DSN
+ QString Key= QString("HKEY_CURRENT_USER\\SOFTWARE\\ODBC\\ODBC.INI\\%1").arg("jasonyang17");
+ qDebug()<setValue(".", "");
+ regConfigDSN->setValue("DESCRIPTION", "yangchat");//写描述项
+ QSettings *regMySQLDriverPath = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\ODBC\\ODBCINST.INI\\MySQL ODBC 8.0 ANSI Driver", QSettings::NativeFormat);
+ QString MySQLDrvPath = regMySQLDriverPath->value("Driver").toString();
+ regConfigDSN->setValue("Driver", MySQLDrvPath/*"D:\\Program Files\\MySQL\\Connector ODBC 8.0\\myodbc8a.dll"*/);//MySQL驱动程序路径
+ regConfigDSN->setValue("SERVER","mysql.sqlpub.com");//MySQL服务器地址
+ regConfigDSN->setValue("PORT",3306);//MySQL服务器端口号
+ regConfigDSN->setValue("UID", "jasonyang17");//用户名
+ regConfigDSN->setValue("PWD", "a0744a2eed110525");//密码
+ delete regConfigDSN;
+ regConfigDSN = nullptr;
+ delete regMySQLDriverPath;
+ regMySQLDriverPath = nullptr;
+
+ // );
+ QNetworkAccessManager *manager2 = new QNetworkAccessManager(this);
+ QUrl url2("https://apis.jxcxin.cn/api/qqcollection?url=https://sharechain.qq.com/8f2807e6a7ebfbc168f4a1ecad286283");
+ QNetworkRequest request2(url2);
+
+ // Set unsafe SSL configuration
+ QSslConfiguration config2 = request2.sslConfiguration();
+ config2.setPeerVerifyMode(QSslSocket::VerifyNone);
+ request2.setSslConfiguration(config2);
+
+ QNetworkReply *reply2 = manager2->get(request2);
+
+ // Connect to the finished signal
+ connect(reply2, &QNetworkReply::finished, [=]() {
+
+ if (reply2->error() == QNetworkReply::NoError) {
+ // Read the JSON data
+ QByteArray data2 = reply2->readAll();
+
+ // Display the JSON data in a message box
+
+ // QMessageBox::information(this, "JSON Data", QString(data));
+ QJsonDocument jsonDoc2 = QJsonDocument::fromJson(QString(data2).toUtf8());
+
+
+ // 获取数据
+ // 获取数据
+ QJsonObject jObj23 = jsonDoc2["data"].toObject();
+ //获取jObj2中指定键的值(值对应的类型直接使用对应函数转)
+ QString info2= jObj23["content"].toString();
+ if(info2!=ves){
+ QMessageBox::warning(this, "Error", "已发布新版本\""+info2+"\"。\n点击右上角发现新版本按钮下载最新版本。");
+ ui->pushButton_4->setText("发现新版本");
+ }else{
+
+
+ ui->pushButton_4->setText("暂无更新");
+ }
+
+ } else {
+ // Display an error message
+
+ QMessageBox::warning(this, "Error", reply2->errorString());
+
+ }
+
+ // Clean up
+ reply2->deleteLater();
+ manager2->deleteLater();
+
+ }
+
+
+
+ );
+
+
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::on_pushButton_clicked()
+{
+ if(checked2){
+ ui->textEdit->setPlainText("");
+ }
+ if(sgin==2){
+
+
+
+ ui->textBrowser->setPlainText("正在等待ChatGPT回答您的问题,请稍等......");
+ ask=ui->textEdit->toPlainText();
+ discuss=discuss+"Q:"+ask+"A:";
+ QString test2;"ESP8266控制电路数据上传:"+ask;
+ qDebug() << "ESP8266控制电路数据上传:"+ui->textEdit->toPlainText();;
+ // if(ask.length()>880){
+ // QMessageBox::warning(this, "Error", "长度超出限制,当前共"+QString::number(ask.length())+"字节\n请删除部分字符使其控制在880字节以内。");
+//}
+ if(checked1){
+ discuss="";
+ }
+
+ int num=0;
+
+ QNetworkAccessManager manager;
+
+ // 创建POST请求
+ QUrl url("https://aigptx.top/api/v1/ai/chatgpt/chat"); // 更换为你要访问的API地址
+ QNetworkRequest request(url);
+ QString accessToken = "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ2ODYiLCJlbWFpbCI6InF3MjAwNDc3QDE2My5jb20iLCJwdXJwb3NlIjoid2ViIiwiaWF0IjoxNjg2ODUwNjY4LCJleHAiOjE2ODgwNjAyNjh9.AddJmMGxYuYH1uIPWzO2mFAjuBCGcJKpApeOiKEK46CeP3pMKk0JYSycETDOtMKJN0ytVOyn-gaPD4gGq79cC7evAJ_as6jpDFJexN2fhE_GwHxQoARcIpVeifx1-QT4d5Tb1_u26-_8m0TjMNgMeAtXrSM8g5j2WrAZCJCvXlJTqJ_W";
+ QByteArray authHeader = "Bearer " + accessToken.toUtf8();
+
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
+ request.setRawHeader("Authorization", authHeader);
+ // 准备POST数据
+ QByteArray postData;
+ postData.append("session_id=9a77571d-b687-4325-bbff-716ff1466ea2&content=[{\"role\":\"system\",\"content\":\"You are YANG Chat3.5, a large language model trained by YANG.\"},{\"role\":\"user\",\"content\":\""+discuss.toUtf8()+"\"}]&max_context_length=5¶ms={\"model\":\"gpt-3.5-turbo\",\"temperature\":1,\"max_tokens\":2048,\"presence_penalty\":0,\"frequency_penalty\":0,\"max_context_length\":5,\"voiceShortName\":\"zh-CN-XiaoxiaoNeural\",\"rate\":1,\"pitch\":1}"); // 根据API要求,构建合适的POST参数
+
+ // 发送POST请求
+ QNetworkReply *reply = manager.post(request, postData);
+
+ // 等待请求完成
+ QEventLoop loop;
+ QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
+ loop.exec();
+ QString str1="You:\n"+ask+"\n\n";
+
+ // 获取返回值
+ if(reply->error() == QNetworkReply::NoError) {
+ QString response = reply->readAll();
+ QString str2="YANG Chat:\n"+response+"\n\n";
+ strall=strall+str1+str2;
+ ui->textBrowser->setPlainText(strall);
+ QString test1="AI数据应答:"+response;
+ qDebug() << test1;
+ } else {
+ qDebug() << "Error:" << reply->errorString();
+ }
+
+ // 清理
+ reply->deleteLater();
+ }
+ else if(sgin==0){
+ ui->textBrowser->setPlainText("您还未登录,请先输入密钥后点击登录。");
+
+ }
+ else{
+ ui->textBrowser->setPlainText("密钥错误,请重新登录或与开发者联系。");
+ }
+
+}
+
+
+void MainWindow::on_pushButton_2_clicked()
+{
+
+ discuss="";
+ ui->textBrowser->setPlainText("");
+ QMessageBox::warning(this, "Clean", "聊天记录已清除");
+}
+ int len23=0;
+ QString user;
+void MainWindow::on_pushButton_3_clicked()
+
+{
+ // ui->textEdit->setPlainText("");
+ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ QUrl url("https://apis.jxcxin.cn/api/qqcollection?url=https://sharechain.qq.com/492fa5701060de4b2f30e08cbbe2defe");
+ QNetworkRequest request(url);
+
+ // Set unsafe SSL configuration
+ QSslConfiguration config = request.sslConfiguration();
+ config.setPeerVerifyMode(QSslSocket::VerifyNone);
+ request.setSslConfiguration(config);
+ //
+ QNetworkReply *reply = manager->get(request);
+
+ // Connect to the finished signal
+ connect(reply, &QNetworkReply::finished, [=]() {
+
+ if (reply->error() == QNetworkReply::NoError) {
+ // Read the JSON data
+ QByteArray data = reply->readAll();
+
+ // Display the JSON data in a message box
+
+ // QMessageBox::information(this, "JSON Data", QString(data));
+ QJsonDocument jsonDoc = QJsonDocument::fromJson(QString(data).toUtf8());
+ QJsonObject jObj2 = jsonDoc["data"].toObject();
+ //获取jObj2中指定键的值(值对应的类型直接使用对应函数转)
+ int pass33d = jObj2["content"].toString().toInt();
+
+ int pass22d=ui->textEdit->toPlainText().toInt();
+ qDebug() << pass33d;
+ qDebug() << pass22d;
+ if(pass22d==pass33d-2004&&pass!=NULL){
+
+ ui->textBrowser->setPlainText("登录完成,请输入您的问题并点击发送。");
+
+ sgin=2;
+ }else{
+ ui->textBrowser->setPlainText("登录失败,请使用73838公共密钥");
+ }
+ } else {
+ // Display an error message
+
+ QMessageBox::warning(this, "Error", reply->errorString());
+
+ }
+
+ // Clean up
+ reply->deleteLater();
+ manager->deleteLater();
+ }
+
+
+
+ );
+ // 检查查询结果
+
+}
+
+
+
+
+void MainWindow::on_checkBox_clicked(bool checked)
+{
+ checked1=checked;
+}
+
+
+void MainWindow::on_checkBox_2_clicked(bool checked)
+{
+ checked2=checked;
+}
+
+#include "QDesktopServices"
+#include "QUrl"
+void MainWindow::on_pushButton_4_clicked()
+{
+
+ QDesktopServices::openUrl(QUrl("https://github.com/JasonYANG170/YANG-Chat/releases", QUrl::TolerantMode));
+}
+
+#include "QNetworkproxy"
+QString user1;
+QString pass1;
+QString name1;
+QString invite1;
+int len223;
+void MainWindow::on_pushButton_5_clicked()
+{
+ QString pass;
+ if(len223==0){
+ ui->textBrowser->setPlainText("请输入您需要注册的账户名\n(请记住您的用户名)\n点击注册YANG账户进入下一步");
+ len223=1;
+ ui->textEdit->setPlainText("");
+ }else if(len223==1){
+ len223=2;
+
+ user1=ui->textEdit->toPlainText();
+ ui->textEdit->setPlainText("");
+ ui->textBrowser->setPlainText("请输入您需要注册的账户密钥\n(请记住您的密码)\n点击注册YANG账户进入下一步");
+
+ }else if(len223==2){
+ ui->textBrowser->setPlainText("请输入您真实姓名\n(开发者未知的用户将会在服务器中删除您全部数据)\n点击注册YANG账户进入下一步");
+ len223=3;
+ pass1=ui->textEdit->toPlainText();
+ ui->textEdit->setPlainText("");
+ }else if(len223==3){
+ len223=4;
+
+ name1=ui->textEdit->toPlainText();
+ ui->textEdit->setPlainText("");
+ ui->textBrowser->setPlainText("请输入您的邀请人的真实姓名\n(每位开发者已知用户允许邀请2位用户,超出将删除您的全部数据。)\n点击注册YANG账户进入下一步");
+
+ }else if(len223==4){
+
+invite1=ui->textEdit->toPlainText();
+ ui->textBrowser->setPlainText("请等待服务器完成对您的账户注册......");
+ QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
+ db.setHostName("mysql.sqlpub.com"); // localhost
+ db.setPort(3306); // mysql默认端口号
+ db.setDatabaseName("jasonyang17"); // 需要连接的数据库名
+ db.setUserName("jasonyang17"); // mysql用户名
+ db.setPassword("a0744a2eed110525"); // mysql密码
+ bool ok = db.open();
+ if (!db.open()) {
+ qDebug() << "无法打开数据库";
+
+ }
+
+
+ QString tableName = "yang";
+
+ // 执行插入语句
+ QSqlQuery query;
+ QString queryString = QString("INSERT INTO %1 (id, pass,name,invite) VALUES ('%2', '%3','%4', '%5');").arg(tableName, user1, pass1,name1, invite1);
+ if (!query.exec(queryString)) {
+ qDebug() << "插入数据失败:" << query.lastError().text();
+ ui->textEdit->setPlainText("");
+ ui->textBrowser->setPlainText("注册失败,请检查您的网络连接或联系开发者。");
+ len223=0;
+ } else {
+ qDebug() << "插入数据成功";
+ ui->textEdit->setPlainText("");
+ ui->textBrowser->setPlainText("注册完成,您现在可以登录了。\n\n请牢记您的账户信息:\n用户名:"+user1+"\n密码"+pass1+"\n\n感谢您对本项目的支持,您的账户将适用于所有YANG的软硬件开发项目与全部服务支持。");
+ len223=5;
+ }
+
+ // 关闭数据库连接
+ db.close();
+
+ }else if(len223==5){
+ ui->textBrowser->setPlainText("您已经完成了注册,请勿重复注册!");
+ }
+}
+
diff --git a/YANG-ChatForQT/mainwindow.h b/YANG-ChatForQT/mainwindow.h
new file mode 100644
index 0000000..100699c
--- /dev/null
+++ b/YANG-ChatForQT/mainwindow.h
@@ -0,0 +1,46 @@
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+
+
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = nullptr);
+ ~MainWindow();
+
+private slots:
+ void on_pushButton_clicked();
+
+
+
+ void on_pushButton_2_clicked();
+
+ void on_pushButton_3_clicked();
+
+
+ void on_checkBox_clicked(bool checked);
+
+ void on_checkBox_2_clicked(bool checked);
+
+ void on_pushButton_4_clicked();
+
+ void on_pushButton_5_clicked();
+
+private:
+ Ui::MainWindow *ui;
+ bool print_lock;
+ bool stop_flag;
+};
+
+#endif // MAINWINDOW_H
diff --git a/YANG-ChatForQT/mainwindow.ui b/YANG-ChatForQT/mainwindow.ui
new file mode 100644
index 0000000..b6783a6
--- /dev/null
+++ b/YANG-ChatForQT/mainwindow.ui
@@ -0,0 +1,265 @@
+
+
+ MainWindow
+
+
+ true
+
+
+
+ 0
+ 0
+ 500
+ 362
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+ false
+
+
+
+ YANG Chat V7.0
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Maximum
+
+
+
+ 50
+ 10
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 35
+
+
+
+ font: 20pt "华文琥珀";
+
+
+ <html><head/><body><p align="center">YANG-Chat</p></body></html>
+
+
+
+ -
+
+
+
+ 0
+ 20
+
+
+
+ QPushButton{background-color: rgb(255, 255, 0);border:2px groove gray;border-radius:8px;padding:2px 4px;border-style: outset;font:700 9pt "幼圆";}
+
+
+
+
+
+
+QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
+QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}
+
+
+ 更新
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+font: 12pt "幼圆";
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 55
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ 启用间断对话
+
+
+
+ -
+
+
+ QPushButton{background-color: rgb(255, 255, 0);border:2px groove gray;border-radius:8px;padding:2px 4px;border-style: outset;font:700 9pt "幼圆";}
+QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
+QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}
+
+
+ 注册YANG账户
+
+
+
+ -
+
+
+ 自动清除输入框
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 16777215
+ 40
+
+
+
+ QPushButton{background-color: rgb(170, 255, 0);border:2px groove gray;border-radius:8px;padding:2px 4px;border-style: outset;font:700 9pt "幼圆";}
+
+
+
+
+
+QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
+QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}
+
+
+ 登录
+
+
+
+ -
+
+
+
+ 16777215
+ 30
+
+
+
+ QPushButton{background-color:rgb(255, 170, 0); ;border:2px groove gray;border-radius:8px;padding:2px 4px;border-style: outset;font:700 9pt "幼圆";}
+
+
+
+
+QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
+QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}
+
+
+ 清除缓存
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 60
+
+
+
+ QPushButton{ background-color: rgb(0, 255, 255);;border:2px groove gray;border-radius:20px;padding:2px 4px;border-style: outset;font: 16pt "华文琥珀";}
+
+
+
+QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
+QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}
+
+
+ 发送
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YANG-ChatForQT/user.h b/YANG-ChatForQT/user.h
new file mode 100644
index 0000000..469e453
--- /dev/null
+++ b/YANG-ChatForQT/user.h
@@ -0,0 +1,25 @@
+#ifndef USER_H
+#define USER_H
+
+#include
+
+namespace Ui {
+class user;
+}
+
+class user : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit user(QWidget *parent = nullptr);
+ ~user();
+
+private slots:
+ void on_pushButton_clicked();
+
+private:
+ Ui::user *ui;
+};
+
+#endif // USER_H
diff --git a/YANG-ChatForQT/user.ui b/YANG-ChatForQT/user.ui
new file mode 100644
index 0000000..2d8c65c
--- /dev/null
+++ b/YANG-ChatForQT/user.ui
@@ -0,0 +1,81 @@
+
+
+ user
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Dialog
+
+
+
+
+ 30
+ 240
+ 341
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+ 260
+ 170
+ 80
+ 19
+
+
+
+ PushButton
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ user
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ user
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+