更新依赖,优化认证流程;添加聊天框动画效果,优化消息处理逻辑

This commit is contained in:
2026-03-24 10:56:25 +08:00
parent accf6ad254
commit 045391d036
9 changed files with 879 additions and 326 deletions
+19
View File
@@ -78,4 +78,23 @@ describe("streamCopilotChat", () => {
{ type: "error", message: "stream request failed", detail: "bad request" },
]);
});
it("emits re-login message on unauthorized response", async () => {
apiFetch.mockResolvedValue({
ok: false,
status: 401,
body: null,
text: async () => "unauthorized",
});
const events: Array<{ type: string; message?: string; detail?: string }> = [];
await streamCopilotChat({
message: "hi",
onEvent: (event) => events.push(event),
});
expect(events).toEqual([
{ type: "error", message: "Login expired. Please sign in again.", detail: undefined },
]);
});
});