Closed HuanLinOTO closed 11 months ago
Sandbox 的输入框用的是 @koishijs/client 的 ChatInput https://github.com/koishijs/webui/blob/main/packages/components/client/chat/input.vue#L39 当你发送消息的时候会发送 escape 过的 value
https://github.com/satorijs/satori/blob/master/packages/element/src/index.ts#L119 然后 escape 把 & 换成 &
https://github.com/koishijs/webui/blob/main/plugins/sandbox/client/layout.vue#L149
然后发送消息,直接发送给后端
https://github.com/koishijs/webui/blob/main/plugins/sandbox/src/index.ts#L93 这边也没有 unescape, 然后就这么收到了未 unescape 过的消息
还有一点是,↑ ↓ 键切换上下文中也有这个问题
https://github.com/koishijs/webui/blob/main/plugins/sandbox/src/index.ts#L100
续之前,后端收到消息 (未 unescape) 之后会发送一个 sandbox/message 给前端
https://github.com/koishijs/webui/blob/main/plugins/sandbox/client/utils.ts#L40
前端接收到消息之后就会把存储消息 (未 unescape) 到 @koishijs/client 的存储 (useLocalStorage of @vueuse/core)
https://github.com/koishijs/webui/blob/main/plugins/sandbox/client/layout.vue#L111
当你使用上下切换之前的消息 (也是未 unescape) 时,读取存储的消息 (未 unescape),于是你就会看到:
你输入的 & (还有其他被 escape 的字符) 全变成 & 了
由于 & 中也有 &
你可以继续 发送(Enter),上一个(UpArrow),无限循环,这个消息长度就会一直增加 (
整个过程只有 escape, 没有 unescape, 最终导致了悲剧的发生 (bushi
pr 了 #197
emmm 是不是有点久
好了速通了 【速通 Koishi!-哔哩哔哩】 https://b23.tv/v9c6AYL View now
6,终于修了
这个问题可以被拆分为两个问题:
后一个问题将会在 koishi 仓库中修复。
标题不太顺,但是看图就懂了参数标注为text,报错来自别的地方