fix(stage-ui): proxy object could not be cloned (#193)

* Fix for proxy could not be cloned error

After several debugging, it was found that streamText initialisation called the structuredClone() function on messages. The problem is that messages is an object containing vue3 proxies, that can not be cloned. My proposed fix is to remove those proxies before passing messages to streamText

* Revert "Fix for proxy could not be cloned error"

This reverts commit 1575d305d5e5df3294991dbf7c8c25abfbfc783e.

* Fix for proxy clone error

rest.tool_results is also a proxy that was not removed properly
This commit is contained in:
Kévin Taccoen
2025-06-04 14:10:42 +08:00
committed by GitHub
parent 2dbeccc62c
commit c29392c6f6
+1
View File
@@ -136,6 +136,7 @@ export const useChatStore = defineStore('chat', () => {
const newMessages = messages.value.slice(0, messages.value.length - 1).map((msg) => {
if (msg.role === 'assistant') {
const { slices: _, ...rest } = msg // exclude slices
rest.tool_results = toRaw(rest.tool_results)
return toRaw(rest)
}
return toRaw(msg)