From c2e4e3c2e9be855277d9f4fa9cd0544892ff829a Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 30 八月 2023 09:57:30 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
funasr/runtime/html5/static/wsconnecter.js | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/funasr/runtime/html5/static/wsconnecter.js b/funasr/runtime/html5/static/wsconnecter.js
index b9098bb..cc6129f 100644
--- a/funasr/runtime/html5/static/wsconnecter.js
+++ b/funasr/runtime/html5/static/wsconnecter.js
@@ -30,7 +30,7 @@
speechSokt.onopen = function(e){onOpen(e);}; // 瀹氫箟鍝嶅簲鍑芥暟
speechSokt.onclose = function(e){
console.log("onclose ws!");
- speechSokt.close();
+ //speechSokt.close();
onClose(e);
};
speechSokt.onmessage = function(e){onMessage(e);};
@@ -51,16 +51,13 @@
}
};
- this.wsSend = function ( oneData,stop ) {
+ this.wsSend = function ( oneData ) {
if(speechSokt == undefined) return;
if ( speechSokt.readyState === 1 ) { // 0:CONNECTING, 1:OPEN, 2:CLOSING, 3:CLOSED
speechSokt.send( oneData );
- if(stop){
- setTimeout(speechSokt.close(), 3000 );
- }
}
};
@@ -75,12 +72,22 @@
"is_speaking": true,
"chunk_interval":10,
"mode":getAsrMode(),
+
};
+ if(isfilemode)
+ {
+ request.wav_format=file_ext;
+ }
+ var hotwords=getHotwords();
+ if(hotwords.length>0)
+ {
+ request.hotwords=hotwords;
+ }
console.log(request);
speechSokt.send( JSON.stringify(request) );
console.log("杩炴帴鎴愬姛");
stateHandle(0);
- isconnected=1;
+
}
function onClose( e ) {
@@ -93,7 +100,7 @@
}
function onError( e ) {
- isconnected=-1;
+
info_div.innerHTML="杩炴帴"+e;
console.log(e);
stateHandle(2);
--
Gitblit v1.9.1