jenwwww Posted June 18, 2023 Share Posted June 18, 2023 I'm trying to use ChatGPT in my mod to plan behaviours of an AI character, which requires sending request to openai.com. However the lua environment doesn't have `socket` library. From a previous post (https://forums.kleientertainment.com/forums/topic/58269-thenet-and-establishing-connections/) it seems it's not allowed to make http request in the mod, but I'm not sure. Is it possible to install the socket library in the environment, or are there other available libraries to send requests? Or are there any other workarounds? Link to comment https://forums.kleientertainment.com/forums/topic/148550-how-can-i-make-http-request-in-a-mod/ Share on other sites More sharing options...
Philip. Posted July 8, 2023 Share Posted July 8, 2023 You can make requests using: TheSim:QueryServer(url [, callbackfn [, method [, encoded_data [, timeout]]]]) But this does only support GET and POST request methods and you can only modify the body of the request not the headers or anything else. So for authorization in the Open AI API you will have to use some kind of a proxy server. Link to comment https://forums.kleientertainment.com/forums/topic/148550-how-can-i-make-http-request-in-a-mod/#findComment-1647536 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now