Read the statement by Michael Teeuw here.
MMM-OpenAI What is the callback for images ?
-
Hi,
i can send a notification for ‘text’ and i can see the result on the MM.
But when i send a notification for ‘imag’ and see nothing on the MM.
But in the log, i can read a good url :[28.02.2023 00:59.02.944] [LOG] {
created: 1677542342,
data: [
{
url: ‘https://oaidalleapiprodscus.blob.core.windows.net/private/org-OMCKXueMYUmh0Sfdw9Odv0BZ/user-5523u5PxqhU1MaCbOrTW9at9/img-xr2UymCnLxsvAQJjj5YJug0E.png?st=2023-02-27T22%3A59%3A02Z&se=2023-02-28T00%3A59%3A02Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-02-27T21%3A40%3A28Z&ske=2023-02-28T21%3A40%3A28Z&sks=b&skv=2021-08-06&sig=mKPs1iAPHXtj/7n5NJsmCeL6K56OFT%2BryfwWoria8pI%3D’
}
]
}Here is my code ( i don’t know what to put in the callback !!!??) :
this.sendNotification('OPENAI_REQUEST', { method: 'IMAGE', request: { prompt: params[1], //'A photo of a bear enjoying honey.', response_format: 'url' }, stealth: true//, /*callback: (response) => { if (response) this.doSomething(response) }*/ })
-
@axel
You set ‘stealth’ to ‘true’, so default display will not work, and you should handle the response by yourself.
In the callback, you can play with the response. Or throw it to your module. What and how is your module’s work -
@axel
So… What do you want?-
Just showing the image result on the MM with the default MMM-OpenAI Display.
=> Just setstealth
tofalse
-
To use the image for your module
=> Handle or Make your logic for that in the callback.
For example, your module is a kind of wallpaper module for MM, and you want to use the image generated for it. I’ll assume your module already has
.changeBackground(url)
for that feature. In that case you can setcallback
like this.callback: (responseObj) => { //console.log('RESPONSED', responseObj) let url = responseObj.response.data[0].url this.changeBackground(url) }
-
-