|
1 | 1 | import { describe, expect, test } from "vite-plus/test"; |
2 | | -import { isChatE2EReady, parseStdoutJson, runCommandE2e } from "../helpers.ts"; |
| 2 | +import { |
| 3 | + isChatE2EReady, |
| 4 | + isMultimodalChatE2EReady, |
| 5 | + parseStdoutJson, |
| 6 | + runCommandE2e, |
| 7 | +} from "../helpers.ts"; |
3 | 8 | import { KNOWLEDGE_CHAT_ROUTES } from "../topic-routes.ts"; |
4 | 9 |
|
5 | 10 | interface ContentPart { |
@@ -389,3 +394,34 @@ describe.skipIf(!isChatE2EReady())("e2e: knowledge chat (live)", () => { |
389 | 394 | expect(stderr).toBeTruthy(); |
390 | 395 | }); |
391 | 396 | }); |
| 397 | + |
| 398 | +// Long-lived console-created fixture (multimodal Q&A services cannot be created |
| 399 | +// via the CLI — see .env BAILIAN_E2E_IMAGE_CHAT_AGENT_ID) |
| 400 | +describe.skipIf(!isMultimodalChatE2EReady())( |
| 401 | + "e2e: knowledge chat --image live (常驻 fixture)", |
| 402 | + () => { |
| 403 | + const workspaceId = process.env.BAILIAN_WORKSPACE_ID!; |
| 404 | + const imageChatAgentId = process.env.BAILIAN_E2E_IMAGE_CHAT_AGENT_ID!; |
| 405 | + |
| 406 | + test("多模态问答接受 --image 并返回非空回答", async () => { |
| 407 | + const { stdout, stderr, exitCode } = await runCommandE2e(KNOWLEDGE_CHAT_ROUTES, [ |
| 408 | + "knowledge", |
| 409 | + "chat", |
| 410 | + "--message", |
| 411 | + "图里有什么", |
| 412 | + "--image", |
| 413 | + "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg", |
| 414 | + "--agent-id", |
| 415 | + imageChatAgentId, |
| 416 | + "--workspace-id", |
| 417 | + workspaceId, |
| 418 | + "--output", |
| 419 | + "json", |
| 420 | + ]); |
| 421 | + expect(exitCode, stderr).toBe(0); |
| 422 | + const data = parseStdoutJson<ChatJsonResult>(stdout); |
| 423 | + expect(data.answer).toBeTruthy(); |
| 424 | + expect(data.answer.length).toBeGreaterThan(0); |
| 425 | + }, 120_000); |
| 426 | + }, |
| 427 | +); |
0 commit comments