Merge branch 'bug/branch-creation' into feat/image-attachments
Some checks failed
Test / frontend-typecheck (pull_request) Successful in 1m4s
Test / frontend-tests (pull_request) Successful in 57s
Test / rust-fmt-check (pull_request) Failing after 2m19s
Test / rust-tests (pull_request) Has been cancelled
Test / rust-clippy (pull_request) Has been cancelled

This commit is contained in:
Shaun Arman 2026-04-08 20:58:25 -05:00
commit d83e8598e0
3 changed files with 37 additions and 5 deletions

View File

@ -82,8 +82,17 @@ impl OpenAiProvider {
let api_url = config.api_url.trim_end_matches('/');
let url = format!("{api_url}{endpoint_path}");
tracing::debug!(
url = %url,
model = %config.model,
max_tokens = ?config.max_tokens,
temperature = ?config.temperature,
"OpenAI API request"
);
let model = config.model.trim_end_matches('.');
let mut body = serde_json::json!({
"model": config.model,
"model": model,
"messages": messages,
});
@ -128,11 +137,20 @@ impl OpenAiProvider {
.header("Content-Type", "application/json")
.json(&body)
.send()
.await?;
.await;
let resp = match resp {
Ok(response) => response,
Err(e) => {
tracing::error!(url = %url, error = %e, "OpenAI API request failed");
anyhow::bail!("OpenAI API request failed: {e}");
}
};
if !resp.status().is_success() {
let status = resp.status();
let text = resp.text().await?;
let text = resp.text().await.unwrap_or_else(|_| "unable to read response body".to_string());
tracing::error!(url = %url, status = %status, response = %text, "OpenAI API error response");
anyhow::bail!("OpenAI API error {status}: {text}");
}

View File

@ -82,6 +82,9 @@ pub fn run() {
commands::ai::chat_message,
commands::ai::test_provider_connection,
commands::ai::list_providers,
commands::system::save_ai_provider,
commands::system::load_ai_providers,
commands::system::delete_ai_provider,
// Docs
commands::docs::generate_rca,
commands::docs::generate_postmortem,

View File

@ -443,8 +443,8 @@ export interface IntegrationConfig {
space_key?: string;
}
export const authenticateWithWebviewCmd = (service: string, baseUrl: string) =>
invoke<WebviewAuthResponse>("authenticate_with_webview", { service, baseUrl });
export const authenticateWithWebviewCmd = (service: string, baseUrl: string, projectName?: string) =>
invoke<WebviewAuthResponse>("authenticate_with_webview", { service, baseUrl, projectName });
export const extractCookiesFromWebviewCmd = (service: string, webviewId: string) =>
invoke<ConnectionResult>("extract_cookies_from_webview", { service, webviewId });
@ -462,3 +462,14 @@ export const getIntegrationConfigCmd = (service: string) =>
export const getAllIntegrationConfigsCmd = () =>
invoke<IntegrationConfig[]>("get_all_integration_configs");
// ─── AI Provider Configuration ────────────────────────────────────────────────
export const saveAiProviderCmd = (config: ProviderConfig) =>
invoke<void>("save_ai_provider", { config });
export const loadAiProvidersCmd = () =>
invoke<ProviderConfig[]>("load_ai_providers");
export const deleteAiProviderCmd = (name: string) =>
invoke<void>("delete_ai_provider", { name });