diff --git a/src-tauri/src/commands/ai.rs b/src-tauri/src/commands/ai.rs index 86c722f8..0cec7836 100644 --- a/src-tauri/src/commands/ai.rs +++ b/src-tauri/src/commands/ai.rs @@ -259,6 +259,21 @@ pub async fn chat_message( Ok(response) } +#[tauri::command] +pub async fn test_provider_connection( + provider_config: ProviderConfig, +) -> Result { + let provider = create_provider(&provider_config); + let messages = vec![Message { + role: "user".into(), + content: "Reply with exactly: TFTSR connection test successful.".into(), + }]; + provider + .chat(messages, &provider_config) + .await + .map_err(|e| e.to_string()) +} + #[tauri::command] pub async fn list_providers() -> Result, String> { Ok(vec![ diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a8e3ed5b..a980edd9 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -70,6 +70,7 @@ pub fn run() { // AI commands::ai::analyze_logs, commands::ai::chat_message, + commands::ai::test_provider_connection, commands::ai::list_providers, // Docs commands::docs::generate_rca, diff --git a/src-tauri/src/ollama/manager.rs b/src-tauri/src/ollama/manager.rs index cea05941..8967ad43 100644 --- a/src-tauri/src/ollama/manager.rs +++ b/src-tauri/src/ollama/manager.rs @@ -57,7 +57,7 @@ pub async fn pull_model(app_handle: tauri::AppHandle, model_name: &str) -> anyho "status": status, "total": total, "completed": completed, - "percent": percent, + "progress": percent, }), ); } diff --git a/src/components/HardwareReport.tsx b/src/components/HardwareReport.tsx index 74e8d087..7c690002 100644 --- a/src/components/HardwareReport.tsx +++ b/src/components/HardwareReport.tsx @@ -82,7 +82,7 @@ export function HardwareReport({ hardware, recommendations }: HardwareReportProp >
{rec.recommended && ( - RECOMMENDED + RECOMMENDED )}

{rec.name}

diff --git a/src/components/ui/index.tsx b/src/components/ui/index.tsx index ca652584..6c7a1b07 100644 --- a/src/components/ui/index.tsx +++ b/src/components/ui/index.tsx @@ -280,6 +280,7 @@ const badgeVariants = cva( secondary: "border-transparent bg-secondary text-secondary-foreground", destructive: "border-transparent bg-destructive text-destructive-foreground", outline: "text-foreground", + success: "border-transparent bg-green-600 text-white", }, }, defaultVariants: { diff --git a/src/lib/tauriCommands.ts b/src/lib/tauriCommands.ts index 5359cb81..a443a5a1 100644 --- a/src/lib/tauriCommands.ts +++ b/src/lib/tauriCommands.ts @@ -265,6 +265,9 @@ export const applyRedactionsCmd = (logFileId: string, approvedSpanIds: string[]) // ─── Issue CRUD ─────────────────────────────────────────────────────────────── +export const testProviderConnectionCmd = (providerConfig: ProviderConfig) => + invoke("test_provider_connection", { providerConfig }); + export const createIssueCmd = (newIssue: NewIssue) => invoke("create_issue", { title: newIssue.title, diff --git a/src/pages/Settings/AIProviders.tsx b/src/pages/Settings/AIProviders.tsx index 2c06fb1d..7ba31cd9 100644 --- a/src/pages/Settings/AIProviders.tsx +++ b/src/pages/Settings/AIProviders.tsx @@ -17,7 +17,7 @@ import { Separator, } from "@/components/ui"; import { useSettingsStore } from "@/stores/settingsStore"; -import { chatMessageCmd, type ProviderConfig, type Message } from "@/lib/tauriCommands"; +import { testProviderConnectionCmd, type ProviderConfig } from "@/lib/tauriCommands"; const emptyProvider: ProviderConfig = { name: "", @@ -82,10 +82,7 @@ export default function AIProviders() { setIsTesting(true); setTestResult(null); try { - const testMessages: Message[] = [ - { role: "user", content: "Reply with exactly: TFTSR connection test successful." }, - ]; - const response = await chatMessageCmd("test-connection", "Test connection", form); + const response = await testProviderConnectionCmd(form); setTestResult({ success: true, message: `OK: ${response.content.slice(0, 100)}` }); } catch (err) { setTestResult({ success: false, message: String(err) });