fix: 修复部分问题
This commit is contained in:
parent
b910acd435
commit
f2d1f60941
|
|
@ -24,7 +24,7 @@
|
||||||
<view class="data">
|
<view class="data">
|
||||||
<image src="https://img.agrimedia.cn/apptest/%E6%89%8B%E8%A1%A8-%E7%BA%BF%E6%80%A73-0.png" mode="widthFix"></image>
|
<image src="https://img.agrimedia.cn/apptest/%E6%89%8B%E8%A1%A8-%E7%BA%BF%E6%80%A73-0.png" mode="widthFix"></image>
|
||||||
<view v-if="activeType == 'stepIndex'">
|
<view v-if="activeType == 'stepIndex'">
|
||||||
步数:{{item.data_msg.step}}
|
步数:{{item.data_msg.stepCount}}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="activeType == 'bloodPressure'">
|
<view v-if="activeType == 'bloodPressure'">
|
||||||
{{item.data_msg.bloodPressureHigh}}/{{item.data_msg.bloodPressureLow}} mmHg
|
{{item.data_msg.bloodPressureHigh}}/{{item.data_msg.bloodPressureLow}} mmHg
|
||||||
|
|
@ -187,13 +187,9 @@
|
||||||
getArrMaxValue,
|
getArrMaxValue,
|
||||||
queryList() {
|
queryList() {
|
||||||
let type = '';
|
let type = '';
|
||||||
if (this.activeType == 'step') {
|
if (this.activeType == 'stepIndex') {
|
||||||
type = 'step_split'
|
type = 'step_split'
|
||||||
} else {
|
} else if (this.activeType == 'bloodLiquidAll') {
|
||||||
type = this.activeType
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.activeType == 'bloodLiquidAll') {
|
|
||||||
type = 'bloodLiquid'
|
type = 'bloodLiquid'
|
||||||
} else {
|
} else {
|
||||||
type = this.activeType
|
type = this.activeType
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,6 @@ import { mapGetters } from "vuex";
|
||||||
|
|
||||||
this.option.series[0].markLine.symbol = 'none'
|
this.option.series[0].markLine.symbol = 'none'
|
||||||
this.option.series[0].markLine.label.position ='insideEndTop'
|
this.option.series[0].markLine.label.position ='insideEndTop'
|
||||||
console.log(this.pageData.type, '900000000000')
|
|
||||||
switch(this.pageData.type){
|
switch(this.pageData.type){
|
||||||
case 'stepIndex':
|
case 'stepIndex':
|
||||||
console.log('步数')
|
console.log('步数')
|
||||||
|
|
|
||||||
|
|
@ -171,12 +171,17 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成份',
|
bloodLiquid: '血液',
|
||||||
stepIndex: '运动'
|
bloodLiquid: '血脂',
|
||||||
|
bloodLiquid: '尿酸',
|
||||||
|
bodyData: '身体成分',
|
||||||
|
stepIndex: '运动',
|
||||||
|
stepIndex: '步数',
|
||||||
|
stepIndex: '运动步数',
|
||||||
};
|
};
|
||||||
|
|
||||||
var videoElement = document.getElementById('myVideo');
|
var videoElement = document.getElementById('myVideo');
|
||||||
|
|
@ -297,9 +302,8 @@
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
statusTxt.value = '正在听…';
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
|
clearTimeout(times);
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
statusTxt.value = '正在说话';
|
statusTxt.value = '正在说话';
|
||||||
|
|
@ -307,10 +311,13 @@
|
||||||
const params = { msg: text };
|
const params = { msg: text };
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
|
console.log('判断')
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
isCallbackExecuted = true;
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
|
||||||
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);
|
||||||
|
|
@ -326,7 +333,7 @@
|
||||||
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
|
||||||
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +442,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": `请模仿全科医生的口吻与我对话`},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -722,6 +729,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 解析文字
|
// 解析文字
|
||||||
function parseHealthQuery(query, demoData) {
|
function parseHealthQuery(query, demoData) {
|
||||||
if (!demoData) {
|
if (!demoData) {
|
||||||
|
|
@ -734,13 +742,9 @@
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bloodLiquid: {
|
bloodLiquid: ['血脂', '血液', '尿酸'],
|
||||||
'血脂': true,
|
|
||||||
'血液成分': true,
|
|
||||||
'尿酸': true
|
|
||||||
},
|
|
||||||
bodyData: '身体成分',
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: ['运动', '步数']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -764,19 +768,14 @@
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
for (let value in bloodLiquidData) {
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
if (value.includes(query)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在查询逻辑中使用这个辅助函数
|
// 在查询逻辑中使用这个辅助函数
|
||||||
for (let key in demoData) {
|
for (let key in demoData) {
|
||||||
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
|
||||||
if (isBloodLiquidMatch(demoData[key], query)) {
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
|
||||||
return {
|
return {
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -171,12 +171,17 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成份',
|
bloodLiquid: '血液',
|
||||||
stepIndex: '运动'
|
bloodLiquid: '血脂',
|
||||||
|
bloodLiquid: '尿酸',
|
||||||
|
bodyData: '身体成分',
|
||||||
|
stepIndex: '运动',
|
||||||
|
stepIndex: '步数',
|
||||||
|
stepIndex: '运动步数',
|
||||||
};
|
};
|
||||||
|
|
||||||
var videoElement = document.getElementById('myVideo');
|
var videoElement = document.getElementById('myVideo');
|
||||||
|
|
@ -297,9 +302,8 @@
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
statusTxt.value = '正在听…';
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
|
clearTimeout(times);
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
statusTxt.value = '正在说话';
|
statusTxt.value = '正在说话';
|
||||||
|
|
@ -307,10 +311,13 @@
|
||||||
const params = { msg: text };
|
const params = { msg: text };
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
|
console.log('判断')
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
isCallbackExecuted = true;
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
|
||||||
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);
|
||||||
|
|
@ -326,7 +333,7 @@
|
||||||
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
|
||||||
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +442,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": `请模仿全科医生的口吻与我对话`},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -722,6 +729,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 解析文字
|
// 解析文字
|
||||||
function parseHealthQuery(query, demoData) {
|
function parseHealthQuery(query, demoData) {
|
||||||
if (!demoData) {
|
if (!demoData) {
|
||||||
|
|
@ -734,13 +742,9 @@
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bloodLiquid: {
|
bloodLiquid: ['血脂', '血液', '尿酸'],
|
||||||
'血脂': true,
|
|
||||||
'血液成分': true,
|
|
||||||
'尿酸': true
|
|
||||||
},
|
|
||||||
bodyData: '身体成分',
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: ['运动', '步数']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -764,19 +768,14 @@
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
for (let value in bloodLiquidData) {
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
if (value.includes(query)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在查询逻辑中使用这个辅助函数
|
// 在查询逻辑中使用这个辅助函数
|
||||||
for (let key in demoData) {
|
for (let key in demoData) {
|
||||||
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
|
||||||
if (isBloodLiquidMatch(demoData[key], query)) {
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
|
||||||
return {
|
return {
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -171,12 +171,17 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成份',
|
bloodLiquid: '血液',
|
||||||
stepIndex: '运动'
|
bloodLiquid: '血脂',
|
||||||
|
bloodLiquid: '尿酸',
|
||||||
|
bodyData: '身体成分',
|
||||||
|
stepIndex: '运动',
|
||||||
|
stepIndex: '步数',
|
||||||
|
stepIndex: '运动步数',
|
||||||
};
|
};
|
||||||
|
|
||||||
var videoElement = document.getElementById('myVideo');
|
var videoElement = document.getElementById('myVideo');
|
||||||
|
|
@ -297,9 +302,8 @@
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
statusTxt.value = '正在听…';
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
|
clearTimeout(times);
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
statusTxt.value = '正在说话';
|
statusTxt.value = '正在说话';
|
||||||
|
|
@ -307,10 +311,13 @@
|
||||||
const params = { msg: text };
|
const params = { msg: text };
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
|
console.log('判断')
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
isCallbackExecuted = true;
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
|
||||||
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);
|
||||||
|
|
@ -326,7 +333,7 @@
|
||||||
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
|
||||||
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
item.data_msg.highDensity = item.data_msg.highDensity/100;
|
||||||
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
|
||||||
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
|
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
|
||||||
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +442,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": `请模仿全科医生的口吻与我对话`},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -722,6 +729,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 解析文字
|
// 解析文字
|
||||||
function parseHealthQuery(query, demoData) {
|
function parseHealthQuery(query, demoData) {
|
||||||
if (!demoData) {
|
if (!demoData) {
|
||||||
|
|
@ -734,13 +742,9 @@
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bloodLiquid: {
|
bloodLiquid: ['血脂', '血液', '尿酸'],
|
||||||
'血脂': true,
|
|
||||||
'血液成分': true,
|
|
||||||
'尿酸': true
|
|
||||||
},
|
|
||||||
bodyData: '身体成分',
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: ['运动', '步数']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -764,19 +768,14 @@
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
for (let value in bloodLiquidData) {
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
if (value.includes(query)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在查询逻辑中使用这个辅助函数
|
// 在查询逻辑中使用这个辅助函数
|
||||||
for (let key in demoData) {
|
for (let key in demoData) {
|
||||||
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
|
||||||
if (isBloodLiquidMatch(demoData[key], query)) {
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
|
||||||
return {
|
return {
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
date: formattedDate
|
date: formattedDate
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -171,12 +171,17 @@
|
||||||
SleepDatas: "睡眠",
|
SleepDatas: "睡眠",
|
||||||
bloodOxygen: "血氧",
|
bloodOxygen: "血氧",
|
||||||
bloodPressure: '血压',
|
bloodPressure: '血压',
|
||||||
bloodLiquid: "血脂",
|
meiTuo: '梅脱',
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bodyData: '身体成份',
|
bloodLiquid: '血液',
|
||||||
stepIndex: '运动'
|
bloodLiquid: '血脂',
|
||||||
|
bloodLiquid: '尿酸',
|
||||||
|
bodyData: '身体成分',
|
||||||
|
stepIndex: '运动',
|
||||||
|
stepIndex: '步数',
|
||||||
|
stepIndex: '运动步数',
|
||||||
};
|
};
|
||||||
|
|
||||||
var videoElement = document.getElementById('myVideo');
|
var videoElement = document.getElementById('myVideo');
|
||||||
|
|
@ -297,9 +302,8 @@
|
||||||
// 3秒钟内没有说话,就自动关闭
|
// 3秒钟内没有说话,就自动关闭
|
||||||
if (text) {
|
if (text) {
|
||||||
statusTxt.value = '正在听…';
|
statusTxt.value = '正在听…';
|
||||||
clearTimeout(times);
|
|
||||||
|
|
||||||
if (!isCallbackExecuted) {
|
if (!isCallbackExecuted) {
|
||||||
|
clearTimeout(times);
|
||||||
times = setTimeout(() => {
|
times = setTimeout(() => {
|
||||||
this.stop();
|
this.stop();
|
||||||
statusTxt.value = '正在说话';
|
statusTxt.value = '正在说话';
|
||||||
|
|
@ -307,10 +311,13 @@
|
||||||
const params = { msg: text };
|
const params = { msg: text };
|
||||||
|
|
||||||
// 判断关键字是否存在
|
// 判断关键字是否存在
|
||||||
|
console.log('判断')
|
||||||
const result = parseHealthQuery(params.msg);
|
const result = parseHealthQuery(params.msg);
|
||||||
|
isCallbackExecuted = true;
|
||||||
console.log(result, '判断关键字是否存在')
|
console.log(result, '判断关键字是否存在')
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
|
||||||
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);
|
||||||
|
|
@ -321,6 +328,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/10000;
|
||||||
|
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字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
|
||||||
|
|
||||||
|
|
@ -340,8 +356,7 @@
|
||||||
{"role": "system", "content": Question},
|
{"role": "system", "content": Question},
|
||||||
{"role": "user", "content": `请问我${params.msg}正常吗`}
|
{"role": "user", "content": `请问我${params.msg}正常吗`}
|
||||||
]
|
]
|
||||||
})
|
});
|
||||||
console.log(data, '问题问题问题问题问题问题问题问题')
|
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
|
|
@ -427,7 +442,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": `请模仿全科医生的口吻与我对话`},
|
||||||
{"role": "user", "content": params.msg}
|
{"role": "user", "content": params.msg}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -714,6 +729,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 解析文字
|
// 解析文字
|
||||||
function parseHealthQuery(query, demoData) {
|
function parseHealthQuery(query, demoData) {
|
||||||
if (!demoData) {
|
if (!demoData) {
|
||||||
|
|
@ -726,13 +742,9 @@
|
||||||
pulseReat: '心率',
|
pulseReat: '心率',
|
||||||
bodyTemperature: '体温',
|
bodyTemperature: '体温',
|
||||||
ECGData: '心电图',
|
ECGData: '心电图',
|
||||||
bloodLiquid: {
|
bloodLiquid: ['血脂', '血液', '尿酸'],
|
||||||
'血脂': true,
|
|
||||||
'血液成分': true,
|
|
||||||
'尿酸': true
|
|
||||||
},
|
|
||||||
bodyData: '身体成分',
|
bodyData: '身体成分',
|
||||||
stepIndex: '运动'
|
stepIndex: ['运动', '步数']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -756,26 +768,20 @@
|
||||||
|
|
||||||
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
|
||||||
function isBloodLiquidMatch(bloodLiquidData, query) {
|
function isBloodLiquidMatch(bloodLiquidData, query) {
|
||||||
for (let value in bloodLiquidData) {
|
return bloodLiquidData.some(element => query.includes(element))
|
||||||
if (value.includes(query)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在查询逻辑中使用这个辅助函数
|
// 在查询逻辑中使用这个辅助函数
|
||||||
for (let key in demoData) {
|
for (let key in demoData) {
|
||||||
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
|
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
|
||||||
if (isBloodLiquidMatch(demoData[key], query)) {
|
if (isBloodLiquidMatch(demoData[key], query)) {
|
||||||
const formattedDate = new Date().toISOString().split('T')[0];
|
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
|
||||||
return {
|
return {
|
||||||
dataKey: key,
|
dataKey: key,
|
||||||
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
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue