fix: 修复部分问题

This commit is contained in:
white 2024-10-09 15:51:20 +08:00
parent 387e2ef30b
commit b326f57742
19 changed files with 208 additions and 127 deletions

View File

@ -333,6 +333,7 @@
meiTuo: '梅脱',
pulseReat: '心率',
updataDate: '更新时间',
bodyData: '身体成分',
bodyTemperature: '体温',
bloodLiquidAll: '血脂'
},
@ -410,8 +411,7 @@
this.dataListsNew[res[i].type] = res[i]
this.dataListsNew[res[i].name] = this.getNameByKey(res[i].type)
}
this.urlLink = `/hybrid/html/ai.html?data=${JSON.stringify(res)}`;
this.$refs.paging.complete();
}

View File

@ -126,7 +126,7 @@
try {
if (dataJson) {
const eventData = JSON.parse(dataJson);
if (eventData.output.finish_reason === "stop") {
if (eventData.output?.finish_reason === "stop") {
stopEvent = eventData;
}
}
@ -279,6 +279,7 @@
...value
}));
/*
* 实例化迅飞语音听写流式版WebAPI
*/
@ -302,25 +303,24 @@
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
// voice.stop();
statusTxt.value = '正在说话';
const params = { msg: text };
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
// if (res?.data?.data) {
// speed(params.msg)
// return
// };
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
delete TargetData[0].data_msg.wavefrom;
delete TargetData[0].data_msg.list;
}
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)},data_msg为值hour_minute为检测时间 #限制回复用户的内容中不要出现Null。#限制:回复不要带英文,要都转化成汉语。#限制监测结果为Null的数据不做分析回复。`
console.log('指定问题', Question)
/*
* 调用接口 传递关键信息 文字转语音
@ -337,7 +337,7 @@
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
]
})
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
@ -724,7 +724,7 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成',
bodyData: '身体成',
stepIndex: '运动'
};
}

View File

@ -279,7 +279,6 @@
// 识别结束 webSocket返回数据
webSocketRes(resultData) {
let jsonData = JSON.parse(resultData);
console.log(JSON.stringify(jsonData), 'websocket')
if (jsonData.data && jsonData.data.result) {
let data = jsonData.data.result;
let str = '';

View File

@ -181,8 +181,14 @@
}
//
this.dataListsNew.bloodLiquidAll = JSON.parse(JSON.stringify(this.dataListsNew.bloodLiquid));
this.dataListsNew.bloodLiquidAll.type = 'bloodLiquidAll';
// this.dataListsNew.bodyData = JSON.parse(JSON.stringify(this.dataListsNew.bloodLiquid));
// this.dataListsNew.bodyData.type = 'bodyData';
console.log(this.dataListsNew)
if (this.dataListsNew.ECGData.data_msg) {
//
delete this.dataListsNew.ECGData.data_msg.wavefrom;
delete this.dataListsNew.ECGData.data_msg.list;
}
this.urlLink = `/hybrid/html/ai.html?data=${JSON.stringify(this.dataListsNew)}&user=${JSON.stringify(this.getUserInfo)}&token=${store.getters['api/getApiToken']}&deviceId=${this.getActiceDevice.device_id}`;
this.loading = false;

View File

@ -1,6 +1,6 @@
<template>
<view class="forget">
<tm-nav-bar left-icon="arrow-left" title="忘记密码" @clickLeft="back" />
<tm-nav-bar left-icon="arrow-left" title="忘记密码" @clickLeft="back" :width="`100%`" :rbgs="false"/>
<view class="content">
<!-- 主体 -->
<view class="main">
@ -178,6 +178,14 @@
<style>
@import url("../../components/watch-login/css/icon.css");
@import url("./css/main.css");
.content {
width: 60%;
margin: 0 auto;
margin-top: 30rpx;
}
.tips {
margin-bottom: 30rpx;
}
.main-list{
display: flex;
flex-direction: row;

View File

@ -1,6 +1,6 @@
<template>
<view class="register">
<tm-nav-bar left-icon="arrow-left" title="注册账号" @clickLeft="back" />
<tm-nav-bar left-icon="arrow-left" title="注册账号" @clickLeft="back" :width="`100%`" :rbgs="false"/>
<view class="content">
<!-- 头部logo -->
<view class="header">
@ -224,7 +224,14 @@
<style>
@import url("../../components/watch-login/css/icon.css");
@import url("./css/main.css");
.content {
width: 60%;
margin: 0 auto;
margin-top: 30rpx;
}
.tips {
margin-bottom: 30rpx;
}
.main-list{
display: flex;
flex-direction: row;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,22 +46,37 @@
<!-- 录制 -->
<div class="buttons startRec">点击说话</div>
<!-- 录制中 -->
<!-- <div class="buttons runRec">暂停</div> -->
<!-- 停止 -->
<div class="buttons endRec">停止</div>
</div>
<!-- 讯飞测试 -->
<div class="voice">
<div class="voice-box scroll-text">
<input class="voice-input" type="search" name="voice" id="voice-txt" style="pointer-events: none" value="我是您的健康助手, 请问您有什么帮助吗?"/>
<div id="marquee">
<span id="voice-txt">我是您的健康助手, 请问您有什么帮助吗?</span>
</div>
</div>
</div>
</div>
<script type="text/javascript">
marquee("marquee", "voice-txt");
function marquee(p, s) {
var scrollWidth = document.getElementById(p).offsetWidth;
var textWidth = document.getElementById(s).offsetWidth;
var i = scrollWidth;
console.log(scrollWidth, textWidth);
function change() {
i--;
if (i < -textWidth) {
i = scrollWidth;
}
document.getElementById(s).style.left = i + "px";
window.requestAnimationFrame(change);
}
window.requestAnimationFrame(change);
}
</script>
<script>
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
var Question = '';
@ -111,7 +126,7 @@
try {
if (dataJson) {
const eventData = JSON.parse(dataJson);
if (eventData.output.finish_reason === "stop") {
if (eventData.output?.finish_reason === "stop") {
stopEvent = eventData;
}
}
@ -147,11 +162,6 @@
const speakingTimeInSeconds = speakingTime * 60;
return speakingTimeInSeconds;
}
// 映射的字段
function Reflection(str) {
}
</script>
<!-- 讯飞语音识别 -->
@ -269,6 +279,7 @@
...value
}));
/*
* 实例化迅飞语音听写流式版WebAPI
*/
@ -281,7 +292,9 @@
onTextChange: function (text) {
// 监听识别结果的变化
voiceTxt.value = text;
voiceTxt.innerText = text;
marquee("marquee", "voice-txt");
statusTxt.value = '正在听…';
// 3秒钟内没有说话就自动关闭
@ -290,24 +303,25 @@
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
// voice.stop();
statusTxt.value = '正在说话';
const params = { msg: text };
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
// if (res?.data?.data) {
// speed(params.msg)
// return
// };
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
delete TargetData[0].data_msg.wavefrom;
delete TargetData[0].data_msg.list;
}
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)},data_msg为值hour_minute为检测时间 #限制回复用户的内容中不要出现Null。#限制:回复不要带英文,要都转化成汉语。#限制监测结果为Null的数据不做分析回复。`
/*
* 调用接口 传递关键信息 文字转语音
*/
@ -323,7 +337,7 @@
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
]
})
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
@ -358,6 +372,10 @@
startRec.style.display = "none";
endRec.style.display = "block";
// 字幕文字
voiceTxt.innerText = filterString(str.output.text, ['*', ' ']);
marquee("marquee", "voice-txt");
// 设置音频源
audioElement.src = blobUrl;
@ -442,7 +460,8 @@
endRec.style.display = "block";
// 字幕文字
voiceTxt.value = filterString(str.output.text, ['*', ' ']);
voiceTxt.innerText = filterString(str.output.text, ['*', ' ']);
marquee("marquee", "voice-txt");
// 设置音频源
audioElement.src = blobUrl;
@ -454,7 +473,7 @@
replayVideoSegment(60, 120);
// 计算所需时间
const speakingTime = calculateSpeakingTime(voiceTxt.value);
const speakingTime = calculateSpeakingTime(voiceTxt.innerText);
// 开始倒计时
var totalTime = speakingTime;
@ -507,7 +526,7 @@
// 开始识别
startRec.addEventListener("click", function() {
/**开始识别**/
voiceTxt.value = '';
voiceTxt.innerText = '';
voice.start();
isCallbackExecuted = false;
@ -526,7 +545,7 @@
// 关闭识别
endRec.addEventListener("click", function() {
/**关闭识别**/
voiceTxt.value = '';
voiceTxt.innerText = '';
statusTxt.value = '';
voice.stop();
@ -615,7 +634,7 @@
const blobUrl = URL.createObjectURL(blob);
// 字幕文字
voiceTxt.value = str;
voiceTxt.innerText = str;
// 设置音频源
audioElement.src = blobUrl;
@ -705,7 +724,7 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成',
bodyData: '身体成',
stepIndex: '运动'
};
}
@ -963,20 +982,27 @@
width: 100%;
/* background-color: #000; */
}
.voice-box {
#marquee {
display: block;
width: 100%;
animation: textRoll linear 10s infinite; // 文字滚动动画
white-space: nowrap; // 文字不换行
height: 60px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
@keyframes textRoll {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
#voice-txt {
position: absolute;
top: 0;
left: 100%;
line-height: 60px;
font-size:29px;
color: #fff;
display: block;
word-break: keep-all;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@ -279,7 +279,6 @@
// 识别结束 webSocket返回数据
webSocketRes(resultData) {
let jsonData = JSON.parse(resultData);
console.log(JSON.stringify(jsonData), 'websocket')
if (jsonData.data && jsonData.data.result) {
let data = jsonData.data.result;
let str = '';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,22 +46,37 @@
<!-- 录制 -->
<div class="buttons startRec">点击说话</div>
<!-- 录制中 -->
<!-- <div class="buttons runRec">暂停</div> -->
<!-- 停止 -->
<div class="buttons endRec">停止</div>
</div>
<!-- 讯飞测试 -->
<div class="voice">
<div class="voice-box scroll-text">
<input class="voice-input" type="search" name="voice" id="voice-txt" style="pointer-events: none" value="我是您的健康助手, 请问您有什么帮助吗?"/>
<div id="marquee">
<span id="voice-txt">我是您的健康助手, 请问您有什么帮助吗?</span>
</div>
</div>
</div>
</div>
<script type="text/javascript">
marquee("marquee", "voice-txt");
function marquee(p, s) {
var scrollWidth = document.getElementById(p).offsetWidth;
var textWidth = document.getElementById(s).offsetWidth;
var i = scrollWidth;
console.log(scrollWidth, textWidth);
function change() {
i--;
if (i < -textWidth) {
i = scrollWidth;
}
document.getElementById(s).style.left = i + "px";
window.requestAnimationFrame(change);
}
window.requestAnimationFrame(change);
}
</script>
<script>
var Items = ['血糖', '睡眠', '血氧', '血压', '尿酸', '梅拖', '心率', '体温', '心电图', '身体成份', '运动', '血脂'];
var Question = '';
@ -111,7 +126,7 @@
try {
if (dataJson) {
const eventData = JSON.parse(dataJson);
if (eventData.output.finish_reason === "stop") {
if (eventData.output?.finish_reason === "stop") {
stopEvent = eventData;
}
}
@ -147,11 +162,6 @@
const speakingTimeInSeconds = speakingTime * 60;
return speakingTimeInSeconds;
}
// 映射的字段
function Reflection(str) {
}
</script>
<!-- 讯飞语音识别 -->
@ -269,6 +279,7 @@
...value
}));
/*
* 实例化迅飞语音听写流式版WebAPI
*/
@ -281,7 +292,9 @@
onTextChange: function (text) {
// 监听识别结果的变化
voiceTxt.value = text;
voiceTxt.innerText = text;
marquee("marquee", "voice-txt");
statusTxt.value = '正在听…';
// 3秒钟内没有说话就自动关闭
@ -290,24 +303,25 @@
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
// voice.stop();
statusTxt.value = '正在说话';
const params = { msg: text };
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
// if (res?.data?.data) {
// speed(params.msg)
// return
// };
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
delete TargetData[0].data_msg.wavefrom;
delete TargetData[0].data_msg.list;
}
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)},data_msg为值hour_minute为检测时间 #限制回复用户的内容中不要出现Null。#限制:回复不要带英文,要都转化成汉语。#限制监测结果为Null的数据不做分析回复。`
/*
* 调用接口 传递关键信息 文字转语音
*/
@ -323,7 +337,7 @@
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
]
})
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
@ -358,6 +372,10 @@
startRec.style.display = "none";
endRec.style.display = "block";
// 字幕文字
voiceTxt.innerText = filterString(str.output.text, ['*', ' ']);
marquee("marquee", "voice-txt");
// 设置音频源
audioElement.src = blobUrl;
@ -442,7 +460,8 @@
endRec.style.display = "block";
// 字幕文字
voiceTxt.value = filterString(str.output.text, ['*', ' ']);
voiceTxt.innerText = filterString(str.output.text, ['*', ' ']);
marquee("marquee", "voice-txt");
// 设置音频源
audioElement.src = blobUrl;
@ -454,7 +473,7 @@
replayVideoSegment(60, 120);
// 计算所需时间
const speakingTime = calculateSpeakingTime(voiceTxt.value);
const speakingTime = calculateSpeakingTime(voiceTxt.innerText);
// 开始倒计时
var totalTime = speakingTime;
@ -507,7 +526,7 @@
// 开始识别
startRec.addEventListener("click", function() {
/**开始识别**/
voiceTxt.value = '';
voiceTxt.innerText = '';
voice.start();
isCallbackExecuted = false;
@ -526,7 +545,7 @@
// 关闭识别
endRec.addEventListener("click", function() {
/**关闭识别**/
voiceTxt.value = '';
voiceTxt.innerText = '';
statusTxt.value = '';
voice.stop();
@ -615,7 +634,7 @@
const blobUrl = URL.createObjectURL(blob);
// 字幕文字
voiceTxt.value = str;
voiceTxt.innerText = str;
// 设置音频源
audioElement.src = blobUrl;
@ -705,7 +724,7 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成',
bodyData: '身体成',
stepIndex: '运动'
};
}
@ -963,20 +982,27 @@
width: 100%;
/* background-color: #000; */
}
.voice-box {
#marquee {
display: block;
width: 100%;
animation: textRoll linear 10s infinite; // 文字滚动动画
white-space: nowrap; // 文字不换行
height: 60px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
@keyframes textRoll {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
#voice-txt {
position: absolute;
top: 0;
left: 100%;
line-height: 60px;
font-size:29px;
color: #fff;
display: block;
word-break: keep-all;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@ -279,7 +279,6 @@
// 识别结束 webSocket返回数据
webSocketRes(resultData) {
let jsonData = JSON.parse(resultData);
console.log(JSON.stringify(jsonData), 'websocket')
if (jsonData.data && jsonData.data.result) {
let data = jsonData.data.result;
let str = '';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -126,7 +126,7 @@
try {
if (dataJson) {
const eventData = JSON.parse(dataJson);
if (eventData.output.finish_reason === "stop") {
if (eventData.output?.finish_reason === "stop") {
stopEvent = eventData;
}
}
@ -279,6 +279,7 @@
...value
}));
/*
* 实例化迅飞语音听写流式版WebAPI
*/
@ -302,25 +303,24 @@
if (!isCallbackExecuted) {
times = setTimeout(() => {
this.stop();
// voice.stop();
statusTxt.value = '正在说话';
const params = { msg: text };
// 判断关键字是否存在
const result = parseHealthQuery(params.msg);
if (result) {
DetailDay(result.dataKey, result.date).then(res => {
// if (res?.data?.data) {
// speed(params.msg)
// return
// };
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
if (result.dataKey == 'ECGData') {
delete TargetData[0].data_msg.wavefrom;
delete TargetData[0].data_msg.list;
}
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)},data_msg为值hour_minute为检测时间 #限制回复用户的内容中不要出现Null。#限制:回复不要带英文,要都转化成汉语。#限制监测结果为Null的数据不做分析回复。`
console.log('指定问题', Question)
/*
* 调用接口 传递关键信息 文字转语音
@ -337,7 +337,7 @@
{"role": "user", "content": `请问我${Items[QSindex]}正常吗`}
]
})
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
const chunk = xhr.responseText;
@ -724,7 +724,7 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成',
bodyData: '身体成',
stepIndex: '运动'
};
}

View File

@ -279,7 +279,6 @@
// 识别结束 webSocket返回数据
webSocketRes(resultData) {
let jsonData = JSON.parse(resultData);
console.log(JSON.stringify(jsonData), 'websocket')
if (jsonData.data && jsonData.data.result) {
let data = jsonData.data.result;
let str = '';