Skip to content

Commit

Permalink
[bin] Ask people to rummage before ideas
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwofford committed May 13, 2024
1 parent 92df1d9 commit 753f53f
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions public/bin/landing-new/gambling.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,24 @@ async function generateProjectIdea() {
document.querySelector('#generate-project-idea').classList.add('disabled')
document.querySelector('#project-idea').innerHTML = "<em>" + thinkingWords() + "..." + "</em>"
document.querySelector('#generate-project-idea').src = "https://cloud-80eg2m8id-hack-club-bot.vercel.app/0thinking_rac.png"
const res = await fetch('/api/bin/openai/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ parts: selectedParts })
})
const json = await res.json()
document.querySelector('#project-idea').innerHTML = json.recommendation
let text = ""
if (selectedParts.length == 0) {
text = "You need to rummage for some parts first!"
} else {
const res = await fetch('/api/bin/openai/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ parts: selectedParts })
})
const json = await res.json()
text = json.recommendation
}
document.querySelector('#project-idea').innerHTML = text
document.querySelector('#generate-project-idea').src = "https://cloud-cyo3pqn0f-hack-club-bot.vercel.app/0statement_rac.png"
document.querySelector('#generate-project-idea').classList.remove('disabled')
yap(json.recommendation)
yap(text)
}

function thinkingWords() {
Expand Down

0 comments on commit 753f53f

Please sign in to comment.