olivebot/main.py
xszyou d90d699b58 Fay数字人助理版提交
+ 打出Fay数字人助理版作为主分支(带货版移到分支[`fay-sales-edition`]);
+ 添加Fay助理的文字沟通窗口(文字与语音同步);
+ 添加沟通记录本地保存功能;
+ 升级ChatGLM-6B的应用逻辑,长文本与语音回复分享;
2023-05-12 18:56:36 +08:00

56 lines
1.4 KiB
Python

import os
import sys
from io import BytesIO
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication
from ai_module import ali_nls
from core import wsa_server
from gui import flask_server
from gui.window import MainWindow
from utils import config_util
from scheduler.thread_manager import MyThread
from core.content_db import Content_Db
def __clear_samples():
if not os.path.exists("./samples"):
os.mkdir("./samples")
for file_name in os.listdir('./samples'):
if file_name.startswith('sample-') and file_name.endswith('.mp3'):
os.remove('./samples/' + file_name)
def __clear_songs():
if not os.path.exists("./songs"):
os.mkdir("./songs")
for file_name in os.listdir('./songs'):
if file_name.endswith('.mp3'):
os.remove('./songs/' + file_name)
if __name__ == '__main__':
__clear_samples()
__clear_songs()
config_util.load_config()
dbstatus = os.path.exists("fay.db")
if(dbstatus == False):
contentdb = Content_Db()
contentdb.init_db()
ws_server = wsa_server.new_instance(port=10002)
ws_server.start_server()
web_ws_server = wsa_server.new_web_instance(port=10003)
web_ws_server.start_server()
ali_nls.start()
flask_server.start()
app = QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon('icon.png'))
win = MainWindow()
win.show()
app.exit(app.exec_())