Skip to content

Commit

Permalink
tuning title suggestion and handling cases where ai fails to provide …
Browse files Browse the repository at this point in the history
…suggestions
  • Loading branch information
sam9116 committed Dec 8, 2024
1 parent dd701a1 commit e82c646
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Odyssey/SharePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ const SharePage = ({ concerts, userLocation, mapStyle, setPosterName, posterName
const newList = concerts.map(({ title, artist, location, date }) => ({ title, artist, date, venue: location.name, city: location.address }));
// now make a request and send it to open AI
var suggestions = await FetchName(newList);
setPosterNameSuggestions(suggestions.slice(1));
setPosterName(suggestions[0].title);
if (suggestions.length >= 1)
{
setPosterName(suggestions[0].title);
}
if (suggestions.length >= 2) {
setPosterNameSuggestions(suggestions.slice(1));
}
}
else
{
else {
setPosterName(posterNameSuggestions[0].title);
setPosterNameSuggestions(posterNameSuggestions=> posterNameSuggestions.slice(1));
setPosterNameSuggestions(posterNameSuggestions => posterNameSuggestions.slice(1));
}

};
Expand All @@ -48,7 +52,7 @@ const SharePage = ({ concerts, userLocation, mapStyle, setPosterName, posterName
InputProps={{ sx: { 'input': { textAlign: 'center', color: 'white' } } }}
value={posterName}
onChange={(e) => setPosterName(e.target.value)}
sx={{ flex: 1}} />
sx={{ flex: 1 }} />
<Button
color="primary"
onClick={GenerateTripTitle}
Expand Down

0 comments on commit e82c646

Please sign in to comment.