11import { useState , useEffect , useMemo } from 'react'
2- import cn from 'classnames'
32import styles from './EditWebConfigurationForm.module.scss'
4- import dropdown_styles from '@ui/components/editor/common/Dropdown/Dropdown.module.scss'
53import { WebConfiguration } from '@shared/types/web-configuration'
64import { CHATBOTS } from '@shared/constants/chatbots'
75import { Field as UiField } from '@ui/components/editor/panel/Field'
@@ -12,6 +10,7 @@ import { BackendMessage } from '@/views/panel/types/messages'
1210import { PresetOption as UiPresetOption } from '@ui/components/editor/panel/PresetOption'
1311import { Scrollable as UiScrollable } from '@ui/components/editor/panel/Scrollable'
1412import { Fieldset as UiFieldset } from '@ui/components/editor/panel/Fieldset'
13+ import { QuickPickButton as UiQuickPickButton } from '@ui/components/editor/common/QuickPickButton'
1514
1615type Props = {
1716 web_configuration : WebConfiguration
@@ -31,7 +30,9 @@ type Props = {
3130export const EditWebConfigurationForm : React . FC < Props > = ( props ) => {
3231 const [ chatbot , set_chatbot ] = useState ( props . web_configuration . chatbot )
3332 const [ name , set_name ] = useState ( props . web_configuration . name )
34- const [ temperature , set_temperature ] = useState ( props . web_configuration . temperature )
33+ const [ temperature , set_temperature ] = useState (
34+ props . web_configuration . temperature
35+ )
3536 const [ top_p , set_top_p ] = useState ( props . web_configuration . top_p )
3637 const [ thinking_budget , set_thinking_budget ] = useState (
3738 props . web_configuration . thinking_budget
@@ -45,9 +46,12 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
4546 )
4647 const [ port , set_port ] = useState ( props . web_configuration . port )
4748 const [ new_url , set_new_url ] = useState ( props . web_configuration . new_url )
48- const [ options , set_options ] = useState < string [ ] > ( props . web_configuration . options || [ ] )
49+ const [ options , set_options ] = useState < string [ ] > (
50+ props . web_configuration . options || [ ]
51+ )
4952 const [ is_sampling_collapsed , set_is_sampling_collapsed ] = useState (
50- props . web_configuration . temperature === undefined && props . web_configuration . top_p === undefined
53+ props . web_configuration . temperature === undefined &&
54+ props . web_configuration . top_p === undefined
5155 )
5256
5357 const chatbot_config = chatbot ? CHATBOTS [ chatbot ] : undefined
@@ -113,7 +117,7 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
113117 } )
114118 } else {
115119 props . on_update ( {
116- name,
120+ name
117121 } )
118122 }
119123 } , [
@@ -194,43 +198,27 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
194198 < UiFieldset label = "General" >
195199 { chatbot && (
196200 < UiField label = "Chatbot" html_for = "chatbot" >
197- < button
198- className = { dropdown_styles . button }
201+ < UiQuickPickButton
202+ label = { chatbot }
199203 onClick = { ( e ) => {
200204 e . stopPropagation ( )
201205 props . pick_chatbot ( chatbot )
202206 } }
203- >
204- < span > { chatbot } </ span >
205- < span
206- className = { cn (
207- 'codicon codicon-chevron-down' ,
208- dropdown_styles . chevron
209- ) }
210- />
211- </ button >
207+ />
212208 </ UiField >
213209 ) }
214210
215211 { ( Object . keys ( models ) . length > 0 || chatbot == 'OpenRouter' ) && (
216212 < UiField label = "Model" html_for = "model" >
217- < button
218- className = { dropdown_styles . button }
213+ < UiQuickPickButton
214+ label = { model_info ?. label || model || 'Select model' }
219215 onClick = { ( e ) => {
220216 e . stopPropagation ( )
221217 if ( chatbot ) {
222218 props . pick_model ( chatbot , model )
223219 }
224220 } }
225- >
226- < span > { model_info ?. label || model || 'Select model' } </ span >
227- < span
228- className = { cn (
229- 'codicon codicon-chevron-down' ,
230- dropdown_styles . chevron
231- ) }
232- />
233- </ button >
221+ />
234222 </ UiField >
235223 ) }
236224
@@ -254,29 +242,21 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
254242 chatbot == 'OpenRouter' ? ' Requires a reasoning model.' : ''
255243 } `}
256244 >
257- < button
258- className = { dropdown_styles . button }
245+ < UiQuickPickButton
246+ label = {
247+ reasoning_effort
248+ ? reasoning_effort . charAt ( 0 ) . toUpperCase ( ) +
249+ reasoning_effort . slice ( 1 )
250+ : '—'
251+ }
259252 onClick = { ( e ) => {
260253 e . stopPropagation ( )
261254 props . pick_reasoning_effort (
262255 supported_reasoning_efforts ,
263256 reasoning_effort
264257 )
265258 } }
266- >
267- < span >
268- { reasoning_effort
269- ? reasoning_effort . charAt ( 0 ) . toUpperCase ( ) +
270- reasoning_effort . slice ( 1 )
271- : '—' }
272- </ span >
273- < span
274- className = { cn (
275- 'codicon codicon-chevron-down' ,
276- dropdown_styles . chevron
277- ) }
278- />
279- </ button >
259+ />
280260 </ UiField >
281261 ) }
282262
@@ -349,7 +329,7 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
349329 < UiField
350330 label = { chatbot_config ?. url_override_label || 'URL override' }
351331 html_for = "new-url"
352- info = "Use a smart workspace for your coding tasks ."
332+ info = "Elevate your workflow with smart workspaces ."
353333 >
354334 < UiInput
355335 id = "new-url"
@@ -379,9 +359,7 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
379359
380360 { chatbot &&
381361 Object . keys ( chatbot_config ?. supported_options || { } ) . length > 0 && (
382- < UiFieldset
383- label = "Options"
384- >
362+ < UiFieldset label = "Options" >
385363 < div className = { styles . options } >
386364 { Object . entries ( chatbot_config ! . supported_options ! ) . map (
387365 ( [ key , label ] ) => {
@@ -394,6 +372,7 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
394372 if ( model_info ?. disabled_options ?. includes ( key ) ) {
395373 return null
396374 }
375+
397376 return (
398377 < UiPresetOption
399378 key = { key }
0 commit comments