From f6434bc4f9c1633ad57b3e796e3bc9fbcfa03914 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Sun, 1 Mar 2026 11:30:30 +0300 Subject: [PATCH] Fix chat reactivity (markRaw), add Playwright tests with mock transport Use markRaw to prevent Vue from deep-proxying the Chat class instance, which broke its internal Vue refs. Add dedent for multiline prompts. Tests use mock transport by default. Set TEST_REAL_LLM=1 and OPENROUTER_API_KEY to run against real OpenRouter. --- bun.lock | 3 + package.json | 1 + src/components/ChatPanel.vue | 23 ++--- src/components/PropertiesPanel.vue | 7 +- src/components/chat/ChatMessage.vue | 8 +- src/composables/use-chat.ts | 60 ++++++----- src/global.d.ts | 2 + tests/e2e/chat-panel.spec.ts | 153 ++++++++++++++++++++++++++++ 8 files changed, 215 insertions(+), 42 deletions(-) create mode 100644 tests/e2e/chat-panel.spec.ts diff --git a/bun.lock b/bun.lock index b3f2e7a49..d2a6f0e94 100644 --- a/bun.lock +++ b/bun.lock @@ -20,6 +20,7 @@ "ai": "^6.0.105", "canvaskit-wasm": "^0.40.0", "culori": "^4.0.2", + "dedent": "^1.7.1", "fflate": "^0.8.2", "fzstd": "^0.1.1", "reka-ui": "^2.8.2", @@ -492,6 +493,8 @@ "decode-named-character-reference": ["decode-named-character-reference@1.3.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q=="], + "dedent": ["dedent@1.7.1", "", { "peerDependencies": { "babel-plugin-macros": "^3.1.0" }, "optionalPeers": ["babel-plugin-macros"] }, "sha512-9JmrhGZpOlEgOLdQgSm0zxFaYoQon408V1v49aqTWuXENVlnCuY9JBZcXZiCsZQWDjTm5Qf/nIvAy77mXDAjEg=="], + "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], diff --git a/package.json b/package.json index 5536afaae..a9564931d 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "ai": "^6.0.105", "canvaskit-wasm": "^0.40.0", "culori": "^4.0.2", + "dedent": "^1.7.1", "fflate": "^0.8.2", "fzstd": "^0.1.1", "reka-ui": "^2.8.2", diff --git a/src/components/ChatPanel.vue b/src/components/ChatPanel.vue index 8e8a82035..f5ca1f7a4 100644 --- a/src/components/ChatPanel.vue +++ b/src/components/ChatPanel.vue @@ -1,30 +1,23 @@