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

Commit 21c044d

Browse files
committed
bug fixes and prompt optimisation
1 parent 29d7387 commit 21c044d

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

assets/javascripts/discourse/components/ai-artifact.gjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ export default class AiArtifactComponent extends Component {
3737
}
3838

3939
get artifactUrl() {
40-
const url = getURL(
40+
let url = getURL(
4141
`/discourse-ai/ai-bot/artifacts/${this.args.artifactId}`
4242
);
4343

4444
if (this.args.artifactVersion) {
45-
return `${url}?version=${this.args.artifactVersion}`;
46-
} else {
47-
return url;
45+
url = `${url}/${this.args.artifactVersion}`;
4846
}
47+
return url;
4948
}
5049

5150
@action

lib/ai_bot/tools/update_artifact.rb

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,26 @@ def self.signature
5151
{
5252
name: "update_artifact",
5353
description:
54-
"Updates an existing web artifact with new HTML, CSS, or JavaScript content.",
54+
"Updates an existing web artifact with new HTML, CSS, or JavaScript content. Note either html, css, or js MUST be provided. You may provide all three if desired.",
5555
parameters: [
5656
{
5757
name: "artifact_id",
5858
description: "The ID of the artifact to update",
5959
type: "integer",
6060
required: true,
6161
},
62-
{
63-
name: "html",
64-
description: "(Optional) new HTML content for the artifact",
65-
type: "string",
66-
},
67-
{
68-
name: "css",
69-
description: "(Optional) new CSS content for the artifact",
70-
type: "string",
71-
},
62+
{ name: "html", description: "new HTML content for the artifact", type: "string" },
63+
{ name: "css", description: "new CSS content for the artifact", type: "string" },
7264
{
7365
name: "js",
74-
description: "(Optional) new JavaScript content for the artifact",
66+
description: "new JavaScript content for the artifact",
7567
type: "string",
7668
},
7769
{
7870
name: "change_description",
79-
description: "A brief description of the changes being made",
71+
description:
72+
"A brief description of the changes being made. Note: This only documents the change - you must provide the actual content in html/css/js parameters to make changes.",
8073
type: "string",
81-
required: true,
8274
},
8375
],
8476
}
@@ -122,7 +114,7 @@ def invoke
122114
html: parameters[:html] || last_version&.html || artifact.html,
123115
css: parameters[:css] || last_version&.css || artifact.css,
124116
js: parameters[:js] || last_version&.js || artifact.js,
125-
change_description: parameters[:change_description],
117+
change_description: parameters[:change_description].to_s,
126118
)
127119

128120
update_custom_html(artifact, version)

0 commit comments

Comments
 (0)