@@ -11,6 +11,19 @@ import { cn } from "@/lib/utils"
1111const DEFAULT_FOLLOWUP_TIMEOUT_MS = 60000
1212const COUNTDOWN_INTERVAL_MS = 1000
1313
14+ const getSuggestionMode = ( mode : unknown ) : string | undefined => {
15+ if ( typeof mode === "string" && mode . trim ( ) . length > 0 ) {
16+ return mode
17+ }
18+
19+ if ( mode && typeof mode === "object" && "mode_slug" in mode ) {
20+ const modeSlug = ( mode as { mode_slug ?: unknown } ) . mode_slug
21+ return typeof modeSlug === "string" && modeSlug . trim ( ) . length > 0 ? modeSlug : undefined
22+ }
23+
24+ return undefined
25+ }
26+
1427interface FollowUpSuggestProps {
1528 suggestions ?: SuggestionItem [ ]
1629 onSuggestionClick ?: ( suggestion : SuggestionItem , event ?: React . MouseEvent ) => void
@@ -111,6 +124,7 @@ export const FollowUpSuggest = ({
111124 < div className = "flex mb-2 flex-col h-full gap-2" >
112125 { suggestions . map ( ( suggestion , index ) => {
113126 const isFirstSuggestion = index === 0
127+ const suggestionMode = getSuggestionMode ( suggestion . mode )
114128
115129 return (
116130 < div key = { `${ suggestion . answer } -${ ts } ` } className = "w-full relative group" >
@@ -134,10 +148,10 @@ export const FollowUpSuggest = ({
134148 { t ( "chat:followUpSuggest.timerPrefix" , { seconds : countdown } ) }
135149 </ p >
136150 ) }
137- { suggestion . mode && (
151+ { suggestionMode && (
138152 < div className = "absolute bottom-0 right-0 text-[10px] text-vscode-badge-foreground pl-1 pr-2.5 pt-0.5 pb-1.5 flex items-center gap-0.5 bg-transparent rounded-xl" >
139153 < span className = "codicon codicon-arrow-right" style = { { fontSize : "8px" } } />
140- { suggestion . mode }
154+ { suggestionMode }
141155 </ div >
142156 ) }
143157 < StandardTooltip content = { t ( "chat:followUpSuggest.copyToInput" ) } >
0 commit comments