Sha256: f613041254fa4b2e89b1ea1ce8a22e612a062c766095c13a8516ff43304e3482

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

class SlackSmartBot
  module AI
    module OpenAI
      def self.send_image_edit(open_api_client, image, message, size: "")
        #todo: add size personal settings
        require "openai"
        user = Thread.current[:user]

        if size == ""
          response = open_ai_client.images.edit(parameters: { image: image, prompt: message })
        else
          response = open_api_client.images.edit(parameters: { image: image, prompt: message, size: size })
        end
        if !response.body.json(:message).empty?
          return false, "*OpenAI*: #{response.body.json(:message)}"
        else
          urls = [response.body.json(:url)].flatten
          return true, urls
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.14.2 lib/slack/smart-bot/ai/open_ai/send_image_edit.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/ai/open_ai/send_image_edit.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/ai/open_ai/send_image_edit.rb