Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(chat): lazy-load noVNC only when opening sandbox desktop (#4034)
JYao-Chend2d8e34aa793
diff --git a/frontend/e2e/README.md b/frontend/e2e/README.mdnew file mode 100644index 000000000..1b13e0308--- /dev/null+++ b/frontend/e2e/README.md@@ -0,0 +1,3 @@+# noVNC regression++Apply shared infrastructure PR #4141, then run `npm run test:e2e -- e2e/novnc.spec.ts`. The regression emulates a never-resolving VideoDecoder capability probe: upstream's static noVNC import blocks chat startup, while the lazy import leaves chat available. The browser harness and CI proposal are reviewed separately in #4141.diff --git a/frontend/e2e/novnc.md b/frontend/e2e/novnc.mdnew file mode 100644index 000000000..020ef3b4d--- /dev/null+++ b/frontend/e2e/novnc.md@@ -0,0 +1,14 @@+# Local browser regressions++Use Node 22+, then `npm ci` and `npx playwright install chromium`.+Run `npm run test:e2e`. No backend, account, credentials or paid model calls are used;+API responses are isolated fixtures. CI setup is intentionally unchanged.++The noVNC regression replaces `VideoDecoder.isConfigSupported` with a promise that+never settles, then checks first-send navigation, reply rendering and direct reload.+To reproduce the pre-fix failure, restore the static RFB import in+`src/composables/useSandboxDesktop.ts` and remove the dynamic import in `openDesktop`.+On upstream main a729d1fc the navigation assertion times out after 15 seconds;+with the lazy import the same test passes without invoking the decoder probe.++`PLAYWRIGHT_CHROMIUM_EXECUTABLE` can select an already installed Chromium binary.diff --git a/frontend/e2e/novnc.spec.ts b/frontend/e2e/novnc.spec.tsnew file mode 100644index 000000000..79b50c136--- /dev/null+++ b/frontend/e2e/novnc.spec.ts@@ -0,0 +1,38 @@+import { test, expect } from '@playwright/test'+import { mockApp } from './fixtures'++test('@desktop chat sends and survives reload when the remote desktop decoder probe never resolves', async ({ page }) => {+ await page.setViewportSize({ width: 1440, height: 844 })+ await mockApp(page)+ await page.route('**/api/v1/agents**', route => route.fulfill({ json: { success: true, data: [{ id: 'builtin-quick-answer', name: '快速问答', is_builtin: true, config: { agent_mode: 'quick-answer', model_id: 'chat-model', kb_selection_mode: 'none' } }] } }))+ let creations = 0+ await page.route('**/api/v1/sessions', route => { creations++; return route.fulfill({ json: { success: true, data: { id: 'delayed-session' } } }) })+ await page.route('**/api/v1/sessions/delayed-session', route => route.fulfill({ json: { success: true, data: { id: 'delayed-session', title: '导航恢复', tenant_id: 1 } } }))+ await page.route('**/api/v1/*-chat/delayed-session', route => route.fulfill({ contentType: 'text/event-stream', body: 'data: '+JSON.stringify({ response_type: 'answer', content: '恢复后的回答', id: 'delayed-answer', done: true })+'\n\ndata: '+JSON.stringify({ response_type: 'complete', id: 'delayed-answer', done: true })+'\n\n' }))+ await page.route('**/api/v1/messages/delayed-session/load?*', route => route.fulfill({ json: { success: true, data: [+ { id: 'question', role: 'user', content: '已发送的问题应该显示在对话区。', is_completed: true, created_at: '2026-01-01T00:00:00Z' },+ { id: 'answer', role: 'assistant', content: '恢复后的回答', is_completed: true, created_at: '2026-01-01T00:00:01Z' },+ ] } }))+ await page.addInitScript(() => {+ ;(window as any).__decoderChecks = 0+ ;(window as any).VideoDecoder = class {+ static isConfigSupported() {+ ;(window as any).__decoderChecks+++ return new Promise(() => {})+ }+ }+ })+ await page.goto('/platform/creatChat')+ const input = page.locator('[data-guide="chat-input"] textarea')+ await input.fill('已发送的问题应该显示在对话区。')+ await page.locator('[data-guide="chat-send"]').click()+ await expect(page).toHaveURL(/chat\/delayed-session/)+ await expect(page.locator('.msg_list')).toContainText('已发送的问题应该显示在对话区。')+ await expect(page.locator('.bot_msg')).toContainText('恢复后的回答')+ expect(creations).toBe(1)+ expect(await page.evaluate(() => (window as any).__decoderChecks)).toBe(0)+ await page.reload()+ await expect(page).toHaveURL(/chat\/delayed-session/)+ await expect(page.locator('[data-guide="chat-input"] textarea')).toBeVisible()+ expect(await page.evaluate(() => (window as any).__decoderChecks)).toBe(0)+})diff --git a/frontend/src/composables/useSandboxDesktop.ts b/frontend/src/composables/useSandboxDesktop.tsindex ddcfbccea..de840badf 100644--- a/frontend/src/composables/useSandboxDesktop.ts+++ b/frontend/src/composables/useSandboxDesktop.ts@@ -1,5 +1,5 @@import { onUnmounted, ref, type Ref } from 'vue'-import RFB from '@novnc/novnc'+import type RFB from '@novnc/novnc'import { post } from '@/utils/request'export type SandboxDesktopStatus =@@ -259,6 +259,10 @@ export function useSandboxDesktop(status.value = 'starting'let socket: WebSocket | undefinedtry {+ // noVNC probes WebCodecs with top-level await. Load it only for an+ // explicit desktop connection so a stalled decoder cannot block chat.+ const { default: RFB } = await import('@novnc/novnc')+ if (disposed || !wanted || !target) returnconst ticket = await mintDesktopTicket(sid)if (disposed || !wanted || !target) return