fix(ai): set correct links in tests, fix headers

This commit is contained in:
2026-04-30 17:02:54 +00:00
parent e43e8378b0
commit 1f1770bd58
4 changed files with 8 additions and 8 deletions

View File

@@ -22,8 +22,8 @@
#include <string.h>
/* Default providers */
#define DEFAULT_OPENAI_URL "https://api.openai.com/v1/responses"
#define DEFAULT_PERPLEXITY_URL "https://api.perplexity.ai/v1/responses"
#define DEFAULT_OPENAI_URL "https://api.openai.com/"
#define DEFAULT_PERPLEXITY_URL "https://api.perplexity.ai/"
/* Global state */
static GHashTable* providers = NULL;
@@ -713,10 +713,12 @@ _ai_request_thread(gpointer data)
/* Configure request */
const gchar* api_url = session->provider ? session->provider->api_url : DEFAULT_OPENAI_URL;
auto_gchar gchar* request_url = g_strdup_printf("%s%sv1/responses", api_url, g_str_has_suffix(api_url, "/") ? "" : "/");
log_debug("[AI-THREAD] API URL: %s", api_url);
log_debug("[AI-THREAD] API Request URL: %s", request_url);
log_debug("[AI-THREAD] Model: %s", session->model);
log_debug("[AI-THREAD] API Key: %s", session->api_key ? (strlen(session->api_key) > 10 ? g_strndup(session->api_key, 10) : session->api_key) : "NULL");
curl_easy_setopt(curl, CURLOPT_URL, api_url);
curl_easy_setopt(curl, CURLOPT_URL, request_url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_payload);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _write_callback);