sync: 同步服务器最新代码 (2026-01-27)
Some checks failed
continuous-integration/drone/push Build is failing

更新内容:
- 后端 AI 服务优化(能力分析、知识点解析等)
- 前端考试和陪练界面更新
- 修复多个 prompt 和 JSON 解析问题
- 更新 Coze 语音客户端
This commit is contained in:
111
2026-01-27 10:03:28 +08:00
parent fcef140d1a
commit 442ac78b56
28 changed files with 324 additions and 121 deletions

View File

@@ -341,8 +341,28 @@ const transformDifyQuestions = (difyQuestions: any[]): any[] => {
const options = q.topic?.options || {}
// 解析正确答案:支持 "A"、"A,B"、"A、B"、"Axxx" 等多种格式
const correctAnswerStr = String(q.correct || '')
// 提取正确答案中的选项字母A、B、C、D等
const correctLetters = correctAnswerStr.match(/[A-Da-d]/g)?.map(l => l.toUpperCase()) || []
// 更精确地提取正确答案字母(避免误提取选项内容中的字母)
let correctLetters: string[] = []
// 情况1纯选项字母格式如 "A", "B", "A,B", "A、B", "A,B,C"
const pureLetterMatch = correctAnswerStr.trim().match(/^[A-Da-d]([,、\s]+[A-Da-d])*$/)
if (pureLetterMatch) {
correctLetters = correctAnswerStr.match(/[A-Da-d]/g)?.map(l => l.toUpperCase()) || []
} else {
// 情况2选项字母+内容格式(如 "Axxx" 或 "A: xxx"
// 只提取开头的选项字母(可能有多个,如 "A,Cxxx"
const prefixMatch = correctAnswerStr.match(/^([A-Da-d](?:[,、\s]*[A-Da-d])*)[:\s]/)
if (prefixMatch) {
correctLetters = prefixMatch[1].match(/[A-Da-d]/g)?.map(l => l.toUpperCase()) || []
} else {
// 情况3只有开头字母如 "A" 后面直接跟内容)
const firstLetterMatch = correctAnswerStr.match(/^([A-Da-d])/)
if (firstLetterMatch) {
correctLetters = [firstLetterMatch[1].toUpperCase()]
}
}
}
console.log(`🔍 解析题目[${index + 1}] - correct: "${q.correct}", correctLetters: [${correctLetters.join(', ')}]`)
@@ -481,10 +501,11 @@ const loadQuestions = async () => {
// 第一轮考试不传mistake_records参数
// 第二、三轮考试传入上一轮的错题记录
if (currentRound.value > 1) {
// 用同一个exam_id获取错题
console.log(`📋 获取第${currentRound.value - 1}轮错题记录 - exam_id: ${currentExamId.value}`)
// 用同一个exam_id获取上一轮的错题传入round参数只获取上一轮的错题
const previousRound = currentRound.value - 1
console.log(`📋 获取第${previousRound}轮错题记录 - exam_id: ${currentExamId.value}, round: ${previousRound}`)
const mistakesRes: any = await getMistakes(currentExamId.value)
const mistakesRes: any = await getMistakes(currentExamId.value, previousRound)
console.log('getMistakes原始响应:', mistakesRes)
console.log('getMistakes响应结构:', {
@@ -785,6 +806,7 @@ const recordWrongAnswer = async () => {
try {
await recordMistake({
exam_id: currentExamId.value,
round: currentRound.value, // 记录当前轮次
question_id: null, // AI生成的题目没有question_id
knowledge_point_id: q.knowledge_point_id || null,
question_content: q.title,