From ebc0a294377692f401caaa22c5c9180a887ffdd8 Mon Sep 17 00:00:00 2001 From: Tracewebstudio Dev Date: Wed, 15 Apr 2026 19:54:58 +0200 Subject: [PATCH] fix(ai): use Ollama cluster URL and gemma3:270m model defaults - Default OLLAMA_BASE_URL to http://ollama.nxtgauge-ai.svc.cluster.local:11434 - Default OLLAMA_CHAT_MODEL to gemma3:270m (matches gitops configmap) --- apps/users/src/handlers/ai.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/users/src/handlers/ai.rs b/apps/users/src/handlers/ai.rs index 94d2b37..5935ae4 100644 --- a/apps/users/src/handlers/ai.rs +++ b/apps/users/src/handlers/ai.rs @@ -13,7 +13,7 @@ pub fn ai_router() -> Router { Router::new() .route("/chat/message", post(ai_chat_message)) .route("/tickets/create", post(ai_create_ticket)) - .route("/tickets/:id", get(ai_get_ticket)) + .route("/tickets/{id}", get(ai_get_ticket)) .route("/forms/extract", post(ai_extract_form)) } @@ -46,7 +46,7 @@ struct OllamaGenerateResponse { } async fn call_ollama(state: &AppState, model: &str, prompt: &str) -> Result { - let base_url = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://localhost:11434".to_string()); + let base_url = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://ollama.nxtgauge-ai.svc.cluster.local:11434".to_string()); let url = format!("{}/api/generate", base_url); let req = OllamaGenerateRequest { @@ -130,8 +130,8 @@ async fn ai_chat_message( State(state): State, Json(body): Json, ) -> impl IntoResponse { - let ollama_base = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://localhost:11434".to_string()); - let model = std::env::var("OLLAMA_CHAT_MODEL").unwrap_or_else(|_| "smollm2:360m".to_string()); + let ollama_base = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://ollama.nxtgauge-ai.svc.cluster.local:11434".to_string()); + let model = std::env::var("OLLAMA_CHAT_MODEL").unwrap_or_else(|_| "gemma3:270m".to_string()); let default_conversation = Uuid::new_v4().to_string(); let conversation_id = body.conversation_id.unwrap_or_else(|| default_conversation); @@ -291,8 +291,8 @@ async fn ai_extract_form( State(state): State, Json(body): Json, ) -> impl IntoResponse { - let ollama_base = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://localhost:11434".to_string()); - let model = std::env::var("OLLAMA_CHAT_MODEL").unwrap_or_else(|_| "smollm2:360m".to_string()); + let ollama_base = std::env::var("OLLAMA_BASE_URL").unwrap_or_else(|_| "http://ollama.nxtgauge-ai.svc.cluster.local:11434".to_string()); + let model = std::env::var("OLLAMA_CHAT_MODEL").unwrap_or_else(|_| "gemma3:270m".to_string()); let form_type = body.form_type.unwrap_or_else(|| "generic".to_string());