[#110] Add AI client with multi-provider support and UI #113

Manually merged
jabber.developer merged 64 commits from feat/ai into master 2026-05-15 02:22:56 +00:00
67 changed files with 3199 additions and 13818 deletions
Showing only changes of commit 93ad7379e2 - Show all commits

View File

@@ -328,7 +328,7 @@ ai_list_providers(void)
g_hash_table_iter_init(&iter, providers);
while (g_hash_table_iter_next(&iter, &key, &value)) {
result = g_list_append(result, ai_provider_ref((AIProvider*)value));
result = g_list_append(result, value);
}
return result;

View File

@@ -97,7 +97,8 @@ void ai_provider_unref(AIProvider* provider);
/**
* List all configured providers.
* @return GList of AIProvider* (caller must not free the list or providers)
* @return GList of AIProvider* (caller must not free the list or providers,
* and must not unref the returned providers)
*/
GList* ai_list_providers(void);

View File

@@ -10929,7 +10929,6 @@ cmd_ai_providers(ProfWin* window, const char* const command, gchar** args)
}
cons_show("");
g_free(key);
ai_provider_unref(provider);
}
g_list_free(providers);

View File

@@ -78,10 +78,7 @@ test_ai_list_providers(void** state)
assert_non_null(providers);
assert_int_equal(2, g_list_length(providers)); /* openai and perplexity */
/* Free list and unref providers (ai_list_providers returns ref'd providers) */
for (GList* l = providers; l; l = g_list_next(l)) {
ai_provider_unref(l->data);
}
/* Free list (ai_list_providers returns non-ref'd providers; caller must not unref) */
g_list_free(providers);
/* Add another provider */
@@ -89,10 +86,7 @@ test_ai_list_providers(void** state)
providers = ai_list_providers();
assert_int_equal(3, g_list_length(providers));
/* Free list and unref providers */
for (GList* l = providers; l; l = g_list_next(l)) {
ai_provider_unref(l->data);
}
/* Free list */
g_list_free(providers);
}