mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-07 01:39:54 +00:00
Add support for versioned artifacts with improved diff handling * Add versioned artifacts support allowing artifacts to be updated and tracked - New `ai_artifact_versions` table to store version history - Support for updating artifacts through a new `UpdateArtifact` tool - Add version-aware artifact rendering in posts - Include change descriptions for version tracking * Enhance artifact rendering and security - Add support for module-type scripts and external JS dependencies - Expand CSP to allow trusted CDN sources (unpkg, cdnjs, jsdelivr, googleapis) - Improve JavaScript handling in artifacts * Implement robust diff handling system (this is dormant but ready to use once LLMs catch up) - Add new DiffUtils module for applying changes to artifacts - Support for unified diff format with multiple hunks - Intelligent handling of whitespace and line endings - Comprehensive error handling for diff operations * Update routes and UI components - Add versioned artifact routes - Update markdown processing for versioned artifacts Also - Tweaks summary prompt - Improves upload support in custom tool to also provide urls
28 lines
858 B
Ruby
28 lines
858 B
Ruby
# frozen_string_literal: true
|
|
class AiArtifactVersion < ActiveRecord::Base
|
|
belongs_to :ai_artifact
|
|
validates :html, length: { maximum: 65_535 }
|
|
validates :css, length: { maximum: 65_535 }
|
|
validates :js, length: { maximum: 65_535 }
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: ai_artifact_versions
|
|
#
|
|
# id :bigint not null, primary key
|
|
# ai_artifact_id :bigint not null
|
|
# version_number :integer not null
|
|
# html :string(65535)
|
|
# css :string(65535)
|
|
# js :string(65535)
|
|
# metadata :jsonb
|
|
# change_description :string
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_ai_artifact_versions_on_ai_artifact_id_and_version_number (ai_artifact_id,version_number) UNIQUE
|
|
#
|