From f418b337b1799bb84c39c41a0e1c9b8244ab2717 Mon Sep 17 00:00:00 2001 From: Thinley Date: Sun, 27 Oct 2024 22:17:49 +0530 Subject: [PATCH] FEAT: Add ai_backend in compose.pro --- web/actions/user.ts | 6 +++--- web/compose.pro.yml | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/web/actions/user.ts b/web/actions/user.ts index 68aacb6..4fd651d 100644 --- a/web/actions/user.ts +++ b/web/actions/user.ts @@ -9,7 +9,7 @@ import { redirect } from 'next/navigation' export async function create(question: string, context: string, collectionName: string, apiKey: string | null) { try { - const response = await axios.post("http://0.0.0.0:8880/getResponse", { + const response = await axios.post(`${process.env.AI_BACKEND_URL}:8880/getResponse`, { question, context, collectionName, @@ -38,7 +38,7 @@ export async function upload(formData: FormData) { try { const session = await auth(); const result = await axios.post( - "http://0.0.0.0:8880/upload", + `${process.env.AI_BACKEND_URL}:8880/upload`, formData, // Send the formData instead of the file directly { headers: { "Content-Type": "multipart/form-data" }, @@ -71,7 +71,7 @@ export async function upload(formData: FormData) { export async function deletePdf(collectionName: string){ try { - await axios.delete( "http://0.0.0.0:8880/del", { + await axios.delete( `${process.env.AI_BACKEND_URL}:8880/del`, { data:{ collectionName: collectionName } diff --git a/web/compose.pro.yml b/web/compose.pro.yml index ee1e68c..d9dd83b 100644 --- a/web/compose.pro.yml +++ b/web/compose.pro.yml @@ -4,12 +4,19 @@ services: container_name: dchat-web env_file: - .env - ports: - - 3000:3000 restart: always networks: network_prod: ipv4_address: 11.0.0.3 + ai_backend: + image: thinley44/dchat-ai:latest + container_name: dchat-ai + env_file: + - .env + restart: always + networks: + network_prod: + ipv4_address: 11.0.0.4 networks: network_prod: name: prod