feat(canvas): 云端 Agent 交互 - 展示错误动作并支持连接器与提示词预填
This commit is contained in:
1 parent
e70430e3e2
commit
8a08663d99
19 files changed
+779
-94
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { appendAgentPromptPrefill } from "@/lib/canvas/agent-prompt-prefill";
|
||||
|
||||
describe("Agent prompt node prefill", () => {
|
||||
it("preserves a long composer draft and appends the node reference with space separator", () => {
|
||||
const draft = "请继续按下面的拍摄方案调整画面。".repeat(20).trimEnd();
|
||||
const reference = "@[node:image-reference-123] ";
|
||||
|
||||
expect(appendAgentPromptPrefill(draft, reference)).toBe(`${draft} @[node:image-reference-123]`);
|
||||
});
|
||||
|
||||
it("uses the prefill directly when the composer is empty", () => {
|
||||
expect(appendAgentPromptPrefill("", "@[node:text-reference-123] ")).toBe("@[node:text-reference-123] ");
|
||||
});
|
||||
|
||||
it("appends with single space separator, no forced line breaks", () => {
|
||||
expect(appendAgentPromptPrefill("已有要求", "@[node:text-reference-123] ")).toBe("已有要求 @[node:text-reference-123]");
|
||||
expect(appendAgentPromptPrefill("已有要求 ", "@[node:text-reference-123] ")).toBe("已有要求 @[node:text-reference-123]");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user