diff --git a/backend/src/controllers/ollama.controller.js b/backend/src/controllers/ollama.controller.js index fe0c4e8..2253de1 100644 --- a/backend/src/controllers/ollama.controller.js +++ b/backend/src/controllers/ollama.controller.js @@ -1,5 +1,10 @@ -const OLLAMA_BASE_URL = "http://jin.neu.edu:11434"; -const OLLAMA_MODEL = "qwen3.6:27b"; +// Ollama server + model come from .env, so switching needs no code change: +// OLLAMA_BASE_URL=http://shui.neu.edu:11434 +// OLLAMA_MODEL=qwen3.8-careful:latest +const OLLAMA_BASE_URL = ( + process.env.OLLAMA_BASE_URL || "http://shui.neu.edu:11434" +).replace(/\/+$/, ""); +const OLLAMA_MODEL = process.env.OLLAMA_MODEL || "qwen3.8-careful:latest"; const proxyChat = async (req, res) => { console.log("🟣 [Ollama] proxyChat hit — model:", OLLAMA_MODEL); diff --git a/src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx b/src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx index 63cc92f..ffdb7ee 100644 --- a/src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx +++ b/src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx @@ -66,7 +66,7 @@ const llmProviders: Record = { name: "Ollama (NeuroJSON Server)", baseUrl: "", models: [ - { id: "qwen3.6:27b", name: "Qwen 3.6 27B" }, + { id: "qwen3.8-careful:latest", name: "Qwen 3.8 Careful" }, // { id: "qwen3-coder-next:latest", name: "Qwen 3 Coder Next" }, // { id: "qwen3-coder-careful:latest", name: "Qwen 3 Coder Careful" }, // { id: "qwen3.5:9b", name: "Qwen 3.5 9B" }, @@ -1461,7 +1461,7 @@ const LLMPanel: React.FC = ({ {provider === "ollama" && ( - Using qwen3.6:27b on NeuroJSON server + Using Qwen 3.8 Careful on NeuroJSON server )} diff --git a/src/services/ollama.service.ts b/src/services/ollama.service.ts index f725687..7a23b01 100644 --- a/src/services/ollama.service.ts +++ b/src/services/ollama.service.ts @@ -15,6 +15,9 @@ export const OllamaService = { // const temperature = getQwenTemperature(model); const response = await fetch(`${API_URL}/ollama/bidsify`, { method: "POST", + // Send the login cookie: /ollama/bidsify requires login, and locally the + // API (localhost:5000) is a different origin from the page. + credentials: "include", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ model, @@ -29,19 +32,23 @@ export const OllamaService = { const data = await response.json(); if (!response.ok) { - throw new Error(data.error || "Failed to call Ollama"); + throw new Error(data.error || data.message || "Failed to call Ollama"); } return data; }, getTags: async (): Promise => { - const response = await fetch(`${API_URL}/ollama/tags`); + const response = await fetch(`${API_URL}/ollama/tags`, { + credentials: "include", + }); const data = await response.json(); if (!response.ok) { - throw new Error(data.error || "Failed to fetch Ollama models"); + throw new Error( + data.error || data.message || "Failed to fetch Ollama models" + ); } return data;