mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-03 01:30:11 +00:00
proper backend url ingestion in frontend
This commit is contained in:
parent
4b77732929
commit
b9c61d3573
@ -62,7 +62,7 @@ services:
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- CHOKIDAR_USEPOLLING=true
|
||||
- BACKEND_URL=http://backend:${BACKEND_PORT:-8000}
|
||||
- REACT_APP_BACKEND_URL=http://0.0.0.0:${BACKEND_PORT:-8000}
|
||||
networks:
|
||||
- agentic-seek-net
|
||||
|
||||
|
@ -3,6 +3,9 @@ import axios from 'axios';
|
||||
import './App.css';
|
||||
import { colors } from './colors';
|
||||
|
||||
// Get backend URL from environment variable, fallback to default if not set
|
||||
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([]);
|
||||
@ -25,7 +28,7 @@ function App() {
|
||||
|
||||
const checkHealth = async () => {
|
||||
try {
|
||||
await axios.get('http://0.0.0.0:8000/health');
|
||||
await axios.get(`${BACKEND_URL}/health`);
|
||||
setIsOnline(true);
|
||||
console.log('System is online');
|
||||
} catch {
|
||||
@ -37,7 +40,7 @@ function App() {
|
||||
const fetchScreenshot = async () => {
|
||||
try {
|
||||
const timestamp = new Date().getTime();
|
||||
const res = await axios.get(`http://0.0.0.0: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');
|
||||
@ -76,7 +79,7 @@ function App() {
|
||||
|
||||
const fetchLatestAnswer = async () => {
|
||||
try {
|
||||
const res = await axios.get('http://0.0.0.0:8000/latest_answer');
|
||||
const res = await axios.get(`${BACKEND_URL}/latest_answer`);
|
||||
const data = res.data;
|
||||
|
||||
updateData(data);
|
||||
@ -134,7 +137,7 @@ function App() {
|
||||
try {
|
||||
console.log('Sending query:', query);
|
||||
setQuery('waiting for response...');
|
||||
const res = await axios.post('http://0.0.0.0:8000/query', {
|
||||
const res = await axios.post(`${BACKEND_URL}/query`, {
|
||||
query,
|
||||
tts_enabled: false
|
||||
});
|
||||
|
@ -75,6 +75,5 @@ if ! $COMPOSE_CMD up; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Backend is expected to be running on port ${BACKEND_PORT:-8000}"
|
||||
|
||||
sleep 10
|
Loading…
x
Reference in New Issue
Block a user