File size: 756 Bytes
3299552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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');
  }
};