fix: 修复 mp-weixin 模板箭头函数和 TextDecoder 不兼容

- 微信小程序 wxml 模板不支持内联箭头函数
  @submit 改为方法引用,submitClarification 自己找未提交卡片
- TextDecoder 在 mp-weixin 不可用
  decodeChunk 改用纯 JS UTF-8 解码实现
This commit is contained in:
2026-07-19 19:02:52 +08:00
parent 7a0e729ab4
commit b194b343ad
2 changed files with 34 additions and 7 deletions
+7 -5
View File
@@ -126,7 +126,7 @@
<ClarificationCard
v-if="!msg.submitted && msg.card"
:card="msg.card"
@submit="(answer) => submitClarification(msg, answer)"
@submit="submitClarification"
/>
<view v-else class="card-answered">
<text>已回答{{ msg.answer }}</text>
@@ -1674,11 +1674,13 @@ const handleShortNovelEvent = (event) => {
}
}
const submitClarification = (msg, answer) => {
const submitClarification = (answer) => {
if (answeringClarification.value) return
if (msg) {
msg.submitted = true
msg.answer = answer
// 找最后一张未提交的卡片消息(mp-weixin 模板不支持内联箭头函数传 msg,改为自己查找)
const card = [...resultMessages.value].reverse().find(m => m.kind === 'card' && !m.submitted)
if (card) {
card.submitted = true
card.answer = answer
}
addResultMessage({ role: 'user', kind: 'text', content: answer })
answeringClarification.value = true