Skip to content

Instantly share code, notes, and snippets.

@cicloid
Created February 11, 2023 23:33
Show Gist options
  • Save cicloid/637cea7059da9d2c455c9a83688a2817 to your computer and use it in GitHub Desktop.
Save cicloid/637cea7059da9d2c455c9a83688a2817 to your computer and use it in GitHub Desktop.
Simple snippet for bettertouchtool and GPT on demand on MacOS

Quick instructions

  • Go to openai.com
  • Replace AQUI-VA-EL-TOKEN with your TOKEN.
  • Map in better touch tool
  • ?
  • Profit!11!!!!!!!!
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