更新mini的libs固件
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -82,18 +82,20 @@ class ASR_WebSocket(Ws_Param):
|
|||||||
break
|
break
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def run(self, seconds=3, ibuf=1600, timeout=2000):
|
def run(self, seconds=3, pace=True, ibuf=1600, timeout=2000):
|
||||||
try:
|
try:
|
||||||
_state = 0
|
_state = 0
|
||||||
self.connect()
|
self.connect()
|
||||||
_star = time.ticks_ms()
|
_star = time.ticks_ms()
|
||||||
_size = int(ibuf * seconds * 10) #100ms/次
|
_size = int(ibuf * seconds * 10) #100ms/次
|
||||||
onboard_bot.pcm_en(True) #PCM开启
|
onboard_bot.pcm_en(True) #PCM开启
|
||||||
|
if pace: print('[',end ="")
|
||||||
while _size > 0:
|
while _size > 0:
|
||||||
if onboard_bot.pcm_any():
|
if onboard_bot.pcm_any():
|
||||||
_size -= ibuf
|
_size -= ibuf
|
||||||
_star = time.ticks_ms()
|
_star = time.ticks_ms()
|
||||||
buf = onboard_bot.pcm_read(ibuf)
|
buf = onboard_bot.pcm_read(ibuf)
|
||||||
|
if pace: print('=',end ="")
|
||||||
# 第一帧处理
|
# 第一帧处理
|
||||||
if _state == 0:
|
if _state == 0:
|
||||||
d = {"common": {"app_id": self.APPID}, "business": self.business, "data": self._frame(_state, buf)}
|
d = {"common": {"app_id": self.APPID}, "business": self.business, "data": self._frame(_state, buf)}
|
||||||
@@ -109,6 +111,7 @@ class ASR_WebSocket(Ws_Param):
|
|||||||
d = {"data": self._frame(2, b'\x00')}
|
d = {"data": self._frame(2, b'\x00')}
|
||||||
self.ws.send(json.dumps(d))
|
self.ws.send(json.dumps(d))
|
||||||
onboard_bot.pcm_en(False) #PCM关闭
|
onboard_bot.pcm_en(False) #PCM关闭
|
||||||
|
if pace: print(']')
|
||||||
msg = self.receive_messages()
|
msg = self.receive_messages()
|
||||||
self.ws.close()
|
self.ws.close()
|
||||||
return msg
|
return msg
|
||||||
@@ -148,9 +151,8 @@ class LLM_WebSocket(Ws_Param):
|
|||||||
"parameter": {
|
"parameter": {
|
||||||
"chat": {
|
"chat": {
|
||||||
"domain": self._url[1],
|
"domain": self._url[1],
|
||||||
"temperature": 0.8,
|
"random_threshold": 0.5,
|
||||||
"max_tokens": 2048,
|
"max_tokens": 2048,
|
||||||
"top_k": 5,
|
|
||||||
"auditing": "default"
|
"auditing": "default"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user