@@ -121,7 +121,7 @@ function computeWaveCloudSections(
121121 sections . push ( {
122122 sectionName : "Wave AI Cloud" ,
123123 configs : waveProviderConfigs ,
124- noTelemetry : ! telemetryEnabled
124+ noTelemetry : ! telemetryEnabled ,
125125 } ) ;
126126 }
127127 if ( otherProviderConfigs . length > 0 ) {
@@ -137,13 +137,12 @@ interface AIModeDropdownProps {
137137
138138export const AIModeDropdown = memo ( ( { compatibilityMode = false } : AIModeDropdownProps ) => {
139139 const model = WaveAIModel . getInstance ( ) ;
140- const aiMode = useAtomValue ( model . currentAIMode ) ;
140+ const currentMode = useAtomValue ( model . currentAIMode ) ;
141141 const aiModeConfigs = useAtomValue ( model . aiModeConfigs ) ;
142142 const waveaiModeConfigs = useAtomValue ( atoms . waveaiModeConfigAtom ) ;
143143 const widgetContextEnabled = useAtomValue ( model . widgetAccessAtom ) ;
144144 const hasPremium = useAtomValue ( model . hasPremiumAtom ) ;
145145 const showCloudModes = useAtomValue ( getSettingsKeyAtom ( "waveai:showcloudmodes" ) ) ;
146- const defaultMode = useAtomValue ( getSettingsKeyAtom ( "waveai:defaultmode" ) ) ?? "waveai@balanced" ;
147146 const telemetryEnabled = useAtomValue ( getSettingsKeyAtom ( "telemetry:enabled" ) ) ?? false ;
148147 const [ isOpen , setIsOpen ] = useState ( false ) ;
149148 const dropdownRef = useRef < HTMLDivElement > ( null ) ;
@@ -152,20 +151,10 @@ export const AIModeDropdown = memo(({ compatibilityMode = false }: AIModeDropdow
152151 aiModeConfigs ,
153152 showCloudModes ,
154153 model . inBuilder ,
155- hasPremium
154+ hasPremium ,
155+ currentMode
156156 ) ;
157157
158- let currentMode = aiMode || defaultMode ;
159- const currentConfig = aiModeConfigs [ currentMode ] ;
160- if ( currentConfig ) {
161- if ( ! hasPremium && currentConfig [ "waveai:premium" ] ) {
162- currentMode = "waveai@quick" ;
163- }
164- if ( model . inBuilder && hasPremium && currentMode === "waveai@quick" ) {
165- currentMode = "waveai@balanced" ;
166- }
167- }
168-
169158 const sections : ConfigSection [ ] = compatibilityMode
170159 ? computeCompatibleSections ( currentMode , aiModeConfigs , waveProviderConfigs , otherProviderConfigs )
171160 : computeWaveCloudSections ( waveProviderConfigs , otherProviderConfigs , telemetryEnabled ) ;
@@ -183,12 +172,17 @@ export const AIModeDropdown = memo(({ compatibilityMode = false }: AIModeDropdow
183172 } ;
184173
185174 const displayConfig = aiModeConfigs [ currentMode ] ;
186- const displayName = displayConfig ? getModeDisplayName ( displayConfig ) : "Unknown" ;
187- const displayIcon = displayConfig ?. [ "display:icon" ] || "sparkles" ;
175+ const displayName = displayConfig ? getModeDisplayName ( displayConfig ) : `Invalid ( ${ currentMode } )` ;
176+ const displayIcon = displayConfig ? ( displayConfig [ "display:icon" ] || "sparkles" ) : "question ";
188177 const resolvedConfig = waveaiModeConfigs [ currentMode ] ;
189178 const hasToolsSupport = resolvedConfig && resolvedConfig [ "ai:capabilities" ] ?. includes ( "tools" ) ;
190179 const showNoToolsWarning = widgetContextEnabled && resolvedConfig && ! hasToolsSupport ;
191180
181+ const handleNewChatClick = ( ) => {
182+ model . clearChat ( ) ;
183+ setIsOpen ( false ) ;
184+ } ;
185+
192186 const handleConfigureClick = ( ) => {
193187 fireAndForget ( async ( ) => {
194188 RpcApi . RecordTEventCommand (
@@ -278,7 +272,8 @@ export const AIModeDropdown = memo(({ compatibilityMode = false }: AIModeDropdow
278272 const isPremiumDisabled = ! hasPremium && config [ "waveai:premium" ] ;
279273 const isIncompatibleDisabled = section . isIncompatible || false ;
280274 const isTelemetryDisabled = section . noTelemetry || false ;
281- const isDisabled = isPremiumDisabled || isIncompatibleDisabled || isTelemetryDisabled ;
275+ const isDisabled =
276+ isPremiumDisabled || isIncompatibleDisabled || isTelemetryDisabled ;
282277 const isSelected = currentMode === config . mode ;
283278 return (
284279 < AIModeMenuItem
@@ -296,6 +291,13 @@ export const AIModeDropdown = memo(({ compatibilityMode = false }: AIModeDropdow
296291 ) ;
297292 } ) }
298293 < div className = "border-t border-gray-600 my-1" />
294+ < button
295+ onClick = { handleNewChatClick }
296+ className = "w-full flex items-center gap-2 px-3 pt-1 pb-1 text-gray-300 hover:bg-zinc-700 cursor-pointer transition-colors text-left"
297+ >
298+ < i className = { makeIconClass ( "plus" , false ) } > </ i >
299+ < span className = "text-sm" > New Chat</ span >
300+ </ button >
299301 < button
300302 onClick = { handleConfigureClick }
301303 className = "w-full flex items-center gap-2 px-3 pt-1 pb-2 text-gray-300 hover:bg-zinc-700 cursor-pointer transition-colors text-left"
0 commit comments