Skip to content

Commit dfa5344

Browse files
committed
fixed prompt
1 parent f3fbe3b commit dfa5344

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

components/ui/airwayscomponents/pickMyDestinationModal.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const [recsGiven, setRecsGiven] = useState(false);
2525
const [destinations, setDestinations] = useState<Array<any>>([]);
2626
const [loading, setLoading] = useState(false);
2727
const prompt =
28-
"give me three recommendations of places to travel based on popular travel destinations, strongly consider weather conditions at the time of the request, and any unique characteristics that would appeal to the average traveler. Try to be creative and choose different spots every time I ask. Only respond using JSON format with the keys 'name' and 'reason', it should be an array of 3 JSON objects returned, limiting each response to 50 characters or less";
28+
"give me three recommendations of places to travel based on popular travel destinations, strongly consider weather conditions at the time of the request, and any unique characteristics that would appeal to the average traveler. Try to be creative and choose different spots every time I ask. Only respond using JSON format with the keys 'name' and 'reason', it should be an array of 3 JSON objects returned, limiting each response to 50 characters or less and 'name' should only contain the name of the destination.";
2929

3030
async function getDestinations () {
3131
try {
@@ -36,8 +36,9 @@ const prompt =
3636
body: JSON.stringify({ prompt: prompt}),
3737
});
3838
const data = await response.json()
39-
console.log(JSON.parse(data));
40-
setDestinations(JSON.parse(data))
39+
const formattedData = JSON.parse(data)
40+
setDestinations(formattedData)
41+
console.log(destinations)
4142

4243
}
4344
catch {
@@ -54,8 +55,10 @@ const prompt =
5455

5556
useEffect(() => {
5657
console.log("useEffect triggered")
58+
if (!destinations) {
5759
setDestinations(destinations)
58-
},[loading])
60+
}
61+
},[recsGiven])
5962

6063
return (
6164
<AlertDialog>

0 commit comments

Comments
 (0)