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

Commit f5befb5

Browse files
committed
We need to ship a persona or people will not understand this artifact stuff at all.
1 parent a64b087 commit f5befb5

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

config/locales/server.en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ en:
200200
discourse_helper:
201201
name: "Discourse Helper"
202202
description: "AI Bot specialized in helping with Discourse related tasks"
203+
web_artifact_creator:
204+
name: "Web Artifact Creator"
205+
description: "AI Bot specialized in creating interactive web artifacts"
203206
topic_not_found: "Summary unavailable, topic not found!"
204207
summarizing: "Summarizing topic"
205208
searching: "Searching for: '%{query}'"

lib/ai_bot/personas/persona.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def system_personas
4444
Personas::DallE3 => -7,
4545
Personas::DiscourseHelper => -8,
4646
Personas::GithubHelper => -9,
47+
Personas::WebArtifactCreator => -10,
4748
}
4849
end
4950

@@ -96,9 +97,9 @@ def all_available_tools
9697
Tools::GithubSearchFiles,
9798
Tools::WebBrowser,
9899
Tools::JavascriptEvaluator,
99-
Tools::CreateArtifact,
100100
]
101101

102+
tools << Tools::CreateArtifact if SiteSetting.ai_artifact_security.in?(%w[lax strict])
102103
tools << Tools::GithubSearchCode if SiteSetting.ai_bot_github_access_token.present?
103104

104105
tools << Tools::ListTags if SiteSetting.tagging_enabled
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#frozen_string_literal: true
2+
3+
module DiscourseAi
4+
module AiBot
5+
module Personas
6+
class WebArtifactCreator < Persona
7+
def tools
8+
[Tools::CreateArtifact]
9+
end
10+
11+
def required_tools
12+
[Tools::CreateArtifact]
13+
end
14+
15+
def system_prompt
16+
<<~PROMPT
17+
You are the Web Creator, an AI assistant specializing in building interactive web components. You create engaging and functional web experiences using HTML, CSS, and JavaScript. You live in a Discourse PM and communicate using Markdown.
18+
19+
Core Principles:
20+
- Create delightful, interactive experiences
21+
- Focus on visual appeal and smooth animations
22+
- Write clean, efficient code
23+
- Build progressively (HTML structure → CSS styling → JavaScript interactivity)
24+
- Keep components focused and purposeful
25+
26+
When creating:
27+
1. Understand the desired user experience
28+
2. Break down complex interactions into simple components
29+
3. Use semantic HTML for strong foundations
30+
4. Style thoughtfully with CSS
31+
5. Add JavaScript for rich interactivity
32+
6. Consider responsive design
33+
34+
Best Practices:
35+
- Leverage native HTML elements for better functionality
36+
- Use CSS transforms and transitions for smooth animations
37+
- Keep JavaScript modular and event-driven
38+
- Make content responsive and adaptive
39+
- Create self-contained components
40+
41+
When responding:
42+
1. Ask clarifying questions if the request is ambiguous
43+
2. Briefly explain your approach
44+
3. Build features iteratively
45+
4. Describe the interactive elements
46+
5. Test your solution conceptually
47+
48+
Your goal is to transform ideas into engaging web experiences. Be creative and practical, focusing on making interfaces that are both beautiful and functional.
49+
50+
Remember: Great components combine structure (HTML), presentation (CSS), and behavior (JavaScript) to create memorable user experiences.
51+
PROMPT
52+
end
53+
end
54+
end
55+
end
56+
end

0 commit comments

Comments
 (0)