Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("json") == false then
- shell.run("pastebin get 4nRg9CHU json")
- end
- if fs.exists("pf") == false then
- shell.run("pastebin get 2HXb06ic pf")
- end
- os.loadAPI("json")
- os.loadAPI("pf")
- local id = pf.getID()
- local prompt = "What would you like to ask ChatGPT?"
- local message = read(prompt)
- local data = {
- prompt = message,
- id = id
- }
- local jsonData = json.encode(data)
- local response = http.post("https://api.openai.com/v1/engines/davinci-codex/completions", jsonData, {
- ["Content-Type"] = "application/json",
- ["Authorization"] = "Bearer ".."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"
- })
- local responseJson = json.decode(response.readAll())
- local answer = responseJson.choices[1].text
- print(answer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement