@@ -23,17 +23,24 @@ local function get_current_model_variants()
2323 return {}
2424 end
2525
26- local variants = {}
26+ local variants = {
27+ {
28+ name = ' default' ,
29+ value = nil ,
30+ config = nil ,
31+ },
32+ }
2733 for variant_name , variant_config in pairs (model_info .variants ) do
2834 table.insert (variants , {
2935 name = variant_name ,
36+ value = variant_name ,
3037 config = variant_config ,
3138 })
3239 end
3340
3441 util .sort_by_priority (variants , function (item )
3542 return item .name
36- end , { low = 1 , medium = 2 , high = 3 })
43+ end , { default = 0 , low = 1 , medium = 2 , high = 3 })
3744
3845 return variants
3946end
@@ -68,7 +75,7 @@ function M.select(callback)
6875 layout_opts = config .ui .picker ,
6976 format_fn = function (item , width )
7077 local item_width = width or vim .api .nvim_win_get_width (0 )
71- local is_current = state .current_variant == item .name
78+ local is_current = state .current_variant == item .value
7279 local current_indicator = is_current and ' *' or ' '
7380
7481 local name_width = item_width - vim .api .nvim_strwidth (current_indicator )
@@ -89,12 +96,12 @@ function M.select(callback)
8996 actions = {},
9097 callback = function (selection )
9198 if selection and state .current_model then
92- state .model .set_variant (selection .name )
99+ state .model .set_variant (selection .value )
93100
94101 -- Save variant to model state
95102 local provider , model = state .current_model :match (' ^(.-)/(.+)$' )
96103 if provider and model then
97- model_state .set_variant (provider , model , selection .name )
104+ model_state .set_variant (provider , model , selection .value )
98105 end
99106 end
100107 if callback then
0 commit comments