fix: 修复问题
This commit is contained in:
parent
d06b55535b
commit
b910acd435
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="box-rds cankao">
|
<view class=" cankao">
|
||||||
<view class="top_title">
|
<view class="top_title">
|
||||||
参考
|
参考
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
let json = {
|
let json = {
|
||||||
position:"absolute",
|
position:"absolute",
|
||||||
top:"22rpx",
|
top:"22rpx",
|
||||||
right:"-20rpx",
|
right:"-10rpx",
|
||||||
fontSize:"24rpx"
|
fontSize:"24rpx"
|
||||||
}
|
}
|
||||||
if(idx == 0){
|
if(idx == 0){
|
||||||
|
|
@ -120,11 +120,10 @@
|
||||||
.box-rds {
|
.box-rds {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
padding: 30rpx;
|
margin: 10rpx;
|
||||||
margin: 20rpx 50rpx 100rpx 50rpx;
|
|
||||||
}
|
}
|
||||||
.cankao{
|
.cankao{
|
||||||
padding: 0rpx 100rpx;
|
margin: 50rpx;
|
||||||
.top_title{
|
.top_title{
|
||||||
padding-bottom: 20rpx;
|
padding-bottom: 20rpx;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row-time" v-if="dataListsNew.stepIndex">
|
<view class="row-time" v-if="dataListsNew.stepIndex">
|
||||||
{{(dataListsNew.stepIndex.device_real_time)}}
|
{{dataListsNew.stepIndex.device_real_time? dataListsNew.stepIndex.device_real_time + '更新' : '--'}}
|
||||||
</view>
|
|
||||||
<view class="bg">
|
|
||||||
<!-- <image src="../../static/icon/血糖.png" mode="widthFix"></image> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="content-item row header-item" style="flex-direction: column" @click="toPageCom('SleepDatas')">
|
<view class="content-item row header-item" style="flex-direction: column" @click="toPageCom('SleepDatas')">
|
||||||
|
|
@ -460,7 +457,7 @@
|
||||||
this.$store.commit('api/setActiceDevice', item);
|
this.$store.commit('api/setActiceDevice', item);
|
||||||
|
|
||||||
// 查询个人信息
|
// 查询个人信息
|
||||||
this.$store.dispatch('api/getUserInfo').then(res => {
|
this.$store.dispatch('api/getUserInfo', { device_id: item.device_id }).then(res => {
|
||||||
this.$store.commit('api/setUserInfo', res);
|
this.$store.commit('api/setUserInfo', res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -605,8 +602,8 @@
|
||||||
.bg {
|
.bg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0rpx;
|
bottom: 0rpx;
|
||||||
right: 50rpx;
|
right: 20rpx;
|
||||||
opacity: .4;
|
opacity: .6;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
image {
|
image {
|
||||||
width: 250rpx;
|
width: 250rpx;
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,15 @@
|
||||||
delete item.data_msg.list;
|
delete item.data_msg.list;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (result.dataKey == 'bloodLiquid') {
|
||||||
|
TargetData.map(item => {
|
||||||
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
||||||
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
||||||
|
|
||||||
|
|
@ -426,7 +435,7 @@
|
||||||
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": params.msg},
|
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -773,13 +782,12 @@
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
|
} else if (query.includes(demoData[key])) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
return {
|
||||||
return {
|
dataKey: key,
|
||||||
dataKey: key,
|
date: formattedDate
|
||||||
date: formattedDate
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -77,7 +77,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
|
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂', '血液成分'];
|
||||||
var Question = '';
|
var Question = '';
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
|
|
@ -294,11 +294,11 @@
|
||||||
voiceTxt.innerText = text;
|
voiceTxt.innerText = text;
|
||||||
marquee("marquee", "voice-txt");
|
marquee("marquee", "voice-txt");
|
||||||
|
|
||||||
statusTxt.value = '正在听…';
|
|
||||||
|
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
clearTimeout(times);
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
@ -309,19 +309,31 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
let TargetData = res.data.data;
|
let TargetData = res.data.data;
|
||||||
var QSindex = containsKeywordRegex(params.msg);
|
var QSindex = containsKeywordRegex(params.msg);
|
||||||
|
|
||||||
if (result.dataKey == 'ECGData') {
|
if (result.dataKey == 'ECGData') {
|
||||||
TargetData.map(item => {
|
TargetData.map(item => {
|
||||||
delete item.data_msg.wavefrom;
|
delete item.data_msg.wavefrom;
|
||||||
delete item.data_msg.list;
|
delete item.data_msg.list;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (result.dataKey == 'bloodLiquid') {
|
||||||
|
TargetData.map(item => {
|
||||||
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
||||||
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
||||||
console.log(Question, '=========================')
|
|
||||||
|
console.log(Question, '=========================');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 调用接口 传递关键信息 文字转语音
|
* 调用接口 传递关键信息 文字转语音
|
||||||
|
|
@ -335,15 +347,17 @@
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": Question},
|
{"role": "system", "content": Question},
|
||||||
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
|
{"role": "user", "content": `请问我${params.msg}正常吗`}
|
||||||
]
|
]
|
||||||
})
|
});
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -401,10 +415,10 @@
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
|
voice.stop();
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
hideModal()
|
hideModal()
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
hideModal();
|
hideModal();
|
||||||
|
|
@ -421,7 +435,7 @@
|
||||||
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": params.msg},
|
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -431,6 +445,8 @@
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -457,7 +473,6 @@
|
||||||
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
const blobUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
statusTxt.value = '正在说话';
|
|
||||||
startRec.style.display = "none";
|
startRec.style.display = "none";
|
||||||
endRec.style.display = "block";
|
endRec.style.display = "block";
|
||||||
|
|
||||||
|
|
@ -489,6 +504,7 @@
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
|
voice.stop();
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
@ -509,25 +525,19 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 暂停
|
|
||||||
// runRec.addEventListener("click", function() {
|
|
||||||
// voiceTxt.value = '';
|
|
||||||
// voice.start();
|
|
||||||
// isCallbackExecuted = false;
|
|
||||||
|
|
||||||
// // 先静音即可处理解决(提前做交互)
|
|
||||||
// audioElement.muted = false;
|
|
||||||
// audioElement.pause();
|
|
||||||
|
|
||||||
// startRec.style.display = 'none';
|
|
||||||
// runRec.style.display = 'block';
|
|
||||||
// endRec.style.display = 'none';
|
|
||||||
// showModal()
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// 开始识别
|
// 开始识别
|
||||||
startRec.addEventListener("click", function() {
|
startRec.addEventListener("click", function() {
|
||||||
|
startShibie();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭识别
|
||||||
|
endRec.addEventListener("click", function() {
|
||||||
|
closeShibie();
|
||||||
|
});
|
||||||
|
|
||||||
|
function startShibie() {
|
||||||
/**开始识别**/
|
/**开始识别**/
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
voice.start();
|
voice.start();
|
||||||
|
|
@ -541,11 +551,9 @@
|
||||||
startRec.style.display = 'none';
|
startRec.style.display = 'none';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
showModal()
|
showModal()
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function closeShibie() {
|
||||||
// 关闭识别
|
|
||||||
endRec.addEventListener("click", function() {
|
|
||||||
/**关闭识别**/
|
/**关闭识别**/
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
|
|
@ -563,19 +571,17 @@
|
||||||
startRec.style.display = 'block';
|
startRec.style.display = 'block';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
hideModal()
|
hideModal()
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
// 显示弹窗和遮罩
|
// 显示弹窗和遮罩
|
||||||
function showModal() {
|
function showModal() {
|
||||||
// overlay.style.display = 'block';
|
|
||||||
modal.style.display = 'block';
|
modal.style.display = 'block';
|
||||||
dialog.style.display = 'block';
|
dialog.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 隐藏弹窗和遮罩
|
// 隐藏弹窗和遮罩
|
||||||
function hideModal() {
|
function hideModal() {
|
||||||
// overlay.style.display = 'none';
|
|
||||||
modal.style.display = 'none';
|
modal.style.display = 'none';
|
||||||
dialog.style.display = 'none';
|
dialog.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
@ -776,13 +782,12 @@
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
|
} else if (query.includes(demoData[key])) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
return {
|
||||||
return {
|
dataKey: key,
|
||||||
dataKey: key,
|
date: formattedDate
|
||||||
date: formattedDate
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -77,7 +77,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
|
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂', '血液成分'];
|
||||||
var Question = '';
|
var Question = '';
|
||||||
|
|
||||||
function getURLParameter(name) {
|
function getURLParameter(name) {
|
||||||
|
|
@ -294,11 +294,11 @@
|
||||||
voiceTxt.innerText = text;
|
voiceTxt.innerText = text;
|
||||||
marquee("marquee", "voice-txt");
|
marquee("marquee", "voice-txt");
|
||||||
|
|
||||||
statusTxt.value = '正在听…';
|
|
||||||
|
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
clearTimeout(times);
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
@ -309,19 +309,31 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
DetailDay(result.dataKey, result.date).then(res => {
|
DetailDay(result.dataKey, result.date).then(res => {
|
||||||
let TargetData = res.data.data;
|
let TargetData = res.data.data;
|
||||||
var QSindex = containsKeywordRegex(params.msg);
|
var QSindex = containsKeywordRegex(params.msg);
|
||||||
|
|
||||||
if (result.dataKey == 'ECGData') {
|
if (result.dataKey == 'ECGData') {
|
||||||
TargetData.map(item => {
|
TargetData.map(item => {
|
||||||
delete item.data_msg.wavefrom;
|
delete item.data_msg.wavefrom;
|
||||||
delete item.data_msg.list;
|
delete item.data_msg.list;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (result.dataKey == 'bloodLiquid') {
|
||||||
|
TargetData.map(item => {
|
||||||
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
||||||
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示:data_msg为值,hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制:回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
||||||
console.log(Question, '=========================')
|
|
||||||
|
console.log(Question, '=========================');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 调用接口 传递关键信息 文字转语音
|
* 调用接口 传递关键信息 文字转语音
|
||||||
|
|
@ -335,15 +347,17 @@
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": Question},
|
{"role": "system", "content": Question},
|
||||||
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
|
{"role": "user", "content": `请问我${params.msg}正常吗`}
|
||||||
]
|
]
|
||||||
})
|
});
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -401,10 +415,10 @@
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
|
voice.stop();
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
hideModal()
|
hideModal()
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
hideModal();
|
hideModal();
|
||||||
|
|
@ -421,7 +435,7 @@
|
||||||
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
|
||||||
var data = JSON.stringify({
|
var data = JSON.stringify({
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": params.msg},
|
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -431,6 +445,8 @@
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -457,7 +473,6 @@
|
||||||
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
const blobUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
statusTxt.value = '正在说话';
|
|
||||||
startRec.style.display = "none";
|
startRec.style.display = "none";
|
||||||
endRec.style.display = "block";
|
endRec.style.display = "block";
|
||||||
|
|
||||||
|
|
@ -489,6 +504,7 @@
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
|
voice.stop();
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
@ -509,25 +525,19 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 暂停
|
|
||||||
// runRec.addEventListener("click", function() {
|
|
||||||
// voiceTxt.value = '';
|
|
||||||
// voice.start();
|
|
||||||
// isCallbackExecuted = false;
|
|
||||||
|
|
||||||
// // 先静音即可处理解决(提前做交互)
|
|
||||||
// audioElement.muted = false;
|
|
||||||
// audioElement.pause();
|
|
||||||
|
|
||||||
// startRec.style.display = 'none';
|
|
||||||
// runRec.style.display = 'block';
|
|
||||||
// endRec.style.display = 'none';
|
|
||||||
// showModal()
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// 开始识别
|
// 开始识别
|
||||||
startRec.addEventListener("click", function() {
|
startRec.addEventListener("click", function() {
|
||||||
|
startShibie();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭识别
|
||||||
|
endRec.addEventListener("click", function() {
|
||||||
|
closeShibie();
|
||||||
|
});
|
||||||
|
|
||||||
|
function startShibie() {
|
||||||
/**开始识别**/
|
/**开始识别**/
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
voice.start();
|
voice.start();
|
||||||
|
|
@ -541,11 +551,9 @@
|
||||||
startRec.style.display = 'none';
|
startRec.style.display = 'none';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
showModal()
|
showModal()
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function closeShibie() {
|
||||||
// 关闭识别
|
|
||||||
endRec.addEventListener("click", function() {
|
|
||||||
/**关闭识别**/
|
/**关闭识别**/
|
||||||
voiceTxt.innerText = '';
|
voiceTxt.innerText = '';
|
||||||
statusTxt.value = '';
|
statusTxt.value = '';
|
||||||
|
|
@ -563,19 +571,17 @@
|
||||||
startRec.style.display = 'block';
|
startRec.style.display = 'block';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
hideModal()
|
hideModal()
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
// 显示弹窗和遮罩
|
// 显示弹窗和遮罩
|
||||||
function showModal() {
|
function showModal() {
|
||||||
// overlay.style.display = 'block';
|
|
||||||
modal.style.display = 'block';
|
modal.style.display = 'block';
|
||||||
dialog.style.display = 'block';
|
dialog.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 隐藏弹窗和遮罩
|
// 隐藏弹窗和遮罩
|
||||||
function hideModal() {
|
function hideModal() {
|
||||||
// overlay.style.display = 'none';
|
|
||||||
modal.style.display = 'none';
|
modal.style.display = 'none';
|
||||||
dialog.style.display = 'none';
|
dialog.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
@ -776,13 +782,12 @@
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
|
} else if (query.includes(demoData[key])) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
return {
|
||||||
return {
|
dataKey: key,
|
||||||
dataKey: key,
|
date: formattedDate
|
||||||
date: formattedDate
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue