feat(webui): add lightweight session messaging via mentions
This commit is contained in:
1 parent
2bdb11eeba
commit
0e184965e8
76 files changed
+8297
-658
No files matched your search
@@ -1049,7 +1049,7 @@ describe("webui API helpers", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("maps generated session titles from the sessions list", async () => {
|
||||
it("maps title-free handle handles", async () => {
|
||||
vi.mocked(fetch).mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
@@ -1061,6 +1061,11 @@ describe("webui API helpers", () => {
|
||||
title: "优化 WebUI 标题",
|
||||
model_preset: "fast",
|
||||
run_started_at: 1_700_000_000,
|
||||
handle: {
|
||||
id: "handle_1234567890abcdef1234567890abcdef",
|
||||
name: "webui-review",
|
||||
color_slot: 5,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
@@ -1073,10 +1078,39 @@ describe("webui API helpers", () => {
|
||||
preview: "",
|
||||
modelPreset: "fast",
|
||||
runStartedAt: 1_700_000_000,
|
||||
handle: {
|
||||
id: "handle_1234567890abcdef1234567890abcdef",
|
||||
name: "webui-review",
|
||||
color_slot: 5,
|
||||
session_key: "websocket:chat-1",
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("rejects malformed session-list handle DTOs instead of trusting enriched fields", async () => {
|
||||
vi.mocked(fetch).mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
sessions: [
|
||||
{
|
||||
key: "websocket:chat-1",
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
handle: {
|
||||
id: "handle_1234567890abcdef1234567890abcdef",
|
||||
name: "valid-handle",
|
||||
color_slot: 8,
|
||||
session_key: "websocket:attacker-controlled",
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
} as Response);
|
||||
|
||||
await expect(listSessions("tok")).resolves.toMatchObject([{ handle: null }]);
|
||||
});
|
||||
|
||||
it("maps slash command metadata from the commands endpoint", async () => {
|
||||
vi.mocked(fetch).mockResolvedValueOnce({
|
||||
ok: true,
|
||||
|
||||
Reference in new issue
Block a user