From 37ec203da99c95f9f904c8f7f3e582c54f1aaacd Mon Sep 17 00:00:00 2001 From: wuyuesong <1377030423@qq.com> Date: Mon, 18 Nov 2024 09:29:44 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=8C=89=E9=92=AE=E9=97=AA=E9=80=80bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/aiassistant/Speech.py | 1 + usr/share/aiassistant/exchangePage.py | 33 ++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/usr/share/aiassistant/Speech.py b/usr/share/aiassistant/Speech.py index f5dd35ca..9851c885 100644 --- a/usr/share/aiassistant/Speech.py +++ b/usr/share/aiassistant/Speech.py @@ -12,6 +12,7 @@ # sudo yum install -y portaudio portaudio-devel && pip install pyaudio # Microsoft Windows # python -m pip install pyaudio +import time import dashscope import sys diff --git a/usr/share/aiassistant/exchangePage.py b/usr/share/aiassistant/exchangePage.py index 52df936d..74df3a6d 100644 --- a/usr/share/aiassistant/exchangePage.py +++ b/usr/share/aiassistant/exchangePage.py @@ -14,7 +14,11 @@ from PyQt5.QtCore import * from PyQt5.QtGui import * from bubble_message import BubbleMessage, MessageType from PublicTypes import PublicTypes +from Config import Config +from SettingPage import SettingsPage +app_list = Config.get_app_list() +api_key = Config.get_api_key() @@ -140,15 +144,28 @@ class exChange(QWidget): self.imageLabel.setPixmap(pixmap) self.current_image_index1 = (self.current_image_index1 + 1) % len(self.image_files1) + def openSettingPage(self): + #创建并显示设置页面 + self.settingPage = SettingsPage(self) + self.settingPage.show() + self.settingPage.move_to_center() + self.show() + + def onSettingPageClosed(self): + # 设置窗口置顶标志 + self.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint) + # 重新置顶主窗口 + self.raise_() + self.show() + def startConversation(self): - # if self.state == '聆听中': - # self.capture_voice() - if self.state == '休眠中': - self.updateStatus('聆听中') - QApplication.processEvents() - self.capture_voice() #获取声音信息 - # self.respondToUser() - #self.timer.start(5000) # 3秒 + if Config.get_api_key() != "": + if self.state == '休眠中': + self.updateStatus('聆听中') + QApplication.processEvents() + self.capture_voice() #获取声音信息 + # self.respondToUser() + #self.timer.start(5000) # 3秒 def updateStatus(self, new_status): -- Gitee