Merge pull request #2 from dengrb1/develop

Develop
This commit is contained in:
dengrb1
2023-08-25 22:06:01 +08:00
committed by GitHub
11 changed files with 203 additions and 94 deletions

27
aiyunos.pyw Normal file
View File

@@ -0,0 +1,27 @@
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QMainWindow, QToolBar, QAction
from PyQt5.QtWebEngineWidgets import QWebEngineView
class BrowserWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Chat Browser")
self.setGeometry(100, 100, 800, 600)
# Create the QWebEngineView widget
self.web_view = QWebEngineView(self)
self.web_view.load(QUrl("https://chat2.aiyunos.top"))
self.setCentralWidget(self.web_view)
# Create the QToolBar widget and add a QAction for the refresh button
toolbar = QToolBar(self)
self.addToolBar(toolbar)
refresh_action = QAction("Refresh", self)
refresh_action.triggered.connect(self.web_view.reload)
toolbar.addAction(refresh_action)
if __name__ == "__main__":
app = QApplication([])
window = BrowserWindow()
window.show()
app.exec_()

47
chat_command.py Normal file
View File

@@ -0,0 +1,47 @@
import openai
import os
from time import sleep
import sys
ml = os.getcwd()
file_path = os.path.join(ml, "api_key.txt")
# 设置openai库的API认证密钥
def api_key():
input1 = input("请输入API_key:")
if input1 == None:
print('error: Not input')
sleep(4)
sys.exit()
else:
openai.api_key = input1
# 设置GPT-3.5模型的引擎ID
model_engine = 'text-davinci-003'
# 循环读入用户输入并输出聊天结果
def input_print():
while True:
# 获取用户输入
prompt = input("你好,请问有什么需要帮助的吗?\n")
# 调用openai.ChatCompletion.create()方法来获取聊天结果
response = openai.Completion.create(
engine='text-davinci-003',
prompt=prompt,
temperature=0.7,
max_tokens=210,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
result = response['choices'][0]['text'].strip()
print(f"chatGPT{result}")
if __name__ == "__main__":
print('注意,本程序是测试程序,如有问题,非常正常')
sleep(2)
api_key()
# 设置GPT-3.5模型的引擎ID
model_engine = 'text-davinci-003'
input_print()

View File

@@ -5,12 +5,12 @@ from PyQt5.QtWebEngineWidgets import QWebEngineView
class BrowserWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Chat Browser")
self.setWindowTitle("AI Browser")
self.setGeometry(100, 100, 800, 600)
# Create the QWebEngineView widget and set the URL to "https://chat.extkj.cn"
# Create the QWebEngineView widget and set the URL to "https://nav.chatkey.top/"
self.web_view = QWebEngineView(self)
self.web_view.load(QUrl("https://chat.extkj.cn"))
self.web_view.load(QUrl("https://nav.chatkey.top/"))
self.setCentralWidget(self.web_view)
# Create the QToolBar widget and add a QAction for the refresh button

View File

@@ -3,12 +3,15 @@ from tkinter import *
from tkinter import messagebox
from time import sleep
import sys
import webbrowser
# Define constants
CURRENT_DIR = os.getcwd()
FILE_ERROR = '文件丢失,请检查文件内容并重新安装'
task = f'taskkill -f -t -im '
# Define functions
''' Define functions
程序文件检测'''
def open_exe(exe_name):
if os.path.exists(os.path.join(CURRENT_DIR, f"{exe_name}.exe")):
os.system(f"start {exe_name}.exe")
@@ -29,9 +32,9 @@ def update():
open_exe("update")
def quit_exe():
os.system('taskkill -f -t -im qdymys.exe')
os.system('taskkill -f -t -im free2gpt.exe')
os.system('taskkill -f -t -im wuguokai.exe')
os.system('taskkill -f -t -im extkj.exe')
os.system('taskkill -f -t -im chatkey.exe')
os.system('taskkill -f -t -im bnu120.exe')
os.system('taskkill -f -t -im 1chat.exe')
os.system('taskkill -f -t -im chat_command.exe')
@@ -39,29 +42,28 @@ def quit_exe():
os.system('taskkill -f -t -im update.exe')
os.system('taskkill -f -t -im xz_chat.exe')
os.system('taskkill -f -t -im xz_main.exe')
os.system('taskkill -f -t -im ol_web.exe')
sys.exit()
def jc():
messagebox.showerror('system', '检测程序暂时无法使用!!!(应该以后都不会写完了......)')
pass
def gk():
open_exe("gk")
def ol_web():
messagebox.showwarning("Warning","这个程序为测试版,如有问题,请马上反馈!")
open_exe('ol_web')
# Create GUI
root = Tk()
root.title('chatGPT')
root.title('chatWEB')
root.geometry('200x200+400+400')
Label(root, text='chatGPT').pack()
bt_web_xz = Button(root, text='网站选择', command=web_xz)
ol_web_b = Button(root ,text='官方网站', command=ol_web)
quit_bt = Button(root, text='退出', command=quit_exe)
Label(root, text='chatWEB')
bt_web_xz.pack()
ol_web_b.pack()
quit_bt.pack()
Label(root,text='version 1.3 @2023-2024 dengrb1').pack()
Label(root,text='version 1.4 @2023-2024 dengrb1').pack()
# mainloop
root.mainloop()

View File

@@ -10,7 +10,7 @@ class BrowserWindow(QMainWindow):
# Create the QWebEngineView widget
self.web_view = QWebEngineView(self)
self.web_view.load(QUrl("https://chatgpt.qdymys.cn/"))
self.web_view.load(QUrl("https://chatc.free2gpt.xyz/"))
self.setCentralWidget(self.web_view)
# Create the QToolBar widget and add a QAction for the refresh button

39
ol_web.pyw Normal file
View File

@@ -0,0 +1,39 @@
import os
import webbrowser
from tkinter import *
from tkinter import messagebox
import sys
root = Tk()
ml = os.getcwd()
# def
def china_github():
webbrowser.open('https://kgithub.com/dengrb1/chatgpt')
sys.exit()
def github():
webbrowser.open('https://github.com/dengrb1/chatgpt')
sys.exit()
def quit_exe():
sys.exit()
# Button
cg_b = Button(root, text='国内镜像官网', command=china_github)
g_b = Button(root , text='国外官网', command=github)
q_b = Button(root ,text='返回', command=quit_exe)
# pack
Label(root , text='官网').pack()
cg_b.pack()
g_b.pack()
q_b.pack()
# mainloop
root.title('chatWEB')
root.geometry('200x220')
root.mainloop()

View File

@@ -17,11 +17,13 @@ def quit_exe():
def update_now():
webbrowser.open("https://kgithub.com/dengrb1/chatgpt/releases/")
messagebox.showinfo('update', '请选择最新版本并下载运行安装程序,然后就可以更新了!')
def downloads_update_now():
'''def downloads_update_now():
if os.path.exists(os.path.join(ml, "downloads_update_now.exe")):
os.startfile("downloads_update_now")
else:
messagebox.showerror(':( error','在线更新模块错误:文件不存在')
'''
# Label
@@ -29,22 +31,27 @@ update_now_bt = Button(root ,text='在线更新', command=update_now).pack(side=
quit_bt = Button(root, text='返回', command=quit_exe).pack(side=RIGHT)
Label(root, text='更新日志').pack()
text = '''
当前版本:1.3 (Not beta or demo)
当前版本:1.4 (Not beta or demo)
1.4 加入aiyunos、free2gpt、chatkey网站删除qdymys、extkj等网站加入在程序内
访问官网加入cmd版本的chatGPT(测试版);修复一些很明显的BUG
0.1.0 DEMO制作完成
0.1.1 demo版本增加lbbAI网站
0.1.2 demo版本删除lbbAI网站因为无法使用
0.1.3 修复BUG
1.0 加入关于模块更新网站aitianhu.top修复“退出”按钮
的问题
1.0.1 修复BUG移除“检查文件完整度”程序使用
可以在github仓库的old文件夹里面看修复其他BUG......
1.1 修复BUG;紧急修复Windows7无法使用情况!重新修正UI界面
1.1.1 更新chatGPT网站;修改update文本显示设置。新增bnu120聊天网站
移除lbbai网站入口
1.2 增加lbbai网站修复BUG;完全移除“关于”模块......
1.3 删除lbbai网站增加1chat网站里面内涵AI画图功能加入WiFi功能
检测;加入在线更新功能
1.2 增加lbbai网站修复BUG;完全移除“关于”模块......
1.1.1 更新chatGPT网站;修改update文本显示设置。新增bnu120聊天网站
1.1 修复BUG;紧急修复Windows7无法使用情况!重新修正UI界面
1.0.1 修复BUG移除“检查文件完整度”程序使用
1.0 加入关于模块更新网站aitianhu.top修复“退出”按钮
的问题
0.1.3 修复BUG
0.1.2 demo版本删除lbbAI网站因为无法使用
0.1.1 demo版本增加lbbAI网站
0.1 DEMO制作完成
'''
text_box = ScrolledText(root)
@@ -55,10 +62,9 @@ text_box.configure(state='disabled')
# Button
quit_bt = Button(root, text='返回', command=quit_exe).pack()
update_now_bt = Button(root, text='在线更新', command=downloads_update_now).pack()
update_now_bt = Button(root, text='在线更新', command=update_now).pack()
# mainloop
root.title('更新日志')
root.geometry('355x250+400+400')
downloads_update_now()
root.mainloop()

View File

@@ -35,39 +35,39 @@ def open_exe(exe_name):
os.system(f"start {exe_name}.exe")
else:
messagebox.showerror('system', file_error)
def extkj():
open_exe("extkj")
def aiyunos():
open_exe("aiyunos")
def wuguokai():
open_exe("wuguokai")
def qdymys():
open_exe("qdymys")
def chatkey():
open_exe("chatkey")
def bnu120():
open_exe('bnu120')
def xjai():
open_exe('xjai')
def free2gpt():
open_exe('free2gpt')
def fh():
root.destroy()
# Button
bt_wuguokai = Button(frame, text='wuguokai网站', command=wuguokai)
bt_extkj = Button(frame, text='extkj网站', command=extkj)
bt_qdymys = Button(frame, text='qdymys网站', command=qdymys)
bt_xjai = Button(frame, text='xjai网站', command=xjai)
bt_aiyunos = Button(frame, text='aiyunos网站', command=aiyunos)
bt_chatkey = Button(frame, text='chatkey网站', command=chatkey)
bt_free2gpt = Button(frame, text='free2gpt网站', command=free2gpt)
bt_bnu120 = Button(frame, text='bnu120网站', command=bnu120)
bt_fh = Button(frame, text='返回', command=fh)
# pack and Label
Label(root, text='选择界面').pack()
bt_wuguokai.pack()
bt_extkj.pack()
bt_xjai.pack()
bt_qdymys.pack()
bt_aiyunos.pack()
bt_free2gpt.pack()
bt_chatkey.pack()
bt_bnu120.pack()
bt_fh.pack()
# mainloop
root.title('选择')
root.title('chatWEB')
root.geometry('200x220+440+600')
root.mainloop()

36
xz_main.pyw Normal file
View File

@@ -0,0 +1,36 @@
import os
from tkinter import *
from tkinter import messagebox
from time import time
import sys
root = Tk()
ml = os.getcwd()
def open_exe(exe_name):
if os.path.exists(os.path.join(ml,f"{exe_name}.exe")):
os.system(f'start {exe_name}.exe')
else:
messagebox.showerror('system','文件丢失!')
pass
def chat():
open_exe("xz_chat")
def quit_exe():
sys.exit()
# Button
chat_b = Button(root ,text='聊天网站', command=chat)
q_b = Button(root ,text='返回', command= quit_exe)
# pack Button and label
Label(root, text='选择模式').pack()
chat_b.pack()
q_b.pack()
# mainloop
root.title('chatWEB')
root.geometry('200x220')
root.mainloop()

View File

@@ -1,48 +0,0 @@
import openai
import os
from time import sleep
import sys
ml = os.getcwd()
file_path = os.path.join(ml, "api_key.txt")
# 设置openai库的API认证密钥
def api_key():
if os.path.exists(os.path.join(ml, f"api_key.txt")):
with open(file_path, 'r') as f:
openai.api_key = f.read().strip()
else:
print('文件丢失请重新输入api_key')
sleep(1)
if os.path.exists(os.path.join(ml, "chat_command_GUI.exe")):
os.startfile("chat_command_GUI.exe")
else:
print('错误,文件不存在!?')
sleep(1)
sys.exit()
pass
# 设置GPT-3.5模型要使用的API_key
api_key()
# 设置GPT-3.5模型的引擎ID
model_engine = 'text-davinci-003'
# 循环读入用户输入并输出聊天结果
while True:
# 获取用户输入
prompt = input("你好,请问有什么需要帮助的吗?\n")
# 调用openai.ChatCompletion.create()方法来获取聊天结果
response = openai.Completion.create(
engine='text-davinci-003',
prompt=prompt,
temperature=0.7,
max_tokens=210,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
result = response['choices'][0]['text'].strip()
print(f"chatGPT{result}")

View File

@@ -45,6 +45,6 @@ fh_bt.grid(row=2,column=1)
# mainloop
root.title('chatGPT')
root.title('chatWEB')
root.geometry('200x250+100+100')
root.mainloop()