1- import { useEffect , useState , useRef , useCallback } from "react" ;
2- import BubbleDot from "@/webview/components/bubbles/BubbleDot" ;
1+ import { useEffect , useState , useRef } from "react" ;
32import { Spinner } from "@/webview/components/ui/spinner" ;
43import type { LlmStreamProgressData } from "@/webview/types" ;
54import ProgressShimmer from "@/webview/components/ProgressShimmer" ;
65
76interface ThinkingLiveBubbleProps {
87 llmStreamProgress : LlmStreamProgressData | null ;
98 processes : Record < string , { startTime : string ; command : string } > | null ;
10- shouldConnect ?: boolean ;
119}
1210
1311function formatElapsed ( startTime : string ) : string {
@@ -33,48 +31,10 @@ function getStatusText(
3331 return "Processing..." ;
3432}
3533
36- function formatElapsedTime ( startTimeIso : string ) {
37- const startTime = new Date ( startTimeIso ) . getTime ( ) ;
38- const elapsedMs = Date . now ( ) - startTime ;
39- const elapsedSeconds = Math . floor ( elapsedMs / 1000 ) ;
40- const minutes = Math . floor ( elapsedSeconds / 60 ) ;
41- const seconds = elapsedSeconds % 60 ;
42- if ( minutes > 0 ) {
43- return `${ minutes } m${ seconds } s` ;
44- }
45- return `${ seconds } s` ;
46- }
47-
48- export default function ThinkingLiveBubble ( {
49- llmStreamProgress,
50- processes,
51- shouldConnect = false ,
52- } : ThinkingLiveBubbleProps ) {
34+ export default function ThinkingLiveBubble ( { llmStreamProgress, processes } : ThinkingLiveBubbleProps ) {
5335 const [ statusText , setStatusText ] = useState ( ( ) => getStatusText ( llmStreamProgress , processes ) ) ;
5436 const intervalRef = useRef < ReturnType < typeof setInterval > | null > ( null ) ;
5537
56- const getThinkingContentText = useCallback ( ( ) => {
57- if ( processes && Object . keys ( processes ) . length > 0 ) {
58- const firstPid = Object . keys ( processes ) [ 0 ] ;
59- const process = processes [ firstPid ] ;
60- const elapsed = formatElapsedTime ( process . startTime ) ;
61- return `(${ elapsed } ) ${ process . command } ` ;
62- }
63-
64- if ( llmStreamProgress && llmStreamProgress . startedAt ) {
65- const startedAt = new Date ( llmStreamProgress . startedAt ) . getTime ( ) ;
66- const elapsedSeconds = Math . max ( 0 , Math . floor ( ( Date . now ( ) - startedAt ) / 1000 ) ) ;
67- const formattedTokens = llmStreamProgress . formattedTokens || "0" ;
68- if ( elapsedSeconds >= 3 ) {
69- return `(${ elapsedSeconds } s) · ↓ ${ formattedTokens } tokens` ;
70- }
71- }
72-
73- return "Processing..." ;
74- } , [ llmStreamProgress , processes ] ) ;
75-
76- console . log ( "getThinkingContentText:" , getThinkingContentText ( ) ) ;
77-
7838 useEffect ( ( ) => {
7939 setStatusText ( getStatusText ( llmStreamProgress , processes ) ) ;
8040 intervalRef . current = setInterval ( ( ) => {
0 commit comments