fix: 修复部分问题
This commit is contained in:
parent
268f21aa3d
commit
d06b55535b
|
|
@ -77,7 +77,7 @@
|
||||||
<detail_components :key_name="activeType" :item="item"></detail_components>
|
<detail_components :key_name="activeType" :item="item"></detail_components>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="end">到底了</view>
|
<view class="end">到底了~</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<ecg-info ref="popShow" :ecgData="ecgData"></ecg-info>
|
<ecg-info ref="popShow" :ecgData="ecgData"></ecg-info>
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
.zzt{
|
.zzt{
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 20rpx 0;
|
padding: 20rpx 0;
|
||||||
width: 60%;
|
width: 70%;
|
||||||
.xnz{
|
.xnz{
|
||||||
width: 8rpx;
|
width: 8rpx;
|
||||||
height: 20rpx;
|
height: 20rpx;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="end">
|
<view class="end">
|
||||||
到底了
|
到底了~
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="time" style="width: 100%; text-align: right; padding-bottom: 0rpx">
|
<view class="time" style="width: 100%; text-align: right; padding-bottom: 0rpx; text-align: left;">
|
||||||
{{dataListsNew.SleepDatas.data_msg? dataListsNew.SleepDatas.device_real_time + '更新' : '--'}}
|
{{dataListsNew.SleepDatas.data_msg? dataListsNew.SleepDatas.device_real_time + '更新' : '--'}}
|
||||||
</view>
|
</view>
|
||||||
<view class="bg">
|
<view class="bg">
|
||||||
|
|
|
||||||
|
|
@ -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,10 +309,12 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
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;
|
||||||
|
|
@ -321,7 +323,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +338,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 +406,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();
|
||||||
|
|
@ -431,6 +436,8 @@
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -457,7 +464,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 +495,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 +516,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 +542,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 +562,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';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -65,7 +65,6 @@
|
||||||
var scrollWidth = document.getElementById(p).offsetWidth;
|
var scrollWidth = document.getElementById(p).offsetWidth;
|
||||||
var textWidth = document.getElementById(s).offsetWidth;
|
var textWidth = document.getElementById(s).offsetWidth;
|
||||||
var i = scrollWidth;
|
var i = scrollWidth;
|
||||||
console.log(scrollWidth, textWidth);
|
|
||||||
function change() {
|
function change() {
|
||||||
i--;
|
i--;
|
||||||
if (i < -textWidth) {
|
if (i < -textWidth) {
|
||||||
|
|
@ -309,7 +308,7 @@
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
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;
|
||||||
|
|
@ -541,7 +540,6 @@
|
||||||
|
|
||||||
startRec.style.display = 'none';
|
startRec.style.display = 'none';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
console.log(endRec.style)
|
|
||||||
showModal()
|
showModal()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -659,7 +657,10 @@
|
||||||
totalTime --;
|
totalTime --;
|
||||||
if (totalTime <= 0) {
|
if (totalTime <= 0) {
|
||||||
// 停止倒计时
|
// 停止倒计时
|
||||||
console.log('计算结束')
|
startRec.style.display = 'block';
|
||||||
|
endRec.style.display = 'none';
|
||||||
|
statusTxt.value = '';
|
||||||
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
|
|
@ -723,12 +724,16 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
|
||||||
meiTuo: '梅脱',
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成分',
|
bloodLiquid: {
|
||||||
|
'血脂': true,
|
||||||
|
'血液成分': true,
|
||||||
|
'尿酸': true
|
||||||
|
},
|
||||||
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: '运动'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -749,18 +754,36 @@
|
||||||
targetDate.setDate(day - 2);
|
targetDate.setDate(day - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化日期为 YYYY-MM-DD
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
// 查找匹配的数据项键
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
for (let key in demoData) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
if (query.includes(demoData[key])) {
|
for (let value in bloodLiquidData) {
|
||||||
return {
|
if (value.includes(query)) {
|
||||||
dataKey: key,
|
return true;
|
||||||
date: formattedDate
|
}
|
||||||
};
|
}
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在查询逻辑中使用这个辅助函数
|
||||||
|
for (let key in demoData) {
|
||||||
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
||||||
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
|
const formattedDate = new Date().toISOString().split('T')[0];
|
||||||
|
return {
|
||||||
|
dataKey: key,
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
|
||||||
|
const formattedDate = new Date().toISOString().split('T')[0];
|
||||||
|
return {
|
||||||
|
dataKey: key,
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -65,7 +65,6 @@
|
||||||
var scrollWidth = document.getElementById(p).offsetWidth;
|
var scrollWidth = document.getElementById(p).offsetWidth;
|
||||||
var textWidth = document.getElementById(s).offsetWidth;
|
var textWidth = document.getElementById(s).offsetWidth;
|
||||||
var i = scrollWidth;
|
var i = scrollWidth;
|
||||||
console.log(scrollWidth, textWidth);
|
|
||||||
function change() {
|
function change() {
|
||||||
i--;
|
i--;
|
||||||
if (i < -textWidth) {
|
if (i < -textWidth) {
|
||||||
|
|
@ -309,7 +308,7 @@
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
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;
|
||||||
|
|
@ -541,7 +540,6 @@
|
||||||
|
|
||||||
startRec.style.display = 'none';
|
startRec.style.display = 'none';
|
||||||
endRec.style.display = 'none';
|
endRec.style.display = 'none';
|
||||||
console.log(endRec.style)
|
|
||||||
showModal()
|
showModal()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -659,7 +657,10 @@
|
||||||
totalTime --;
|
totalTime --;
|
||||||
if (totalTime <= 0) {
|
if (totalTime <= 0) {
|
||||||
// 停止倒计时
|
// 停止倒计时
|
||||||
console.log('计算结束')
|
startRec.style.display = 'block';
|
||||||
|
endRec.style.display = 'none';
|
||||||
|
statusTxt.value = '';
|
||||||
|
voiceTxt.innerText = '';
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
replayVideoSegment(0, 60);
|
replayVideoSegment(0, 60);
|
||||||
}
|
}
|
||||||
|
|
@ -723,12 +724,16 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
|
||||||
meiTuo: '梅脱',
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成分',
|
bloodLiquid: {
|
||||||
|
'血脂': true,
|
||||||
|
'血液成分': true,
|
||||||
|
'尿酸': true
|
||||||
|
},
|
||||||
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: '运动'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -749,18 +754,36 @@
|
||||||
targetDate.setDate(day - 2);
|
targetDate.setDate(day - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化日期为 YYYY-MM-DD
|
|
||||||
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
const formattedDate = `${targetDate.getFullYear()}-${('0' + targetDate.getMonth()).slice(-2)}-${('0' + targetDate.getDate()).slice(-2)}`;
|
||||||
|
|
||||||
// 查找匹配的数据项键
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
for (let key in demoData) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
if (query.includes(demoData[key])) {
|
for (let value in bloodLiquidData) {
|
||||||
return {
|
if (value.includes(query)) {
|
||||||
dataKey: key,
|
return true;
|
||||||
date: formattedDate
|
}
|
||||||
};
|
}
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在查询逻辑中使用这个辅助函数
|
||||||
|
for (let key in demoData) {
|
||||||
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
||||||
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
|
const formattedDate = new Date().toISOString().split('T')[0];
|
||||||
|
return {
|
||||||
|
dataKey: key,
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
|
||||||
|
const formattedDate = new Date().toISOString().split('T')[0];
|
||||||
|
return {
|
||||||
|
dataKey: key,
|
||||||
|
date: formattedDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
// 如果没有找到匹配的数据项,则返回null或错误信息(这里选择返回null)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -3802,7 +3802,7 @@ var render = function () {
|
||||||
staticClass: _vm._$g(43, "sc"),
|
staticClass: _vm._$g(43, "sc"),
|
||||||
staticStyle: {
|
staticStyle: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
"text-align": "right",
|
"text-align": "left",
|
||||||
"padding-bottom": "0rpx",
|
"padding-bottom": "0rpx",
|
||||||
},
|
},
|
||||||
attrs: { _i: 43 },
|
attrs: { _i: 43 },
|
||||||
|
|
@ -8181,7 +8181,7 @@ var render = function () {
|
||||||
1
|
1
|
||||||
),
|
),
|
||||||
_c("uni-view", { staticClass: _vm._$g(28, "sc"), attrs: { _i: 28 } }, [
|
_c("uni-view", { staticClass: _vm._$g(28, "sc"), attrs: { _i: 28 } }, [
|
||||||
_vm._v("到底了"),
|
_vm._v("到底了~"),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
1
|
1
|
||||||
|
|
@ -9401,7 +9401,7 @@ var render = function () {
|
||||||
_c(
|
_c(
|
||||||
"uni-view",
|
"uni-view",
|
||||||
{ staticClass: _vm._$g(39, "sc"), attrs: { _i: 39 } },
|
{ staticClass: _vm._$g(39, "sc"), attrs: { _i: 39 } },
|
||||||
[_vm._v("到底了")]
|
[_vm._v("到底了~")]
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
2
|
2
|
||||||
|
|
|
||||||
|
|
@ -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,10 +309,12 @@
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
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;
|
||||||
|
|
@ -321,7 +323,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +338,18 @@
|
||||||
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}正常吗`}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
console.log(data, '问题问题问题问题问题问题问题问题')
|
||||||
|
|
||||||
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 +407,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();
|
||||||
|
|
@ -431,6 +437,8 @@
|
||||||
const chunk = xhr.responseText;
|
const chunk = xhr.responseText;
|
||||||
const str = extractStopEvent(chunk);
|
const str = extractStopEvent(chunk);
|
||||||
|
|
||||||
|
statusTxt.value = '正在说话';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 微软接口识别
|
* 微软接口识别
|
||||||
*/
|
*/
|
||||||
|
|
@ -457,7 +465,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 +496,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 +517,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 +543,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 +563,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';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue