mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-09 23:53:29 +00:00
This commit enhances the AI image generation functionality by adding support for: 1. OpenAI's GPT-based image generation model (gpt-image-1) 2. Image editing capabilities through the OpenAI API 3. A new "Designer" persona specialized in image generation and editing 4. Two new AI tools: CreateImage and EditImage Technical changes include: - Renaming `ai_openai_dall_e_3_url` to `ai_openai_image_generation_url` with a migration - Adding `ai_openai_image_edit_url` setting for the image edit API endpoint - Refactoring image generation code to handle both DALL-E and the newer GPT models - Supporting multipart/form-data for image editing requests * wild guess but maybe quantization is breaking the test sometimes this increases distance * Update lib/personas/designer.rb Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com> * simplify and de-flake code * fix, in chat we need enough context so we know exactly what uploads a user uploaded. * Update lib/personas/tools/edit_image.rb Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com> * cleanup downloaded files right away * fix implementation --------- Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
24 lines
537 B
Ruby
24 lines
537 B
Ruby
# frozen_string_literal: true
|
|
class MoveDallEUrl < ActiveRecord::Migration[7.2]
|
|
def up
|
|
execute <<~SQL
|
|
UPDATE site_settings
|
|
SET name = 'ai_openai_image_generation_url'
|
|
WHERE name = 'ai_openai_dall_e_3_url'
|
|
AND NOT EXISTS (
|
|
SELECT 1
|
|
FROM site_settings
|
|
WHERE name = 'ai_openai_image_generation_url')
|
|
SQL
|
|
|
|
execute <<~SQL
|
|
DELETE FROM site_settings
|
|
WHERE name = 'ai_openai_dall_e_3_url'
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|