Spaces:
Sleeping
Sleeping
import axios from './api'; | |
const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || 'https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space'; | |
export const searchQuery = async (query) => { | |
try { | |
const response = await axios.post(`${API_BASE_URL}/search`, { query }); | |
return response.data; | |
} catch (error) { | |
throw new Error(error.response?.data?.detail || 'Search failed'); | |
} | |
}; | |
export const saveFeedback = async (feedbackData, token) => { | |
try { | |
await axios.post(`${API_BASE_URL}/save`, | |
{ items: [feedbackData] }, | |
{ | |
headers: { | |
Authorization: `Bearer ${token}` | |
} | |
} | |
); | |
} catch (error) { | |
throw new Error(error.response?.data?.detail || 'Failed to save feedback'); | |
} | |
}; |