fix: 澄清卡片已回答用 label 显示,后端 payload 仍用 value

This commit is contained in:
2026-07-20 21:25:09 +08:00
parent 412d3f3a9a
commit 41c2112c5b
+6 -3
View File
@@ -1747,16 +1747,19 @@ const submitClarification = (answer) => {
if (answeringClarification.value) return
// 找最后一张未提交的卡片消息(mp-weixin 模板不支持内联箭头函数传 msg,改为自己查找)
const card = [...resultMessages.value].reverse().find(m => m.kind === 'card' && !m.submitted)
// 通过 value 查找选项的 label,用于前端显示;后端 payload 仍用 value(语义化)
const option = card?.card?.options?.find(opt => opt.value === answer)
const label = option?.label || answer
if (card) {
card.submitted = true
card.answer = answer
card.answer = label // 显示用 label(中文)
}
addResultMessage({ role: 'user', kind: 'text', content: answer })
addResultMessage({ role: 'user', kind: 'text', content: label })
answeringClarification.value = true
currentStreamTask.value = followupStream({
sessionId: novelSessionId.value,
action: 'answer_clarification',
payload: { answer },
payload: { answer }, // 后端仍收 value
onEvent: handleShortNovelEvent,
onError: (errMsg) => markGenerationFailed(errMsg)
})