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
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:
commit
d83e8598e0
@ -82,8 +82,17 @@ impl OpenAiProvider {
|
|||||||
let api_url = config.api_url.trim_end_matches('/');
|
let api_url = config.api_url.trim_end_matches('/');
|
||||||
let url = format!("{api_url}{endpoint_path}");
|
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!({
|
let mut body = serde_json::json!({
|
||||||
"model": config.model,
|
"model": model,
|
||||||
"messages": messages,
|
"messages": messages,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -128,11 +137,20 @@ impl OpenAiProvider {
|
|||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.json(&body)
|
.json(&body)
|
||||||
.send()
|
.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() {
|
if !resp.status().is_success() {
|
||||||
let status = resp.status();
|
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}");
|
anyhow::bail!("OpenAI API error {status}: {text}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,9 @@ pub fn run() {
|
|||||||
commands::ai::chat_message,
|
commands::ai::chat_message,
|
||||||
commands::ai::test_provider_connection,
|
commands::ai::test_provider_connection,
|
||||||
commands::ai::list_providers,
|
commands::ai::list_providers,
|
||||||
|
commands::system::save_ai_provider,
|
||||||
|
commands::system::load_ai_providers,
|
||||||
|
commands::system::delete_ai_provider,
|
||||||
// Docs
|
// Docs
|
||||||
commands::docs::generate_rca,
|
commands::docs::generate_rca,
|
||||||
commands::docs::generate_postmortem,
|
commands::docs::generate_postmortem,
|
||||||
|
|||||||
@ -443,8 +443,8 @@ export interface IntegrationConfig {
|
|||||||
space_key?: string;
|
space_key?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const authenticateWithWebviewCmd = (service: string, baseUrl: string) =>
|
export const authenticateWithWebviewCmd = (service: string, baseUrl: string, projectName?: string) =>
|
||||||
invoke<WebviewAuthResponse>("authenticate_with_webview", { service, baseUrl });
|
invoke<WebviewAuthResponse>("authenticate_with_webview", { service, baseUrl, projectName });
|
||||||
|
|
||||||
export const extractCookiesFromWebviewCmd = (service: string, webviewId: string) =>
|
export const extractCookiesFromWebviewCmd = (service: string, webviewId: string) =>
|
||||||
invoke<ConnectionResult>("extract_cookies_from_webview", { service, webviewId });
|
invoke<ConnectionResult>("extract_cookies_from_webview", { service, webviewId });
|
||||||
@ -462,3 +462,14 @@ export const getIntegrationConfigCmd = (service: string) =>
|
|||||||
|
|
||||||
export const getAllIntegrationConfigsCmd = () =>
|
export const getAllIntegrationConfigsCmd = () =>
|
||||||
invoke<IntegrationConfig[]>("get_all_integration_configs");
|
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 });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user