Spaces:
Runtime error
Runtime error
File size: 1,259 Bytes
89c010a |
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
// api.js
const API_BASE_URL = 'http://localhost:5000/api';
export const generateQuestions = async (context) => {
const response = await fetch(`${API_BASE_URL}/generate-questions`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ context }),
});
return response.json();
};
export const generateFinalPrompt = async (context, questions, answers) => {
const response = await fetch(`${API_BASE_URL}/generate-final-prompt`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ context, questions, answers }),
});
return response.json();
};
export const processInvitations = async (file, prompt) => {
const formData = new FormData();
formData.append('file', file);
formData.append('prompt', prompt);
const response = await fetch(`${API_BASE_URL}/process-invitations`, {
method: 'POST',
body: formData,
});
return response.json();
};
export const updateSession = async (sessionData) => {
const response = await fetch(`${API_BASE_URL}/session`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(sessionData),
});
return response.json();
}; |