fix: 修复问题

This commit is contained in:
white 2024-10-10 16:58:57 +08:00
parent d06b55535b
commit b910acd435
9 changed files with 124 additions and 110 deletions

View File

@ -1,6 +1,6 @@
<template>
<view>
<view class="box-rds cankao">
<view class=" cankao">
<view class="top_title">
参考
</view>
@ -83,7 +83,7 @@
let json = {
position:"absolute",
top:"22rpx",
right:"-20rpx",
right:"-10rpx",
fontSize:"24rpx"
}
if(idx == 0){
@ -120,11 +120,10 @@
.box-rds {
background-color: #fff;
border-radius: 40rpx;
padding: 30rpx;
margin: 20rpx 50rpx 100rpx 50rpx;
margin: 10rpx;
}
.cankao{
padding: 0rpx 100rpx;
margin: 50rpx;
.top_title{
padding-bottom: 20rpx;
font-size: 36rpx;

View File

@ -51,10 +51,7 @@
</view>
</view>
<view class="row-time" v-if="dataListsNew.stepIndex">
{{(dataListsNew.stepIndex.device_real_time)}}
</view>
<view class="bg">
<!-- <image src="../../static/icon/血糖.png" mode="widthFix"></image> -->
{{dataListsNew.stepIndex.device_real_time? dataListsNew.stepIndex.device_real_time + '更新' : '--'}}
</view>
</view>
<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.dispatch('api/getUserInfo').then(res => {
this.$store.dispatch('api/getUserInfo', { device_id: item.device_id }).then(res => {
this.$store.commit('api/setUserInfo', res);
});
@ -605,8 +602,8 @@
.bg {
position: absolute;
bottom: 0rpx;
right: 50rpx;
opacity: .4;
right: 20rpx;
opacity: .6;
z-index: -1;
image {
width: 250rpx;

View File

@ -321,6 +321,15 @@
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字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
@ -426,7 +435,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "user", "content": params.msg}
]
})
@ -773,8 +782,7 @@
date: formattedDate
};
}
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
const formattedDate = new Date().toISOString().split('T')[0];
} else if (query.includes(demoData[key])) {
return {
dataKey: key,
date: formattedDate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,7 @@
}
</script>
<script>
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂', '血液成分'];
var Question = '';
function getURLParameter(name) {
@ -294,11 +294,11 @@
voiceTxt.innerText = text;
marquee("marquee", "voice-txt");
statusTxt.value = '正在听…';
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
@ -309,19 +309,31 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
console.log(result, '判断关键字是否存在')
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
TargetData.map(item => {
delete item.data_msg.wavefrom;
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字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
console.log(Question, '=========================')
console.log(Question, '=========================');
/*
* 调用接口 传递关键信息 文字转语音
@ -335,15 +347,17 @@
var data = JSON.stringify({
"messages": [
{"role": "system", "content": Question},
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
{"role": "user", "content": `请问我${params.msg}正常吗`}
]
})
});
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
const str = extractStopEvent(chunk);
statusTxt.value = '正在说话';
/*
* 微软接口识别
*/
@ -401,10 +415,10 @@
statusTxt.value = '';
voiceTxt.innerText = '';
clearInterval(countdown);
voice.stop();
replayVideoSegment(0, 60);
}
}, 1000);
hideModal()
}).catch(e => {
hideModal();
@ -421,7 +435,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "user", "content": params.msg}
]
})
@ -431,6 +445,8 @@
const chunk = xhr.responseText;
const str = extractStopEvent(chunk);
statusTxt.value = '正在说话';
/*
* 微软接口识别
*/
@ -457,7 +473,6 @@
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
const blobUrl = URL.createObjectURL(blob);
statusTxt.value = '正在说话';
startRec.style.display = "none";
endRec.style.display = "block";
@ -489,6 +504,7 @@
statusTxt.value = '';
voiceTxt.innerText = '';
clearInterval(countdown);
voice.stop();
replayVideoSegment(0, 60);
}
}, 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() {
startShibie();
});
// 关闭识别
endRec.addEventListener("click", function() {
closeShibie();
});
function startShibie() {
/**开始识别**/
voiceTxt.innerText = '';
voice.start();
@ -541,11 +551,9 @@
startRec.style.display = 'none';
endRec.style.display = 'none';
showModal()
});
}
// 关闭识别
endRec.addEventListener("click", function() {
function closeShibie() {
/**关闭识别**/
voiceTxt.innerText = '';
statusTxt.value = '';
@ -563,19 +571,17 @@
startRec.style.display = 'block';
endRec.style.display = 'none';
hideModal()
});
}
// 显示弹窗和遮罩
function showModal() {
// overlay.style.display = 'block';
modal.style.display = 'block';
dialog.style.display = 'block';
}
// 隐藏弹窗和遮罩
function hideModal() {
// overlay.style.display = 'none';
modal.style.display = 'none';
dialog.style.display = 'none';
}
@ -776,8 +782,7 @@
date: formattedDate
};
}
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
const formattedDate = new Date().toISOString().split('T')[0];
} else if (query.includes(demoData[key])) {
return {
dataKey: key,
date: formattedDate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,7 @@
}
</script>
<script>
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂', '血液成分'];
var Question = '';
function getURLParameter(name) {
@ -294,11 +294,11 @@
voiceTxt.innerText = text;
marquee("marquee", "voice-txt");
statusTxt.value = '正在听…';
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
@ -309,19 +309,31 @@
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
console.log(result, '判断关键字是否存在')
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
TargetData.map(item => {
delete item.data_msg.wavefrom;
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字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
console.log(Question, '=========================')
console.log(Question, '=========================');
/*
* 调用接口 传递关键信息 文字转语音
@ -335,15 +347,17 @@
var data = JSON.stringify({
"messages": [
{"role": "system", "content": Question},
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
{"role": "user", "content": `请问我${params.msg}正常吗`}
]
})
});
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
const str = extractStopEvent(chunk);
statusTxt.value = '正在说话';
/*
* 微软接口识别
*/
@ -401,10 +415,10 @@
statusTxt.value = '';
voiceTxt.innerText = '';
clearInterval(countdown);
voice.stop();
replayVideoSegment(0, 60);
}
}, 1000);
hideModal()
}).catch(e => {
hideModal();
@ -421,7 +435,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "user", "content": params.msg}
]
})
@ -431,6 +445,8 @@
const chunk = xhr.responseText;
const str = extractStopEvent(chunk);
statusTxt.value = '正在说话';
/*
* 微软接口识别
*/
@ -457,7 +473,6 @@
const blob = new Blob([content_bytes], { type: 'audio/mp3' });
const blobUrl = URL.createObjectURL(blob);
statusTxt.value = '正在说话';
startRec.style.display = "none";
endRec.style.display = "block";
@ -489,6 +504,7 @@
statusTxt.value = '';
voiceTxt.innerText = '';
clearInterval(countdown);
voice.stop();
replayVideoSegment(0, 60);
}
}, 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() {
startShibie();
});
// 关闭识别
endRec.addEventListener("click", function() {
closeShibie();
});
function startShibie() {
/**开始识别**/
voiceTxt.innerText = '';
voice.start();
@ -541,11 +551,9 @@
startRec.style.display = 'none';
endRec.style.display = 'none';
showModal()
});
}
// 关闭识别
endRec.addEventListener("click", function() {
function closeShibie() {
/**关闭识别**/
voiceTxt.innerText = '';
statusTxt.value = '';
@ -563,19 +571,17 @@
startRec.style.display = 'block';
endRec.style.display = 'none';
hideModal()
});
}
// 显示弹窗和遮罩
function showModal() {
// overlay.style.display = 'block';
modal.style.display = 'block';
dialog.style.display = 'block';
}
// 隐藏弹窗和遮罩
function hideModal() {
// overlay.style.display = 'none';
modal.style.display = 'none';
dialog.style.display = 'none';
}
@ -776,8 +782,7 @@
date: formattedDate
};
}
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
const formattedDate = new Date().toISOString().split('T')[0];
} else if (query.includes(demoData[key])) {
return {
dataKey: key,
date: formattedDate