diff --git a/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_cn.cpython-310.pyc b/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_cn.cpython-310.pyc index 139cee2f..113800e3 100644 Binary files a/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_cn.cpython-310.pyc and b/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_cn.cpython-310.pyc differ diff --git a/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_en.cpython-310.pyc b/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_en.cpython-310.pyc new file mode 100644 index 00000000..9925e0d6 Binary files /dev/null and b/dsLightRag/KeDaXunFei/__pycache__/XunFeiAudioEvaluator_en.cpython-310.pyc differ diff --git a/dsLightRag/Routes/XunFeiRoute_cn.py b/dsLightRag/Routes/XunFeiRoute_cn.py index 67173c27..18a2be81 100644 --- a/dsLightRag/Routes/XunFeiRoute_cn.py +++ b/dsLightRag/Routes/XunFeiRoute_cn.py @@ -66,12 +66,21 @@ async def save_audio(audio: UploadFile = File(...), txt: str = Form(...)): appid=XF_APPID, api_key=XF_APIKEY, api_secret=XF_APISECRET, - audio_file=mp3_file_path, # 使用新的MP3路径 - txt=txt + audio_file=mp3_file_path, # 使用MP3文件路径 + txt=txt.strip() # 确保文本预处理,避免None ) + + # 运行评测并获取结果(已整合重构后的解析逻辑) results, eval_time = evaluator.run_evaluation() - print(evaluator.get_evaluation_summary()) - + + # 验证解析结果完整性 + if not results or 'total_score' not in results: + # 尝试从本地XML文件重新解析(容错机制) + xml_log_path = os.path.join(UPLOAD_DIR, f"{os.path.splitext(mp3_file_name)[0]}.xml") + if os.path.exists(xml_log_path): + with open(xml_log_path, 'r', encoding='utf-8') as f: + evaluator.parse_evaluation_results(f.read()) + results = evaluator.evaluation_results return { "success": True, diff --git a/dsLightRag/Routes/__pycache__/XunFeiRoute_cn.cpython-310.pyc b/dsLightRag/Routes/__pycache__/XunFeiRoute_cn.cpython-310.pyc index 879864fb..9fd433f0 100644 Binary files a/dsLightRag/Routes/__pycache__/XunFeiRoute_cn.cpython-310.pyc and b/dsLightRag/Routes/__pycache__/XunFeiRoute_cn.cpython-310.pyc differ diff --git a/dsLightRag/Routes/__pycache__/XunFeiRoute_en.cpython-310.pyc b/dsLightRag/Routes/__pycache__/XunFeiRoute_en.cpython-310.pyc index 23c8d20b..c4f6978a 100644 Binary files a/dsLightRag/Routes/__pycache__/XunFeiRoute_en.cpython-310.pyc and b/dsLightRag/Routes/__pycache__/XunFeiRoute_en.cpython-310.pyc differ diff --git a/dsLightRag/static/XunFei/audio_evaluation_cn.html b/dsLightRag/static/XunFei/audio_evaluation_cn.html index 423c4d77..ab37799e 100644 --- a/dsLightRag/static/XunFei/audio_evaluation_cn.html +++ b/dsLightRag/static/XunFei/audio_evaluation_cn.html @@ -116,10 +116,6 @@ -- 总分 -
- -- - 准确度 -
-- 流利度 @@ -128,10 +124,15 @@ -- 完整度
- -
-

字词评分

-
等待评测结果...
+ +
+ -- + 语调 +
+
+ -- + 发音 +
@@ -174,11 +175,15 @@ this.progressText = document.getElementById('progressText'); this.evaluationContainer = document.getElementById('evaluationContainer'); this.totalScore = document.getElementById('totalScore'); - this.accuracyScore = document.getElementById('accuracyScore'); + // 移除已删除的准确度评分元素引用 this.fluencyScore = document.getElementById('fluencyScore'); this.completenessScore = document.getElementById('completenessScore'); - this.wordsList = document.getElementById('wordsList'); - this.wordsContent = document.getElementById('wordsContent'); + this.toneScore = document.getElementById('toneScore'); + this.phoneScore = document.getElementById('phoneScore'); + // 移除已删除的情感评分元素引用 + //this.emotionScore = document.getElementById('emotionScore'); + //this.wordsList = document.getElementById('wordsList'); + //this.wordsContent = document.getElementById('wordsContent'); } setupCanvas() { @@ -395,34 +400,37 @@ } displayEvaluationResults(evaluation) { - if (!evaluation) return; + if (!evaluation) return; - // 显示评分卡片 - this.totalScore.textContent = evaluation.total_score ? evaluation.total_score.toFixed(1) : '--'; - this.accuracyScore.textContent = evaluation.accuracy_score ? evaluation.accuracy_score.toFixed(1) : '--'; - this.fluencyScore.textContent = evaluation.fluency_score ? evaluation.fluency_score.toFixed(1) : '--'; - this.completenessScore.textContent = evaluation.completeness_score ? evaluation.completeness_score.toFixed(1) : '--'; - - this.evaluationContainer.classList.add('show'); - - // 显示字词评分 - if (evaluation.words && evaluation.words.length > 0) { - let wordsHTML = ''; - evaluation.words.forEach((word, index) => { - const score = word.total_score ? word.total_score.toFixed(1) : '0.0'; - const color = score >= 80 ? '#10b981' : score >= 60 ? '#f59e0b' : '#ef4444'; - wordsHTML += ` -
- ${word.content || `字词${index + 1}`} - ${score} -
- `; - }); - this.wordsContent.innerHTML = wordsHTML; - } else { - this.wordsContent.innerHTML = '

无字词评分数据

'; - } - } + this.totalScore.textContent = evaluation.total_score ? evaluation.total_score.toFixed(1) : '--'; + // 移除已删除的准确度评分设置 + this.fluencyScore.textContent = evaluation.fluency_score ? evaluation.fluency_score.toFixed(1) : '--'; + this.completenessScore.textContent = evaluation.integrity_score ? evaluation.integrity_score.toFixed(1) : '--'; + this.toneScore.textContent = evaluation.tone_score ? evaluation.tone_score.toFixed(1) : '--'; + this.phoneScore.textContent = evaluation.phone_score ? evaluation.phone_score.toFixed(1) : '--'; + // 移除已删除的情感评分设置 + + this.evaluationContainer.classList.add('show'); + + // // 移除已删除的句子评分相关代码 + // const sentencesContent = document.getElementById('sentencesContent'); + // if (evaluation.sentences && evaluation.sentences.length > 0) { + // let sentencesHTML = ''; + // evaluation.sentences.forEach((sentence, index) => { + // const score = sentence.total_score ? sentence.total_score.toFixed(1) : '--'; + // const color = score >= 90 ? '#5eead4' : score >= 80 ? '#a7f3d0' : '#fef3c7'; + // sentencesHTML += ` + //
+ // ${index + 1}. ${sentence.content} + // ${score} + //
+ // `; + // }); + // sentencesContent.innerHTML = sentencesHTML; + // } else { + // sentencesContent.innerHTML = '

