-
Notifications
You must be signed in to change notification settings - Fork 0
/
noahgpt.js
54 lines (46 loc) · 1.32 KB
/
noahgpt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Made with PenguinBuilder 2.6
// use PenguinBuilder at "https://chickencuber.github.io/PenguinBuilder/"
(function(Scratch) {
const blocks = [];
const vars = {};
const menus = {};
const key = 'https://c.ai/c/SuGJTIu7niq55uscGvNj0-TJCleEsB2vNDgH_tsh7b4'
class Extension {
getInfo() {
return {
"id": "noahgpt",
"name": "noahgpt",
"color1": "#383838",
"blocks": blocks,
"menus": menus,
}
}
}
blocks.push({
opcode: "noahgpt_Block_prompt-noahgpt",
blockType: Scratch.BlockType.REPORTER,
text: "prompt [input] to noahgpt",
arguments: {
"input": {
type: Scratch.ArgumentType.STRING,
defaultValue: `how are you?`
},
},
disableMonitor: false
});
Extension.prototype["noahgpt_Block_prompt-noahgpt"] = function(args, util) {
const input = args.input
const localVars = {};
return Scratch.fetch(key, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Origin': 'https://c.ai/c/SuGJTIu7niq55uscGvNj0-TJCleEsB2vNDgH_tsh7b4',
'Referer': 'https://c.ai/c/SuGJTIu7niq55uscGvNj0-TJCleEsB2vNDgH_tsh7b4'
},
body: JSON.stringify({
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: input }],
},
Scratch.extensions.register(new Extension()),
})(Scratch)}