MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-OpenAI What is the callback for images ?

    Scheduled Pinned Locked Moved Productivity
    4 Posts 2 Posters 573 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      axel
      last edited by

      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)
                          }*/
                        })
      
      M 2 Replies Last reply Reply Quote 0
      • M Offline
        MMRIZE @axel
        last edited by MMRIZE

        @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

        1 Reply Last reply Reply Quote 0
        • M Offline
          MMRIZE @axel
          last edited by MMRIZE

          @axel
          So… What do you want?

          1. Just showing the image result on the MM with the default MMM-OpenAI Display.
            => Just set stealth to false

          2. 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 set callback like this.

          callback: (responseObj) => {
            //console.log('RESPONSED', responseObj)
            let url = responseObj.response.data[0].url
            this.changeBackground(url)
          }
          
          1 Reply Last reply Reply Quote 0
          • A Offline
            axel
            last edited by

            @MMRIZE said in MMM-OpenAI What is the callback for images ?:

            stealth

            ok thanks , it works now.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy