Some checks failed
Build & Sign Wraith / Build Windows + Sign (push) Failing after 9s
Backend cleanup (Gemini): - Strip verbose doc comments across SSH, RDP, and command modules - Add 10s timeout on SSH connect/auth, 15s on RDP connection - Fix macOS data directory to ~/Library/Application Support/Wraith - Add generic disconnect_session command - Simplify SFTP setup and error handling - Inline AppState field construction Gemini AI XO integration: - Add GeminiService (src-tauri/src/ai/) with API Key, Service Account, and Google Account (OAuth2) authentication methods - Add ai_commands (set_gemini_auth, gemini_chat, is_gemini_authenticated) - Add GeminiPanel.vue — collapsible chat sidebar with multi-auth UI - Wire Ctrl+Shift+G toggle and status bar AI button in MainLayout - Add reqwest + anyhow dependencies Bugfix: - Fix dropped modulo operator in Ctrl+Tab/Ctrl+Shift+Tab handlers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
26 lines
854 B
Rust
26 lines
854 B
Rust
use tauri::State;
|
|
use crate::AppState;
|
|
use crate::ai::{AuthMethod, GeminiClient};
|
|
|
|
#[tauri::command]
|
|
pub async fn set_gemini_auth(auth: AuthMethod, model: Option<String>, state: State<'_, AppState>) -> Result<(), String> {
|
|
let client = GeminiClient::new(auth, model.unwrap_or_else(|| "gemini-2.0-flash".to_string()));
|
|
*state.gemini.lock().unwrap() = Some(client);
|
|
Ok(())
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub async fn gemini_chat(message: String, state: State<'_, AppState>) -> Result<String, String> {
|
|
let client = {
|
|
let client_opt = state.gemini.lock().unwrap();
|
|
client_opt.as_ref().cloned().ok_or("Gemini not authenticated")?
|
|
};
|
|
|
|
client.chat(&message).await.map_err(|e| e.to_string())
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn is_gemini_authenticated(state: State<'_, AppState>) -> bool {
|
|
state.gemini.lock().unwrap().is_some()
|
|
}
|