年翻更新
1、去除funasr子协议限制; 2、默认声音替换; 3、修复在服务器上聊天记录时间显示问题; 4、修复前端font缺失问题; 5、前端css调整为本地加载; 6、修复因线程问题,导致启动(关闭)失败、tts不合成等问题; 7、用户切换栏新增左右滑动; 8、修复bs4包安装遗漏问题; 9、修复聊天记录不自动换行问题; 10、修复favicon.ico 缺失问题;
This commit is contained in:
parent
87ed1c4425
commit
48395ebb12
@ -102,7 +102,7 @@ class FunASR:
|
|||||||
self.done = False
|
self.done = False
|
||||||
self.__frames.clear()
|
self.__frames.clear()
|
||||||
websocket.enableTrace(False)
|
websocket.enableTrace(False)
|
||||||
self.__ws = websocket.WebSocketApp(self.__URL, on_message=self.on_message,on_close=self.on_close,on_error=self.on_error,subprotocols=["binary"])
|
self.__ws = websocket.WebSocketApp(self.__URL, on_message=self.on_message,on_close=self.on_close,on_error=self.on_error)
|
||||||
self.__ws.on_open = self.on_open
|
self.__ws.on_open = self.on_open
|
||||||
|
|
||||||
self.__ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
|
self.__ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
|
||||||
|
@ -2,11 +2,11 @@ import asyncio
|
|||||||
import websockets
|
import websockets
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
from funasr import AutoModel
|
from funasr import AutoModel
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# 设置日志级别
|
# 设置日志级别
|
||||||
import logging
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.CRITICAL)
|
logger.setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ async def worker():
|
|||||||
task_queue.task_done()
|
task_queue.task_done()
|
||||||
|
|
||||||
async def process_wav_file(websocket, url):
|
async def process_wav_file(websocket, url):
|
||||||
#热词
|
# 热词
|
||||||
param_dict = {"sentence_timestamp": False}
|
param_dict = {"sentence_timestamp": False}
|
||||||
with open("data/hotword.txt", "r", encoding="utf-8") as f:
|
with open("data/hotword.txt", "r", encoding="utf-8") as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
@ -67,7 +67,7 @@ async def process_wav_file(websocket, url):
|
|||||||
param_dict["hotword"] = hotword
|
param_dict["hotword"] = hotword
|
||||||
wav_path = url
|
wav_path = url
|
||||||
try:
|
try:
|
||||||
res = asr_model.generate(input=wav_path,is_final=True, **param_dict)
|
res = asr_model.generate(input=wav_path, is_final=True, **param_dict)
|
||||||
if res:
|
if res:
|
||||||
if 'text' in res[0] and websocket.open:
|
if 'text' in res[0] and websocket.open:
|
||||||
await websocket.send(res[0]['text'])
|
await websocket.send(res[0]['text'])
|
||||||
@ -78,10 +78,10 @@ async def process_wav_file(websocket, url):
|
|||||||
os.remove(wav_path)
|
os.remove(wav_path)
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
start_server = websockets.serve(ws_serve, args.host, args.port, subprotocols=["binary"], ping_interval=10)
|
start_server = websockets.serve(ws_serve, args.host, args.port, ping_interval=10)
|
||||||
await start_server
|
await start_server
|
||||||
worker_task = asyncio.create_task(worker())
|
worker_task = asyncio.create_task(worker())
|
||||||
await worker_task
|
await worker_task
|
||||||
|
|
||||||
# 使用 asyncio 运行主函数
|
# 使用 asyncio 运行主函数
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"hobby": "\u53d1\u5446",
|
"hobby": "\u53d1\u5446",
|
||||||
"job": "\u52a9\u7406",
|
"job": "\u52a9\u7406",
|
||||||
"name": "\u83f2\u83f2",
|
"name": "\u83f2\u83f2",
|
||||||
"voice": "abin",
|
"voice": "\u6653\u6653(edge)",
|
||||||
"zodiac": "\u86c7"
|
"zodiac": "\u86c7"
|
||||||
},
|
},
|
||||||
"interact": {
|
"interact": {
|
||||||
|
@ -8,6 +8,7 @@ from flask import Flask, render_template, request, jsonify, Response, send_file
|
|||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
import requests
|
import requests
|
||||||
import datetime
|
import datetime
|
||||||
|
import pytz
|
||||||
|
|
||||||
import fay_booter
|
import fay_booter
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ def api_submit():
|
|||||||
merge_configs(existing_config, config_data['config'])
|
merge_configs(existing_config, config_data['config'])
|
||||||
|
|
||||||
config_util.save_config(existing_config)
|
config_util.save_config(existing_config)
|
||||||
|
config_util.load_config()
|
||||||
|
|
||||||
return jsonify({'result': 'successful'})
|
return jsonify({'result': 'successful'})
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
@ -280,7 +282,8 @@ def api_get_Msg():
|
|||||||
relist = []
|
relist = []
|
||||||
i = len(list) - 1
|
i = len(list) - 1
|
||||||
while i >= 0:
|
while i >= 0:
|
||||||
timetext = datetime.datetime.fromtimestamp(list[i][3]).strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
|
timezone = pytz.timezone('Asia/Shanghai')
|
||||||
|
timetext = datetime.datetime.fromtimestamp(list[i][3], timezone).strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
|
||||||
relist.append(dict(type=list[i][0], way=list[i][1], content=list[i][2], createtime=list[i][3], timetext=timetext, username=list[i][5], id=list[i][6], is_adopted=list[i][7]))
|
relist.append(dict(type=list[i][0], way=list[i][1], content=list[i][2], createtime=list[i][3], timetext=timetext, username=list[i][5], id=list[i][6], is_adopted=list[i][7]))
|
||||||
i -= 1
|
i -= 1
|
||||||
if fay_booter.is_running():
|
if fay_booter.is_running():
|
||||||
@ -312,7 +315,7 @@ def api_send_v1_chat_completions():
|
|||||||
|
|
||||||
model = data.get('model', 'fay')
|
model = data.get('model', 'fay')
|
||||||
observation = data.get('observation', '')
|
observation = data.get('observation', '')
|
||||||
interact = Interact("text", 1, {'user': username, 'msg': last_content, 'observation': observation})
|
interact = Interact("text", 1, {'user': username, 'msg': last_content, 'observation': str(observation)})
|
||||||
util.printInfo(1, username, '[文字沟通接口]{}'.format(interact.data["msg"]), time.time())
|
util.printInfo(1, username, '[文字沟通接口]{}'.format(interact.data["msg"]), time.time())
|
||||||
text = fay_booter.feiFei.on_interact(interact)
|
text = fay_booter.feiFei.on_interact(interact)
|
||||||
|
|
||||||
|
BIN
gui/static/css/element/fonts/element-icons.ttf
Normal file
BIN
gui/static/css/element/fonts/element-icons.ttf
Normal file
Binary file not shown.
BIN
gui/static/css/element/fonts/element-icons.woff
Normal file
BIN
gui/static/css/element/fonts/element-icons.woff
Normal file
Binary file not shown.
1
gui/static/css/element/theme-chalk.css
Normal file
1
gui/static/css/element/theme-chalk.css
Normal file
File diff suppressed because one or more lines are too long
@ -179,6 +179,8 @@ html {
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sender-message.message-bubble {
|
.sender-message.message-bubble {
|
||||||
|
BIN
gui/static/images/favicon.ico
Normal file
BIN
gui/static/images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
gui/static/images/scrollleft.png
Normal file
BIN
gui/static/images/scrollleft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
BIN
gui/static/images/scrollright.png
Normal file
BIN
gui/static/images/scrollright.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 368 B |
1
gui/static/js/element-ui.js
Normal file
1
gui/static/js/element-ui.js
Normal file
File diff suppressed because one or more lines are too long
14
gui/static/js/script.js
Normal file
14
gui/static/js/script.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
const menu = document.querySelector('.menu');
|
||||||
|
const prevButton = document.getElementById('prevButton');
|
||||||
|
const nextButton = document.getElementById('nextButton');
|
||||||
|
|
||||||
|
// 每次滑动的距离,可根据菜单项宽度和间距等实际情况调整
|
||||||
|
const slideDistance = 500;
|
||||||
|
|
||||||
|
prevButton.addEventListener('click', () => {
|
||||||
|
menu.style.transform = `translateX(${slideDistance}px)`;
|
||||||
|
});
|
||||||
|
|
||||||
|
nextButton.addEventListener('click', () => {
|
||||||
|
menu.style.transform = `translateX(-${slideDistance}px)`;
|
||||||
|
});
|
@ -6,10 +6,12 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Fay数字人</title>
|
<title>Fay数字人</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}" />
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}" />
|
||||||
|
<link rel="icon" href="{{ url_for('static',filename='images/favicon.ico') }}" type="image/x-icon">
|
||||||
<script src="{{ url_for('static',filename='js/vue.js') }}"></script>
|
<script src="{{ url_for('static',filename='js/vue.js') }}"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.6/lib/index.js"></script>
|
<script src="{{ url_for('static',filename='js/element-ui.js') }}"></script>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.6/lib/theme-chalk/index.css" />
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/element/theme-chalk.css') }}" />
|
||||||
<script src="{{ url_for('static',filename='js/index.js') }}" defer></script>
|
<script src="{{ url_for('static',filename='js/index.js') }}" defer></script>
|
||||||
|
<script src="{{ url_for('static',filename='js/script.js') }}" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body >
|
<body >
|
||||||
<div id="app" class="main_bg">
|
<div id="app" class="main_bg">
|
||||||
@ -89,12 +91,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="Userchange">
|
<div class="Userchange">
|
||||||
<div class="tag-container">
|
<button id="prevButton" ><img src="{{ url_for('static',filename='images/scrollleft.png') }}" alt="向左滑动" ></button>
|
||||||
|
<div class="menu" ref="menuContainer">
|
||||||
<div class="tag" v-for="user in userList" :key="user[0]" :class="{'selected': selectedUser && selectedUser[0] === user[0]}" @click="selectUser(user)">
|
<div class="tag" v-for="user in userList" :key="user[0]" :class="{'selected': selectedUser && selectedUser[0] === user[0]}" @click="selectUser(user)">
|
||||||
[[ user[1] ]]
|
[[ user[1] ]]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button id="nextButton" ><img src="{{ url_for('static',filename='images/scrollright.png') }}" alt="向右滑动" ></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -102,20 +107,5 @@
|
|||||||
<!-- 以上是多用户切换 -->
|
<!-- 以上是多用户切换 -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
@ -7,6 +7,8 @@
|
|||||||
<title>Fay数字人</title>
|
<title>Fay数字人</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}"/>
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}"/>
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='css/setting.css') }}"/>
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/setting.css') }}"/>
|
||||||
|
<link rel="icon" href="{{ url_for('static',filename='images/favicon.ico') }}" type="image/x-icon">
|
||||||
|
|
||||||
<!-- 引入样式 -->
|
<!-- 引入样式 -->
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='css/element/index.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/element/index.css') }}">
|
||||||
</head>
|
</head>
|
||||||
|
@ -27,4 +27,5 @@ psutil
|
|||||||
langchain
|
langchain
|
||||||
langchain_openai
|
langchain_openai
|
||||||
langgraph
|
langgraph
|
||||||
langchain-community
|
langchain-community
|
||||||
|
bs4
|
@ -138,6 +138,4 @@ def save_config(config_data):
|
|||||||
file = codecs.open('config.json', mode='w', encoding='utf-8')
|
file = codecs.open('config.json', mode='w', encoding='utf-8')
|
||||||
file.write(json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')))
|
file.write(json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')))
|
||||||
file.close()
|
file.close()
|
||||||
load_config()
|
|
||||||
# for line in json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')).split("\n"):
|
|
||||||
# print(line)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user