From c8d862c84a6ddf57bf2fae8ad9243c7d19a909f9 Mon Sep 17 00:00:00 2001 From: ikaros <327209194@qq.com> Date: Sat, 21 Oct 2023 16:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5twitch=EF=BC=9B=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\350\243\205\344\276\235\350\265\226.bat" | 4 + UI_main.py | 1073 ++++++------ config.json | 10 +- config.json.bak | 6 + main.py | 80 +- requirements_common.txt | 3 +- requirements_twitch.txt | 38 + tests/test_tiktok/tiktok.py | 37 + tests/test_twitch/twitch.py | 56 + twitch.py | 270 +++ ui/main.ui | 1468 +++++++++-------- webui.py | 39 +- 12 files changed, 1809 insertions(+), 1275 deletions(-) create mode 100644 requirements_twitch.txt create mode 100644 tests/test_tiktok/tiktok.py create mode 100644 tests/test_twitch/twitch.py create mode 100644 twitch.py diff --git "a/Scripts/2-2.\345\256\211\350\243\205\344\276\235\350\265\226.bat" "b/Scripts/2-2.\345\256\211\350\243\205\344\276\235\350\265\226.bat" index 8c95f9d0..ea5d56ea 100644 --- "a/Scripts/2-2.\345\256\211\350\243\205\344\276\235\350\265\226.bat" +++ "b/Scripts/2-2.\345\256\211\350\243\205\344\276\235\350\265\226.bat" @@ -6,11 +6,15 @@ Miniconda3\python.exe -m pip install -r requirements_dy.txt -i https://pypi.tuna Miniconda3\python.exe -m pip install -r requirements_ks.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Miniconda3\python.exe -m pip install -r requirements_douyu.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Miniconda3\python.exe -m pip install -r requirements_talk.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +Miniconda3\python.exe -m pip install -r requirements_youtube.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +Miniconda3\python.exe -m pip install -r requirements_twitch.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Miniconda3\python.exe -m pip install -r requirements_bilibili.txt -i https://pypi.python.org/simple/ Miniconda3\python.exe -m pip install -r requirements_dy.txt -i https://pypi.python.org/simple/ Miniconda3\python.exe -m pip install -r requirements_ks.txt -i https://pypi.python.org/simple/ Miniconda3\python.exe -m pip install -r requirements_douyu.txt -i https://pypi.python.org/simple/ Miniconda3\python.exe -m pip install -r requirements_talk.txt -i https://pypi.python.org/simple/ +Miniconda3\python.exe -m pip install -r requirements_youtube.txt -i https://pypi.python.org/simple/ +Miniconda3\python.exe -m pip install -r requirements_twitch.txt -i https://pypi.python.org/simple/ echo 如果都成功了,那没事了,如果有失败的,请手动补装 cmd /k \ No newline at end of file diff --git a/UI_main.py b/UI_main.py index 90d4938f..34100ff1 100644 --- a/UI_main.py +++ b/UI_main.py @@ -86,7 +86,7 @@ def setupUi(self, MainWindow): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, -9992, 991, 10717)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, -111, 991, 10780)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout.setContentsMargins(35, 20, 35, 20) @@ -98,92 +98,48 @@ def setupUi(self, MainWindow): self.gridLayout = QtWidgets.QGridLayout(self.formWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") + self.label_before_prompt = QtWidgets.QLabel(self.formWidget) + self.label_before_prompt.setObjectName("label_before_prompt") + self.gridLayout.addWidget(self.label_before_prompt, 5, 0, 1, 1) + self.groupBox_xuniren = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_xuniren.setObjectName("groupBox_xuniren") + self.gridLayout_89 = QtWidgets.QGridLayout(self.groupBox_xuniren) + self.gridLayout_89.setObjectName("gridLayout_89") + self.gridLayout_xuniren = QtWidgets.QGridLayout() + self.gridLayout_xuniren.setObjectName("gridLayout_xuniren") + self.gridLayout_89.addLayout(self.gridLayout_xuniren, 0, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_xuniren, 18, 0, 1, 2) + self.label_need_lang = QtWidgets.QLabel(self.formWidget) + self.label_need_lang.setObjectName("label_need_lang") + self.gridLayout.addWidget(self.label_need_lang, 4, 0, 1, 1) + self.comboBox_need_lang = QtWidgets.QComboBox(self.formWidget) + self.comboBox_need_lang.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.comboBox_need_lang.setObjectName("comboBox_need_lang") + self.comboBox_need_lang.addItem("") + self.comboBox_need_lang.addItem("") + self.comboBox_need_lang.addItem("") + self.comboBox_need_lang.addItem("") + self.gridLayout.addWidget(self.comboBox_need_lang, 4, 1, 1, 1) self.comboBox_visual_body = QtWidgets.QComboBox(self.formWidget) self.comboBox_visual_body.setObjectName("comboBox_visual_body") self.gridLayout.addWidget(self.comboBox_visual_body, 3, 1, 1, 1) - self.groupBox_chatgpt = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_chatgpt.setObjectName("groupBox_chatgpt") - self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_chatgpt) - self.gridLayout_5.setObjectName("gridLayout_5") - self.gridLayout_3 = QtWidgets.QGridLayout() - self.gridLayout_3.setObjectName("gridLayout_3") - self.lineEdit_chatgpt_max_tokens = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_max_tokens.setObjectName("lineEdit_chatgpt_max_tokens") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_max_tokens, 2, 1, 1, 1) - self.label_chatgpt_model = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_model.setObjectName("label_chatgpt_model") - self.gridLayout_3.addWidget(self.label_chatgpt_model, 0, 0, 1, 1) - self.label_chatgpt_max_tokens = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_max_tokens.setObjectName("label_chatgpt_max_tokens") - self.gridLayout_3.addWidget(self.label_chatgpt_max_tokens, 2, 0, 1, 1) - self.lineEdit_chatgpt_presence_penalty = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_presence_penalty.setObjectName("lineEdit_chatgpt_presence_penalty") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_presence_penalty, 4, 1, 1, 1) - self.label_chatgpt_temperature = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_temperature.setObjectName("label_chatgpt_temperature") - self.gridLayout_3.addWidget(self.label_chatgpt_temperature, 1, 0, 1, 1) - self.label_chatgpt_top_p = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_top_p.setObjectName("label_chatgpt_top_p") - self.gridLayout_3.addWidget(self.label_chatgpt_top_p, 3, 0, 1, 1) - self.lineEdit_chatgpt_top_p = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_top_p.setObjectName("lineEdit_chatgpt_top_p") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_top_p, 3, 1, 1, 1) - self.lineEdit_chatgpt_temperature = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_temperature.setObjectName("lineEdit_chatgpt_temperature") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_temperature, 1, 1, 1, 1) - self.label_chatgpt_frequency_penalty = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_frequency_penalty.setObjectName("label_chatgpt_frequency_penalty") - self.gridLayout_3.addWidget(self.label_chatgpt_frequency_penalty, 5, 0, 1, 1) - self.lineEdit_chatgpt_frequency_penalty = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_frequency_penalty.setObjectName("lineEdit_chatgpt_frequency_penalty") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_frequency_penalty, 5, 1, 1, 1) - self.label_chatgpt_presence_penalty = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_presence_penalty.setObjectName("label_chatgpt_presence_penalty") - self.gridLayout_3.addWidget(self.label_chatgpt_presence_penalty, 4, 0, 1, 1) - self.label_chatgpt_preset = QtWidgets.QLabel(self.groupBox_chatgpt) - self.label_chatgpt_preset.setObjectName("label_chatgpt_preset") - self.gridLayout_3.addWidget(self.label_chatgpt_preset, 6, 0, 1, 1) - self.lineEdit_chatgpt_preset = QtWidgets.QLineEdit(self.groupBox_chatgpt) - self.lineEdit_chatgpt_preset.setObjectName("lineEdit_chatgpt_preset") - self.gridLayout_3.addWidget(self.lineEdit_chatgpt_preset, 6, 1, 1, 1) - self.comboBox_chatgpt_model = QtWidgets.QComboBox(self.groupBox_chatgpt) - self.comboBox_chatgpt_model.setObjectName("comboBox_chatgpt_model") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.comboBox_chatgpt_model.addItem("") - self.gridLayout_3.addWidget(self.comboBox_chatgpt_model, 0, 1, 1, 1) - self.gridLayout_5.addLayout(self.gridLayout_3, 0, 0, 1, 1) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_5.addItem(spacerItem, 0, 1, 1, 1) - self.gridLayout_5.setColumnStretch(0, 9) - self.gridLayout_5.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_chatgpt, 28, 0, 2, 3) - self.label_chat_type = QtWidgets.QLabel(self.formWidget) - self.label_chat_type.setObjectName("label_chat_type") - self.gridLayout.addWidget(self.label_chat_type, 2, 0, 1, 1) - self.lineEdit_after_prompt = QtWidgets.QLineEdit(self.formWidget) - self.lineEdit_after_prompt.setObjectName("lineEdit_after_prompt") - self.gridLayout.addWidget(self.lineEdit_after_prompt, 6, 1, 1, 1) - self.comboBox_audio_synthesis_type = QtWidgets.QComboBox(self.formWidget) - self.comboBox_audio_synthesis_type.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) - self.comboBox_audio_synthesis_type.setObjectName("comboBox_audio_synthesis_type") - self.gridLayout.addWidget(self.comboBox_audio_synthesis_type, 11, 1, 1, 1) + self.label_audio_synthesis_type = QtWidgets.QLabel(self.formWidget) + self.label_audio_synthesis_type.setObjectName("label_audio_synthesis_type") + self.gridLayout.addWidget(self.label_audio_synthesis_type, 11, 0, 1, 1) + self.comboBox_chat_type = QtWidgets.QComboBox(self.formWidget) + self.comboBox_chat_type.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.comboBox_chat_type.setObjectName("comboBox_chat_type") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.comboBox_chat_type.addItem("") + self.gridLayout.addWidget(self.comboBox_chat_type, 2, 1, 1, 1) self.groupBox_audio_random_speed = QtWidgets.QGroupBox(self.formWidget) self.groupBox_audio_random_speed.setObjectName("groupBox_audio_random_speed") self.gridLayout_53 = QtWidgets.QGridLayout(self.groupBox_audio_random_speed) @@ -231,96 +187,77 @@ def setupUi(self, MainWindow): self.gridLayout_52.setColumnStretch(2, 1) self.gridLayout_52.setColumnStretch(3, 2) self.gridLayout_53.addLayout(self.gridLayout_52, 0, 0, 1, 1) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_53.addItem(spacerItem1, 0, 1, 1, 1) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_53.addItem(spacerItem, 0, 1, 1, 1) self.gridLayout_53.setColumnStretch(0, 9) self.gridLayout_53.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_audio_random_speed, 25, 0, 1, 3) - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem2, 0, 2, 1, 1) - self.label_platform = QtWidgets.QLabel(self.formWidget) - self.label_platform.setAutoFillBackground(False) - self.label_platform.setObjectName("label_platform") - self.gridLayout.addWidget(self.label_platform, 0, 0, 1, 1) - self.comboBox_platform = QtWidgets.QComboBox(self.formWidget) - self.comboBox_platform.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) - self.comboBox_platform.setObjectName("comboBox_platform") - self.gridLayout.addWidget(self.comboBox_platform, 0, 1, 1, 1) - self.lineEdit_before_prompt = QtWidgets.QLineEdit(self.formWidget) - self.lineEdit_before_prompt.setObjectName("lineEdit_before_prompt") - self.gridLayout.addWidget(self.lineEdit_before_prompt, 5, 1, 1, 1) - self.comboBox_need_lang = QtWidgets.QComboBox(self.formWidget) - self.comboBox_need_lang.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) - self.comboBox_need_lang.setObjectName("comboBox_need_lang") - self.comboBox_need_lang.addItem("") - self.comboBox_need_lang.addItem("") - self.comboBox_need_lang.addItem("") - self.comboBox_need_lang.addItem("") - self.gridLayout.addWidget(self.comboBox_need_lang, 4, 1, 1, 1) - self.groupBox_local_qa = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_local_qa.setObjectName("groupBox_local_qa") - self.gridLayout_51 = QtWidgets.QGridLayout(self.groupBox_local_qa) - self.gridLayout_51.setObjectName("gridLayout_51") - self.gridLayout_50 = QtWidgets.QGridLayout() - self.gridLayout_50.setObjectName("gridLayout_50") - self.label_local_qa_audio_enable = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_audio_enable.setObjectName("label_local_qa_audio_enable") - self.gridLayout_50.addWidget(self.label_local_qa_audio_enable, 4, 0, 1, 1) - self.label_local_qa_text_enable = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_text_enable.setObjectName("label_local_qa_text_enable") - self.gridLayout_50.addWidget(self.label_local_qa_text_enable, 0, 0, 1, 1) - self.checkBox_local_qa_text_enable = QtWidgets.QCheckBox(self.groupBox_local_qa) - self.checkBox_local_qa_text_enable.setObjectName("checkBox_local_qa_text_enable") - self.gridLayout_50.addWidget(self.checkBox_local_qa_text_enable, 0, 1, 1, 1) - self.lineEdit_local_qa_text_file_path = QtWidgets.QLineEdit(self.groupBox_local_qa) - self.lineEdit_local_qa_text_file_path.setObjectName("lineEdit_local_qa_text_file_path") - self.gridLayout_50.addWidget(self.lineEdit_local_qa_text_file_path, 2, 1, 1, 1) - self.label_local_qa_audio_similarity = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_audio_similarity.setObjectName("label_local_qa_audio_similarity") - self.gridLayout_50.addWidget(self.label_local_qa_audio_similarity, 6, 0, 1, 1) - self.checkBox_local_qa_audio_enable = QtWidgets.QCheckBox(self.groupBox_local_qa) - self.checkBox_local_qa_audio_enable.setObjectName("checkBox_local_qa_audio_enable") - self.gridLayout_50.addWidget(self.checkBox_local_qa_audio_enable, 4, 1, 1, 1) - self.label_local_qa_text_similarity = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_text_similarity.setObjectName("label_local_qa_text_similarity") - self.gridLayout_50.addWidget(self.label_local_qa_text_similarity, 3, 0, 1, 1) - self.lineEdit_local_qa_audio_file_path = QtWidgets.QLineEdit(self.groupBox_local_qa) - self.lineEdit_local_qa_audio_file_path.setObjectName("lineEdit_local_qa_audio_file_path") - self.gridLayout_50.addWidget(self.lineEdit_local_qa_audio_file_path, 5, 1, 1, 1) - self.label_local_qa_audio_file_path = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_audio_file_path.setObjectName("label_local_qa_audio_file_path") - self.gridLayout_50.addWidget(self.label_local_qa_audio_file_path, 5, 0, 1, 1) - self.label_local_qa_text_file_path = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_text_file_path.setObjectName("label_local_qa_text_file_path") - self.gridLayout_50.addWidget(self.label_local_qa_text_file_path, 2, 0, 1, 1) - self.lineEdit_local_qa_text_similarity = QtWidgets.QLineEdit(self.groupBox_local_qa) - self.lineEdit_local_qa_text_similarity.setObjectName("lineEdit_local_qa_text_similarity") - self.gridLayout_50.addWidget(self.lineEdit_local_qa_text_similarity, 3, 1, 1, 1) - self.lineEdit_local_qa_audio_similarity = QtWidgets.QLineEdit(self.groupBox_local_qa) - self.lineEdit_local_qa_audio_similarity.setObjectName("lineEdit_local_qa_audio_similarity") - self.gridLayout_50.addWidget(self.lineEdit_local_qa_audio_similarity, 6, 1, 1, 1) - self.label_local_qa_text_type = QtWidgets.QLabel(self.groupBox_local_qa) - self.label_local_qa_text_type.setObjectName("label_local_qa_text_type") - self.gridLayout_50.addWidget(self.label_local_qa_text_type, 1, 0, 1, 1) - self.comboBox_local_qa_text_type = QtWidgets.QComboBox(self.groupBox_local_qa) - self.comboBox_local_qa_text_type.setObjectName("comboBox_local_qa_text_type") - self.comboBox_local_qa_text_type.addItem("") - self.comboBox_local_qa_text_type.addItem("") - self.gridLayout_50.addWidget(self.comboBox_local_qa_text_type, 1, 1, 1, 1) - self.gridLayout_51.addLayout(self.gridLayout_50, 0, 0, 1, 1) - spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_51.addItem(spacerItem3, 0, 1, 1, 1) - self.gridLayout_51.setColumnStretch(0, 9) - self.gridLayout_51.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_local_qa, 19, 0, 1, 3) - self.groupBox_bilibili = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_bilibili.setObjectName("groupBox_bilibili") - self.gridLayout_72 = QtWidgets.QGridLayout(self.groupBox_bilibili) - self.gridLayout_72.setObjectName("gridLayout_72") - self.gridLayout_bilibili = QtWidgets.QGridLayout() - self.gridLayout_bilibili.setObjectName("gridLayout_bilibili") - self.gridLayout_72.addLayout(self.gridLayout_bilibili, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_bilibili, 12, 0, 1, 2) + self.gridLayout.addWidget(self.groupBox_audio_random_speed, 28, 0, 1, 3) + self.groupBox_show_box = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_show_box.setObjectName("groupBox_show_box") + self.gridLayout_62 = QtWidgets.QGridLayout(self.groupBox_show_box) + self.gridLayout_62.setObjectName("gridLayout_62") + self.gridLayout_show_box = QtWidgets.QGridLayout() + self.gridLayout_show_box.setObjectName("gridLayout_show_box") + self.gridLayout_62.addLayout(self.gridLayout_show_box, 1, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_show_box, 16, 0, 1, 2) + self.comboBox_audio_synthesis_type = QtWidgets.QComboBox(self.formWidget) + self.comboBox_audio_synthesis_type.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.comboBox_audio_synthesis_type.setObjectName("comboBox_audio_synthesis_type") + self.gridLayout.addWidget(self.comboBox_audio_synthesis_type, 11, 1, 1, 1) + self.label_after_prompt = QtWidgets.QLabel(self.formWidget) + self.label_after_prompt.setObjectName("label_after_prompt") + self.gridLayout.addWidget(self.label_after_prompt, 6, 0, 1, 1) + self.groupBox_chatglm = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_chatglm.setObjectName("groupBox_chatglm") + self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_chatglm) + self.gridLayout_9.setObjectName("gridLayout_9") + self.gridLayout_8 = QtWidgets.QGridLayout() + self.gridLayout_8.setObjectName("gridLayout_8") + self.label_chatglm_api_ip_port = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_api_ip_port.setObjectName("label_chatglm_api_ip_port") + self.gridLayout_8.addWidget(self.label_chatglm_api_ip_port, 0, 0, 1, 1) + self.lineEdit_chatglm_top_p = QtWidgets.QLineEdit(self.groupBox_chatglm) + self.lineEdit_chatglm_top_p.setObjectName("lineEdit_chatglm_top_p") + self.gridLayout_8.addWidget(self.lineEdit_chatglm_top_p, 2, 1, 1, 1) + self.label_chatglm_history_max_len = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_history_max_len.setObjectName("label_chatglm_history_max_len") + self.gridLayout_8.addWidget(self.label_chatglm_history_max_len, 5, 0, 1, 1) + self.lineEdit_chatglm_max_length = QtWidgets.QLineEdit(self.groupBox_chatglm) + self.lineEdit_chatglm_max_length.setObjectName("lineEdit_chatglm_max_length") + self.gridLayout_8.addWidget(self.lineEdit_chatglm_max_length, 1, 1, 1, 1) + self.label_chatglm_top_p = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_top_p.setObjectName("label_chatglm_top_p") + self.gridLayout_8.addWidget(self.label_chatglm_top_p, 2, 0, 1, 1) + self.label_chatglm_temperature = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_temperature.setObjectName("label_chatglm_temperature") + self.gridLayout_8.addWidget(self.label_chatglm_temperature, 3, 0, 1, 1) + self.lineEdit_chatglm_temperature = QtWidgets.QLineEdit(self.groupBox_chatglm) + self.lineEdit_chatglm_temperature.setObjectName("lineEdit_chatglm_temperature") + self.gridLayout_8.addWidget(self.lineEdit_chatglm_temperature, 3, 1, 1, 1) + self.lineEdit_chatglm_api_ip_port = QtWidgets.QLineEdit(self.groupBox_chatglm) + self.lineEdit_chatglm_api_ip_port.setObjectName("lineEdit_chatglm_api_ip_port") + self.gridLayout_8.addWidget(self.lineEdit_chatglm_api_ip_port, 0, 1, 1, 1) + self.label_chatglm_max_length = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_max_length.setObjectName("label_chatglm_max_length") + self.gridLayout_8.addWidget(self.label_chatglm_max_length, 1, 0, 1, 1) + self.label_chatglm_history_enable = QtWidgets.QLabel(self.groupBox_chatglm) + self.label_chatglm_history_enable.setObjectName("label_chatglm_history_enable") + self.gridLayout_8.addWidget(self.label_chatglm_history_enable, 4, 0, 1, 1) + self.checkBox_chatglm_history_enable = QtWidgets.QCheckBox(self.groupBox_chatglm) + self.checkBox_chatglm_history_enable.setObjectName("checkBox_chatglm_history_enable") + self.gridLayout_8.addWidget(self.checkBox_chatglm_history_enable, 4, 1, 1, 1) + self.lineEdit_chatglm_history_max_len = QtWidgets.QLineEdit(self.groupBox_chatglm) + self.lineEdit_chatglm_history_max_len.setObjectName("lineEdit_chatglm_history_max_len") + self.gridLayout_8.addWidget(self.lineEdit_chatglm_history_max_len, 5, 1, 1, 1) + self.gridLayout_9.addLayout(self.gridLayout_8, 0, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_9.addItem(spacerItem1, 0, 1, 1, 1) + self.gridLayout_9.setColumnStretch(0, 9) + self.gridLayout_9.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_chatglm, 35, 0, 1, 3) + self.lineEdit_after_prompt = QtWidgets.QLineEdit(self.formWidget) + self.lineEdit_after_prompt.setObjectName("lineEdit_after_prompt") + self.gridLayout.addWidget(self.lineEdit_after_prompt, 6, 1, 1, 1) self.groupBox_log = QtWidgets.QGroupBox(self.formWidget) self.groupBox_log.setObjectName("groupBox_log") self.gridLayout_47 = QtWidgets.QGridLayout(self.groupBox_log) @@ -352,17 +289,132 @@ def setupUi(self, MainWindow): self.gridLayout_46.setColumnStretch(0, 1) self.gridLayout_46.setColumnStretch(1, 5) self.gridLayout_47.addLayout(self.gridLayout_46, 0, 0, 1, 1) - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_47.addItem(spacerItem4, 0, 1, 1, 1) + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_47.addItem(spacerItem2, 0, 1, 1, 1) self.gridLayout_47.setColumnStretch(0, 9) self.gridLayout_47.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_log, 18, 0, 1, 3) + self.gridLayout.addWidget(self.groupBox_log, 21, 0, 1, 3) + self.comboBox_platform = QtWidgets.QComboBox(self.formWidget) + self.comboBox_platform.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) + self.comboBox_platform.setObjectName("comboBox_platform") + self.gridLayout.addWidget(self.comboBox_platform, 0, 1, 1, 1) + self.label_platform = QtWidgets.QLabel(self.formWidget) + self.label_platform.setAutoFillBackground(False) + self.label_platform.setObjectName("label_platform") + self.gridLayout.addWidget(self.label_platform, 0, 0, 1, 1) self.label_room_display_id = QtWidgets.QLabel(self.formWidget) self.label_room_display_id.setObjectName("label_room_display_id") self.gridLayout.addWidget(self.label_room_display_id, 1, 0, 1, 1) - self.label_visual_body = QtWidgets.QLabel(self.formWidget) - self.label_visual_body.setObjectName("label_visual_body") - self.gridLayout.addWidget(self.label_visual_body, 3, 0, 1, 1) + self.label_chat_type = QtWidgets.QLabel(self.formWidget) + self.label_chat_type.setObjectName("label_chat_type") + self.gridLayout.addWidget(self.label_chat_type, 2, 0, 1, 1) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem3, 0, 2, 1, 1) + self.groupBox_openai = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_openai.setObjectName("groupBox_openai") + self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_openai) + self.gridLayout_4.setObjectName("gridLayout_4") + self.gridLayout_2 = QtWidgets.QGridLayout() + self.gridLayout_2.setSpacing(2) + self.gridLayout_2.setObjectName("gridLayout_2") + self.label_openai_api = QtWidgets.QLabel(self.groupBox_openai) + self.label_openai_api.setObjectName("label_openai_api") + self.gridLayout_2.addWidget(self.label_openai_api, 0, 0, 1, 1) + self.lineEdit_openai_api = QtWidgets.QLineEdit(self.groupBox_openai) + self.lineEdit_openai_api.setObjectName("lineEdit_openai_api") + self.gridLayout_2.addWidget(self.lineEdit_openai_api, 0, 2, 1, 1) + self.label_openai_api_key = QtWidgets.QLabel(self.groupBox_openai) + self.label_openai_api_key.setObjectName("label_openai_api_key") + self.gridLayout_2.addWidget(self.label_openai_api_key, 1, 0, 1, 1) + self.textEdit_openai_api_key = QtWidgets.QTextEdit(self.groupBox_openai) + self.textEdit_openai_api_key.setObjectName("textEdit_openai_api_key") + self.gridLayout_2.addWidget(self.textEdit_openai_api_key, 1, 1, 1, 2) + self.gridLayout_4.addLayout(self.gridLayout_2, 0, 0, 1, 1) + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_4.addItem(spacerItem4, 0, 1, 1, 1) + self.gridLayout_4.setColumnStretch(0, 9) + self.gridLayout_4.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_openai, 29, 0, 1, 3) + self.groupBox_claude2 = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_claude2.setObjectName("groupBox_claude2") + self.gridLayout_65 = QtWidgets.QGridLayout(self.groupBox_claude2) + self.gridLayout_65.setObjectName("gridLayout_65") + self.gridLayout_60 = QtWidgets.QGridLayout() + self.gridLayout_60.setObjectName("gridLayout_60") + self.lineEdit_claude2_cookie = QtWidgets.QLineEdit(self.groupBox_claude2) + self.lineEdit_claude2_cookie.setObjectName("lineEdit_claude2_cookie") + self.gridLayout_60.addWidget(self.lineEdit_claude2_cookie, 0, 1, 1, 1) + self.lineEdit_claude2_proxies_socks5 = QtWidgets.QLineEdit(self.groupBox_claude2) + self.lineEdit_claude2_proxies_socks5.setObjectName("lineEdit_claude2_proxies_socks5") + self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_socks5, 4, 1, 1, 1) + self.label_claude2_proxies_https = QtWidgets.QLabel(self.groupBox_claude2) + self.label_claude2_proxies_https.setObjectName("label_claude2_proxies_https") + self.gridLayout_60.addWidget(self.label_claude2_proxies_https, 3, 0, 1, 1) + self.label_claude2_proxies_socks5 = QtWidgets.QLabel(self.groupBox_claude2) + self.label_claude2_proxies_socks5.setObjectName("label_claude2_proxies_socks5") + self.gridLayout_60.addWidget(self.label_claude2_proxies_socks5, 4, 0, 1, 1) + self.checkBox_claude2_use_proxy = QtWidgets.QCheckBox(self.groupBox_claude2) + self.checkBox_claude2_use_proxy.setObjectName("checkBox_claude2_use_proxy") + self.gridLayout_60.addWidget(self.checkBox_claude2_use_proxy, 1, 1, 1, 1) + self.label_claude2_cookie = QtWidgets.QLabel(self.groupBox_claude2) + self.label_claude2_cookie.setObjectName("label_claude2_cookie") + self.gridLayout_60.addWidget(self.label_claude2_cookie, 0, 0, 1, 1) + self.label_claude2_use_proxy = QtWidgets.QLabel(self.groupBox_claude2) + self.label_claude2_use_proxy.setObjectName("label_claude2_use_proxy") + self.gridLayout_60.addWidget(self.label_claude2_use_proxy, 1, 0, 1, 1) + self.label_claude2_proxies_http = QtWidgets.QLabel(self.groupBox_claude2) + self.label_claude2_proxies_http.setObjectName("label_claude2_proxies_http") + self.gridLayout_60.addWidget(self.label_claude2_proxies_http, 2, 0, 1, 1) + self.lineEdit_claude2_proxies_https = QtWidgets.QLineEdit(self.groupBox_claude2) + self.lineEdit_claude2_proxies_https.setObjectName("lineEdit_claude2_proxies_https") + self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_https, 3, 1, 1, 1) + self.lineEdit_claude2_proxies_http = QtWidgets.QLineEdit(self.groupBox_claude2) + self.lineEdit_claude2_proxies_http.setObjectName("lineEdit_claude2_proxies_http") + self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_http, 2, 1, 1, 1) + self.gridLayout_65.addLayout(self.gridLayout_60, 0, 0, 1, 1) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_65.addItem(spacerItem5, 0, 1, 1, 1) + self.gridLayout_65.setColumnStretch(0, 9) + self.gridLayout_65.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_claude2, 34, 0, 1, 3) + self.lineEdit_room_display_id = QtWidgets.QLineEdit(self.formWidget) + self.lineEdit_room_display_id.setObjectName("lineEdit_room_display_id") + self.gridLayout.addWidget(self.lineEdit_room_display_id, 1, 1, 1, 1) + self.groupBox_read_user_name = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_read_user_name.setObjectName("groupBox_read_user_name") + self.gridLayout_59 = QtWidgets.QGridLayout(self.groupBox_read_user_name) + self.gridLayout_59.setObjectName("gridLayout_59") + self.gridLayout_58 = QtWidgets.QGridLayout() + self.gridLayout_58.setObjectName("gridLayout_58") + self.label_read_user_name_reply_before = QtWidgets.QLabel(self.groupBox_read_user_name) + self.label_read_user_name_reply_before.setObjectName("label_read_user_name_reply_before") + self.gridLayout_58.addWidget(self.label_read_user_name_reply_before, 2, 0, 1, 1) + self.textEdit_read_user_name_reply_before = QtWidgets.QTextEdit(self.groupBox_read_user_name) + self.textEdit_read_user_name_reply_before.setObjectName("textEdit_read_user_name_reply_before") + self.gridLayout_58.addWidget(self.textEdit_read_user_name_reply_before, 2, 1, 1, 1) + self.label_read_user_name_enable = QtWidgets.QLabel(self.groupBox_read_user_name) + self.label_read_user_name_enable.setObjectName("label_read_user_name_enable") + self.gridLayout_58.addWidget(self.label_read_user_name_enable, 0, 0, 1, 1) + self.checkBox_read_user_name_enable = QtWidgets.QCheckBox(self.groupBox_read_user_name) + self.checkBox_read_user_name_enable.setObjectName("checkBox_read_user_name_enable") + self.gridLayout_58.addWidget(self.checkBox_read_user_name_enable, 0, 1, 1, 1) + self.label_read_user_name_voice_change = QtWidgets.QLabel(self.groupBox_read_user_name) + self.label_read_user_name_voice_change.setObjectName("label_read_user_name_voice_change") + self.gridLayout_58.addWidget(self.label_read_user_name_voice_change, 1, 0, 1, 1) + self.checkBox_read_user_name_voice_change = QtWidgets.QCheckBox(self.groupBox_read_user_name) + self.checkBox_read_user_name_voice_change.setObjectName("checkBox_read_user_name_voice_change") + self.gridLayout_58.addWidget(self.checkBox_read_user_name_voice_change, 1, 1, 1, 1) + self.label_read_user_name_reply_after = QtWidgets.QLabel(self.groupBox_read_user_name) + self.label_read_user_name_reply_after.setObjectName("label_read_user_name_reply_after") + self.gridLayout_58.addWidget(self.label_read_user_name_reply_after, 3, 0, 1, 1) + self.textEdit_read_user_name_reply_after = QtWidgets.QTextEdit(self.groupBox_read_user_name) + self.textEdit_read_user_name_reply_after.setObjectName("textEdit_read_user_name_reply_after") + self.gridLayout_58.addWidget(self.textEdit_read_user_name_reply_after, 3, 1, 1, 1) + self.gridLayout_59.addLayout(self.gridLayout_58, 0, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_read_user_name, 20, 0, 1, 2) + self.lineEdit_before_prompt = QtWidgets.QLineEdit(self.formWidget) + self.lineEdit_before_prompt.setObjectName("lineEdit_before_prompt") + self.gridLayout.addWidget(self.lineEdit_before_prompt, 5, 1, 1, 1) self.groupBox_filter = QtWidgets.QGroupBox(self.formWidget) self.groupBox_filter.setStyleSheet("") self.groupBox_filter.setObjectName("groupBox_filter") @@ -449,197 +501,108 @@ def setupUi(self, MainWindow): self.label_filter_before_must_str.setObjectName("label_filter_before_must_str") self.gridLayout_filter.addWidget(self.label_filter_before_must_str, 0, 0, 1, 1) self.lineEdit_filter_talk_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter) - self.lineEdit_filter_talk_forget_duration.setObjectName("lineEdit_filter_talk_forget_duration") - self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_duration, 14, 1, 1, 1) - self.label_filter_after_must_str = QtWidgets.QLabel(self.groupBox_filter) - self.label_filter_after_must_str.setObjectName("label_filter_after_must_str") - self.gridLayout_filter.addWidget(self.label_filter_after_must_str, 1, 0, 1, 1) - self.lineEdit_filter_comment_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) - self.lineEdit_filter_comment_forget_reserve_num.setObjectName("lineEdit_filter_comment_forget_reserve_num") - self.gridLayout_filter.addWidget(self.lineEdit_filter_comment_forget_reserve_num, 7, 1, 1, 1) - self.label_filter_schedule_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter) - self.label_filter_schedule_forget_reserve_num.setObjectName("label_filter_schedule_forget_reserve_num") - self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_reserve_num, 17, 0, 1, 1) - self.label_filter_gift_forget_duration = QtWidgets.QLabel(self.groupBox_filter) - self.label_filter_gift_forget_duration.setObjectName("label_filter_gift_forget_duration") - self.gridLayout_filter.addWidget(self.label_filter_gift_forget_duration, 8, 0, 1, 1) - self.lineEdit_filter_schedule_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) - self.lineEdit_filter_schedule_forget_reserve_num.setObjectName("lineEdit_filter_schedule_forget_reserve_num") - self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_reserve_num, 17, 1, 1, 1) - self.label_filter_entrance_forget_duration = QtWidgets.QLabel(self.groupBox_filter) - self.label_filter_entrance_forget_duration.setObjectName("label_filter_entrance_forget_duration") - self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_duration, 12, 0, 1, 1) - self.label_filter_follow_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter) - self.label_filter_follow_forget_reserve_num.setObjectName("label_filter_follow_forget_reserve_num") - self.gridLayout_filter.addWidget(self.label_filter_follow_forget_reserve_num, 11, 0, 1, 1) - self.lineEdit_filter_follow_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter) - self.lineEdit_filter_follow_forget_duration.setObjectName("lineEdit_filter_follow_forget_duration") - self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_duration, 10, 1, 1, 1) - self.lineEdit_filter_follow_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) - self.lineEdit_filter_follow_forget_reserve_num.setObjectName("lineEdit_filter_follow_forget_reserve_num") - self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_reserve_num, 11, 1, 1, 1) - self.gridLayout_26.addLayout(self.gridLayout_filter, 0, 0, 1, 1) - spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_26.addItem(spacerItem5, 0, 1, 1, 1) - self.gridLayout_26.setColumnStretch(0, 9) - self.gridLayout_26.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_filter, 20, 0, 1, 3) - self.label_after_prompt = QtWidgets.QLabel(self.formWidget) - self.label_after_prompt.setObjectName("label_after_prompt") - self.gridLayout.addWidget(self.label_after_prompt, 6, 0, 1, 1) - self.label_audio_synthesis_type = QtWidgets.QLabel(self.formWidget) - self.label_audio_synthesis_type.setObjectName("label_audio_synthesis_type") - self.gridLayout.addWidget(self.label_audio_synthesis_type, 11, 0, 1, 1) - self.groupBox_openai = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_openai.setObjectName("groupBox_openai") - self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_openai) - self.gridLayout_4.setObjectName("gridLayout_4") - self.gridLayout_2 = QtWidgets.QGridLayout() - self.gridLayout_2.setSpacing(2) - self.gridLayout_2.setObjectName("gridLayout_2") - self.label_openai_api = QtWidgets.QLabel(self.groupBox_openai) - self.label_openai_api.setObjectName("label_openai_api") - self.gridLayout_2.addWidget(self.label_openai_api, 0, 0, 1, 1) - self.lineEdit_openai_api = QtWidgets.QLineEdit(self.groupBox_openai) - self.lineEdit_openai_api.setObjectName("lineEdit_openai_api") - self.gridLayout_2.addWidget(self.lineEdit_openai_api, 0, 2, 1, 1) - self.label_openai_api_key = QtWidgets.QLabel(self.groupBox_openai) - self.label_openai_api_key.setObjectName("label_openai_api_key") - self.gridLayout_2.addWidget(self.label_openai_api_key, 1, 0, 1, 1) - self.textEdit_openai_api_key = QtWidgets.QTextEdit(self.groupBox_openai) - self.textEdit_openai_api_key.setObjectName("textEdit_openai_api_key") - self.gridLayout_2.addWidget(self.textEdit_openai_api_key, 1, 1, 1, 2) - self.gridLayout_4.addLayout(self.gridLayout_2, 0, 0, 1, 1) - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_4.addItem(spacerItem6, 0, 1, 1, 1) - self.gridLayout_4.setColumnStretch(0, 9) - self.gridLayout_4.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_openai, 26, 0, 1, 3) - self.label_need_lang = QtWidgets.QLabel(self.formWidget) - self.label_need_lang.setObjectName("label_need_lang") - self.gridLayout.addWidget(self.label_need_lang, 4, 0, 1, 1) - self.groupBox_show_box = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_show_box.setObjectName("groupBox_show_box") - self.gridLayout_62 = QtWidgets.QGridLayout(self.groupBox_show_box) - self.gridLayout_62.setObjectName("gridLayout_62") - self.gridLayout_show_box = QtWidgets.QGridLayout() - self.gridLayout_show_box.setObjectName("gridLayout_show_box") - self.gridLayout_62.addLayout(self.gridLayout_show_box, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_show_box, 13, 0, 1, 2) - self.groupBox_chatglm = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_chatglm.setObjectName("groupBox_chatglm") - self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_chatglm) - self.gridLayout_9.setObjectName("gridLayout_9") - self.gridLayout_8 = QtWidgets.QGridLayout() - self.gridLayout_8.setObjectName("gridLayout_8") - self.label_chatglm_api_ip_port = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_api_ip_port.setObjectName("label_chatglm_api_ip_port") - self.gridLayout_8.addWidget(self.label_chatglm_api_ip_port, 0, 0, 1, 1) - self.lineEdit_chatglm_top_p = QtWidgets.QLineEdit(self.groupBox_chatglm) - self.lineEdit_chatglm_top_p.setObjectName("lineEdit_chatglm_top_p") - self.gridLayout_8.addWidget(self.lineEdit_chatglm_top_p, 2, 1, 1, 1) - self.label_chatglm_history_max_len = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_history_max_len.setObjectName("label_chatglm_history_max_len") - self.gridLayout_8.addWidget(self.label_chatglm_history_max_len, 5, 0, 1, 1) - self.lineEdit_chatglm_max_length = QtWidgets.QLineEdit(self.groupBox_chatglm) - self.lineEdit_chatglm_max_length.setObjectName("lineEdit_chatglm_max_length") - self.gridLayout_8.addWidget(self.lineEdit_chatglm_max_length, 1, 1, 1, 1) - self.label_chatglm_top_p = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_top_p.setObjectName("label_chatglm_top_p") - self.gridLayout_8.addWidget(self.label_chatglm_top_p, 2, 0, 1, 1) - self.label_chatglm_temperature = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_temperature.setObjectName("label_chatglm_temperature") - self.gridLayout_8.addWidget(self.label_chatglm_temperature, 3, 0, 1, 1) - self.lineEdit_chatglm_temperature = QtWidgets.QLineEdit(self.groupBox_chatglm) - self.lineEdit_chatglm_temperature.setObjectName("lineEdit_chatglm_temperature") - self.gridLayout_8.addWidget(self.lineEdit_chatglm_temperature, 3, 1, 1, 1) - self.lineEdit_chatglm_api_ip_port = QtWidgets.QLineEdit(self.groupBox_chatglm) - self.lineEdit_chatglm_api_ip_port.setObjectName("lineEdit_chatglm_api_ip_port") - self.gridLayout_8.addWidget(self.lineEdit_chatglm_api_ip_port, 0, 1, 1, 1) - self.label_chatglm_max_length = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_max_length.setObjectName("label_chatglm_max_length") - self.gridLayout_8.addWidget(self.label_chatglm_max_length, 1, 0, 1, 1) - self.label_chatglm_history_enable = QtWidgets.QLabel(self.groupBox_chatglm) - self.label_chatglm_history_enable.setObjectName("label_chatglm_history_enable") - self.gridLayout_8.addWidget(self.label_chatglm_history_enable, 4, 0, 1, 1) - self.checkBox_chatglm_history_enable = QtWidgets.QCheckBox(self.groupBox_chatglm) - self.checkBox_chatglm_history_enable.setObjectName("checkBox_chatglm_history_enable") - self.gridLayout_8.addWidget(self.checkBox_chatglm_history_enable, 4, 1, 1, 1) - self.lineEdit_chatglm_history_max_len = QtWidgets.QLineEdit(self.groupBox_chatglm) - self.lineEdit_chatglm_history_max_len.setObjectName("lineEdit_chatglm_history_max_len") - self.gridLayout_8.addWidget(self.lineEdit_chatglm_history_max_len, 5, 1, 1, 1) - self.gridLayout_9.addLayout(self.gridLayout_8, 0, 0, 1, 1) + self.lineEdit_filter_talk_forget_duration.setObjectName("lineEdit_filter_talk_forget_duration") + self.gridLayout_filter.addWidget(self.lineEdit_filter_talk_forget_duration, 14, 1, 1, 1) + self.label_filter_after_must_str = QtWidgets.QLabel(self.groupBox_filter) + self.label_filter_after_must_str.setObjectName("label_filter_after_must_str") + self.gridLayout_filter.addWidget(self.label_filter_after_must_str, 1, 0, 1, 1) + self.lineEdit_filter_comment_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) + self.lineEdit_filter_comment_forget_reserve_num.setObjectName("lineEdit_filter_comment_forget_reserve_num") + self.gridLayout_filter.addWidget(self.lineEdit_filter_comment_forget_reserve_num, 7, 1, 1, 1) + self.label_filter_schedule_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter) + self.label_filter_schedule_forget_reserve_num.setObjectName("label_filter_schedule_forget_reserve_num") + self.gridLayout_filter.addWidget(self.label_filter_schedule_forget_reserve_num, 17, 0, 1, 1) + self.label_filter_gift_forget_duration = QtWidgets.QLabel(self.groupBox_filter) + self.label_filter_gift_forget_duration.setObjectName("label_filter_gift_forget_duration") + self.gridLayout_filter.addWidget(self.label_filter_gift_forget_duration, 8, 0, 1, 1) + self.lineEdit_filter_schedule_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) + self.lineEdit_filter_schedule_forget_reserve_num.setObjectName("lineEdit_filter_schedule_forget_reserve_num") + self.gridLayout_filter.addWidget(self.lineEdit_filter_schedule_forget_reserve_num, 17, 1, 1, 1) + self.label_filter_entrance_forget_duration = QtWidgets.QLabel(self.groupBox_filter) + self.label_filter_entrance_forget_duration.setObjectName("label_filter_entrance_forget_duration") + self.gridLayout_filter.addWidget(self.label_filter_entrance_forget_duration, 12, 0, 1, 1) + self.label_filter_follow_forget_reserve_num = QtWidgets.QLabel(self.groupBox_filter) + self.label_filter_follow_forget_reserve_num.setObjectName("label_filter_follow_forget_reserve_num") + self.gridLayout_filter.addWidget(self.label_filter_follow_forget_reserve_num, 11, 0, 1, 1) + self.lineEdit_filter_follow_forget_duration = QtWidgets.QLineEdit(self.groupBox_filter) + self.lineEdit_filter_follow_forget_duration.setObjectName("lineEdit_filter_follow_forget_duration") + self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_duration, 10, 1, 1, 1) + self.lineEdit_filter_follow_forget_reserve_num = QtWidgets.QLineEdit(self.groupBox_filter) + self.lineEdit_filter_follow_forget_reserve_num.setObjectName("lineEdit_filter_follow_forget_reserve_num") + self.gridLayout_filter.addWidget(self.lineEdit_filter_follow_forget_reserve_num, 11, 1, 1, 1) + self.gridLayout_26.addLayout(self.gridLayout_filter, 0, 0, 1, 1) + spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_26.addItem(spacerItem6, 0, 1, 1, 1) + self.gridLayout_26.setColumnStretch(0, 9) + self.gridLayout_26.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_filter, 23, 0, 1, 3) + self.label_visual_body = QtWidgets.QLabel(self.formWidget) + self.label_visual_body.setObjectName("label_visual_body") + self.gridLayout.addWidget(self.label_visual_body, 3, 0, 1, 1) + self.groupBox_play_audio = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_play_audio.setObjectName("groupBox_play_audio") + self.gridLayout_68 = QtWidgets.QGridLayout(self.groupBox_play_audio) + self.gridLayout_68.setObjectName("gridLayout_68") + self.gridLayout_play_audio = QtWidgets.QGridLayout() + self.gridLayout_play_audio.setObjectName("gridLayout_play_audio") + self.gridLayout_68.addLayout(self.gridLayout_play_audio, 0, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_play_audio, 17, 0, 1, 2) + self.groupBox_local_qa = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_local_qa.setObjectName("groupBox_local_qa") + self.gridLayout_51 = QtWidgets.QGridLayout(self.groupBox_local_qa) + self.gridLayout_51.setObjectName("gridLayout_51") + self.gridLayout_50 = QtWidgets.QGridLayout() + self.gridLayout_50.setObjectName("gridLayout_50") + self.label_local_qa_audio_enable = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_audio_enable.setObjectName("label_local_qa_audio_enable") + self.gridLayout_50.addWidget(self.label_local_qa_audio_enable, 4, 0, 1, 1) + self.label_local_qa_text_enable = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_text_enable.setObjectName("label_local_qa_text_enable") + self.gridLayout_50.addWidget(self.label_local_qa_text_enable, 0, 0, 1, 1) + self.checkBox_local_qa_text_enable = QtWidgets.QCheckBox(self.groupBox_local_qa) + self.checkBox_local_qa_text_enable.setObjectName("checkBox_local_qa_text_enable") + self.gridLayout_50.addWidget(self.checkBox_local_qa_text_enable, 0, 1, 1, 1) + self.lineEdit_local_qa_text_file_path = QtWidgets.QLineEdit(self.groupBox_local_qa) + self.lineEdit_local_qa_text_file_path.setObjectName("lineEdit_local_qa_text_file_path") + self.gridLayout_50.addWidget(self.lineEdit_local_qa_text_file_path, 2, 1, 1, 1) + self.label_local_qa_audio_similarity = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_audio_similarity.setObjectName("label_local_qa_audio_similarity") + self.gridLayout_50.addWidget(self.label_local_qa_audio_similarity, 6, 0, 1, 1) + self.checkBox_local_qa_audio_enable = QtWidgets.QCheckBox(self.groupBox_local_qa) + self.checkBox_local_qa_audio_enable.setObjectName("checkBox_local_qa_audio_enable") + self.gridLayout_50.addWidget(self.checkBox_local_qa_audio_enable, 4, 1, 1, 1) + self.label_local_qa_text_similarity = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_text_similarity.setObjectName("label_local_qa_text_similarity") + self.gridLayout_50.addWidget(self.label_local_qa_text_similarity, 3, 0, 1, 1) + self.lineEdit_local_qa_audio_file_path = QtWidgets.QLineEdit(self.groupBox_local_qa) + self.lineEdit_local_qa_audio_file_path.setObjectName("lineEdit_local_qa_audio_file_path") + self.gridLayout_50.addWidget(self.lineEdit_local_qa_audio_file_path, 5, 1, 1, 1) + self.label_local_qa_audio_file_path = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_audio_file_path.setObjectName("label_local_qa_audio_file_path") + self.gridLayout_50.addWidget(self.label_local_qa_audio_file_path, 5, 0, 1, 1) + self.label_local_qa_text_file_path = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_text_file_path.setObjectName("label_local_qa_text_file_path") + self.gridLayout_50.addWidget(self.label_local_qa_text_file_path, 2, 0, 1, 1) + self.lineEdit_local_qa_text_similarity = QtWidgets.QLineEdit(self.groupBox_local_qa) + self.lineEdit_local_qa_text_similarity.setObjectName("lineEdit_local_qa_text_similarity") + self.gridLayout_50.addWidget(self.lineEdit_local_qa_text_similarity, 3, 1, 1, 1) + self.lineEdit_local_qa_audio_similarity = QtWidgets.QLineEdit(self.groupBox_local_qa) + self.lineEdit_local_qa_audio_similarity.setObjectName("lineEdit_local_qa_audio_similarity") + self.gridLayout_50.addWidget(self.lineEdit_local_qa_audio_similarity, 6, 1, 1, 1) + self.label_local_qa_text_type = QtWidgets.QLabel(self.groupBox_local_qa) + self.label_local_qa_text_type.setObjectName("label_local_qa_text_type") + self.gridLayout_50.addWidget(self.label_local_qa_text_type, 1, 0, 1, 1) + self.comboBox_local_qa_text_type = QtWidgets.QComboBox(self.groupBox_local_qa) + self.comboBox_local_qa_text_type.setObjectName("comboBox_local_qa_text_type") + self.comboBox_local_qa_text_type.addItem("") + self.comboBox_local_qa_text_type.addItem("") + self.gridLayout_50.addWidget(self.comboBox_local_qa_text_type, 1, 1, 1, 1) + self.gridLayout_51.addLayout(self.gridLayout_50, 0, 0, 1, 1) spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_9.addItem(spacerItem7, 0, 1, 1, 1) - self.gridLayout_9.setColumnStretch(0, 9) - self.gridLayout_9.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_chatglm, 32, 0, 1, 3) - self.groupBox_claude2 = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_claude2.setObjectName("groupBox_claude2") - self.gridLayout_65 = QtWidgets.QGridLayout(self.groupBox_claude2) - self.gridLayout_65.setObjectName("gridLayout_65") - self.gridLayout_60 = QtWidgets.QGridLayout() - self.gridLayout_60.setObjectName("gridLayout_60") - self.lineEdit_claude2_cookie = QtWidgets.QLineEdit(self.groupBox_claude2) - self.lineEdit_claude2_cookie.setObjectName("lineEdit_claude2_cookie") - self.gridLayout_60.addWidget(self.lineEdit_claude2_cookie, 0, 1, 1, 1) - self.lineEdit_claude2_proxies_socks5 = QtWidgets.QLineEdit(self.groupBox_claude2) - self.lineEdit_claude2_proxies_socks5.setObjectName("lineEdit_claude2_proxies_socks5") - self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_socks5, 4, 1, 1, 1) - self.label_claude2_proxies_https = QtWidgets.QLabel(self.groupBox_claude2) - self.label_claude2_proxies_https.setObjectName("label_claude2_proxies_https") - self.gridLayout_60.addWidget(self.label_claude2_proxies_https, 3, 0, 1, 1) - self.label_claude2_proxies_socks5 = QtWidgets.QLabel(self.groupBox_claude2) - self.label_claude2_proxies_socks5.setObjectName("label_claude2_proxies_socks5") - self.gridLayout_60.addWidget(self.label_claude2_proxies_socks5, 4, 0, 1, 1) - self.checkBox_claude2_use_proxy = QtWidgets.QCheckBox(self.groupBox_claude2) - self.checkBox_claude2_use_proxy.setObjectName("checkBox_claude2_use_proxy") - self.gridLayout_60.addWidget(self.checkBox_claude2_use_proxy, 1, 1, 1, 1) - self.label_claude2_cookie = QtWidgets.QLabel(self.groupBox_claude2) - self.label_claude2_cookie.setObjectName("label_claude2_cookie") - self.gridLayout_60.addWidget(self.label_claude2_cookie, 0, 0, 1, 1) - self.label_claude2_use_proxy = QtWidgets.QLabel(self.groupBox_claude2) - self.label_claude2_use_proxy.setObjectName("label_claude2_use_proxy") - self.gridLayout_60.addWidget(self.label_claude2_use_proxy, 1, 0, 1, 1) - self.label_claude2_proxies_http = QtWidgets.QLabel(self.groupBox_claude2) - self.label_claude2_proxies_http.setObjectName("label_claude2_proxies_http") - self.gridLayout_60.addWidget(self.label_claude2_proxies_http, 2, 0, 1, 1) - self.lineEdit_claude2_proxies_https = QtWidgets.QLineEdit(self.groupBox_claude2) - self.lineEdit_claude2_proxies_https.setObjectName("lineEdit_claude2_proxies_https") - self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_https, 3, 1, 1, 1) - self.lineEdit_claude2_proxies_http = QtWidgets.QLineEdit(self.groupBox_claude2) - self.lineEdit_claude2_proxies_http.setObjectName("lineEdit_claude2_proxies_http") - self.gridLayout_60.addWidget(self.lineEdit_claude2_proxies_http, 2, 1, 1, 1) - self.gridLayout_65.addLayout(self.gridLayout_60, 0, 0, 1, 1) - spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_65.addItem(spacerItem8, 0, 1, 1, 1) - self.gridLayout_65.setColumnStretch(0, 9) - self.gridLayout_65.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_claude2, 31, 0, 1, 3) - self.groupBox_claude = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_claude.setObjectName("groupBox_claude") - self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox_claude) - self.gridLayout_7.setObjectName("gridLayout_7") - self.gridLayout_6 = QtWidgets.QGridLayout() - self.gridLayout_6.setObjectName("gridLayout_6") - self.lineEdit_claude_slack_user_token = QtWidgets.QLineEdit(self.groupBox_claude) - self.lineEdit_claude_slack_user_token.setObjectName("lineEdit_claude_slack_user_token") - self.gridLayout_6.addWidget(self.lineEdit_claude_slack_user_token, 1, 1, 1, 1) - self.label_claude_slack_user_token = QtWidgets.QLabel(self.groupBox_claude) - self.label_claude_slack_user_token.setObjectName("label_claude_slack_user_token") - self.gridLayout_6.addWidget(self.label_claude_slack_user_token, 1, 0, 1, 1) - self.label_claude_bot_user_id = QtWidgets.QLabel(self.groupBox_claude) - self.label_claude_bot_user_id.setObjectName("label_claude_bot_user_id") - self.gridLayout_6.addWidget(self.label_claude_bot_user_id, 2, 0, 1, 1) - self.lineEdit_claude_bot_user_id = QtWidgets.QLineEdit(self.groupBox_claude) - self.lineEdit_claude_bot_user_id.setObjectName("lineEdit_claude_bot_user_id") - self.gridLayout_6.addWidget(self.lineEdit_claude_bot_user_id, 2, 1, 1, 1) - self.gridLayout_7.addLayout(self.gridLayout_6, 0, 0, 1, 1) - spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_7.addItem(spacerItem9, 0, 1, 1, 1) - self.gridLayout_7.setColumnStretch(0, 9) - self.gridLayout_7.setColumnStretch(1, 1) - self.gridLayout.addWidget(self.groupBox_claude, 30, 0, 1, 3) + self.gridLayout_51.addItem(spacerItem7, 0, 1, 1, 1) + self.gridLayout_51.setColumnStretch(0, 9) + self.gridLayout_51.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_local_qa, 22, 0, 1, 3) self.groupBox_thanks = QtWidgets.QGroupBox(self.formWidget) self.groupBox_thanks.setObjectName("groupBox_thanks") self.gridLayout_42 = QtWidgets.QGridLayout(self.groupBox_thanks) @@ -668,8 +631,8 @@ def setupUi(self, MainWindow): self.lineEdit_thanks_follow_copy = QtWidgets.QLineEdit(self.groupBox_thanks) self.lineEdit_thanks_follow_copy.setObjectName("lineEdit_thanks_follow_copy") self.gridLayout_42.addWidget(self.lineEdit_thanks_follow_copy, 7, 1, 1, 1) - spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_42.addItem(spacerItem10, 2, 2, 1, 1) + spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_42.addItem(spacerItem8, 2, 2, 1, 1) self.checkBox_thanks_gift_enable = QtWidgets.QCheckBox(self.groupBox_thanks) self.checkBox_thanks_gift_enable.setObjectName("checkBox_thanks_gift_enable") self.gridLayout_42.addWidget(self.checkBox_thanks_gift_enable, 3, 1, 1, 1) @@ -691,18 +654,7 @@ def setupUi(self, MainWindow): self.gridLayout_42.setColumnStretch(0, 1) self.gridLayout_42.setColumnStretch(1, 8) self.gridLayout_42.setColumnStretch(2, 1) - self.gridLayout.addWidget(self.groupBox_thanks, 22, 0, 1, 3) - self.groupBox_play_audio = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_play_audio.setObjectName("groupBox_play_audio") - self.gridLayout_68 = QtWidgets.QGridLayout(self.groupBox_play_audio) - self.gridLayout_68.setObjectName("gridLayout_68") - self.gridLayout_play_audio = QtWidgets.QGridLayout() - self.gridLayout_play_audio.setObjectName("gridLayout_play_audio") - self.gridLayout_68.addLayout(self.gridLayout_play_audio, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_play_audio, 14, 0, 1, 2) - self.label_before_prompt = QtWidgets.QLabel(self.formWidget) - self.label_before_prompt.setObjectName("label_before_prompt") - self.gridLayout.addWidget(self.label_before_prompt, 5, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_thanks, 25, 0, 1, 3) self.groupBox_read_comment = QtWidgets.QGroupBox(self.formWidget) self.groupBox_read_comment.setObjectName("groupBox_read_comment") self.gridLayout_75 = QtWidgets.QGridLayout(self.groupBox_read_comment) @@ -710,64 +662,120 @@ def setupUi(self, MainWindow): self.gridLayout_read_comment = QtWidgets.QGridLayout() self.gridLayout_read_comment.setObjectName("gridLayout_read_comment") self.gridLayout_75.addLayout(self.gridLayout_read_comment, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_read_comment, 16, 0, 1, 2) - self.groupBox_read_user_name = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_read_user_name.setObjectName("groupBox_read_user_name") - self.gridLayout_59 = QtWidgets.QGridLayout(self.groupBox_read_user_name) - self.gridLayout_59.setObjectName("gridLayout_59") - self.gridLayout_58 = QtWidgets.QGridLayout() - self.gridLayout_58.setObjectName("gridLayout_58") - self.label_read_user_name_reply_before = QtWidgets.QLabel(self.groupBox_read_user_name) - self.label_read_user_name_reply_before.setObjectName("label_read_user_name_reply_before") - self.gridLayout_58.addWidget(self.label_read_user_name_reply_before, 2, 0, 1, 1) - self.textEdit_read_user_name_reply_before = QtWidgets.QTextEdit(self.groupBox_read_user_name) - self.textEdit_read_user_name_reply_before.setObjectName("textEdit_read_user_name_reply_before") - self.gridLayout_58.addWidget(self.textEdit_read_user_name_reply_before, 2, 1, 1, 1) - self.label_read_user_name_enable = QtWidgets.QLabel(self.groupBox_read_user_name) - self.label_read_user_name_enable.setObjectName("label_read_user_name_enable") - self.gridLayout_58.addWidget(self.label_read_user_name_enable, 0, 0, 1, 1) - self.checkBox_read_user_name_enable = QtWidgets.QCheckBox(self.groupBox_read_user_name) - self.checkBox_read_user_name_enable.setObjectName("checkBox_read_user_name_enable") - self.gridLayout_58.addWidget(self.checkBox_read_user_name_enable, 0, 1, 1, 1) - self.label_read_user_name_voice_change = QtWidgets.QLabel(self.groupBox_read_user_name) - self.label_read_user_name_voice_change.setObjectName("label_read_user_name_voice_change") - self.gridLayout_58.addWidget(self.label_read_user_name_voice_change, 1, 0, 1, 1) - self.checkBox_read_user_name_voice_change = QtWidgets.QCheckBox(self.groupBox_read_user_name) - self.checkBox_read_user_name_voice_change.setObjectName("checkBox_read_user_name_voice_change") - self.gridLayout_58.addWidget(self.checkBox_read_user_name_voice_change, 1, 1, 1, 1) - self.label_read_user_name_reply_after = QtWidgets.QLabel(self.groupBox_read_user_name) - self.label_read_user_name_reply_after.setObjectName("label_read_user_name_reply_after") - self.gridLayout_58.addWidget(self.label_read_user_name_reply_after, 3, 0, 1, 1) - self.textEdit_read_user_name_reply_after = QtWidgets.QTextEdit(self.groupBox_read_user_name) - self.textEdit_read_user_name_reply_after.setObjectName("textEdit_read_user_name_reply_after") - self.gridLayout_58.addWidget(self.textEdit_read_user_name_reply_after, 3, 1, 1, 1) - self.gridLayout_59.addLayout(self.gridLayout_58, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_read_user_name, 17, 0, 1, 2) - self.comboBox_chat_type = QtWidgets.QComboBox(self.formWidget) - self.comboBox_chat_type.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) - self.comboBox_chat_type.setObjectName("comboBox_chat_type") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.comboBox_chat_type.addItem("") - self.gridLayout.addWidget(self.comboBox_chat_type, 2, 1, 1, 1) - self.lineEdit_room_display_id = QtWidgets.QLineEdit(self.formWidget) - self.lineEdit_room_display_id.setObjectName("lineEdit_room_display_id") - self.gridLayout.addWidget(self.lineEdit_room_display_id, 1, 1, 1, 1) - self.groupBox_xuniren = QtWidgets.QGroupBox(self.formWidget) - self.groupBox_xuniren.setObjectName("groupBox_xuniren") - self.gridLayout_89 = QtWidgets.QGridLayout(self.groupBox_xuniren) - self.gridLayout_89.setObjectName("gridLayout_89") - self.gridLayout_xuniren = QtWidgets.QGridLayout() - self.gridLayout_xuniren.setObjectName("gridLayout_xuniren") - self.gridLayout_89.addLayout(self.gridLayout_xuniren, 0, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox_xuniren, 15, 0, 1, 2) + self.gridLayout.addWidget(self.groupBox_read_comment, 19, 0, 1, 2) + self.groupBox_chatgpt = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_chatgpt.setObjectName("groupBox_chatgpt") + self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_chatgpt) + self.gridLayout_5.setObjectName("gridLayout_5") + self.gridLayout_3 = QtWidgets.QGridLayout() + self.gridLayout_3.setObjectName("gridLayout_3") + self.lineEdit_chatgpt_max_tokens = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_max_tokens.setObjectName("lineEdit_chatgpt_max_tokens") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_max_tokens, 2, 1, 1, 1) + self.label_chatgpt_model = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_model.setObjectName("label_chatgpt_model") + self.gridLayout_3.addWidget(self.label_chatgpt_model, 0, 0, 1, 1) + self.label_chatgpt_max_tokens = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_max_tokens.setObjectName("label_chatgpt_max_tokens") + self.gridLayout_3.addWidget(self.label_chatgpt_max_tokens, 2, 0, 1, 1) + self.lineEdit_chatgpt_presence_penalty = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_presence_penalty.setObjectName("lineEdit_chatgpt_presence_penalty") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_presence_penalty, 4, 1, 1, 1) + self.label_chatgpt_temperature = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_temperature.setObjectName("label_chatgpt_temperature") + self.gridLayout_3.addWidget(self.label_chatgpt_temperature, 1, 0, 1, 1) + self.label_chatgpt_top_p = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_top_p.setObjectName("label_chatgpt_top_p") + self.gridLayout_3.addWidget(self.label_chatgpt_top_p, 3, 0, 1, 1) + self.lineEdit_chatgpt_top_p = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_top_p.setObjectName("lineEdit_chatgpt_top_p") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_top_p, 3, 1, 1, 1) + self.lineEdit_chatgpt_temperature = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_temperature.setObjectName("lineEdit_chatgpt_temperature") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_temperature, 1, 1, 1, 1) + self.label_chatgpt_frequency_penalty = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_frequency_penalty.setObjectName("label_chatgpt_frequency_penalty") + self.gridLayout_3.addWidget(self.label_chatgpt_frequency_penalty, 5, 0, 1, 1) + self.lineEdit_chatgpt_frequency_penalty = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_frequency_penalty.setObjectName("lineEdit_chatgpt_frequency_penalty") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_frequency_penalty, 5, 1, 1, 1) + self.label_chatgpt_presence_penalty = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_presence_penalty.setObjectName("label_chatgpt_presence_penalty") + self.gridLayout_3.addWidget(self.label_chatgpt_presence_penalty, 4, 0, 1, 1) + self.label_chatgpt_preset = QtWidgets.QLabel(self.groupBox_chatgpt) + self.label_chatgpt_preset.setObjectName("label_chatgpt_preset") + self.gridLayout_3.addWidget(self.label_chatgpt_preset, 6, 0, 1, 1) + self.lineEdit_chatgpt_preset = QtWidgets.QLineEdit(self.groupBox_chatgpt) + self.lineEdit_chatgpt_preset.setObjectName("lineEdit_chatgpt_preset") + self.gridLayout_3.addWidget(self.lineEdit_chatgpt_preset, 6, 1, 1, 1) + self.comboBox_chatgpt_model = QtWidgets.QComboBox(self.groupBox_chatgpt) + self.comboBox_chatgpt_model.setObjectName("comboBox_chatgpt_model") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.comboBox_chatgpt_model.addItem("") + self.gridLayout_3.addWidget(self.comboBox_chatgpt_model, 0, 1, 1, 1) + self.gridLayout_5.addLayout(self.gridLayout_3, 0, 0, 1, 1) + spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_5.addItem(spacerItem9, 0, 1, 1, 1) + self.gridLayout_5.setColumnStretch(0, 9) + self.gridLayout_5.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_chatgpt, 31, 0, 2, 3) + self.groupBox_claude = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_claude.setObjectName("groupBox_claude") + self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox_claude) + self.gridLayout_7.setObjectName("gridLayout_7") + self.gridLayout_6 = QtWidgets.QGridLayout() + self.gridLayout_6.setObjectName("gridLayout_6") + self.lineEdit_claude_slack_user_token = QtWidgets.QLineEdit(self.groupBox_claude) + self.lineEdit_claude_slack_user_token.setObjectName("lineEdit_claude_slack_user_token") + self.gridLayout_6.addWidget(self.lineEdit_claude_slack_user_token, 1, 1, 1, 1) + self.label_claude_slack_user_token = QtWidgets.QLabel(self.groupBox_claude) + self.label_claude_slack_user_token.setObjectName("label_claude_slack_user_token") + self.gridLayout_6.addWidget(self.label_claude_slack_user_token, 1, 0, 1, 1) + self.label_claude_bot_user_id = QtWidgets.QLabel(self.groupBox_claude) + self.label_claude_bot_user_id.setObjectName("label_claude_bot_user_id") + self.gridLayout_6.addWidget(self.label_claude_bot_user_id, 2, 0, 1, 1) + self.lineEdit_claude_bot_user_id = QtWidgets.QLineEdit(self.groupBox_claude) + self.lineEdit_claude_bot_user_id.setObjectName("lineEdit_claude_bot_user_id") + self.gridLayout_6.addWidget(self.lineEdit_claude_bot_user_id, 2, 1, 1, 1) + self.gridLayout_7.addLayout(self.gridLayout_6, 0, 0, 1, 1) + spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_7.addItem(spacerItem10, 0, 1, 1, 1) + self.gridLayout_7.setColumnStretch(0, 9) + self.gridLayout_7.setColumnStretch(1, 1) + self.gridLayout.addWidget(self.groupBox_claude, 33, 0, 1, 3) + self.groupBox_bilibili = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_bilibili.setObjectName("groupBox_bilibili") + self.gridLayout_72 = QtWidgets.QGridLayout(self.groupBox_bilibili) + self.gridLayout_72.setObjectName("gridLayout_72") + self.gridLayout_bilibili = QtWidgets.QGridLayout() + self.gridLayout_bilibili.setObjectName("gridLayout_bilibili") + self.gridLayout_72.addLayout(self.gridLayout_bilibili, 0, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_bilibili, 12, 0, 1, 2) + self.groupBox_twitch = QtWidgets.QGroupBox(self.formWidget) + self.groupBox_twitch.setObjectName("groupBox_twitch") + self.gridLayout_91 = QtWidgets.QGridLayout(self.groupBox_twitch) + self.gridLayout_91.setObjectName("gridLayout_91") + self.gridLayout_twitch = QtWidgets.QGridLayout() + self.gridLayout_twitch.setObjectName("gridLayout_twitch") + self.gridLayout_91.addLayout(self.gridLayout_twitch, 0, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox_twitch, 13, 0, 1, 2) self.gridLayout.setColumnStretch(0, 1) self.gridLayout.setColumnStretch(1, 8) self.gridLayout.setColumnStretch(2, 1) @@ -2248,34 +2256,24 @@ def retranslateUi(self, MainWindow): self.pushButton_run.setText(_translate("MainWindow", "运行")) self.pushButton_config_page.setText(_translate("MainWindow", "①配置页")) self.pushButton_save.setText(_translate("MainWindow", "保存配置")) - self.groupBox_chatgpt.setTitle(_translate("MainWindow", "chatgpt")) - self.label_chatgpt_model.setText(_translate("MainWindow", "模型")) - self.label_chatgpt_max_tokens.setText(_translate("MainWindow", "最大令牌数")) - self.label_chatgpt_temperature.setText(_translate("MainWindow", "温度")) - self.label_chatgpt_top_p.setText(_translate("MainWindow", "前p个选择")) - self.label_chatgpt_frequency_penalty.setText(_translate("MainWindow", "频率惩罚")) - self.label_chatgpt_presence_penalty.setText(_translate("MainWindow", "存在惩罚")) - self.label_chatgpt_preset.setText(_translate("MainWindow", "预设")) - self.comboBox_chatgpt_model.setItemText(0, _translate("MainWindow", "gpt-3.5-turbo")) - self.comboBox_chatgpt_model.setItemText(1, _translate("MainWindow", "gpt-3.5-turbo-0301")) - self.comboBox_chatgpt_model.setItemText(2, _translate("MainWindow", "gpt-3.5-turbo-0613")) - self.comboBox_chatgpt_model.setItemText(3, _translate("MainWindow", "gpt-3.5-turbo-16k")) - self.comboBox_chatgpt_model.setItemText(4, _translate("MainWindow", "gpt-3.5-turbo-16k-0613")) - self.comboBox_chatgpt_model.setItemText(5, _translate("MainWindow", "gpt-4")) - self.comboBox_chatgpt_model.setItemText(6, _translate("MainWindow", "gpt-4-0314")) - self.comboBox_chatgpt_model.setItemText(7, _translate("MainWindow", "gpt-4-0613")) - self.comboBox_chatgpt_model.setItemText(8, _translate("MainWindow", "gpt-4-32k")) - self.comboBox_chatgpt_model.setItemText(9, _translate("MainWindow", "gpt-4-32k-0314")) - self.comboBox_chatgpt_model.setItemText(10, _translate("MainWindow", "gpt-4-32k-0613")) - self.comboBox_chatgpt_model.setItemText(11, _translate("MainWindow", "text-embedding-ada-002")) - self.comboBox_chatgpt_model.setItemText(12, _translate("MainWindow", "text-davinci-003")) - self.comboBox_chatgpt_model.setItemText(13, _translate("MainWindow", "text-davinci-002")) - self.comboBox_chatgpt_model.setItemText(14, _translate("MainWindow", "text-curie-001")) - self.comboBox_chatgpt_model.setItemText(15, _translate("MainWindow", "text-babbage-001")) - self.comboBox_chatgpt_model.setItemText(16, _translate("MainWindow", "text-ada-001")) - self.comboBox_chatgpt_model.setItemText(17, _translate("MainWindow", "text-moderation-latest")) - self.comboBox_chatgpt_model.setItemText(18, _translate("MainWindow", "text-moderation-stable")) - self.label_chat_type.setText(_translate("MainWindow", "聊天类型")) + self.label_before_prompt.setText(_translate("MainWindow", "提示词前缀")) + self.groupBox_xuniren.setTitle(_translate("MainWindow", "xuniren")) + self.label_need_lang.setText(_translate("MainWindow", "回复语言")) + self.comboBox_need_lang.setItemText(0, _translate("MainWindow", "所有")) + self.comboBox_need_lang.setItemText(1, _translate("MainWindow", "中文")) + self.comboBox_need_lang.setItemText(2, _translate("MainWindow", "英文")) + self.comboBox_need_lang.setItemText(3, _translate("MainWindow", "日文")) + self.label_audio_synthesis_type.setText(_translate("MainWindow", "语音合成")) + self.comboBox_chat_type.setItemText(0, _translate("MainWindow", "不启用")) + self.comboBox_chat_type.setItemText(1, _translate("MainWindow", "复读机")) + self.comboBox_chat_type.setItemText(2, _translate("MainWindow", "ChatGPT")) + self.comboBox_chat_type.setItemText(3, _translate("MainWindow", "Claude")) + self.comboBox_chat_type.setItemText(4, _translate("MainWindow", "ChatGLM")) + self.comboBox_chat_type.setItemText(5, _translate("MainWindow", "chat_with_file")) + self.comboBox_chat_type.setItemText(6, _translate("MainWindow", "Chatterbot")) + self.comboBox_chat_type.setItemText(7, _translate("MainWindow", "text-generation-webui")) + self.comboBox_chat_type.setItemText(8, _translate("MainWindow", "讯飞星火")) + self.comboBox_chat_type.setItemText(9, _translate("MainWindow", "Langchain_ChatGLM")) self.groupBox_audio_random_speed.setTitle(_translate("MainWindow", "音频随机变速")) self.label_audio_random_speed_normal_enable.setText(_translate("MainWindow", "普通音频变速")) self.label_audio_random_speed_normal_speed_min.setText(_translate("MainWindow", "速度下限")) @@ -2285,24 +2283,16 @@ def retranslateUi(self, MainWindow): self.checkBox_audio_random_speed_copywriting_enable.setText(_translate("MainWindow", "启用")) self.label_audio_random_speed_copywriting_speed_min.setText(_translate("MainWindow", "速度下限")) self.label_audio_random_speed_copywriting_speed_max.setText(_translate("MainWindow", "速度上限")) - self.label_platform.setText(_translate("MainWindow", "平台")) - self.comboBox_need_lang.setItemText(0, _translate("MainWindow", "所有")) - self.comboBox_need_lang.setItemText(1, _translate("MainWindow", "中文")) - self.comboBox_need_lang.setItemText(2, _translate("MainWindow", "英文")) - self.comboBox_need_lang.setItemText(3, _translate("MainWindow", "日文")) - self.groupBox_local_qa.setTitle(_translate("MainWindow", "本地问答")) - self.label_local_qa_audio_enable.setText(_translate("MainWindow", "音频匹配")) - self.label_local_qa_text_enable.setText(_translate("MainWindow", "文本匹配")) - self.checkBox_local_qa_text_enable.setText(_translate("MainWindow", "启用")) - self.label_local_qa_audio_similarity.setText(_translate("MainWindow", "音频最低相似度")) - self.checkBox_local_qa_audio_enable.setText(_translate("MainWindow", "启用")) - self.label_local_qa_text_similarity.setText(_translate("MainWindow", "文本最低相似度")) - self.label_local_qa_audio_file_path.setText(_translate("MainWindow", "音频存储路径")) - self.label_local_qa_text_file_path.setText(_translate("MainWindow", "文本问答数据路径")) - self.label_local_qa_text_type.setText(_translate("MainWindow", "文本问答算法类型")) - self.comboBox_local_qa_text_type.setItemText(0, _translate("MainWindow", "自定义json")) - self.comboBox_local_qa_text_type.setItemText(1, _translate("MainWindow", "一问一答")) - self.groupBox_bilibili.setTitle(_translate("MainWindow", "哔哩哔哩")) + self.groupBox_show_box.setTitle(_translate("MainWindow", "自定义显示板块")) + self.label_after_prompt.setText(_translate("MainWindow", "提示词后缀")) + self.groupBox_chatglm.setTitle(_translate("MainWindow", "ChatGLM")) + self.label_chatglm_api_ip_port.setText(_translate("MainWindow", "api地址")) + self.label_chatglm_history_max_len.setText(_translate("MainWindow", "最大记忆长度")) + self.label_chatglm_top_p.setText(_translate("MainWindow", "前p个选择")) + self.label_chatglm_temperature.setText(_translate("MainWindow", "温度")) + self.label_chatglm_max_length.setText(_translate("MainWindow", "最大长度限制")) + self.label_chatglm_history_enable.setText(_translate("MainWindow", "上下文记忆")) + self.checkBox_chatglm_history_enable.setText(_translate("MainWindow", "启用")) self.groupBox_log.setTitle(_translate("MainWindow", "日志")) self.comboBox_comment_log_type.setItemText(0, _translate("MainWindow", "问答")) self.comboBox_comment_log_type.setItemText(1, _translate("MainWindow", "问题")) @@ -2312,8 +2302,26 @@ def retranslateUi(self, MainWindow): self.label_captions_file_path.setText(_translate("MainWindow", "字幕日志路径")) self.label_captions_enable.setText(_translate("MainWindow", "字幕日志")) self.checkBox_captions_enable.setText(_translate("MainWindow", "启用")) + self.label_platform.setText(_translate("MainWindow", "平台")) self.label_room_display_id.setText(_translate("MainWindow", "直播间号")) - self.label_visual_body.setText(_translate("MainWindow", "虚拟身体")) + self.label_chat_type.setText(_translate("MainWindow", "聊天类型")) + self.groupBox_openai.setTitle(_translate("MainWindow", "openai")) + self.label_openai_api.setText(_translate("MainWindow", "API")) + self.label_openai_api_key.setText(_translate("MainWindow", "API KEY")) + self.groupBox_claude2.setTitle(_translate("MainWindow", "Claude2")) + self.label_claude2_proxies_https.setText(_translate("MainWindow", "https代理地址")) + self.label_claude2_proxies_socks5.setText(_translate("MainWindow", "socks5代理地址")) + self.checkBox_claude2_use_proxy.setText(_translate("MainWindow", "启用")) + self.label_claude2_cookie.setText(_translate("MainWindow", "cookie")) + self.label_claude2_use_proxy.setText(_translate("MainWindow", "启用代理")) + self.label_claude2_proxies_http.setText(_translate("MainWindow", "http代理地址")) + self.groupBox_read_user_name.setTitle(_translate("MainWindow", "念用户名")) + self.label_read_user_name_reply_before.setText(_translate("MainWindow", "前置回复")) + self.label_read_user_name_enable.setText(_translate("MainWindow", "启用")) + self.checkBox_read_user_name_enable.setText(_translate("MainWindow", "是")) + self.label_read_user_name_voice_change.setText(_translate("MainWindow", "启用变声")) + self.checkBox_read_user_name_voice_change.setText(_translate("MainWindow", "是")) + self.label_read_user_name_reply_after.setText(_translate("MainWindow", "后置回复")) self.groupBox_filter.setTitle(_translate("MainWindow", "过滤")) self.label_filter_talk_forget_reserve_num.setText(_translate("MainWindow", "聊天保留数")) self.label_filter_comment_forget_reserve_num.setText(_translate("MainWindow", "弹幕保留数")) @@ -2333,31 +2341,20 @@ def retranslateUi(self, MainWindow): self.label_filter_gift_forget_duration.setText(_translate("MainWindow", "礼物遗忘间隔")) self.label_filter_entrance_forget_duration.setText(_translate("MainWindow", "入场遗忘间隔")) self.label_filter_follow_forget_reserve_num.setText(_translate("MainWindow", "关注保留数")) - self.label_after_prompt.setText(_translate("MainWindow", "提示词后缀")) - self.label_audio_synthesis_type.setText(_translate("MainWindow", "语音合成")) - self.groupBox_openai.setTitle(_translate("MainWindow", "openai")) - self.label_openai_api.setText(_translate("MainWindow", "API")) - self.label_openai_api_key.setText(_translate("MainWindow", "API KEY")) - self.label_need_lang.setText(_translate("MainWindow", "回复语言")) - self.groupBox_show_box.setTitle(_translate("MainWindow", "自定义显示板块")) - self.groupBox_chatglm.setTitle(_translate("MainWindow", "ChatGLM")) - self.label_chatglm_api_ip_port.setText(_translate("MainWindow", "api地址")) - self.label_chatglm_history_max_len.setText(_translate("MainWindow", "最大记忆长度")) - self.label_chatglm_top_p.setText(_translate("MainWindow", "前p个选择")) - self.label_chatglm_temperature.setText(_translate("MainWindow", "温度")) - self.label_chatglm_max_length.setText(_translate("MainWindow", "最大长度限制")) - self.label_chatglm_history_enable.setText(_translate("MainWindow", "上下文记忆")) - self.checkBox_chatglm_history_enable.setText(_translate("MainWindow", "启用")) - self.groupBox_claude2.setTitle(_translate("MainWindow", "Claude2")) - self.label_claude2_proxies_https.setText(_translate("MainWindow", "https代理地址")) - self.label_claude2_proxies_socks5.setText(_translate("MainWindow", "socks5代理地址")) - self.checkBox_claude2_use_proxy.setText(_translate("MainWindow", "启用")) - self.label_claude2_cookie.setText(_translate("MainWindow", "cookie")) - self.label_claude2_use_proxy.setText(_translate("MainWindow", "启用代理")) - self.label_claude2_proxies_http.setText(_translate("MainWindow", "http代理地址")) - self.groupBox_claude.setTitle(_translate("MainWindow", "Claude")) - self.label_claude_slack_user_token.setText(_translate("MainWindow", "slack_user_token")) - self.label_claude_bot_user_id.setText(_translate("MainWindow", "bot_user_id")) + self.label_visual_body.setText(_translate("MainWindow", "虚拟身体")) + self.groupBox_play_audio.setTitle(_translate("MainWindow", "音频播放")) + self.groupBox_local_qa.setTitle(_translate("MainWindow", "本地问答")) + self.label_local_qa_audio_enable.setText(_translate("MainWindow", "音频匹配")) + self.label_local_qa_text_enable.setText(_translate("MainWindow", "文本匹配")) + self.checkBox_local_qa_text_enable.setText(_translate("MainWindow", "启用")) + self.label_local_qa_audio_similarity.setText(_translate("MainWindow", "音频最低相似度")) + self.checkBox_local_qa_audio_enable.setText(_translate("MainWindow", "启用")) + self.label_local_qa_text_similarity.setText(_translate("MainWindow", "文本最低相似度")) + self.label_local_qa_audio_file_path.setText(_translate("MainWindow", "音频存储路径")) + self.label_local_qa_text_file_path.setText(_translate("MainWindow", "文本问答数据路径")) + self.label_local_qa_text_type.setText(_translate("MainWindow", "文本问答算法类型")) + self.comboBox_local_qa_text_type.setItemText(0, _translate("MainWindow", "自定义json")) + self.comboBox_local_qa_text_type.setItemText(1, _translate("MainWindow", "一问一答")) self.groupBox_thanks.setTitle(_translate("MainWindow", "答谢")) self.label_thanks_follow_enable.setText(_translate("MainWindow", "关注答谢")) self.label_thanks_entrance_enable.setText(_translate("MainWindow", "入场欢迎")) @@ -2369,27 +2366,39 @@ def retranslateUi(self, MainWindow): self.label_thanks_lowest_price.setText(_translate("MainWindow", "最低答谢价格")) self.checkBox_thanks_entrance_enable.setText(_translate("MainWindow", "启用")) self.checkBox_thanks_follow_enable.setText(_translate("MainWindow", "启用")) - self.groupBox_play_audio.setTitle(_translate("MainWindow", "音频播放")) - self.label_before_prompt.setText(_translate("MainWindow", "提示词前缀")) self.groupBox_read_comment.setTitle(_translate("MainWindow", "念弹幕")) - self.groupBox_read_user_name.setTitle(_translate("MainWindow", "念用户名")) - self.label_read_user_name_reply_before.setText(_translate("MainWindow", "前置回复")) - self.label_read_user_name_enable.setText(_translate("MainWindow", "启用")) - self.checkBox_read_user_name_enable.setText(_translate("MainWindow", "是")) - self.label_read_user_name_voice_change.setText(_translate("MainWindow", "启用变声")) - self.checkBox_read_user_name_voice_change.setText(_translate("MainWindow", "是")) - self.label_read_user_name_reply_after.setText(_translate("MainWindow", "后置回复")) - self.comboBox_chat_type.setItemText(0, _translate("MainWindow", "不启用")) - self.comboBox_chat_type.setItemText(1, _translate("MainWindow", "复读机")) - self.comboBox_chat_type.setItemText(2, _translate("MainWindow", "ChatGPT")) - self.comboBox_chat_type.setItemText(3, _translate("MainWindow", "Claude")) - self.comboBox_chat_type.setItemText(4, _translate("MainWindow", "ChatGLM")) - self.comboBox_chat_type.setItemText(5, _translate("MainWindow", "chat_with_file")) - self.comboBox_chat_type.setItemText(6, _translate("MainWindow", "Chatterbot")) - self.comboBox_chat_type.setItemText(7, _translate("MainWindow", "text-generation-webui")) - self.comboBox_chat_type.setItemText(8, _translate("MainWindow", "讯飞星火")) - self.comboBox_chat_type.setItemText(9, _translate("MainWindow", "Langchain_ChatGLM")) - self.groupBox_xuniren.setTitle(_translate("MainWindow", "xuniren")) + self.groupBox_chatgpt.setTitle(_translate("MainWindow", "chatgpt")) + self.label_chatgpt_model.setText(_translate("MainWindow", "模型")) + self.label_chatgpt_max_tokens.setText(_translate("MainWindow", "最大令牌数")) + self.label_chatgpt_temperature.setText(_translate("MainWindow", "温度")) + self.label_chatgpt_top_p.setText(_translate("MainWindow", "前p个选择")) + self.label_chatgpt_frequency_penalty.setText(_translate("MainWindow", "频率惩罚")) + self.label_chatgpt_presence_penalty.setText(_translate("MainWindow", "存在惩罚")) + self.label_chatgpt_preset.setText(_translate("MainWindow", "预设")) + self.comboBox_chatgpt_model.setItemText(0, _translate("MainWindow", "gpt-3.5-turbo")) + self.comboBox_chatgpt_model.setItemText(1, _translate("MainWindow", "gpt-3.5-turbo-0301")) + self.comboBox_chatgpt_model.setItemText(2, _translate("MainWindow", "gpt-3.5-turbo-0613")) + self.comboBox_chatgpt_model.setItemText(3, _translate("MainWindow", "gpt-3.5-turbo-16k")) + self.comboBox_chatgpt_model.setItemText(4, _translate("MainWindow", "gpt-3.5-turbo-16k-0613")) + self.comboBox_chatgpt_model.setItemText(5, _translate("MainWindow", "gpt-4")) + self.comboBox_chatgpt_model.setItemText(6, _translate("MainWindow", "gpt-4-0314")) + self.comboBox_chatgpt_model.setItemText(7, _translate("MainWindow", "gpt-4-0613")) + self.comboBox_chatgpt_model.setItemText(8, _translate("MainWindow", "gpt-4-32k")) + self.comboBox_chatgpt_model.setItemText(9, _translate("MainWindow", "gpt-4-32k-0314")) + self.comboBox_chatgpt_model.setItemText(10, _translate("MainWindow", "gpt-4-32k-0613")) + self.comboBox_chatgpt_model.setItemText(11, _translate("MainWindow", "text-embedding-ada-002")) + self.comboBox_chatgpt_model.setItemText(12, _translate("MainWindow", "text-davinci-003")) + self.comboBox_chatgpt_model.setItemText(13, _translate("MainWindow", "text-davinci-002")) + self.comboBox_chatgpt_model.setItemText(14, _translate("MainWindow", "text-curie-001")) + self.comboBox_chatgpt_model.setItemText(15, _translate("MainWindow", "text-babbage-001")) + self.comboBox_chatgpt_model.setItemText(16, _translate("MainWindow", "text-ada-001")) + self.comboBox_chatgpt_model.setItemText(17, _translate("MainWindow", "text-moderation-latest")) + self.comboBox_chatgpt_model.setItemText(18, _translate("MainWindow", "text-moderation-stable")) + self.groupBox_claude.setTitle(_translate("MainWindow", "Claude")) + self.label_claude_slack_user_token.setText(_translate("MainWindow", "slack_user_token")) + self.label_claude_bot_user_id.setText(_translate("MainWindow", "bot_user_id")) + self.groupBox_bilibili.setTitle(_translate("MainWindow", "哔哩哔哩")) + self.groupBox_twitch.setTitle(_translate("MainWindow", "twitch")) self.groupBox_zhipu.setTitle(_translate("MainWindow", "智谱AI")) self.groupBox_langchain_chatglm.setTitle(_translate("MainWindow", "Langchain_ChatGLM")) self.label_langchain_chatglm_api_ip_port.setText(_translate("MainWindow", "api地址")) diff --git a/config.json b/config.json index ed80769b..290dff01 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { - "platform": "talk", - "room_display_id": "278333", + "platform": "twitch", + "room_display_id": "zod0416", "chat_type": "reread", "need_lang": "none", "before_prompt": "请简要回复:", @@ -38,6 +38,12 @@ "cookie": "", "ac_time_value": "" }, + "twitch": { + "token": "oauth:xxxx", + "user": "love_ikaros", + "proxy_server": "127.0.0.1", + "proxy_port": "10809" + }, "read_user_name": { "enable": false, "voice_change": true, diff --git a/config.json.bak b/config.json.bak index f79fb4ab..a36d69ad 100644 --- a/config.json.bak +++ b/config.json.bak @@ -38,6 +38,12 @@ "cookie": "", "ac_time_value": "" }, + "twitch": { + "token": "oauth:xxxx", + "user": "love_ikaros", + "proxy_server": "127.0.0.1", + "proxy_port": "10809" + }, "read_user_name": { "enable": false, "voice_change": true, diff --git a/main.py b/main.py index 47668e96..d203f284 100644 --- a/main.py +++ b/main.py @@ -687,7 +687,7 @@ def init_config(self): """ # 修改下拉框内容 self.ui.comboBox_platform.clear() - self.ui.comboBox_platform.addItems(["聊天模式", "哔哩哔哩", "抖音", "快手", "斗鱼", "YouTube"]) + self.ui.comboBox_platform.addItems(["聊天模式", "哔哩哔哩", "抖音", "快手", "斗鱼", "YouTube", "twitch"]) platform_index = 0 if self.platform == "talk": platform_index = 0 @@ -701,6 +701,8 @@ def init_config(self): platform_index = 4 elif self.platform == "youtube": platform_index = 5 + elif self.platform == "twitch": + platform_index = 6 self.ui.comboBox_platform.setCurrentIndex(platform_index) # 修改输入框内容 @@ -1969,6 +1971,59 @@ def bilibili_gui_create(): bilibili_gui_create() + # twitch + def twitch_gui_create(): + data_json = [] + twitch_config = config.get("twitch") + + tmp_json = { + "label_text": "token", + "label_tip": "访问 https://twitchapps.com/tmi/ 获取,格式为:oauth:xxx", + "data": twitch_config["token"], + "main_obj_name": "twitch", + "index": 1 + } + data_json.append(tmp_json) + + tmp_json = { + "label_text": "用户名", + "label_tip": "你的twitch账号用户名", + "data": twitch_config["user"], + "main_obj_name": "twitch", + "index": 2 + } + data_json.append(tmp_json) + + tmp_json = { + "label_text": "HTTP代理IP地址", + "label_tip": "代理软件,http协议监听的ip地址,一般为:127.0.0.1", + "data": twitch_config["proxy_server"], + "main_obj_name": "twitch", + "index": 3 + } + data_json.append(tmp_json) + + tmp_json = { + "label_text": "HTTP代理端口", + "label_tip": "代理软件,http协议监听的端口,一般为:1080", + "data": twitch_config["proxy_port"], + "main_obj_name": "twitch", + "index": 4 + } + data_json.append(tmp_json) + + widgets = self.create_widgets_from_json(data_json) + + # 动态添加widget到对应的gridLayout + row = 0 + # 分2列,左边就是label说明,右边就是输入框等 + for i in range(0, len(widgets), 2): + self.ui.gridLayout_twitch.addWidget(widgets[i], row, 0) + self.ui.gridLayout_twitch.addWidget(widgets[i + 1], row, 1) + row += 1 + + twitch_gui_create() + # bard def bard_gui_create(): data_json = [] @@ -2701,13 +2756,16 @@ def common_textEdit_handle(content): config_data["platform"] = "douyu" elif platform == "YouTube": config_data["platform"] = "youtube" + elif platform == "twitch": + config_data["platform"] = "twitch" # 获取单行文本输入框的内容 room_display_id = self.ui.lineEdit_room_display_id.text() - if False == self.is_alpha_numeric(room_display_id): - logging.error("直播间号只由字母或数字组成,请勿输入错误内容") - self.show_message_box("错误", "直播间号只由字母或数字组成,请勿输入错误内容", QMessageBox.Critical) - return False + # 直播间号配置放宽 + # if False == self.is_alpha_numeric(room_display_id): + # logging.error("直播间号只由字母或数字组成,请勿输入错误内容") + # self.show_message_box("错误", "直播间号只由字母或数字组成,请勿输入错误内容", QMessageBox.Critical) + # return False config_data["room_display_id"] = room_display_id # 新增LLM时,这块也需要适配,保存回配置文件 @@ -3224,6 +3282,18 @@ def reorganize_copywriting_config_data(copywriting_config_data): bilibili_data = self.update_data_from_gridLayout(self.ui.gridLayout_bilibili) config_data["bilibili"] = reorganize_grid_data(bilibili_data, bilibili_keys_mapping) + twitch_keys_mapping = { + "token": 0, + "user": 1, + "proxy_server": 2, + "proxy_port": 3 + } + + # 重组twitch数据并写回json + twitch_data = self.update_data_from_gridLayout(self.ui.gridLayout_twitch) + config_data["twitch"] = reorganize_grid_data(twitch_data, twitch_keys_mapping) + + bard_keys_mapping = { "token": 0 } diff --git a/requirements_common.txt b/requirements_common.txt index 378f7474..5e06d02f 100644 --- a/requirements_common.txt +++ b/requirements_common.txt @@ -135,4 +135,5 @@ zhipuai==1.0.7 bardapi==0.1.33 revTongYi==0.0.1.0 pyautogui -nicegui==1.3.14 \ No newline at end of file +nicegui==1.3.14 +pytchat==0.5.5 \ No newline at end of file diff --git a/requirements_twitch.txt b/requirements_twitch.txt new file mode 100644 index 00000000..e19cc07f --- /dev/null +++ b/requirements_twitch.txt @@ -0,0 +1,38 @@ +openai +pygame +edge-tts==6.1.6 +langid +aiohttp +asyncio +slack_sdk==3.21.3 +profanity==1.1 +elevenlabs +PyPDF2 +protobuf +protobuf_inspector +requests +websocket-client +langchain==0.0.142 +PyQt5 +pyqt5-tools +tiktoken +pyahocorasick +webuiapi +pyvirtualcam +numpy +faiss-cpu +sentence_transformers +pydub +send2trash +pypinyin +sparkdesk-api +gradio_client +schedule +pyhandytools +curl_cffi +zhipuai +bardapi +revTongYi +pyautogui +nicegui +socket \ No newline at end of file diff --git a/tests/test_tiktok/tiktok.py b/tests/test_tiktok/tiktok.py new file mode 100644 index 00000000..ad76bd4b --- /dev/null +++ b/tests/test_tiktok/tiktok.py @@ -0,0 +1,37 @@ +from TikTokLive import TikTokLiveClient +from TikTokLive.types.events import CommentEvent, ConnectEvent, DisconnectEvent, JoinEvent + +proxies = { + "http://": "http://127.0.0.1:10809", + "https://": "http://127.0.0.1:10809" +} + +# Instantiate the client with the user's username +client: TikTokLiveClient = TikTokLiveClient(unique_id="@markus864", proxies=proxies) + + +# Define how you want to handle specific events via decorator +@client.on("connect") +async def on_connect(_: ConnectEvent): + print("Connected to Room ID:", client.room_id) + +@client.on("disconnect") +async def on_disconnect(event: DisconnectEvent): + print("Disconnected") + +@client.on("join") +async def on_join(event: JoinEvent): + print(f"@{event.user.unique_id} joined the stream!") + +# Notice no decorator? +async def on_comment(event: CommentEvent): + print(f"{event.user.nickname} -> {event.comment}") + + +# Define handling an event via a "callback" +client.add_listener("comment", on_comment) + +if __name__ == '__main__': + # Run the client and block the main thread + # await client.start() to run non-blocking + client.run() \ No newline at end of file diff --git a/tests/test_twitch/twitch.py b/tests/test_twitch/twitch.py new file mode 100644 index 00000000..3f67a72c --- /dev/null +++ b/tests/test_twitch/twitch.py @@ -0,0 +1,56 @@ +import socks, re +from emoji import demojize + +server = 'irc.chat.twitch.tv' +port = 6667 +nickname = '主人' +token = 'oauth:xxx' # 访问 https://twitchapps.com/tmi/ 获取 +user = 'love_ikaros' # 你的Twitch用户名 Your Twitch username +channel = '#prettyyjj' # 要从中检索消息的频道,注意#必须携带在头部 The channel you want to retrieve messages from + +# 代理服务器的地址和端口 +proxy_server = "127.0.0.1" +proxy_port = 10809 + +# 配置代理服务器 +socks.set_default_proxy(socks.HTTP, proxy_server, proxy_port) + +# 创建socket对象 +sock = socks.socksocket() + +try: + sock.connect((server, port)) + print("成功连接 Twitch IRC server") +except Exception as e: + print(f"连接 Twitch IRC server 失败: {e}") + + +sock.send(f"PASS {token}\n".encode('utf-8')) +sock.send(f"NICK {nickname}\n".encode('utf-8')) +sock.send(f"JOIN {channel}\n".encode('utf-8')) + +regex = r":(\w+)!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :(.+)" + +while True: + try: + resp = sock.recv(2048).decode('utf-8') + + # 输出所有接收到的内容,包括PING/PONG + # print(resp) + + if resp.startswith('PING'): + sock.send("PONG\n".encode('utf-8')) + + elif not user in resp: + resp = demojize(resp) + match = re.match(regex, resp) + + username = match.group(1) + message = match.group(2) + + + chat = '[' + username + ']: ' + message + print(chat) + + except Exception as e: + print("Error receiving chat: {0}".format(e)) \ No newline at end of file diff --git a/twitch.py b/twitch.py new file mode 100644 index 00000000..af611686 --- /dev/null +++ b/twitch.py @@ -0,0 +1,270 @@ +import socks +from emoji import demojize +import logging, os +import threading +import schedule +import random +import asyncio +import traceback +import re + +from functools import partial + +from utils.common import Common +from utils.config import Config +from utils.logger import Configure_logger +from utils.my_handle import My_handle + +""" + ___ _ + |_ _| | ____ _ _ __ ___ ___ + | || |/ / _` | '__/ _ \/ __| + | || < (_| | | | (_) \__ \ + |___|_|\_\__,_|_| \___/|___/ + +""" + +config = None +common = None +my_handle = None +# last_liveroom_data = None +last_username_list = None + +# 点火起飞 +def start_server(): + global config, common, my_handle, last_username_list + + config_path = "config.json" + + common = Common() + config = Config(config_path) + # 日志文件路径 + log_path = "./log/log-" + common.get_bj_time(1) + ".txt" + Configure_logger(log_path) + + # 获取 httpx 库的日志记录器 + httpx_logger = logging.getLogger("httpx") + # 设置 httpx 日志记录器的级别为 WARNING + httpx_logger.setLevel(logging.WARNING) + + # 最新入场的用户名列表 + last_username_list = [""] + + my_handle = My_handle(config_path) + if my_handle is None: + logging.error("程序初始化失败!") + os._exit(0) + + + # 添加用户名到最新的用户名列表 + def add_username_to_last_username_list(data): + global last_username_list + + # 添加数据到 最新入场的用户名列表 + last_username_list.append(data) + + # 保留最新的3个数据 + last_username_list = last_username_list[-3:] + + + # 定时任务 + def schedule_task(index): + logging.debug("定时任务执行中...") + hour, min = common.get_bj_time(6) + + if 0 <= hour and hour < 6: + time = f"凌晨{hour}点{min}分" + elif 6 <= hour and hour < 9: + time = f"早晨{hour}点{min}分" + elif 9 <= hour and hour < 12: + time = f"上午{hour}点{min}分" + elif hour == 12: + time = f"中午{hour}点{min}分" + elif 13 <= hour and hour < 18: + time = f"下午{hour - 12}点{min}分" + elif 18 <= hour and hour < 20: + time = f"傍晚{hour - 12}点{min}分" + elif 20 <= hour and hour < 24: + time = f"晚上{hour - 12}点{min}分" + + + # 根据对应索引从列表中随机获取一个值 + random_copy = random.choice(config.get("schedule")[index]["copy"]) + + # 假设有多个未知变量,用户可以在此处定义动态变量 + variables = { + 'time': time, + 'user_num': "N", + 'last_username': last_username_list[-1], + } + + # 使用字典进行字符串替换 + if any(var in random_copy for var in variables): + content = random_copy.format(**{var: value for var, value in variables.items() if var in random_copy}) + else: + content = random_copy + + data = { + "platform": "YouTube", + "username": None, + "content": content + } + + logging.info(f"定时任务:{content}") + + my_handle.process_data(data, "schedule") + + + # 启动定时任务 + def run_schedule(): + global config + + try: + for index, task in enumerate(config.get("schedule")): + if task["enable"]: + # logging.info(task) + # 设置定时任务,每隔n秒执行一次 + schedule.every(task["time"]).seconds.do(partial(schedule_task, index)) + except Exception as e: + logging.error(traceback.format_exc()) + + while True: + schedule.run_pending() + # time.sleep(1) # 控制每次循环的间隔时间,避免过多占用 CPU 资源 + + + # 创建定时任务子线程并启动 + schedule_thread = threading.Thread(target=run_schedule) + schedule_thread.start() + + + # 启动动态文案 + async def run_trends_copywriting(): + global config + + try: + if False == config.get("trends_copywriting", "enable"): + return + + logging.info(f"动态文案任务线程运行中...") + + while True: + # 文案文件路径列表 + copywriting_file_path_list = [] + + # 获取动态文案列表 + for copywriting in config.get("trends_copywriting", "copywriting"): + # 获取文件夹内所有文件的文件绝对路径,包括文件扩展名 + for tmp in common.get_all_file_paths(copywriting["folder_path"]): + copywriting_file_path_list.append(tmp) + + # 是否开启随机播放 + if config.get("trends_copywriting", "random_play"): + random.shuffle(copywriting_file_path_list) + + # 遍历文案文件路径列表 + for copywriting_file_path in copywriting_file_path_list: + # 获取文案文件内容 + copywriting_file_content = common.read_file_return_content(copywriting_file_path) + # 是否启用提示词对文案内容进行转换 + if copywriting["prompt_change_enable"]: + data_json = { + "user_name": "trends_copywriting", + "content": copywriting["prompt_change_content"] + copywriting_file_content + } + + # 调用函数进行LLM处理,以及生成回复内容,进行音频合成,需要好好考虑考虑实现 + data_json["content"] = my_handle.llm_handle(config.get("chat_type"), data_json) + else: + data_json = { + "user_name": "trends_copywriting", + "content": copywriting_file_content + } + + # 空数据判断 + if data_json["content"] != None and data_json["content"] != "": + # 发给直接复读进行处理 + my_handle.reread_handle(data_json) + + await asyncio.sleep(config.get("trends_copywriting", "play_interval")) + except Exception as e: + logging.error(traceback.format_exc()) + + + # 创建动态文案子线程并启动 + threading.Thread(target=lambda: asyncio.run(run_trends_copywriting())).start() + + try: + server = 'irc.chat.twitch.tv' + port = 6667 + nickname = '主人' + + try: + channel = '#' + config.get("room_display_id") # 要从中检索消息的频道,注意#必须携带在头部 The channel you want to retrieve messages from + token = config.get("twitch", "token") # 访问 https://twitchapps.com/tmi/ 获取 + user = config.get("twitch", "user") # 你的Twitch用户名 Your Twitch username + # 代理服务器的地址和端口 + proxy_server = config.get("twitch", "proxy_server") + proxy_port = int(config.get("twitch", "proxy_port")) + except Exception as e: + logging.error("获取Twitch配置失败!\n{0}".format(e)) + + # 配置代理服务器 + socks.set_default_proxy(socks.HTTP, proxy_server, proxy_port) + + # 创建socket对象 + sock = socks.socksocket() + + try: + sock.connect((server, port)) + logging.info("成功连接 Twitch IRC server") + except Exception as e: + logging.error(f"连接 Twitch IRC server 失败: {e}") + + + sock.send(f"PASS {token}\n".encode('utf-8')) + sock.send(f"NICK {nickname}\n".encode('utf-8')) + sock.send(f"JOIN {channel}\n".encode('utf-8')) + + regex = r":(\w+)!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :(.+)" + + while True: + try: + resp = sock.recv(2048).decode('utf-8') + + # 输出所有接收到的内容,包括PING/PONG + # logging.info(resp) + + if resp.startswith('PING'): + sock.send("PONG\n".encode('utf-8')) + + elif not user in resp: + resp = demojize(resp) + + logging.debug(resp) + + match = re.match(regex, resp) + + user_name = match.group(1) + content = match.group(2) + content = content.rstrip() + + logging.info(f"[{user_name}]: {content}") + + data = { + "platform": "twitch", + "username": user_name, + "content": content + } + + my_handle.process_data(data, "comment") + + except Exception as e: + logging.error("Error receiving chat: {0}".format(e)) + except Exception as e: + logging.error(traceback.format_exc()) + + + +if __name__ == '__main__': + start_server() diff --git a/ui/main.ui b/ui/main.ui index 60b13114..80a92f9d 100644 --- a/ui/main.ui +++ b/ui/main.ui @@ -136,9 +136,9 @@ background-color: rgba(255, 255, 255, 50); 0 - -9992 + -111 991 - 10717 + 10780 @@ -175,187 +175,322 @@ background-color: rgba(255, 255, 255, 50); 0 + + + + 提示词前缀 + + + + + + + xuniren + + + + + + + + + + + + 回复语言 + + + + + + + PointingHandCursor + + + + 所有 + + + + + 中文 + + + + + 英文 + + + + + 日文 + + + + - - + + + + 语音合成 + + + + + + + PointingHandCursor + + + + 不启用 + + + + + 复读机 + + + + + ChatGPT + + + + + Claude + + + + + ChatGLM + + + + + chat_with_file + + + + + Chatterbot + + + + + text-generation-webui + + + + + 讯飞星火 + + + + + Langchain_ChatGLM + + + + + + - chatgpt + 音频随机变速 - + - + - + - - + + - 模型 + 普通音频变速 - + - 最大令牌数 + 速度下限 - - + + + + 速度上限 + + - - + + - 温度 + 启用 + + + - + - 前p个选择 + 文案音频变速 - + + + 启用 + + - - + + + + 速度下限 + + - - + + + + + - 频率惩罚 + 速度上限 - - + + - - + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 自定义显示板块 + + + + + + + + + + + + PointingHandCursor + + + + + + + 提示词后缀 + + + + + + + ChatGLM + + + + + + - 存在惩罚 + api地址 - - + + + + + - 预设 + 最大记忆长度 - - + + - - - - - gpt-3.5-turbo - - - - - gpt-3.5-turbo-0301 - - - - - gpt-3.5-turbo-0613 - - - - - gpt-3.5-turbo-16k - - - - - gpt-3.5-turbo-16k-0613 - - - - - gpt-4 - - - - - gpt-4-0314 - - - - - gpt-4-0613 - - - - - gpt-4-32k - - - - - gpt-4-32k-0314 - - - - - gpt-4-32k-0613 - - - - - text-embedding-ada-002 - - - - - text-davinci-003 - - - - - text-davinci-002 - - - - - text-curie-001 - - - - - text-babbage-001 - - - - - text-ada-001 - - - - - text-moderation-latest - - - - - text-moderation-stable - - + + + + 前p个选择 + + + + + + + 温度 + + + + + + + + + + + + + 最大长度限制 + + + + + + + 上下文记忆 + + + + + + + 启用 + + + + - + Qt::Horizontal @@ -370,103 +505,76 @@ background-color: rgba(255, 255, 255, 50); - - - - 聊天类型 - - - - - - - PointingHandCursor - - - - - + + - 音频随机变速 + 日志 - + - - - - - - - - 普通音频变速 - - - - - - - 速度下限 - - - - - - - 速度上限 - + + + + + + 问答 + + + + + 问题 + + + + + 回答 + + + + + 不记录 + + - - + + - 启用 + 弹幕日志类型 - - - - + - 文案音频变速 + 字幕日志路径 - - - 启用 - - + - - + + - 速度下限 + 字幕日志 - - - - - + + - 速度上限 + 启用 - - - - + Qt::Horizontal @@ -481,18 +589,12 @@ background-color: rgba(255, 255, 255, 50); - - - - Qt::Horizontal + + + + PointingHandCursor - - - 40 - 20 - - - + @@ -504,144 +606,148 @@ background-color: rgba(255, 255, 255, 50); - - - - PointingHandCursor + + + + 直播间号 - - - - - - - PointingHandCursor + + + + 聊天类型 - - - 所有 - - - - - 中文 - - - - - 英文 - - - - - 日文 - - - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - 本地问答 + openai - + - - - + + + 2 + + + - 音频匹配 + API - - + + + + + - 文本匹配 + API KEY + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Claude2 + + + + - + + + + + + + - 启用 + https代理地址 - - - - - + + - 音频最低相似度 + socks5代理地址 - - + + 启用 - - + + - 文本最低相似度 + cookie - - - - - + + - 音频存储路径 + 启用代理 - + - 文本问答数据路径 + http代理地址 - - - - - - - - - 文本问答算法类型 - - + - - - - - 自定义json - - - - - 一问一答 - - - + + - + Qt::Horizontal @@ -656,114 +762,74 @@ background-color: rgba(255, 255, 255, 50); - - - - 哔哩哔哩 - - - - - - - + + - - + + - 日志 + 念用户名 - + - - - - - - 问答 - - - - - 问题 - - - - - 回答 - - - - - 不记录 - - + + + + + 前置回复 + - - + + + + + - 弹幕日志类型 + 启用 - - + + - 字幕日志路径 + - - - - - + + - 字幕日志 + 启用变声 - - + + - 启用 + + + + + + + + 后置回复 + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 直播间号 - - - - - - - 虚拟身体 - - + + - + @@ -972,164 +1038,126 @@ background-color: rgba(255, 255, 255, 50); - - + + - 提示词后缀 + 虚拟身体 - - - - 语音合成 + + + + 音频播放 + + + + + - - + + - openai + 本地问答 - + - - - 2 - - - + + + - API + 音频匹配 - - - - - + + - API KEY + 文本匹配 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 回复语言 - - - - - - - 自定义显示板块 - - - - - - - - - - - - ChatGLM - - - - - - + + - api地址 + 启用 - + - - + + - 最大记忆长度 + 音频最低相似度 - - - - - + + - 前p个选择 + 启用 - + - 温度 + 文本最低相似度 - - - - - + + - - + + - 最大长度限制 + 音频存储路径 - - + + - 上下文记忆 + 文本问答数据路径 - - + + + + + + + + - 启用 + 文本问答算法类型 - - + + + + + 自定义json + + + + + 一问一答 + + + - + Qt::Horizontal @@ -1144,145 +1172,19 @@ background-color: rgba(255, 255, 255, 50); - - + + - Claude2 + 答谢 - - - - - - - - - - - - - https代理地址 - - - - - - - socks5代理地址 - - - - - - - 启用 - - - - - - - cookie - - - - - - - 启用代理 - - - - - - - http代理地址 - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Claude - - - - - - - - - - - slack_user_token - - - - - - - bot_user_id - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 答谢 - - - - - - 关注答谢 - - - + + + + + 关注答谢 + + + @@ -1374,26 +1276,7 @@ background-color: rgba(255, 255, 255, 50); - - - - 音频播放 - - - - - - - - - - - - 提示词前缀 - - - - + 念弹幕 @@ -1405,135 +1288,264 @@ background-color: rgba(255, 255, 255, 50); - - + + - 念用户名 + chatgpt - + - + + + + + + + + 模型 + + + - + - 前置回复 + 最大令牌数 - - + + - - + + - 启用 + 温度 - - + + - + 前p个选择 - - + + + + + + + + - 启用变声 + 频率惩罚 - - + + + + + - + 存在惩罚 - - + + - 后置回复 + 预设 - - + + + + + + + + gpt-3.5-turbo + + + + + gpt-3.5-turbo-0301 + + + + + gpt-3.5-turbo-0613 + + + + + gpt-3.5-turbo-16k + + + + + gpt-3.5-turbo-16k-0613 + + + + + gpt-4 + + + + + gpt-4-0314 + + + + + gpt-4-0613 + + + + + gpt-4-32k + + + + + gpt-4-32k-0314 + + + + + gpt-4-32k-0613 + + + + + text-embedding-ada-002 + + + + + text-davinci-003 + + + + + text-davinci-002 + + + + + text-curie-001 + + + + + text-babbage-001 + + + + + text-ada-001 + + + + + text-moderation-latest + + + + + text-moderation-stable + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - - PointingHandCursor + + + + Claude - - - 不启用 - - - - - 复读机 - - - - - ChatGPT - - - - - Claude - - - - - ChatGLM - - - - - chat_with_file - - - - - Chatterbot - - - - - text-generation-webui - - - - - 讯飞星火 - - - - - Langchain_ChatGLM - - + + + + + + + + + + slack_user_token + + + + + + + bot_user_id + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - + + + + 哔哩哔哩 + + + + + + + - - + + - xuniren + twitch - + - + diff --git a/webui.py b/webui.py index d27c466d..c18a955a 100644 --- a/webui.py +++ b/webui.py @@ -28,6 +28,9 @@ web_server_port = 12345 +""" +初始化基本配置 +""" def init(): global config_path, config, common @@ -89,7 +92,9 @@ def init_dir(): init() - +""" +按键调用函数 +""" # 创建一个函数,用于运行外部程序 def run_external_program(): global running_flag, running_process @@ -106,9 +111,10 @@ def run_external_program(): running_process = subprocess.Popen(["python", f"{select_platform.value}.py"]) ui.notify("程序开始运行") - + logging.info("程序开始运行") except Exception as e: ui.notify(f"错误:{e}") + logging.error(f"错误:{e}") running_flag = False @@ -121,8 +127,10 @@ def stop_external_program(): running_process.terminate() # 终止子进程 running_flag = False ui.notify("程序已停止") + logging.info("程序已停止") except Exception as e: ui.notify(f"停止错误:{e}") + logging.error(f"停止错误:{e}") def save_config(): @@ -172,6 +180,12 @@ def common_textarea_handle(content): config_data["bilibili"]["cookie"] = input_bilibili_cookie.value config_data["bilibili"]["ac_time_value"] = input_bilibili_ac_time_value.value + # twitch + config_data["twitch"]["token"] = input_twitch_token.value + config_data["twitch"]["user"] = input_twitch_user.value + config_data["twitch"]["proxy_server"] = input_twitch_proxy_server.value + config_data["twitch"]["proxy_port"] = input_twitch_proxy_port.value + # 音频播放 config_data["play_audio"]["enable"] = switch_play_audio_enable.value config_data["play_audio"]["out_path"] = input_play_audio_out_path.value @@ -604,6 +618,9 @@ def common_textarea_handle(content): return False +""" +通用函数 +""" def textarea_data_change(data): """ 字符串数组数据格式转换 @@ -632,7 +649,7 @@ def textarea_data_change(data): with ui.tab_panels(tabs, value=common_config_page).classes('w-full'): with ui.tab_panel(common_config_page): with ui.column(): - select_platform = ui.select(label='平台', options={'talk': '聊天模式', 'bilibili': '哔哩哔哩', 'dy': '抖音', 'ks': '快手', 'douyu': '斗鱼', 'youtube': 'YouTube'}, value=config.get("platform")).style("width:200px;") + select_platform = ui.select(label='平台', options={'talk': '聊天模式', 'bilibili': '哔哩哔哩', 'dy': '抖音', 'ks': '快手', 'douyu': '斗鱼', 'youtube': 'YouTube', 'twitch': 'twitch'}, value=config.get("platform")).style("width:200px;") input_room_display_id = ui.input(label='直播间号', placeholder='一般为直播间URL最后/后面的字母或数字', value=config.get("room_display_id")).style("width:200px;") @@ -692,6 +709,14 @@ def textarea_data_change(data): ) input_bilibili_cookie = ui.input(label='cookie', placeholder='b站登录后F12抓网络包获取cookie,强烈建议使用小号!有封号风险', value=config.get("bilibili", "cookie")).style("width:500px;") input_bilibili_ac_time_value = ui.input(label='ac_time_value', placeholder='b站登录后,F12控制台,输入window.localStorage.ac_time_value获取(如果没有,请重新登录)', value=config.get("bilibili", "ac_time_value")).style("width:500px;") + with ui.card().style("margin:10px 0px"): + ui.label('twitch') + with ui.row(): + input_twitch_token = ui.input(label='token', value=config.get("twitch", "token"), placeholder='访问 https://twitchapps.com/tmi/ 获取,格式为:oauth:xxx').style("width:500px;") + input_twitch_user = ui.input(label='用户名', value=config.get("twitch", "user"), placeholder='你的twitch账号用户名').style("width:500px;") + input_twitch_proxy_server = ui.input(label='HTTP代理IP地址', value=config.get("twitch", "proxy_server"), placeholder='代理软件,http协议监听的ip地址,一般为:127.0.0.1').style("width:500px;") + input_twitch_proxy_port = ui.input(label='HTTP代理端口', value=config.get("twitch", "proxy_port"), placeholder='代理软件,http协议监听的端口,一般为:1080').style("width:500px;") + with ui.card().style("margin:10px 0px"): ui.label('音频播放') with ui.grid(columns=2): @@ -1520,10 +1545,10 @@ def talk_chat_box_reread(): ui.label('webui采用nicegui框架搭建,目前还在施工中,部分功能可以使用。敬请期待。') with ui.grid(columns=3).style("position: fixed; bottom: 10px;"): - save_button = ui.button('保存配置', on_click=lambda: save_config()) - run_button = ui.button('一键运行', on_click=lambda: run_external_program()) + button_save = ui.button('保存配置', on_click=lambda: save_config()) + button_run = ui.button('一键运行', on_click=lambda: run_external_program()) # 创建一个按钮,用于停止正在运行的程序 - stop_button = ui.button("停止运行", on_click=lambda: stop_external_program()) - # stop_button.enabled = False # 初始状态下停止按钮禁用 + button_stop = ui.button("停止运行", on_click=lambda: stop_external_program()) + # button_stop.enabled = False # 初始状态下停止按钮禁用 ui.run() \ No newline at end of file