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