Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit e933f38

Browse files
committed
handle pr comment and restrict artifacts to staff by default
1 parent 665fec2 commit e933f38

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/models/ai_artifact.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
class AiArtifact < ActiveRecord::Base
44
belongs_to :user
55
belongs_to :post
6+
validates :html, length: { maximum: 65_535 }
7+
validates :css, length: { maximum: 65_535 }
8+
validates :js, length: { maximum: 65_535 }
69

710
def self.iframe_for(id)
811
<<~HTML

db/fixtures/ai_bot/603_bot_ai_personas.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
if !persona
66
persona = AiPersona.new
77
persona.id = id
8-
persona.allowed_group_ids = [Group::AUTO_GROUPS[:trust_level_0]]
8+
if persona_class == DiscourseAi::AiBot::Personas::WebArtifactCreator
9+
# this is somewhat sensitive, so we default it to staff
10+
persona.allowed_group_ids = [Group::AUTO_GROUPS[:staff]]
11+
else
12+
persona.allowed_group_ids = [Group::AUTO_GROUPS[:trust_level_0]]
13+
end
914
persona.enabled = true
1015
persona.priority = true if persona_class == DiscourseAi::AiBot::Personas::General
1116
end

0 commit comments

Comments
 (0)