mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-06-11 18:05:58 +00:00
Show IM channel source on threads
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { pathOfThread } from "@/core/threads/utils";
|
||||
import { channelSourceOfThread, pathOfThread } from "@/core/threads/utils";
|
||||
|
||||
test("uses standard chat route when thread has no agent context", () => {
|
||||
expect(pathOfThread("thread-123")).toBe("/workspace/chats/thread-123");
|
||||
@@ -44,3 +44,40 @@ test("prefers context.agent_name over metadata.agent_name", () => {
|
||||
}),
|
||||
).toBe("/workspace/agents/from-context/chats/thread-789");
|
||||
});
|
||||
|
||||
test("reads IM channel source metadata", () => {
|
||||
expect(
|
||||
channelSourceOfThread({
|
||||
metadata: {
|
||||
channel_source: {
|
||||
type: "im_channel",
|
||||
provider: "feishu",
|
||||
chat_id: "oc_123",
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
type: "im_channel",
|
||||
provider: "feishu",
|
||||
label: "Feishu",
|
||||
});
|
||||
});
|
||||
|
||||
test("ignores threads without valid IM channel source metadata", () => {
|
||||
expect(channelSourceOfThread({ metadata: {} })).toBeNull();
|
||||
expect(
|
||||
channelSourceOfThread({
|
||||
metadata: { channel_source: { provider: "" } },
|
||||
}),
|
||||
).toBeNull();
|
||||
expect(
|
||||
channelSourceOfThread({
|
||||
metadata: {
|
||||
channel_source: {
|
||||
type: "other",
|
||||
provider: "feishu",
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user