deploy : current attempt at backend dockerization

This commit is contained in:
martin legrand
2025-05-29 10:51:08 +08:00
committed by Antoine Vivies
parent c1a1e9409d
commit a3ad635728
10 changed files with 170 additions and 35 deletions
+7 -5
View File
@@ -4,6 +4,8 @@ import axios from 'axios';
import './App.css';
import { colors } from './colors';
const BACKEND_URL = process.env.REACT_APP_BACKEND_URL || 'http://0.0.0.0:8000';
function App() {
const [query, setQuery] = useState('');
const [messages, setMessages] = useState([]);
@@ -27,7 +29,7 @@ function App() {
const checkHealth = async () => {
try {
await axios.get('http://127.0.0.1:8000/health');
await axios.get(`${BACKEND_URL}/health`);
setIsOnline(true);
console.log('System is online');
} catch {
@@ -39,7 +41,7 @@ function App() {
const fetchScreenshot = async () => {
try {
const timestamp = new Date().getTime();
const res = await axios.get(`http://127.0.0.1:8000/screenshots/updated_screen.png?timestamp=${timestamp}`, {
const res = await axios.get(`${BACKEND_URL}/screenshots/updated_screen.png?timestamp=${timestamp}`, {
responseType: 'blob'
});
console.log('Screenshot fetched successfully');
@@ -90,7 +92,7 @@ function App() {
const fetchLatestAnswer = async () => {
try {
const res = await axios.get('http://127.0.0.1:8000/latest_answer');
const res = await axios.get(`${BACKEND_URL}/latest_answer`);
const data = res.data;
updateData(data);
@@ -141,7 +143,7 @@ function App() {
setIsLoading(false);
setError(null);
try {
const res = await axios.get('http://127.0.0.1:8000/stop');
const res = await axios.get(`${BACKEND_URL}/stop`);
setStatus("Requesting stop...");
} catch (err) {
console.error('Error stopping the agent:', err);
@@ -162,7 +164,7 @@ function App() {
try {
console.log('Sending query:', query);
setQuery('waiting for response...');
const res = await axios.post('http://127.0.0.1:8000/query', {
const res = await axios.post(`${BACKEND_URL}/query`, {
query,
tts_enabled: false
});