diff --git a/src/ai/ai_client.c b/src/ai/ai_client.c index 88c340bd..f958b39c 100644 --- a/src/ai/ai_client.c +++ b/src/ai/ai_client.c @@ -406,37 +406,6 @@ ai_providers_find(const char* const search_str, gboolean previous, void* context return autocomplete_complete(providers_ac, search_str, FALSE, previous); } -/* Stateful model name finder for autocomplete. - * Uses the current session's provider models for completion. */ -gchar* -ai_models_find(const char* const search_str, gboolean previous, void* context) -{ - ProfAiWin* aiwin = (ProfAiWin*)context; - if (!aiwin || !aiwin->session) { - return NULL; - } - - AIProvider* provider = aiwin->session->provider; - if (!provider || !provider->models) { - return NULL; - } - - /* Create a temporary autocomplete for models */ - Autocomplete models_ac = autocomplete_new(); - GList* curr = provider->models; - while (curr) { - autocomplete_add(models_ac, curr->data); - curr = g_list_next(curr); - } - - /* NULL search_str is treated as empty string for cycling */ - const char* effective_search = (search_str != NULL) ? search_str : ""; - - gchar* result = autocomplete_complete(models_ac, effective_search, FALSE, previous); - autocomplete_free(models_ac); - return result; -} - /* Reset the provider autocomplete state. * Called from cmd_ac_reset() to clear autocomplete state when the user presses Ctrl+C. */ void diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 86f491ca..bda8b79a 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -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 - 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 - 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 - autocomplete provider names result = autocomplete_param_with_func(input, "/ai models", ai_providers_find, previous, NULL); if (result) {