fix(webui): keep automation creation intent in runtime context

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-13 05:43:05 +08:00
1 parent 037438e7d1
commit 458b925f86
21 files changed
+149 -20

No files matched your search

+24
View File
@@ -1974,6 +1974,30 @@ describe("NanobotClient", () => {
});
});
it("sends automation intent separately from the user's text", () => {
const client = new NanobotClient({
url: "ws://test",
reconnect: false,
socketFactory: (url) => new FakeSocket(url) as unknown as WebSocket,
});
client.connect();
lastSocket().fakeOpen();
client.sendMessage("chat-x", "每天八点提醒我喝水", undefined, {
intent: "create_automation",
});
expect(JSON.parse(lastSocket().sent.at(-1) as string)).toEqual({
type: "message",
chat_id: "chat-x",
content: "每天八点提醒我喝水",
intent: "create_automation",
webui: true,
});
client.sendMessage("chat-x", "Thanks");
expect(JSON.parse(lastSocket().sent.at(-1) as string)).not.toHaveProperty("intent");
});
it("includes CLI app attachments in outbound messages", () => {
const client = new NanobotClient({
url: "ws://test",