fix: 代码优化

This commit is contained in:
white 2024-10-14 13:28:52 +08:00
parent 9a37c1cd99
commit 7ad93af5d4
1 changed files with 0 additions and 26 deletions

View File

@ -136,31 +136,6 @@
// 如果没有找到 finish_reason 为 "stop" 的事件,则返回 null 或其他默认值
return stopEvent;
}
// 筛选关键词
function containsKeywordRegex(text) {
var index = Items.findIndex(item => text.includes(item));
if (index !== -1) {
return index
} else {
return 99999
}
}
// 语音所需时间
function calculateSpeakingTime(text) {
// 假设平均每分钟说230个单词
const wordsPerMinute = 230;
// 计算文字的长度
const wordCount = text.trim().length;
// 计算所需时间(以分钟为单位)
const speakingTime = wordCount / wordsPerMinute;
// 转换为秒数
const speakingTimeInSeconds = speakingTime * 60;
console.log(speakingTimeInSeconds, '说完需要多少秒')
return speakingTimeInSeconds;
}
</script>
@ -300,7 +275,6 @@
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 => {