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)
This commit is contained in:
parent
430711a0ae
commit
ebc0a29437
1 changed files with 6 additions and 6 deletions
|
|
@ -13,7 +13,7 @@ pub fn ai_router() -> Router<AppState> {
|
|||
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<String, String> {
|
||||
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<AppState>,
|
||||
Json(body): Json<OllamaChatRequest>,
|
||||
) -> 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<AppState>,
|
||||
Json(body): Json<FormExtractBody>,
|
||||
) -> 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());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue