Capstone-DayScape / dayscape-backend

Repository for the backend of the DayScape project for the 2024 CSC 490 Senior Capstone
0 stars 0 forks source link

Add preferences_to_types llm API method #17

Closed wrycode closed 5 days ago

wrycode commented 5 days ago

I confirmed that it works with the frontend. I'm still leaving it up to you guys how to design the API.js file, but for reference the test function I used was this:

const getTypes = async (accessToken, callback) => {
    try {
    const response = await fetch(config.backend_endpoint + '/api/private/preferences_to_types', {
      method: 'POST',
      headers: {
          'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
      },
    body: JSON.stringify({ input_list: ['food', 'alcohol', 'family friendly'] })
    });
      const data = await response.json();
      console.log("Data response form API: ", data)
    callback(data);
  } catch (error) {
    console.error('Error:', error);
  }
};