@@ -10,17 +10,19 @@ import { Toggler as UiToggler } from '@ui/components/editor/common/Toggler'
1010import { Button as UiButton } from '@ui/components/editor/common/Button'
1111import { Notice as UiNotice } from '@ui/components/editor/settings/Notice'
1212import {
13- ApiConfigurationForClient ,
14- ProviderForClient ,
13+ ApiConfiguration ,
14+ Provider ,
1515 EditFormatInstructions
1616} from '@/views/settings/types/messages'
17+ import { WebConfiguration } from '@shared/types/web-configuration'
1718import { GeneralSection } from './sections/GeneralSection'
1819import { ToolType } from '@/views/settings/types/tools'
1920import {
2021 Translation ,
2122 use_translation ,
2223 TranslationKey
2324} from '../i18n/use-translation'
25+ import { WebConfigurationsSection } from './sections/WebConfigurationsSection'
2426import {
2527 commit_message_instructions as default_commit_message_instructions ,
2628 voice_input_instructions as default_voice_input_instructions
@@ -32,9 +34,9 @@ export type NavItem =
3234 | 'prompt-field'
3335 | 'checkpoints'
3436 | 'edit-format'
35- | 'chatbots'
3637 | 'model-providers'
37- | 'configurations'
38+ | 'api-configurations'
39+ | 'web-configurations'
3840 | 'default-configurations'
3941 | 'instructions'
4042
@@ -57,20 +59,19 @@ const NAV_ITEMS_CONFIG: NavConfigItem[] = [
5759 } ,
5860 {
5961 id : 'edit-format' ,
60- label : 'general.edit-format-instructions .title' ,
62+ label : 'general.edit-formats .title' ,
6163 is_nested : true
6264 } ,
6365 {
64- id : 'chatbots' ,
65- label : 'general.chatbots.title' ,
66- is_nested : true
66+ id : 'web-configurations' ,
67+ label : 'sections.web-configurations' as any
6768 } ,
6869 {
6970 id : 'model-providers' ,
7071 label : 'sections.model-providers'
7172 } ,
7273 {
73- id : 'configurations' ,
74+ id : 'api- configurations' ,
7475 label : 'sections.api-configurations'
7576 } ,
7677 {
@@ -86,8 +87,9 @@ const NAV_ITEMS_CONFIG: NavConfigItem[] = [
8687]
8788
8889type Props = {
89- providers : ProviderForClient [ ]
90- api_configurations : ApiConfigurationForClient [ ]
90+ providers : Provider [ ]
91+ api_configurations : ApiConfiguration [ ]
92+ web_configurations : WebConfiguration [ ]
9193 defaults : Record < ToolType , string | null >
9294 edit_context_system_instructions : string
9395 voice_input_instructions : string
@@ -106,8 +108,9 @@ type Props = {
106108 clear_checks_in_workspace_behavior : 'ignore-open-editors' | 'uncheck-all'
107109 extended_cache_duration_for_anthropic : boolean
108110 auto_run_intelligent_update : boolean
109- set_providers : ( providers : ProviderForClient [ ] ) => void
110- set_api_configurations : ( configurations : ApiConfigurationForClient [ ] ) => void
111+ set_providers : ( providers : Provider [ ] ) => void
112+ set_api_configurations : ( configurations : ApiConfiguration [ ] ) => void
113+ set_web_configurations : ( configurations : WebConfiguration [ ] ) => void
111114 on_context_size_warning_threshold_change : (
112115 threshold : number | undefined
113116 ) => void
@@ -141,12 +144,12 @@ type Props = {
141144 } ) => void
142145 on_delete_provider : ( provider_name : string ) => void
143146 on_edit_provider : ( provider_name : string ) => void
144- on_reorder_providers : ( reordered_providers : ProviderForClient [ ] ) => void
147+ on_reorder_providers : ( reordered_providers : Provider [ ] ) => void
145148 on_add_api_configuration : ( params ?: {
146149 insertion_index ?: number
147150 create_on_top ?: boolean
148151 } ) => void
149- on_reorder_api_configurations : ( reordered : ApiConfigurationForClient [ ] ) => void
152+ on_reorder_api_configurations : ( reordered : ApiConfiguration [ ] ) => void
150153 on_edit_api_configuration : ( api_configuration_id : string ) => void
151154 on_duplicate_api_configuration : ( api_configuration_id : string ) => void
152155 on_delete_api_configuration : ( api_configuration_id : string ) => void
@@ -155,6 +158,14 @@ type Props = {
155158 api_configuration_id : string | null
156159 ) => void
157160 on_select_default_api_configuration : ( tool_name : ToolType ) => void
161+ on_reorder_web_configurations : ( reordered : WebConfiguration [ ] ) => void
162+ on_add_web_configuration : ( params ?: {
163+ insertion_index ?: number
164+ create_on_top ?: boolean
165+ } ) => void
166+ on_duplicate_web_configuration : ( id : string ) => void
167+ on_edit_web_configuration : ( id : string ) => void
168+ on_delete_web_configuration : ( id : string ) => void
158169 on_open_external_url : ( url : string ) => void
159170 scroll_to_section_on_load ?: NavItem
160171}
@@ -168,16 +179,19 @@ export const Home: React.FC<Props> = (props) => {
168179 'prompt-field' : null ,
169180 checkpoints : null ,
170181 'edit-format' : null ,
171- chatbots : null ,
172182 'model-providers' : null ,
173- configurations : null ,
183+ 'api-configurations' : null ,
184+ 'web-configurations' : null ,
174185 'default-configurations' : null ,
175186 instructions : null
176187 } )
177188
178- const set_section_ref = useCallback ( ( id : NavItem , el : HTMLDivElement | null ) => {
179- section_refs . current [ id ] = el
180- } , [ ] )
189+ const set_section_ref = useCallback (
190+ ( id : NavItem , el : HTMLDivElement | null ) => {
191+ section_refs . current [ id ] = el
192+ } ,
193+ [ ]
194+ )
181195
182196 const [ commit_instructions , set_commit_instructions ] = useState ( '' )
183197 const [ voice_input_instructions , set_voice_input_instructions ] = useState ( '' )
@@ -187,14 +201,18 @@ export const Home: React.FC<Props> = (props) => {
187201 const get_has_warning = ( id : NavItem ) : boolean => {
188202 if ( id == 'model-providers' ) {
189203 return props . providers . length == 0
190- } else if ( id == 'configurations' ) {
204+ } else if ( id == 'api- configurations' ) {
191205 return props . api_configurations . length == 0
206+ } else if ( id == 'web-configurations' ) {
207+ return props . web_configurations . length == 0
192208 } else {
193209 return false
194210 }
195211 }
196212
197- const [ active_nav_item_id , set_active_nav_item_id ] = useState < NavItem > ( NAV_ITEMS_CONFIG [ 0 ] . id )
213+ const [ active_nav_item_id , set_active_nav_item_id ] = useState < NavItem > (
214+ NAV_ITEMS_CONFIG [ 0 ] . id
215+ )
198216
199217 useEffect ( ( ) => {
200218 const scroll_container = scroll_container_ref . current
@@ -249,12 +267,15 @@ export const Home: React.FC<Props> = (props) => {
249267 const offset = section_rect . top - container_rect . top
250268
251269 let extra_offset = 0
252- const is_subsection = NAV_ITEMS_CONFIG . find ( ( i ) => i . id === item_id ) ?. is_nested
270+ const is_subsection = NAV_ITEMS_CONFIG . find (
271+ ( i ) => i . id === item_id
272+ ) ?. is_nested
253273 if ( is_subsection ) {
254274 extra_offset = - 112
255275 }
256276
257- const target_scroll_top = scroll_container . scrollTop + offset + extra_offset
277+ const target_scroll_top =
278+ scroll_container . scrollTop + offset + extra_offset
258279
259280 scroll_container . scrollTo ( {
260281 top : target_scroll_top ,
@@ -283,7 +304,6 @@ export const Home: React.FC<Props> = (props) => {
283304 ref = { scroll_container_ref }
284305 title = { t ( 'sections.settings' ) }
285306 sidebar = { NAV_ITEMS_CONFIG . map ( ( item , i ) => {
286-
287307 return (
288308 < UiNavigationItem
289309 key = { i }
@@ -293,7 +313,9 @@ export const Home: React.FC<Props> = (props) => {
293313 has_warning = { get_has_warning ( item . id ) }
294314 on_click = { ( e ) => handle_nav_click ( e , item . id ) }
295315 is_nested = { item . is_nested }
296- is_last_nested = { item . is_nested && ! NAV_ITEMS_CONFIG [ i + 1 ] ?. is_nested }
316+ is_last_nested = {
317+ item . is_nested && ! NAV_ITEMS_CONFIG [ i + 1 ] ?. is_nested
318+ }
297319 />
298320 )
299321 } ) }
@@ -339,16 +361,36 @@ export const Home: React.FC<Props> = (props) => {
339361 props . on_open_allow_patterns_settings
340362 }
341363 on_open_keybindings = { props . on_open_keybindings }
364+ auto_run_intelligent_update = { props . auto_run_intelligent_update }
365+ on_auto_run_intelligent_update_change = {
366+ props . on_auto_run_intelligent_update_change
367+ }
368+ include_prompts_in_commit_messages = {
369+ props . include_prompts_in_commit_messages
370+ }
371+ on_include_prompts_in_commit_messages_change = {
372+ props . on_include_prompts_in_commit_messages_change
373+ }
374+ voice_input_push_to_talk = { props . voice_input_push_to_talk }
375+ on_voice_input_push_to_talk_change = {
376+ props . on_voice_input_push_to_talk_change
377+ }
378+ />
379+
380+ < WebConfigurationsSection
381+ ref = { ( el ) => set_section_ref ( 'web-configurations' , el ) }
382+ set_section_ref = { set_section_ref }
383+ web_configurations = { props . web_configurations }
384+ set_web_configurations = { props . set_web_configurations }
385+ on_reorder_web_configurations = { props . on_reorder_web_configurations }
386+ on_add_web_configuration = { props . on_add_web_configuration }
387+ on_duplicate_web_configuration = { props . on_duplicate_web_configuration }
388+ on_edit_web_configuration = { props . on_edit_web_configuration }
389+ on_delete_web_configuration = { props . on_delete_web_configuration }
342390 gemini_user_id = { props . gemini_user_id }
343391 ai_studio_user_id = { props . ai_studio_user_id }
344392 on_gemini_user_id_change = { props . on_gemini_user_id_change }
345393 on_ai_studio_user_id_change = { props . on_ai_studio_user_id_change }
346- auto_run_intelligent_update = { props . auto_run_intelligent_update }
347- on_auto_run_intelligent_update_change = { props . on_auto_run_intelligent_update_change }
348- include_prompts_in_commit_messages = { props . include_prompts_in_commit_messages }
349- on_include_prompts_in_commit_messages_change = { props . on_include_prompts_in_commit_messages_change }
350- voice_input_push_to_talk = { props . voice_input_push_to_talk }
351- on_voice_input_push_to_talk_change = { props . on_voice_input_push_to_talk_change }
352394 />
353395
354396 < UiSection
@@ -434,7 +476,7 @@ export const Home: React.FC<Props> = (props) => {
434476 </ UiSection >
435477
436478 < ApiConfigurationsSection
437- ref = { ( el ) => set_section_ref ( 'configurations' , el ) }
479+ ref = { ( el ) => set_section_ref ( 'api- configurations' , el ) }
438480 set_section_ref = { set_section_ref }
439481 api_configurations = { props . api_configurations }
440482 defaults = { props . defaults }
@@ -444,8 +486,12 @@ export const Home: React.FC<Props> = (props) => {
444486 on_duplicate_api_configuration = { props . on_duplicate_api_configuration }
445487 on_edit_api_configuration = { props . on_edit_api_configuration }
446488 on_delete_api_configuration = { props . on_delete_api_configuration }
447- on_set_default_api_configuration = { props . on_set_default_api_configuration }
448- on_select_default_api_configuration = { props . on_select_default_api_configuration }
489+ on_set_default_api_configuration = {
490+ props . on_set_default_api_configuration
491+ }
492+ on_select_default_api_configuration = {
493+ props . on_select_default_api_configuration
494+ }
449495 edit_context_instructions = { edit_context_instructions }
450496 commit_instructions = { commit_instructions }
451497 voice_input_instructions = { voice_input_instructions }
@@ -471,23 +517,16 @@ export const Home: React.FC<Props> = (props) => {
471517 props . commit_message_instructions ==
472518 default_commit_message_instructions
473519 ) {
474- set_commit_instructions (
475- default_commit_message_instructions
476- )
520+ set_commit_instructions ( default_commit_message_instructions )
477521 }
478522 } }
479523 on_voice_input_instructions_blur = { ( ) => {
480- props . on_voice_input_instructions_change (
481- voice_input_instructions
482- )
524+ props . on_voice_input_instructions_change ( voice_input_instructions )
483525 if (
484526 voice_input_instructions == '' &&
485- props . voice_input_instructions ==
486- default_voice_input_instructions
527+ props . voice_input_instructions == default_voice_input_instructions
487528 ) {
488- set_voice_input_instructions (
489- default_voice_input_instructions
490- )
529+ set_voice_input_instructions ( default_voice_input_instructions )
491530 }
492531 } }
493532 default_edit_context_instructions = { default_system_instructions }
0 commit comments