Spaces:
Running
Running
feat: enterprise multi-page RAG platform with GraphRAG, CRAG, Guardrails, and VectorDB Inspector
73905db Download RAG_FULL_APPLICATION_FRONTEND/src/api/client.js from Pkiran/RAG-Generation: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/spaces/Pkiran/RAG-Generation/resolve/main/RAG_FULL_APPLICATION_FRONTEND/src/api/client.js
- Command line
-
hf download hf://spaces/Pkiran/RAG-Generation/RAG_FULL_APPLICATION_FRONTEND/src/api/client.js
-
curl -L -o client.js https://huggingface.co/spaces/Pkiran/RAG-Generation/resolve/main/RAG_FULL_APPLICATION_FRONTEND/src/api/client.js
620 Bytes
| import axios from 'axios'; | |
| const getApiBaseUrl = () => { | |
| if (import.meta.env.VITE_API_BASE_URL) return import.meta.env.VITE_API_BASE_URL; | |
| if (typeof window !== 'undefined' && (window.location.port === '5173' || window.location.port === '5174')) { | |
| return 'http://127.0.0.1:8008'; | |
| } | |
| return window.location.origin; | |
| }; | |
| const api = axios.create({ | |
| baseURL: getApiBaseUrl(), | |
| }); | |
| // Interceptor for JWT | |
| api.interceptors.request.use((config) => { | |
| const token = sessionStorage.getItem('token'); | |
| if (token) { | |
| config.headers.Authorization = `Bearer ${token}`; | |
| } | |
| return config; | |
| }); | |
| export default api; | |