
459 Views
40 Executions
Does it work?
No reports yetNo reports yet. Tried it? Be the first to say.
Also noticed:
Description
THIS SCEIPT IS STILL IN BETA
-- =========================
-- WINDOWS-13 STYLE CHATGPT
-- MOVEABLE GUI + CLOSE BUTTON
-- WINDOWS-STYLE TEXT BAR
-- ONE FILE ONLY (main.lua)
-- =========================
local http = require("socket.http")
local ltn12 = require("ltn12")
local json = require("dkjson")
local OPENAI = os.getenv("OPENAI_API_KEY")
local win = {
x = 100, y = 100,
w = 350, h = 230,
dragging = false,
show = true
}
local inputText = ""
local responseText = ""
function ai_query(prompt)
local body = json.encode({
model = "gpt-4o-mini",
messages = { { role = "user", content = prompt } }
})
local r = {}
local _, code = http.request{
url = "https://api.openai.com/v1/chat/completions",
method = "POST",
headers = {
["Content-Type"] = "application/json",
["Content-Length"] = tostring(#body),
["Authorization"] = "Bearer " .. OPENAI
},
source = ltn12.source.string(body),
sink = ltn12.sink.table(r)
Comments
0Log in to join the conversation. Login
No comments yet. Be the first!





