88import { dictionary } from '@shared/constants/dictionary'
99import { ModelFetcher } from '@/services/model-fetcher'
1010import {
11- edit_max_concurrency_for_config ,
1211 edit_model_for_config ,
1312 edit_provider_for_config ,
1413 edit_reasoning_effort_for_config ,
@@ -58,7 +57,7 @@ export const upsert_configuration = async (params: {
5857 providers_manager . get_intelligent_update_tool_configs ( )
5958 save_configs = ( configs ) =>
6059 providers_manager . save_intelligent_update_tool_configs ( configs )
61- advanced_options = [ 'Temperature' , 'Reasoning Effort' , 'Max Concurrency' ]
60+ advanced_options = [ 'Temperature' , 'Reasoning Effort' ]
6261 break
6362 case 'prune-context' :
6463 get_configs = ( ) => providers_manager . get_prune_context_tool_configs ( )
@@ -177,9 +176,12 @@ export const upsert_configuration = async (params: {
177176 JSON . stringify ( updated_config ) !== JSON . stringify ( starting_config )
178177
179178 const items : vscode . QuickPickItem [ ] = [
180- { label : 'Model Provider' , detail : updated_config . provider_name } ,
181- { label : 'Model' , detail : updated_config . model } ,
182- { label : 'Advanced' }
179+ {
180+ label : 'Model' ,
181+ description : updated_config . provider_name ,
182+ detail : updated_config . model
183+ } ,
184+ { label : 'More...' }
183185 ]
184186
185187 const selected_item = await new Promise < vscode . QuickPickItem | undefined > (
@@ -224,11 +226,11 @@ export const upsert_configuration = async (params: {
224226 Object . assign ( updated_config , starting_config )
225227 quick_pick . items = [
226228 {
227- label : 'Model Provider' ,
228- detail : updated_config . provider_name
229+ label : 'Model' ,
230+ description : updated_config . provider_name ,
231+ detail : updated_config . model
229232 } ,
230- { label : 'Model' , detail : updated_config . model } ,
231- { label : 'Advanced' }
233+ { label : 'More...' }
232234 ]
233235 quick_pick . buttons = [ close_button ]
234236 }
@@ -250,27 +252,46 @@ export const upsert_configuration = async (params: {
250252 last_selected_label = selected_item . label
251253 const selected_option = selected_item . label
252254
253- if ( selected_option == 'Model Provider' ) {
254- const new_provider = await edit_provider_for_config (
255- providers_manager ,
256- updated_config . provider_name
257- )
258- if ( new_provider ) {
259- updated_config . provider_name = new_provider . provider_name
260- updated_config . provider_type = new_provider . provider_type
261- }
262- } else if ( selected_option == 'Model' ) {
263- const new_model = await edit_model_for_config (
264- updated_config ,
265- providers_manager ,
266- model_fetcher
267- )
268- if ( new_model !== undefined ) {
269- updated_config . model = new_model
270- }
271- } else if ( selected_option == 'Advanced' ) {
255+ if ( selected_option == 'Model' ) {
256+ let current_provider_name = updated_config . provider_name
257+
272258 // eslint-disable-next-line no-constant-condition
259+ while ( true ) {
260+ const new_provider = await edit_provider_for_config (
261+ providers_manager ,
262+ current_provider_name
263+ )
264+
265+ if ( ! new_provider ) {
266+ break
267+ }
268+
269+ current_provider_name = new_provider . provider_name
270+
271+ const temp_config = {
272+ ...updated_config ,
273+ provider_name : new_provider . provider_name ,
274+ provider_type : new_provider . provider_type ,
275+ model :
276+ new_provider . provider_name === updated_config . provider_name
277+ ? updated_config . model
278+ : ''
279+ }
280+ const new_model = await edit_model_for_config (
281+ temp_config ,
282+ providers_manager ,
283+ model_fetcher
284+ )
285+ if ( new_model !== undefined ) {
286+ updated_config . provider_name = new_provider . provider_name
287+ updated_config . provider_type = new_provider . provider_type
288+ updated_config . model = new_model
289+ break
290+ }
291+ }
292+ } else if ( selected_option == 'More...' ) {
273293 let last_advanced_label : string | undefined
294+ // eslint-disable-next-line no-constant-condition
274295 while ( true ) {
275296 const advanced_items : vscode . QuickPickItem [ ] = [ ]
276297 if ( advanced_options . includes ( 'Temperature' ) ) {
@@ -287,22 +308,13 @@ export const upsert_configuration = async (params: {
287308 detail : updated_config . reasoning_effort
288309 } )
289310 }
290- if ( advanced_options . includes ( 'Max Concurrency' ) ) {
291- advanced_items . push ( {
292- label : 'Max Concurrency' ,
293- description : ! updated_config . max_concurrency ? 'Unset' : undefined ,
294- detail : updated_config . max_concurrency ?. toString ( ) || undefined
295- } )
296- }
297311
298312 const selected_advanced = await new Promise <
299313 vscode . QuickPickItem | undefined
300314 > ( ( resolve ) => {
301315 const quick_pick = vscode . window . createQuickPick ( )
302316 quick_pick . items = advanced_items
303- quick_pick . title = original_id
304- ? 'Edit Configuration - Advanced'
305- : 'Create New Configuration - Advanced'
317+ quick_pick . title = 'Edit Configuration'
306318 quick_pick . placeholder = 'Select a property to edit'
307319 quick_pick . buttons = [ vscode . QuickInputButtons . Back ]
308320 if ( last_advanced_label ) {
@@ -401,13 +413,6 @@ export const upsert_configuration = async (params: {
401413 break
402414 }
403415 }
404- } else if ( selected_advanced . label == 'Max Concurrency' ) {
405- const new_concurrency =
406- await edit_max_concurrency_for_config ( updated_config )
407- if ( new_concurrency !== undefined ) {
408- updated_config . max_concurrency =
409- new_concurrency === null ? undefined : new_concurrency
410- }
411416 }
412417 }
413418 }
0 commit comments