fix(ai): reset provider autocomplete state on search string change

When typing /ai start <prefix><tab>, the autocomplete was not properly
handling search string changes. For example, typing "/ai start o<tab>"
would return "openai", but then typing "/ai start p<tab>" would still
return "openai" because the autocomplete state was not reset.

This commit:
- Adds ai_providers_reset_ac() function to reset provider autocomplete
  state, following the same pattern as accounts_reset_all_search()
- Integrates ai_providers_reset_ac() into cmd_ac_reset() for proper
  state cleanup when user presses Ctrl+C or switches contexts
This commit is contained in:
2026-05-13 09:40:52 +00:00
parent 18fb7fa733
commit 1ecaceb59f
3 changed files with 21 additions and 10 deletions

View File

@@ -115,6 +115,12 @@ gchar* ai_providers_find(const char* const search_str, gboolean previous, void*
*/
gchar* ai_models_find(const char* const search_str, gboolean previous, void* context);
/**
* Reset the provider autocomplete state.
* Called from cmd_ac_reset() to clear autocomplete state.
*/
void ai_providers_reset_ac(void);
/**
* Get the API key for a provider.
* @param provider_name The provider name