Hi guys, I made a small Discord Bot with node.js, it is connecting to my channel. With /mind it should interact with the invokeAPI (localhost:9090) but it gives me some errors. I would share the code, just to ge tit done, its about 60 code lines yet. I could not find anything helpful in the documentation, but I might missed it.
#Connecting to localhost with my discord Bot
1 messages · Page 1 of 1 (latest)
What errors you getting?
its a very long error message, lets see if I can partially copy it
PS D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main> npm start
[email protected] start
node index.js
Logged in as Arty#7655!
Arty is connected to http://127.0.0.1:9090/images/generate
Error: Request failed with status code 405
at createError (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\Arbeitszimmer\Projekte\DiscordBot\Mind-Imager\main\node_modules\axios\lib\adapters\http.js:293:11)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [Function: httpAdapter],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json',
'User-Agent': 'axios/0.24.0',
'Content-Length': 33
},
method: 'post',
url: 'http://127.0.0.1:9090/images/generate',
data: '{"text":"a house","format":"png"}'
},
all in all, it says methood not allowed, I am calling it with post, its sending a message from my channel to the invokeAPI, thats where it is failing
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I guess you are using the old legacy http server?
I dont know, using the newest InvokeAI, its all working with ausbitbanks bot, just my own code fails. I need to know about the endpoints and with what commands invokeAI API works...could not find it yet
Oh, yeah there’s no http api with the current web server and no documentation. It’s only intended for the web ui. We are migrating to a documented api soon. Until then the web server is not supported for external consumption. You need to check with @compact harbor for how to use it or review the web server code. It’s all socket.io
allright, thanks for youre answer, so I was at least researching into the correct thing, I discovered that his .js opens up a websocket connection but was not able to integrate it into my simple 50 code line bot. Is there any API I can use? how about the dev cli mode or just the simple codeline?
Sorry, to be clear, you will indeed need to use websockets. Ideally, use the socket.io library. That is the API at the moment. The upcoming API uses HTTP with socket.io for event signaling (like generation progress and completion). We will be starting the migration in the next week or so. It’s a major effort so I can’t say when the new API will be available for you to use.
ah allright, maybe I wait with it, or I get to work, already working on it with socket.io, as I do not just want to copy the code from ausbit its a bit more complicated for me to solve it...:D
The new api will have documentation so it will be a lot easier to get things working with it
I mean, its no problem for me not having an API right now, testing it with the socket. Alternatively I would have to write my own core version of what invoke is, soooo, I am very happy you guys doing it 😄 😄