Spaces:
Runtime error
Runtime error
| // 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(); | |
| }; |