test(webui): trim redundant browser coverage
This commit is contained in:
1 parent
8857d4f9c8
commit
960bfa9a83
10 files changed
+187
-260
No files matched your search
@@ -1,14 +1,13 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { SessionSearchDialog } from "@/components/SessionSearchDialog";
|
||||
import { useAppViewport } from "@/hooks/useAppViewport";
|
||||
import { ThreadMessageCache } from "@/lib/thread-message-cache";
|
||||
import { ThreadTranscript } from "@/lib/thread-transcript";
|
||||
import type { ChatSummary } from "@/lib/types";
|
||||
|
||||
const sessions: ChatSummary[] = Array.from({ length: 1000 }, (_, index) => ({
|
||||
const sessions: ChatSummary[] = Array.from({ length: 2 }, (_, index) => ({
|
||||
key: `websocket:topic-${index}`, chatId: `topic-${index}`, channel: "websocket",
|
||||
title: `Topic ${index}`, preview: `Preview ${index}`, createdAt: null, updatedAt: null,
|
||||
...(index === 1 ? { handle: { id: "handle_00000000000000000000000000000001", name: "betu" } } : {}),
|
||||
}));
|
||||
|
||||
export function LoadedSessionSearchFixture() {
|
||||
@@ -19,23 +18,11 @@ export function LoadedSessionSearchFixture() {
|
||||
const value = new ThreadMessageCache(() => false);
|
||||
value.set("topic-1", new ThreadTranscript([
|
||||
{ id: "user", role: "user", content: "我们讨论权限与配对", createdAt: 1 },
|
||||
{ id: "answer", role: "assistant", content: `${"Earlier notes. ".repeat(500)}Use Full Access at 25% in session_history.py`, createdAt: 2 },
|
||||
]).save());
|
||||
return value;
|
||||
});
|
||||
useEffect(() => {
|
||||
const shortcut = (event: KeyboardEvent) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "k") {
|
||||
event.preventDefault();
|
||||
setOpen(true);
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", shortcut);
|
||||
return () => window.removeEventListener("keydown", shortcut);
|
||||
}, []);
|
||||
return <main className="h-[100dvh] bg-background p-6 text-foreground">
|
||||
<button onClick={() => setOpen(true)}>Search</button>
|
||||
<textarea aria-label="Draft" defaultValue="Keep this unsent draft" className="block" />
|
||||
<output aria-label="Selected topic">{selected}</output>
|
||||
<SessionSearchDialog open={open} onOpenChange={setOpen} sessions={sessions}
|
||||
activeKey={selected} loading={false} messageCache={cache} onSelect={setSelected} />
|
||||
|
||||
Reference in new issue
Block a user