From f5da6623cf02a12e1f61d995218fe3735f04b4a8 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Wed, 22 May 2024 12:42:34 +0200
Subject: [PATCH] fix: update llamaindex, use 127.0.0.1 for ollama as default

---
 helpers/env-variables.ts                                        | 2 +-
 helpers/proxy.ts                                                | 2 --
 templates/types/streaming/express/package.json                  | 2 +-
 .../types/streaming/express/src/controllers/engine/settings.ts  | 2 +-
 templates/types/streaming/fastapi/app/settings.py               | 2 +-
 .../types/streaming/nextjs/app/api/chat/engine/settings.ts      | 2 +-
 templates/types/streaming/nextjs/package.json                   | 2 +-
 7 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/helpers/env-variables.ts b/helpers/env-variables.ts
index b5b36dd7..34fdc952 100644
--- a/helpers/env-variables.ts
+++ b/helpers/env-variables.ts
@@ -224,7 +224,7 @@ const getModelEnvs = (modelConfig: ModelConfig): EnvVar[] => {
           {
             name: "OLLAMA_BASE_URL",
             description:
-              "The base URL for the Ollama API. Eg: http://localhost:11434",
+              "The base URL for the Ollama API. Eg: http://127.0.0.1:11434",
           },
         ]
       : []),
diff --git a/helpers/proxy.ts b/helpers/proxy.ts
index 2973926c..a65d0704 100644
--- a/helpers/proxy.ts
+++ b/helpers/proxy.ts
@@ -4,7 +4,5 @@ export async function initializeGlobalAgent() {
     /* Dynamically import global-agent/bootstrap */
     await import("global-agent/bootstrap");
     console.log("Proxy enabled via global-agent.");
-  } else {
-    console.log("No proxy configuration found. Continuing without proxy.");
   }
 }
diff --git a/templates/types/streaming/express/package.json b/templates/types/streaming/express/package.json
index d61b7fba..b8bb9a71 100644
--- a/templates/types/streaming/express/package.json
+++ b/templates/types/streaming/express/package.json
@@ -14,7 +14,7 @@
     "cors": "^2.8.5",
     "dotenv": "^16.3.1",
     "express": "^4.18.2",
-    "llamaindex": "0.3.9",
+    "llamaindex": "0.3.13",
     "pdf2json": "3.0.5",
     "ajv": "^8.12.0"
   },
diff --git a/templates/types/streaming/express/src/controllers/engine/settings.ts b/templates/types/streaming/express/src/controllers/engine/settings.ts
index 27e946cf..a46feb7e 100644
--- a/templates/types/streaming/express/src/controllers/engine/settings.ts
+++ b/templates/types/streaming/express/src/controllers/engine/settings.ts
@@ -57,7 +57,7 @@ function initOpenAI() {
 
 function initOllama() {
   const config = {
-    host: process.env.OLLAMA_BASE_URL ?? "http://localhost:11434",
+    host: process.env.OLLAMA_BASE_URL ?? "http://127.0.0.1:11434",
   };
 
   Settings.llm = new Ollama({
diff --git a/templates/types/streaming/fastapi/app/settings.py b/templates/types/streaming/fastapi/app/settings.py
index 57eab4a0..90cc0918 100644
--- a/templates/types/streaming/fastapi/app/settings.py
+++ b/templates/types/streaming/fastapi/app/settings.py
@@ -23,7 +23,7 @@ def init_ollama():
     from llama_index.llms.ollama import Ollama
     from llama_index.embeddings.ollama import OllamaEmbedding
 
-    base_url = os.getenv("OLLAMA_BASE_URL") or "http://localhost:11434"
+    base_url = os.getenv("OLLAMA_BASE_URL") or "http://127.0.0.1:11434"
     Settings.embed_model = OllamaEmbedding(
         base_url=base_url,
         model_name=os.getenv("EMBEDDING_MODEL"),
diff --git a/templates/types/streaming/nextjs/app/api/chat/engine/settings.ts b/templates/types/streaming/nextjs/app/api/chat/engine/settings.ts
index a6fdf3ef..9b7bb00e 100644
--- a/templates/types/streaming/nextjs/app/api/chat/engine/settings.ts
+++ b/templates/types/streaming/nextjs/app/api/chat/engine/settings.ts
@@ -57,7 +57,7 @@ function initOpenAI() {
 
 function initOllama() {
   const config = {
-    host: process.env.OLLAMA_BASE_URL ?? "http://localhost:11434",
+    host: process.env.OLLAMA_BASE_URL ?? "http://127.0.0.1:11434",
   };
   Settings.llm = new Ollama({
     model: process.env.MODEL ?? "",
diff --git a/templates/types/streaming/nextjs/package.json b/templates/types/streaming/nextjs/package.json
index babe4319..ad182f73 100644
--- a/templates/types/streaming/nextjs/package.json
+++ b/templates/types/streaming/nextjs/package.json
@@ -18,7 +18,7 @@
     "class-variance-authority": "^0.7.0",
     "clsx": "^2.1.1",
     "dotenv": "^16.3.1",
-    "llamaindex": "0.3.8",
+    "llamaindex": "0.3.13",
     "lucide-react": "^0.294.0",
     "next": "^14.0.3",
     "pdf2json": "3.0.5",
-- 
GitLab