- Go to openai.com
- Replace
AQUI-VA-EL-TOKEN
with your TOKEN. - Map in better touch tool
- ?
- Profit!11!!!!!!!!
Created
February 11, 2023 23:33
-
-
Save cicloid/637cea7059da9d2c455c9a83688a2817 to your computer and use it in GitHub Desktop.
Simple snippet for bettertouchtool and GPT on demand on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async (clipboardContentString) => { | |
try { | |
const response = await fetch("https://api.openai.com/v1/completions", { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": "Bearer AQUI-VA-EL-TOKEN" | |
}, | |
body: JSON.stringify({ | |
model: "text-davinci-003", | |
prompt: `${clipboardContentString}.`, | |
temperature: 0, | |
max_tokens: 256 | |
}) | |
}); | |
const data = await response.json(); | |
const text = data.choices[0].text; | |
return `${clipboardContentString} ${text}`; | |
} catch (error) { | |
return "Error" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment