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:
zhaomingwork
2023-11-08 09:22:06 +08:00
committed by GitHub
parent 301d0522bb
commit 2e36e738ca
2 changed files with 7 additions and 6 deletions
+3 -3
View File
@@ -262,7 +262,7 @@ function getHotwords(){
var obj = document.getElementById("varHot");
if(typeof(obj) == 'undefined' || obj==null || obj.value.length<=0){
return "";
return null;
}
let val = obj.value.toString();
@@ -279,11 +279,11 @@ function getHotwords(){
for(var i=0;i<result.length-1;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));
return jsonresult;
return JSON.stringify(jsonresult);
}
function getAsrMode(){
+4 -3
View File
@@ -85,12 +85,13 @@ function WebSocketConnectMethod( config ) { //定义socket连接方法类
}
var hotwords=getHotwords();
if(hotwords.length>0)
if(hotwords!=null )
{
request.hotwords=hotwords;
}
console.log(request);
speechSokt.send( JSON.stringify(request) );
console.log(JSON.stringify(request));
speechSokt.send(JSON.stringify(request));
console.log("连接成功");
stateHandle(0);