1- import { Campfire , Circle } from "@phosphor-icons/react" ;
1+ import { Brain , Circle } from "@phosphor-icons/react" ;
22import { Flex , Text } from "@radix-ui/themes" ;
33import { useEffect , useState } from "react" ;
44
5- const ACTIVITIES = [ "Foraging" , "Hunting" , "Building" , "Gathering" , "Crafting" ] ;
5+ const THINKING_MESSAGES = [
6+ "Booping" ,
7+ "Crunching" ,
8+ "Digging" ,
9+ "Fetching" ,
10+ "Inferring" ,
11+ "Indexing" ,
12+ "Juggling" ,
13+ "Noodling" ,
14+ "Peeking" ,
15+ "Percolating" ,
16+ "Poking" ,
17+ "Pondering" ,
18+ "Scanning" ,
19+ "Scrambling" ,
20+ "Sifting" ,
21+ "Sniffing" ,
22+ "Spelunking" ,
23+ "Tinkering" ,
24+ "Unraveling" ,
25+ "Decoding" ,
26+ "Trekking" ,
27+ "Sorting" ,
28+ "Trimming" ,
29+ "Mulling" ,
30+ "Surfacing" ,
31+ "Rummaging" ,
32+ "Scouting" ,
33+ "Scouring" ,
34+ "Threading" ,
35+ "Hunting" ,
36+ "Swizzling" ,
37+ "Grokking" ,
38+ "Hedging" ,
39+ "Scheming" ,
40+ "Unfurling" ,
41+ "Puzzling" ,
42+ "Dissecting" ,
43+ "Stacking" ,
44+ "Snuffling" ,
45+ "Hashing" ,
46+ "Clustering" ,
47+ "Teasing" ,
48+ "Cranking" ,
49+ "Merging" ,
50+ "Snooping" ,
51+ "Rewiring" ,
52+ "Bundling" ,
53+ "Linking" ,
54+ "Mapping" ,
55+ "Tickling" ,
56+ "Flicking" ,
57+ "Hopping" ,
58+ "Rolling" ,
59+ "Zipping" ,
60+ "Twisting" ,
61+ "Blooming" ,
62+ "Sparking" ,
63+ "Nesting" ,
64+ "Looping" ,
65+ "Wiring" ,
66+ "Snipping" ,
67+ "Zoning" ,
68+ "Tracing" ,
69+ "Warping" ,
70+ "Twinkling" ,
71+ "Flipping" ,
72+ "Priming" ,
73+ "Snagging" ,
74+ "Scuttling" ,
75+ "Framing" ,
76+ "Sharpening" ,
77+ "Flibbertigibbeting" ,
78+ "Kerfuffling" ,
79+ "Dithering" ,
80+ "Discombobulating" ,
81+ "Rambling" ,
82+ "Befuddling" ,
83+ "Waffling" ,
84+ "Muckling" ,
85+ "Hobnobbing" ,
86+ "Galumphing" ,
87+ "Puttering" ,
88+ "Whiffling" ,
89+ "Thinking" ,
90+ ] ;
91+
92+ function getRandomThinkingMessage ( ) : string {
93+ return THINKING_MESSAGES [
94+ Math . floor ( Math . random ( ) * THINKING_MESSAGES . length )
95+ ] ;
96+ }
697
798export function formatDuration ( ms : number ) : string {
899 const totalSeconds = Math . floor ( ms / 1000 ) ;
@@ -23,7 +114,7 @@ interface GeneratingIndicatorProps {
23114
24115export function GeneratingIndicator ( { startedAt } : GeneratingIndicatorProps ) {
25116 const [ elapsed , setElapsed ] = useState ( 0 ) ;
26- const [ activityIndex , setActivityIndex ] = useState ( 0 ) ;
117+ const [ activity , setActivity ] = useState ( getRandomThinkingMessage ) ;
27118
28119 useEffect ( ( ) => {
29120 const startTime = startedAt ?? Date . now ( ) ;
@@ -36,7 +127,7 @@ export function GeneratingIndicator({ startedAt }: GeneratingIndicatorProps) {
36127
37128 useEffect ( ( ) => {
38129 const interval = setInterval ( ( ) => {
39- setActivityIndex ( ( i ) => ( i + 1 ) % ACTIVITIES . length ) ;
130+ setActivity ( getRandomThinkingMessage ( ) ) ;
40131 } , 2000 ) ;
41132
42133 return ( ) => clearInterval ( interval ) ;
@@ -49,8 +140,8 @@ export function GeneratingIndicator({ startedAt }: GeneratingIndicatorProps) {
49140 className = "select-none text-accent-11"
50141 style = { { userSelect : "none" , WebkitUserSelect : "none" } }
51142 >
52- < Campfire size = { 14 } weight = "fill" className = "ph-pulse" />
53- < Text size = "1" > { ACTIVITIES [ activityIndex ] } ...</ Text >
143+ < Brain size = { 12 } className = "ph-pulse" />
144+ < Text size = "1" > { activity } ...</ Text >
54145 < Text size = "1" color = "gray" >
55146 (Esc to interrupt
56147 </ Text >
0 commit comments