fix: configurable OLLAMA_URL for Docker container
Ollama runs on host, container needs host.docker.internal mapping. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -31,11 +31,14 @@ jobs:
|
||||
|
||||
- name: Run container in proxy network
|
||||
run: |
|
||||
HOST_IP=$(ip route | grep default | awk '{print $3}')
|
||||
docker run -d \
|
||||
--name oma-memorial \
|
||||
--network proxy \
|
||||
--add-host=host.docker.internal:${HOST_IP} \
|
||||
--restart unless-stopped \
|
||||
-e NODE_ENV=production \
|
||||
-e OLLAMA_URL="http://host.docker.internal:11434" \
|
||||
-e SITE_PASSWORD="${{ secrets.SITE_PASSWORD }}" \
|
||||
-e ADMIN_PASSWORD="${{ secrets.ADMIN_PASSWORD }}" \
|
||||
-v ${{ gitea.workspace }}/data:/app/data \
|
||||
|
||||
@@ -65,7 +65,8 @@ JSON:`
|
||||
const controller = new AbortController()
|
||||
setTimeout(() => controller.abort(), 15000)
|
||||
|
||||
const res = await fetch('http://localhost:11434/api/generate', {
|
||||
const ollamaUrl = process.env.OLLAMA_URL || 'http://localhost:11434'
|
||||
const res = await fetch(`${ollamaUrl}/api/generate`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
signal: controller.signal,
|
||||
|
||||
@@ -15,7 +15,8 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
// Ollama API aufrufen
|
||||
const ollamaResponse = await fetch('http://localhost:11434/api/generate', {
|
||||
const ollamaUrl = process.env.OLLAMA_URL || 'http://localhost:11434'
|
||||
const ollamaResponse = await fetch(`${ollamaUrl}/api/generate`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user