MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / handleFollowupClick

Function handleFollowupClick

cli/src/chat.tsx:530–570  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

528 // Handle followup suggestion clicks
529 useEffect(() => {
530 const handleFollowupClick = (event: Event) => {
531 const customEvent = event as CustomEvent<{
532 prompt: string
533 index: number
534 toolCallId: string
535 }>
536 const { prompt, index, toolCallId } = customEvent.detail
537
538 logger.info(
539 { promptLength: prompt.length, index, toolCallId, agentMode },
540 '[followup-click] Followup clicked',
541 )
542
543 // Track analytics event
544 trackEvent(AnalyticsEvent.FOLLOWUP_CLICKED, {
545 promptLength: prompt.length,
546 index,
547 agentMode,
548 })
549
550 // Mark this followup as clicked (persisted per toolCallId)
551 useChatStore.getState().markFollowupClicked(toolCallId, index)
552
553 // Send the followup prompt directly, preserving the user's current input
554 onSubmitPrompt(prompt, agentMode, {
555 preserveInputValue: true,
556 })
557 .then((result) => {
558 logger.info(
559 { hasResult: !!result },
560 '[followup-click] onSubmitPrompt completed',
561 )
562 })
563 .catch((error) => {
564 logger.error(
565 { error },
566 '[followup-click] onSubmitPrompt failed with error',
567 )
568 showClipboardMessage('Failed to send followup', { durationMs: 3000 })
569 })
570 }
571
572 globalThis.addEventListener('codebuff:send-followup', handleFollowupClick)
573 return () => {

Callers

nothing calls this directly

Calls 2

trackEventFunction · 0.90
showClipboardMessageFunction · 0.90

Tested by

no test coverage detected