mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
fix bug for h5 hotwords (#1067)
* fix bug for h5 hotwords * make changes for main.js * change json from string to object * change from object to string for hotwords
This commit is contained in:
parent
301d0522bb
commit
2e36e738ca
@ -262,7 +262,7 @@ function getHotwords(){
|
|||||||
var obj = document.getElementById("varHot");
|
var obj = document.getElementById("varHot");
|
||||||
|
|
||||||
if(typeof(obj) == 'undefined' || obj==null || obj.value.length<=0){
|
if(typeof(obj) == 'undefined' || obj==null || obj.value.length<=0){
|
||||||
return "";
|
return null;
|
||||||
}
|
}
|
||||||
let val = obj.value.toString();
|
let val = obj.value.toString();
|
||||||
|
|
||||||
@ -279,11 +279,11 @@ function getHotwords(){
|
|||||||
for(var i=0;i<result.length-1;i++)
|
for(var i=0;i<result.length-1;i++)
|
||||||
wordstr=wordstr+result[i]+" ";
|
wordstr=wordstr+result[i]+" ";
|
||||||
|
|
||||||
jsonresult[wordstr.trim()]=result[result.length-1];
|
jsonresult[wordstr.trim()]= parseInt(result[result.length-1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("jsonresult="+JSON.stringify(jsonresult));
|
console.log("jsonresult="+JSON.stringify(jsonresult));
|
||||||
return jsonresult;
|
return JSON.stringify(jsonresult);
|
||||||
|
|
||||||
}
|
}
|
||||||
function getAsrMode(){
|
function getAsrMode(){
|
||||||
|
|||||||
@ -85,12 +85,13 @@ function WebSocketConnectMethod( config ) { //定义socket连接方法类
|
|||||||
}
|
}
|
||||||
|
|
||||||
var hotwords=getHotwords();
|
var hotwords=getHotwords();
|
||||||
if(hotwords.length>0)
|
|
||||||
|
if(hotwords!=null )
|
||||||
{
|
{
|
||||||
request.hotwords=hotwords;
|
request.hotwords=hotwords;
|
||||||
}
|
}
|
||||||
console.log(request);
|
console.log(JSON.stringify(request));
|
||||||
speechSokt.send( JSON.stringify(request) );
|
speechSokt.send(JSON.stringify(request));
|
||||||
console.log("连接成功");
|
console.log("连接成功");
|
||||||
stateHandle(0);
|
stateHandle(0);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user