This commit is contained in:
@@ -1182,9 +1182,12 @@ const renderMarkdown = (content: string): string => {
|
|||||||
*/
|
*/
|
||||||
const formatCorrectAnswer = (question: any) => {
|
const formatCorrectAnswer = (question: any) => {
|
||||||
if (question.type === 'single' || question.type === 'multiple') {
|
if (question.type === 'single' || question.type === 'multiple') {
|
||||||
// 如果有correctAnswer字段(来自Dify的原始correct),直接使用
|
// 如果有correctAnswer字段(来自Dify的原始correct)
|
||||||
if (question.correctAnswer) {
|
if (question.correctAnswer) {
|
||||||
return question.correctAnswer
|
// 多选题格式优化:将 "A:xxx,B:xxx" 改为换行显示
|
||||||
|
// 匹配 ",A:" 或 ",B:" 等格式,在逗号后的选项字母前换行
|
||||||
|
const formatted = question.correctAnswer.replace(/,([A-Za-z][::])/g, '\n$1')
|
||||||
|
return formatted
|
||||||
}
|
}
|
||||||
// 否则从options中提取
|
// 否则从options中提取
|
||||||
return question.options
|
return question.options
|
||||||
|
|||||||
Reference in New Issue
Block a user