refactor: 参照 SqlChat 优化 AI 阅卷提示词结构

This commit is contained in:
2026-07-16 06:03:18 +08:00
parent d346b5fc56
commit a96f01007d
+22 -20
View File
@@ -268,33 +268,35 @@ async function callAiApi(imageBase64: string, rubric: string, config: { apiKey:
deductions: string[]
comment: string
}> {
const systemRole = `你是一名经验丰富的高校教师。你必须严格依据评分标准逐项评分。
【输出要求】
1. 仅输出纯JSON,不要包含任何markdown代码块、\`\`\`标记、或额外文字
2. 不得在JSON前后添加任何说明、注释或分隔符
3. 字符串必须使用双引号,不得使用单引号
4. 不得有多余的逗号
【输出格式】
{
"score": 分数,
"confidence": 置信度(0-1),
"deductions": ["扣分项1", "扣分项2"],
"comment": "总评语及逐项得分说明"
}`
const systemRole = `你是高校阅卷专家,严格按照评分标准逐项评分。`
const prompt = `${extras?.questionTitle ? `【题目】\n${extras.questionTitle}\n` : ''}【评分标准】
${rubric}
${rubric || '无'}
【参考答案】
${extras?.referenceAnswer || '无'}
分】
分】
${extras?.maxScore ?? 100}
【学生答案】
请看图片中的内容。`
请看图片中的内容。
---
【评分规则】
1. 根据评分标准中的各项指标逐项评分,每项给出得分和说明
2. 各评分项得分之和不得超过满分${extras?.maxScore ?? 100}
3. 如果学生答案为空、空白或明显与题目无关,直接给0分
4. 部分正确时按评分标准酌情给分
请严格按照以下JSON格式返回结果,不要包含任何markdown标记或其他文字:
{
"score": <总分>,
"confidence": <置信度0~1>,
"deductions": ["扣分项说明1", "扣分项说明2"],
"comment": "总评语及逐项得分说明"
}`
const axios = require('axios')
const response = await axios.post(`${config.baseUrl}/chat/completions`, {
@@ -312,8 +314,8 @@ ${extras?.maxScore ?? 100}
]
}
],
max_tokens: 2048,
temperature: 0.1
max_tokens: 4096,
temperature: 0.3
}, {
headers: {
'Content-Type': 'application/json',