diff --git a/calliope-web/src/routes/agents/+page.svelte b/calliope-web/src/routes/agents/+page.svelte index 3ae0460d..048fae57 100644 --- a/calliope-web/src/routes/agents/+page.svelte +++ b/calliope-web/src/routes/agents/+page.svelte @@ -187,6 +187,7 @@ async function newSession() { if (sendPending || uploadPending || projectPending) return; + sendPending = true; try { const s = await agentApi.createSession({ agent_key: activeKey, @@ -201,6 +202,8 @@ resetStreaming(); } catch (err) { toast.error(err instanceof Error ? err.message : String(err)); + } finally { + sendPending = false; } } @@ -1782,7 +1785,7 @@ id="agent-result-editor" aria-label="编辑智能体创作内容" bind:value={resultText} - disabled={resultBusy} + readonly={resultBusy} >
{resultKey === 'script' diff --git a/e2e/reference/README.md b/e2e/reference/README.md index a651bdfb..3344a6ec 100644 --- a/e2e/reference/README.md +++ b/e2e/reference/README.md @@ -17,13 +17,14 @@ npm --prefix calliope-web run dev python3 e2e/seed.py python3 e2e/reference/seed.py PLAYWRIGHT_MODULE_PATH=/path/to/playwright-core CHROMIUM_EXECUTABLE_PATH=/path/to/chromium node e2e/reference/check.cjs +PLAYWRIGHT_MODULE_PATH=/path/to/playwright-core CHROMIUM_EXECUTABLE_PATH=/path/to/chromium node e2e/reference/check-copy-fallback.cjs ``` 检查真实上传、任务、消息、技能引用、模型绑定、故事结果保存、取消/保存参数、工作流筛选、独立草稿、小窗口和手动播放。结果与截图写入 `e2e/shots/reference`。测试会暂改假 ComfyUI 的模式文件,退出时恢复。 ## 已验证的范围 -- 25 项浏览器回归通过;图像与视频输出由本地假服务提供,智能体回复来自本地兼容模型服务。正式功能仍调用现有后端接口。 +- 25 项浏览器回归及一项真实剪贴板降级回归通过;图像与视频输出由本地假服务提供,智能体回复来自本地兼容模型服务。正式功能仍调用现有后端接口。 - 引用限额由单条工作流改成一条工作流加最多四个技能;五项模型校验单测通过,第二条工作流仍拒绝。 - 项目保存使用现有 PATCH 故事草稿接口,由用户在工作台继续确认。其他阶段需要结构化字段,因此明确提供“复制内容并打开项目”,不把自由文本伪装成结构化结果。 - 实际外部模型质量、真实 GPU 性能和参考站完整成片流程不在这个隔离回归中验证。 diff --git a/e2e/reference/check-copy-fallback.cjs b/e2e/reference/check-copy-fallback.cjs new file mode 100644 index 00000000..294bfa63 --- /dev/null +++ b/e2e/reference/check-copy-fallback.cjs @@ -0,0 +1,73 @@ +const { chromium } = require( + process.env.PLAYWRIGHT_MODULE_PATH || 'playwright', +); +const assert = require('node:assert/strict'); +(async () => { + const path = require('node:path'); + const expected = path.resolve(__dirname, '../shots/reference/data'); + const config = await ( + await fetch('http://127.0.0.1:8247/api/settings') + ).json(); + assert.equal( + path.resolve(config.data_dir), + expected, + 'Start the isolated reference server first.', + ); + const b = await chromium.launch({ + executablePath: process.env.CHROMIUM_EXECUTABLE_PATH, + args: ['--no-sandbox', '--disable-dev-shm-usage'], + }); + try { + const c = await b.newContext({ + permissions: ['clipboard-read', 'clipboard-write'], + }); + const p = await c.newPage(); + p.setDefaultTimeout(15000); + await p.goto('http://127.0.0.1:5173/agents'); + await p.locator('.agent-row').filter({ hasText: '视觉设计' }).click(); + const created = p.waitForResponse( + (r) => + r.url().endsWith('/api/agent/sessions') && + r.request().method() === 'POST', + ); + await p.getByRole('button', { name: /新任务/ }).click(); + await created; + await p.waitForFunction(() => + Array.from(document.querySelectorAll('.agent-toolbar button')).some( + (b) => b.textContent.includes('新任务') && !b.disabled, + ), + ); + await p + .locator('.agent-composer textarea') + .fill('需要一个温暖的绘本视觉方向'); + await p.locator('.agent-send').click(); + await p.getByRole('button', { name: /编辑内容并带回项目/ }).waitFor(); + await p.getByRole('button', { name: /编辑内容并带回项目/ }).click(); + await p.locator('.result-project-label select').selectOption('3'); + const text = + '剪贴板降级复制的实际内容。此处用于确认非安全上下文的操作不会误报成功。'; + await p.locator('#agent-result-editor').fill(text); + await p.evaluate(async () => { + window.__testClipboard = navigator.clipboard; + await window.__testClipboard.writeText('INITIAL'); + Object.defineProperty(navigator, 'clipboard', { + value: undefined, + configurable: true, + }); + }); + await p + .getByRole('button', { name: '复制内容并打开项目', exact: true }) + .click(); + await p.waitForURL('**/workbench/3?stage=style'); + const copied = await p.evaluate(() => window.__testClipboard.readText()); + assert.equal(copied, text); + console.log( + 'PASS clipboard unavailable: actual content copied and correct stage opened', + ); + } finally { + await b.close(); + } +})().catch((e) => { + console.error(e); + process.exitCode = 1; +});