forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

rag-thinking-label.tsx20 lines, 853 bytesHistoryRawDownload
1import { createSignal, onCleanup } from "solid-js";
2
3const ROTATE_MS = 1_800;
4
5/**
6 * The "working on it" line while an answer is still pending.
7 *
8 * Retrieval here runs over the whole course corpus and takes longer than the
9 * assistant popover's turn, and a single frozen sentence starts to read as a
10 * stall. Rotating through the phases says the wait is expected — same device as
11 * `CelebiThinkingLabel`, but the phrases come from this tree's own copy object
12 * rather than the global message union.
13 */
14export function RagThinkingLabel(props: { phases: string[] }) {
15 const [index, setIndex] = createSignal(0);
16 const count = () => Math.max(1, props.phases.length);
17 const timer = window.setInterval(() => setIndex((i) => i + 1), ROTATE_MS);
18 onCleanup(() => window.clearInterval(timer));
19 return <>{props.phases[index() % count()]}</>;
20}