fix(ai): add reset for models_ac and streamline model autocomplete handling

Replace the custom ai_models_find function with a dedicated
ai_models_ac autocomplete list. Update the /ai switch trigger to
include a trailing space for consistent parsing.
This commit is contained in:
2026-05-13 12:59:29 +00:00
parent 277c82fb5d
commit 2f1637ca8e
2 changed files with 3 additions and 40 deletions

View File

@@ -469,7 +469,8 @@ static Autocomplete* all_acs[] = {
&ai_subcommands_ac,
&ai_set_subcommands_ac,
&ai_set_custom_subcommands_ac,
&ai_remove_subcommands_ac
&ai_remove_subcommands_ac,
&ai_models_ac
};
static GHashTable* ac_funcs = NULL;
@@ -4566,7 +4567,7 @@ _ai_autocomplete(ProfWin* window, const char* const input, gboolean previous)
}
// /ai switch <provider> <model> - autocomplete model names for specified provider
result = _ai_model_autocomplete(window, input, previous, "/ai switch");
result = _ai_model_autocomplete(window, input, previous, "/ai switch ");
if (result) {
return result;
}
@@ -4576,13 +4577,6 @@ _ai_autocomplete(ProfWin* window, const char* const input, gboolean previous)
return result;
}
// /ai switch <model> - autocomplete model names from current session's provider
ProfAiWin* aiwin = (window && window->type == WIN_AI) ? (ProfAiWin*)window : NULL;
result = autocomplete_param_with_func(input, "/ai switch", ai_models_find, previous, aiwin);
if (result) {
return result;
}
// /ai models <provider> - autocomplete provider names
result = autocomplete_param_with_func(input, "/ai models", ai_providers_find, previous, NULL);
if (result) {