diff --git a/usr/share/aiassistant/Speech.py b/usr/share/aiassistant/Speech.py index f5dd35ca63d5b3fef49c4d4d3abbe186cf6c9783..9851c88514d9fbb48ea5534e471d066b423d94ee 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 52df936de9d0b80ba4731ce284ef64e63b61cc40..74df3a6d3cdd59690e80ad79b1d147a232dd7ef0 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):