无句子评分数据

'; + // } + } simulateUploadProgress() { let progress = 0; diff --git a/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.mp3 b/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.mp3 new file mode 100644 index 00000000..6319c6ac Binary files /dev/null and b/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.mp3 differ diff --git a/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.wav b/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.wav new file mode 100644 index 00000000..1ed979f0 Binary files /dev/null and b/dsLightRag/static/audio/audio_272b406f66904ac4b660725d561b8a69.wav differ diff --git a/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.mp3 b/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.mp3 new file mode 100644 index 00000000..fd7a4081 Binary files /dev/null and b/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.mp3 differ diff --git a/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.wav b/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.wav new file mode 100644 index 00000000..46b1f15e Binary files /dev/null and b/dsLightRag/static/audio/audio_3052c3a7bf334ea281d8d5dea35104ed.wav differ diff --git a/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.mp3 b/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.mp3 new file mode 100644 index 00000000..7def6784 Binary files /dev/null and b/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.mp3 differ diff --git a/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.wav b/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.wav new file mode 100644 index 00000000..e8a78525 Binary files /dev/null and b/dsLightRag/static/audio/audio_3c42609622834d8a859c38175777fa56.wav differ diff --git a/dsLightRag/static/audio/audio_4c77a6269ebb4cd9bc13c2cb5cc091fe.wav b/dsLightRag/static/audio/audio_4c77a6269ebb4cd9bc13c2cb5cc091fe.wav new file mode 100644 index 00000000..4b888caa Binary files /dev/null and b/dsLightRag/static/audio/audio_4c77a6269ebb4cd9bc13c2cb5cc091fe.wav differ diff --git a/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.mp3 b/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.mp3 new file mode 100644 index 00000000..b5ed32be Binary files /dev/null and b/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.mp3 differ diff --git a/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.wav b/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.wav new file mode 100644 index 00000000..abe667e8 Binary files /dev/null and b/dsLightRag/static/audio/audio_6b8f19eaa999414e9a8403d1c1d9f638.wav differ diff --git a/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.mp3 b/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.mp3 new file mode 100644 index 00000000..98c2461d Binary files /dev/null and b/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.mp3 differ diff --git a/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.wav b/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.wav new file mode 100644 index 00000000..03afd4ed Binary files /dev/null and b/dsLightRag/static/audio/audio_d4b6e4eed9754c94aa676c63d8a8ece5.wav differ diff --git a/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.mp3 b/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.mp3 new file mode 100644 index 00000000..a8b8ae8d Binary files /dev/null and b/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.mp3 differ diff --git a/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.wav b/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.wav new file mode 100644 index 00000000..676eb8e2 Binary files /dev/null and b/dsLightRag/static/audio/audio_d904295ef4d9465098fea15aa00b7d01.wav differ diff --git a/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.mp3 b/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.mp3 new file mode 100644 index 00000000..23ec1252 Binary files /dev/null and b/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.mp3 differ diff --git a/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.wav b/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.wav new file mode 100644 index 00000000..5cefc6aa Binary files /dev/null and b/dsLightRag/static/audio/audio_d94381fe15164da79b6bf86ecf034671.wav differ diff --git a/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.mp3 b/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.mp3 new file mode 100644 index 00000000..8d34033c Binary files /dev/null and b/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.mp3 differ diff --git a/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.wav b/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.wav new file mode 100644 index 00000000..3dcc4dad Binary files /dev/null and b/dsLightRag/static/audio/audio_fe24faebc4f04619ac0c78e0b47d6645.wav differ