File size: 414 Bytes
5fe93dd
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const isProd = import.meta.env.PROD || window.location.hostname !== 'localhost';

const API_BASE = isProd ? '' : 'http://localhost:7860';

const getWsUrl = () => {
    if (!isProd) return 'ws://localhost:7860/ws';
    const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
    return `${protocol}//${window.location.host}/ws`;
};

export const config = {
    API_BASE,
    WS_URL: getWsUrl(),
};