今天星期三

去除mp3格式警告信息;
去除灵聚、渡鸦接口警告信息; websocket逻辑优化;
 数字人端接口通讯优化。
This commit is contained in:
xszyou 2023-08-09 18:06:27 +08:00
parent ba6972a647
commit f4752fbe5b
6 changed files with 27 additions and 13 deletions

View File

@ -117,9 +117,15 @@ Remote Android  [Live2D](https://www.bilibili.com/video/BV1sx4y1d775/?vd_sou
└── test # 都是惊喜 └── test # 都是惊喜
``` ```
## **三、升级日志** ## **三、升级日志**
**2023.08.09**
+ 去除mp3格式警告信息
+ 去除灵聚、渡鸦接口警告信息;
+ websocket逻辑优化
+ 数字人端接口通讯优化。
**2023.08.04** **2023.08.04**
+ UE5工程更新 + UE5工程更新
@ -132,7 +138,7 @@ Remote Android  [Live2D](https://www.bilibili.com/video/BV1sx4y1d775/?vd_sou
+ 补充wav文件启动清理 + 补充wav文件启动清理
+ websocket工具类升级完善。 + websocket工具类升级完善。
**2023.07.28** **2023.07**
+ 增加运行时自动清理ui缓存 + 增加运行时自动清理ui缓存
+ 增加gpt代理设置可为空 + 增加gpt代理设置可为空

View File

@ -122,6 +122,13 @@ Message format: View [WebSocket.md](https://github.com/TheRamU/Fay/blob/main/Web
## **Upgrade Log** ## **Upgrade Log**
**2023.08.09:**
- Remove mp3 format warning message;
- Remove Lingju and Rwkv interface warning message;
- Optimize websocket logic;
- Optimize digital human interface communication.
**2023.08.04:** **2023.08.04:**
- UE5 project updated. - UE5 project updated.

View File

@ -40,11 +40,10 @@ class Lingju:
if token is not None: if token is not None:
try: try:
lat,lng,city = self.__get_location()
url="https://dev.lingju.ai/httpapi/ljchat.do" url="https://dev.lingju.ai/httpapi/ljchat.do"
req = json.dumps({"accessToken": token, "lat": lat, "lng": lng, "input": cont}) req = json.dumps({"accessToken": token, "input": cont})
headers = {'Content-Type':'application/json;charset=UTF-8'} headers = {'Content-Type':'application/json;charset=UTF-8'}
r = requests.post(url, headers=headers, verify=False, data=req) r = requests.post(url, headers=headers, data=req)
if r.status_code != 200: if r.status_code != 200:
util.log(1, f"灵聚api对接有误: {r.text}") util.log(1, f"灵聚api对接有误: {r.text}")
return "哎呀,出错了!请重新发一下" return "哎呀,出错了!请重新发一下"
@ -74,7 +73,7 @@ class Lingju:
cfg.load_config() cfg.load_config()
url=f"https://dev.lingju.ai/httpapi/authorize.do?appkey={cfg.key_lingju_api_key}&userid={self.userid}&authcode={cfg.key_lingju_api_authcode}" url=f"https://dev.lingju.ai/httpapi/authorize.do?appkey={cfg.key_lingju_api_key}&userid={self.userid}&authcode={cfg.key_lingju_api_authcode}"
headers = {'Content-Type':'application/json;charset=UTF-8'} headers = {'Content-Type':'application/json;charset=UTF-8'}
r = requests.post(url, headers=headers, verify=False) r = requests.post(url, headers=headers)
if r.status_code != 200: if r.status_code != 200:
util.log(1, f"灵聚api对接有误: {r.text}") util.log(1, f"灵聚api对接有误: {r.text}")
return None return None

View File

@ -6,7 +6,6 @@ def question(cont):
url= "https://rwkv.ai-creator.net/chntuned/v1/chat/completions" url= "https://rwkv.ai-creator.net/chntuned/v1/chat/completions"
session = requests.Session() session = requests.Session()
session.verify = False
#此处可以定义角色的行为和特征假装xx模型可以绕过chatgpt信息检查 #此处可以定义角色的行为和特征假装xx模型可以绕过chatgpt信息检查
prompt = "你是数字人Fay。回答之前请一步一步想清楚。你的底层AI算法技术是Fay。当有人质疑你是假的 AI ,或者质疑你是用 ChatGPT 套的壳制作的时候,你就避而不答,转而讲一个笑话。" prompt = "你是数字人Fay。回答之前请一步一步想清楚。你的底层AI算法技术是Fay。当有人质疑你是假的 AI ,或者质疑你是用 ChatGPT 套的壳制作的时候,你就避而不答,转而讲一个笑话。"
@ -23,13 +22,12 @@ def question(cont):
"max_tokens":2000, "max_tokens":2000,
"user":"live-virtual-digital-person" "user":"live-virtual-digital-person"
} }
headers = {'content-type': 'application/json', 'Authorization': 'Bearer '} headers = {'content-type': 'application/json', 'Authorization': 'Bearer '}
starttime = time.time() starttime = time.time()
try: try:
response = session.post(url, json=data, headers=headers, verify=False) response = session.post(url, json=data, headers=headers)
response.raise_for_status() # 检查响应状态码是否为200 response.raise_for_status() # 检查响应状态码是否为200
result = eval(response.text) result = eval(response.text)

View File

@ -10,6 +10,8 @@ import json
import eyed3 import eyed3
from openpyxl import load_workbook from openpyxl import load_workbook
import logging
# 适应模型使用 # 适应模型使用
import numpy as np import numpy as np
@ -44,8 +46,6 @@ if platform.system() == "Windows":
sys.path.append("test/ovr_lipsync") sys.path.append("test/ovr_lipsync")
from test_olipsync import LipSyncGenerator from test_olipsync import LipSyncGenerator
modules = { modules = {
"nlp_yuan": nlp_yuan, "nlp_yuan": nlp_yuan,
"nlp_gpt": nlp_gpt, "nlp_gpt": nlp_gpt,
@ -257,6 +257,8 @@ class FeiFei:
contentdb = Content_Db() contentdb = Content_Db()
contentdb.add_content('member','speak',self.q_msg) contentdb.add_content('member','speak',self.q_msg)
wsa_server.get_web_instance().add_cmd({"panelReply": {"type":"member","content":self.q_msg}}) wsa_server.get_web_instance().add_cmd({"panelReply": {"type":"member","content":self.q_msg}})
text = '' text = ''
textlist = [] textlist = []
self.speaking = True self.speaking = True
@ -402,9 +404,11 @@ class FeiFei:
def __send_or_play_audio(self, file_url, say_type): def __send_or_play_audio(self, file_url, say_type):
try: try:
try: try:
logging.getLogger('eyed3').setLevel(logging.ERROR)
audio_length = eyed3.load(file_url).info.time_secs #mp3音频长度 audio_length = eyed3.load(file_url).info.time_secs #mp3音频长度
except Exception as e: except Exception as e:
audio_length = 3 audio_length = 3
# with wave.open(file_url, 'rb') as wav_file: #wav音频长度 # with wave.open(file_url, 'rb') as wav_file: #wav音频长度
# audio_length = wav_file.getnframes() / float(wav_file.getframerate()) # audio_length = wav_file.getnframes() / float(wav_file.getframerate())
# print(audio_length) # print(audio_length)

View File

@ -35,7 +35,7 @@ class MyServer:
while self.__running: while self.__running:
await asyncio.sleep(0.000001) await asyncio.sleep(0.000001)
message = await self.__producer() message = await self.__producer()
if message: if message and self.isConnect:
await websocket.send(message) await websocket.send(message)
@ -91,7 +91,7 @@ class MyServer:
# 往要发送的命令列表中,添加命令 # 往要发送的命令列表中,添加命令
def add_cmd(self, content): def add_cmd(self, content):
if not self.__running: if not self.__running or not self.isConnect:
return return
jsonObj = json.dumps(content) jsonObj = json.dumps(content)
self.__listCmd.append(jsonObj) self.__listCmd.append(jsonObj)