Skip to content

Commit e771a0d

Browse files
committed
feat(ollama): move AI panel to shui with server and model set in .env;
1 parent 888e01c commit e771a0d

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎backend/src/controllers/ollama.controller.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
const OLLAMA_BASE_URL = "http://jin.neu.edu:11434";
2-
const OLLAMA_MODEL = "qwen3.6:27b";
1+
// Ollama server + model come from .env, so switching needs no code change:
2+
// OLLAMA_BASE_URL=http://shui.neu.edu:11434
3+
// OLLAMA_MODEL=qwen3.8-careful:latest
4+
const OLLAMA_BASE_URL = (
5+
process.env.OLLAMA_BASE_URL || "http://shui.neu.edu:11434"
6+
).replace(/\/+$/, "");
7+
const OLLAMA_MODEL = process.env.OLLAMA_MODEL || "qwen3.8-careful:latest";
38

49
const proxyChat = async (req, res) => {
510
console.log("🟣 [Ollama] proxyChat hit — model:", OLLAMA_MODEL);

‎src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const llmProviders: Record<string, LLMProvider> = {
6666
name: "Ollama (NeuroJSON Server)",
6767
baseUrl: "",
6868
models: [
69-
{ id: "qwen3.6:27b", name: "Qwen 3.6 27B" },
69+
{ id: "qwen3.8-careful:latest", name: "Qwen 3.8 Careful" },
7070
// { id: "qwen3-coder-next:latest", name: "Qwen 3 Coder Next" },
7171
// { id: "qwen3-coder-careful:latest", name: "Qwen 3 Coder Careful" },
7272
// { id: "qwen3.5:9b", name: "Qwen 3.5 9B" },
@@ -1461,7 +1461,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({
14611461

14621462
{provider === "ollama" && (
14631463
<Typography variant="caption" color="text.secondary" sx={{ mt: -1, mb: 2, display: "block" }}>
1464-
Using qwen3.6:27b on NeuroJSON server
1464+
Using Qwen 3.8 Careful on NeuroJSON server
14651465
</Typography>
14661466
)}
14671467

‎src/services/ollama.service.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export const OllamaService = {
1515
// const temperature = getQwenTemperature(model);
1616
const response = await fetch(`${API_URL}/ollama/bidsify`, {
1717
method: "POST",
18+
// Send the login cookie: /ollama/bidsify requires login, and locally the
19+
// API (localhost:5000) is a different origin from the page.
20+
credentials: "include",
1821
headers: { "Content-Type": "application/json" },
1922
body: JSON.stringify({
2023
model,
@@ -29,19 +32,23 @@ export const OllamaService = {
2932
const data = await response.json();
3033

3134
if (!response.ok) {
32-
throw new Error(data.error || "Failed to call Ollama");
35+
throw new Error(data.error || data.message || "Failed to call Ollama");
3336
}
3437

3538
return data;
3639
},
3740

3841
getTags: async (): Promise<any> => {
39-
const response = await fetch(`${API_URL}/ollama/tags`);
42+
const response = await fetch(`${API_URL}/ollama/tags`, {
43+
credentials: "include",
44+
});
4045

4146
const data = await response.json();
4247

4348
if (!response.ok) {
44-
throw new Error(data.error || "Failed to fetch Ollama models");
49+
throw new Error(
50+
data.error || data.message || "Failed to fetch Ollama models"
51+
);
4552
}
4653

4754
return data;

0 commit comments

Comments
 (0)