@paroicms/site-generator-plugin 0.31.3 → 0.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/dist/commands/execute-command.js +7 -6
- package/backend/dist/generator/lib/parse-llm-response.js +0 -3
- package/backend/dist/generator/llm-queries/invoke-message-guard.js +3 -3
- package/backend/dist/generator/llm-queries/invoke-new-site-analysis.js +6 -6
- package/backend/prompts/initial-1-analysis.md +88 -73
- package/backend/prompts/initial-2-fields.md +13 -11
- package/backend/prompts/message-guard.md +21 -23
- package/frontend/dist/frontend.css +1 -1
- package/frontend/dist/frontend.mjs +18 -18
- package/package.json +6 -7
|
@@ -45,18 +45,19 @@ export async function executeCommand(commandCtx, input) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
if (input.command === "createSiteSchema") {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
48
|
+
const guardResult = await invokeMessageGuard(ctx, input);
|
|
49
|
+
if ("success" in guardResult)
|
|
50
|
+
return guardResult;
|
|
51
51
|
return {
|
|
52
52
|
success: true,
|
|
53
53
|
result: await startInitialAnalysis(ctx, input),
|
|
54
|
+
detectedLanguage: guardResult.detectedLanguage,
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
if (input.command === "updateSiteSchema") {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
58
|
+
const guardResult = await invokeMessageGuard(ctx, input, { skipOutOfScopeCheck: true });
|
|
59
|
+
if ("success" in guardResult)
|
|
60
|
+
return guardResult;
|
|
60
61
|
return {
|
|
61
62
|
success: true,
|
|
62
63
|
result: await startUpdateSiteSchema(ctx, input),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { parse } from "yaml";
|
|
2
1
|
export function parseLlmResponseAsProperties(llmResponse, outputTags) {
|
|
3
2
|
const rawTags = parseLlmRawTags(llmResponse, outputTags.map((tag) => tag.tagName));
|
|
4
3
|
const map = new Map(rawTags.map((tag) => [tag.tagName, tag]));
|
|
@@ -107,8 +106,6 @@ function formatRawContent(rawContent, tag) {
|
|
|
107
106
|
if (!rawContent && optional)
|
|
108
107
|
return;
|
|
109
108
|
switch (format) {
|
|
110
|
-
case "yaml":
|
|
111
|
-
return parse(rawContent);
|
|
112
109
|
case "json":
|
|
113
110
|
return JSON.parse(rawContent);
|
|
114
111
|
case "markdown":
|
|
@@ -35,9 +35,9 @@ export async function invokeMessageGuard(ctx, input, { skipOutOfScopeCheck = fal
|
|
|
35
35
|
}
|
|
36
36
|
const rawReport = parseLlmResponseAsProperties(llmOutput.output, [
|
|
37
37
|
{
|
|
38
|
-
tagName: "
|
|
38
|
+
tagName: "guard_json",
|
|
39
39
|
key: "guard",
|
|
40
|
-
format: "
|
|
40
|
+
format: "json",
|
|
41
41
|
},
|
|
42
42
|
]);
|
|
43
43
|
const report = MessageGuardReportAT.assert(rawReport.guard);
|
|
@@ -48,7 +48,7 @@ export async function invokeMessageGuard(ctx, input, { skipOutOfScopeCheck = fal
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (report.valid)
|
|
51
|
-
return;
|
|
51
|
+
return { detectedLanguage: report.language };
|
|
52
52
|
await insertIssueEvent(ctx, {
|
|
53
53
|
eventType: "blockedByGuard",
|
|
54
54
|
llmTaskName: "guard",
|
|
@@ -87,9 +87,9 @@ async function invokeAnalysisStep1(ctx, input, stepHandle) {
|
|
|
87
87
|
}
|
|
88
88
|
const rawAnalysis = parseLlmResponseAsProperties(llmOutput.output, [
|
|
89
89
|
{
|
|
90
|
-
tagName: "
|
|
90
|
+
tagName: "website_properties_json",
|
|
91
91
|
key: "siteProperties",
|
|
92
|
-
format: "
|
|
92
|
+
format: "json",
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
tagName: "hierarchical_md",
|
|
@@ -97,9 +97,9 @@ async function invokeAnalysisStep1(ctx, input, stepHandle) {
|
|
|
97
97
|
format: "markdown",
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
tagName: "
|
|
100
|
+
tagName: "dictionary_json",
|
|
101
101
|
key: "dictionary",
|
|
102
|
-
format: "
|
|
102
|
+
format: "json",
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
tagName: "explanation_md",
|
|
@@ -154,9 +154,9 @@ siteSchema, stepHandle) {
|
|
|
154
154
|
}
|
|
155
155
|
const { assignedFields, unusedInformation } = parseLlmResponseAsProperties(llmOutput.output, [
|
|
156
156
|
{
|
|
157
|
-
tagName: "
|
|
157
|
+
tagName: "json_result",
|
|
158
158
|
key: "assignedFields",
|
|
159
|
-
format: "
|
|
159
|
+
format: "json",
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
162
|
tagName: "unused_information_md",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
You will be given a description of a website's structure. Your task is to **analyze** the website description, then you will generate three things:
|
|
2
2
|
|
|
3
|
-
1. A
|
|
3
|
+
1. A JSON object for website properties.
|
|
4
4
|
2. A Markdown bulleted list that represents the hierarchy of node types (routing documents, regular documents and parts) within the site.
|
|
5
|
-
3. A
|
|
5
|
+
3. A JSON object to describe each node type.
|
|
6
6
|
|
|
7
7
|
Here is the website description:
|
|
8
8
|
|
|
@@ -12,9 +12,9 @@ Here is the website description:
|
|
|
12
12
|
|
|
13
13
|
Notice: If the website description doesn't mention a _contact page_ and a _search page_, then append them by default as routing documents, children of the home page.
|
|
14
14
|
|
|
15
|
-
## Step 1 - Instructions for the website properties
|
|
15
|
+
## Step 1 - Instructions for the website properties JSON
|
|
16
16
|
|
|
17
|
-
In the first step, you are tasked to write global properties of the website as a
|
|
17
|
+
In the first step, you are tasked to write global properties of the website as a JSON object.
|
|
18
18
|
|
|
19
19
|
Provide the following website properties:
|
|
20
20
|
|
|
@@ -119,13 +119,13 @@ Here's an example of correct output using parts, and with the default contact an
|
|
|
119
119
|
|
|
120
120
|
When you have a choice, keep it simple. If the user lets you invent the site's structure, limit the site's sections to **2 main entries**. For example, a “news” routing document with a list of articles and categories, and a list of pages on the site's theme. Plus the usual contact and search pages.
|
|
121
121
|
|
|
122
|
-
## Step 3 - Instructions for the
|
|
122
|
+
## Step 3 - Instructions for the dictionary JSON
|
|
123
123
|
|
|
124
|
-
In the third step, you are tasked to produce a
|
|
124
|
+
In the third step, you are tasked to produce a JSON object that describes every node type and list of parts identified in the hierarchical markdown.
|
|
125
125
|
|
|
126
|
-
Guidelines for creating the
|
|
126
|
+
Guidelines for creating the dictionary JSON:
|
|
127
127
|
|
|
128
|
-
- Use
|
|
128
|
+
- Use JSON syntax.
|
|
129
129
|
- Keys: each key is the name of a node type or the name of a list of parts.
|
|
130
130
|
- If the same type is reused several times, then write only one entry in this dictionnary.
|
|
131
131
|
- Values contains the properties. For a node type, provide the following properties:
|
|
@@ -147,74 +147,89 @@ Guidelines for creating the dictionnary YAML:
|
|
|
147
147
|
Here is an example of expected output:
|
|
148
148
|
|
|
149
149
|
<correct_example>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
150
|
+
{
|
|
151
|
+
"home": {
|
|
152
|
+
"confidence": 1,
|
|
153
|
+
"kind": "routingDocument",
|
|
154
|
+
"entryPage": true,
|
|
155
|
+
"label": "Home page",
|
|
156
|
+
"description": "This is the home page of the website."
|
|
157
|
+
},
|
|
158
|
+
"homeSections": {
|
|
159
|
+
"confidence": 0.9,
|
|
160
|
+
"kind": "partList",
|
|
161
|
+
"label": "Sections",
|
|
162
|
+
"description": "This list contains the main sections of the home page."
|
|
163
|
+
},
|
|
164
|
+
"homeSection": {
|
|
165
|
+
"confidence": 0.7,
|
|
166
|
+
"kind": "part",
|
|
167
|
+
"label": "Section",
|
|
168
|
+
"description": "A home section is a sub-part of the home page."
|
|
169
|
+
},
|
|
170
|
+
"pages": {
|
|
171
|
+
"confidence": 0.9,
|
|
172
|
+
"kind": "routingDocument",
|
|
173
|
+
"label": "Pages",
|
|
174
|
+
"description": "This is the document for grouping all pages."
|
|
175
|
+
},
|
|
176
|
+
"page": {
|
|
177
|
+
"confidence": 0.9,
|
|
178
|
+
"kind": "regularDocument",
|
|
179
|
+
"temporal": false,
|
|
180
|
+
"label": "Page",
|
|
181
|
+
"description": "..."
|
|
182
|
+
},
|
|
183
|
+
"pageSections": {
|
|
184
|
+
"confidence": 0.9,
|
|
185
|
+
"kind": "partList",
|
|
186
|
+
"label": "Sections",
|
|
187
|
+
"description": "..."
|
|
188
|
+
},
|
|
189
|
+
"pageSection": {
|
|
190
|
+
"confidence": 0.8,
|
|
191
|
+
"kind": "part",
|
|
192
|
+
"label": "Section",
|
|
193
|
+
"description": "..."
|
|
194
|
+
}
|
|
195
|
+
}
|
|
187
196
|
</correct_example>
|
|
188
197
|
|
|
189
198
|
Here is how to specify posts with a "tags" taxonomy:
|
|
190
199
|
|
|
191
200
|
<correct_example>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
201
|
+
{
|
|
202
|
+
"news": {
|
|
203
|
+
"confidence": 1,
|
|
204
|
+
"kind": "routingDocument",
|
|
205
|
+
"entryPage": true,
|
|
206
|
+
"label": "News",
|
|
207
|
+
"description": "This is the blog section of the website. The news document contains all the topical posts."
|
|
208
|
+
},
|
|
209
|
+
"post": {
|
|
210
|
+
"confidence": 0.8,
|
|
211
|
+
"kind": "regularDocument",
|
|
212
|
+
"temporal": true,
|
|
213
|
+
"jsonLdType": "Article",
|
|
214
|
+
"label": "Post",
|
|
215
|
+
"description": "A topical post about the subject of the website whatever it is.",
|
|
216
|
+
"prompt": "Add a labeling field using the tags taxonomy (allow multiple tags)"
|
|
217
|
+
},
|
|
218
|
+
"tags": {
|
|
219
|
+
"confidence": 0.9,
|
|
220
|
+
"kind": "routingDocument",
|
|
221
|
+
"taxonomy": true,
|
|
222
|
+
"label": "Tags",
|
|
223
|
+
"description": "Tags taxonomy for post documents."
|
|
224
|
+
},
|
|
225
|
+
"tag": {
|
|
226
|
+
"confidence": 0.9,
|
|
227
|
+
"kind": "regularDocument",
|
|
228
|
+
"temporal": false,
|
|
229
|
+
"label": "Tag",
|
|
230
|
+
"description": "A tag is a term in the tags taxonomy."
|
|
231
|
+
}
|
|
232
|
+
}
|
|
218
233
|
</correct_example>
|
|
219
234
|
|
|
220
235
|
Note the `prompt` property in the `post` type: in this way, tags can be assigned to a post.
|
|
@@ -227,11 +242,11 @@ Before providing your final answer, use the scratchpad to organize your thoughts
|
|
|
227
242
|
[Use this space to analyze the website description, identify node types, and plan the hierarchy]
|
|
228
243
|
</scratchpad>
|
|
229
244
|
|
|
230
|
-
Once you have organized your thoughts, provide the
|
|
245
|
+
Once you have organized your thoughts, provide the JSON for website properties (step 1) within <website_properties_json> tags.
|
|
231
246
|
|
|
232
247
|
Then, provide the mardown representing the website tree structure (step 2) within <hierarchical_md> tags.
|
|
233
248
|
|
|
234
|
-
Provide the node types properties (step 3) within <
|
|
249
|
+
Provide the node types properties (step 3) within <dictionary_json> tags.
|
|
235
250
|
|
|
236
251
|
Also, write a short explanation of your choices regarding the 3 steps, within <explanation_md> tags. Write the explanation in markdown and in the website description language. Your explanation message will be shown to the end-user as a message in a chat. The user will also see the website structure and its properties, so don't repeat descriptions, don't describe choices when they're obvious. Be as succinct as possible. If there is nothing valuable to say, then let this tag empty.
|
|
237
252
|
|
|
@@ -22,9 +22,9 @@ You are tasked of assigning predefined fields for each node type (routing docume
|
|
|
22
22
|
|
|
23
23
|
Create a key/value dictionnary. Keys are the node type names of the provided site schema. Value are arrays of field names.
|
|
24
24
|
|
|
25
|
-
Guidelines for creating the
|
|
25
|
+
Guidelines for creating the dictionary JSON:
|
|
26
26
|
|
|
27
|
-
- Use
|
|
27
|
+
- Use JSON syntax.
|
|
28
28
|
- All the node types must have a key in your result.
|
|
29
29
|
- If there is no need of a field for a node type, then leave an empty array.
|
|
30
30
|
- Documents and parts already contains a _publish date_ and a _draft_ flag.
|
|
@@ -39,16 +39,18 @@ Guidelines for creating the dictionnary YAML:
|
|
|
39
39
|
Here is an example of expected output:
|
|
40
40
|
|
|
41
41
|
<correct_example>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
{
|
|
43
|
+
"_site": ["logo", "footerMention[@paroicms/tiptap-editor-plugin]"],
|
|
44
|
+
"home": ["gallery", "introduction[@paroicms/tiptap-editor-plugin]"],
|
|
45
|
+
"posts": ["introduction[@paroicms/tiptap-editor-plugin]"],
|
|
46
|
+
"searchPage": [],
|
|
47
|
+
"contactPage": ["introduction[@paroicms/tiptap-editor-plugin]"],
|
|
48
|
+
"regularDocumentExemple1": ["gallery", "htmlContent[@paroicms/tiptap-editor-plugin]"],
|
|
49
|
+
"partExemple2": ["title", "image", "htmlContent[@paroicms/tiptap-editor-plugin]"],
|
|
50
|
+
"aBlogPostExample": ["gallery", "leadParagraph[@paroicms/tiptap-editor-plugin]", "htmlContent[@paroicms/tiptap-editor-plugin]"]
|
|
51
|
+
}
|
|
50
52
|
</correct_example>
|
|
51
53
|
|
|
52
|
-
Provide the
|
|
54
|
+
Provide the JSON result within <json_result> tags. Do not write any explanation or commentary outside the tags.
|
|
53
55
|
|
|
54
56
|
Additionally, write within <unused_information_md> tags the information from the user instructions that you weren't able to use here, in the form of a short prompt, in markdown format. Do not invent anything. Do not imagine anything. If there is no remaining information, then let this tag empty.
|
|
@@ -33,9 +33,9 @@ Here is the user request:
|
|
|
33
33
|
{{message}}
|
|
34
34
|
</user_message>
|
|
35
35
|
|
|
36
|
-
# The output format in
|
|
36
|
+
# The output format in JSON
|
|
37
37
|
|
|
38
|
-
Generate your evaluation as a
|
|
38
|
+
Generate your evaluation as a JSON object. It contains:
|
|
39
39
|
|
|
40
40
|
- `language`: The language used in <website_description>, as a two-letters code. Return this key only if you are sure.
|
|
41
41
|
- `valid`: A boolean value.
|
|
@@ -49,35 +49,33 @@ Generate your evaluation as a YAML object. It contains:
|
|
|
49
49
|
|
|
50
50
|
Examples of outputs:
|
|
51
51
|
|
|
52
|
-
```
|
|
53
|
-
language: en
|
|
54
|
-
valid: true
|
|
52
|
+
```json
|
|
53
|
+
{ "language": "en", "valid": true }
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
explanation: We can't implement online shop.
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"language": "en",
|
|
59
|
+
"valid": false,
|
|
60
|
+
"causes": ["technicalLimits"],
|
|
61
|
+
"explanation": "We can't implement online shop."
|
|
62
|
+
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
```
|
|
66
|
-
valid: false
|
|
67
|
-
causes:
|
|
68
|
-
- noSense
|
|
65
|
+
```json
|
|
66
|
+
{ "valid": false, "causes": ["noSense"] }
|
|
69
67
|
```
|
|
70
68
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"language": "en",
|
|
72
|
+
"valid": false,
|
|
73
|
+
"causes": ["rude", "outOfScope"]
|
|
74
|
+
}
|
|
77
75
|
```
|
|
78
76
|
|
|
79
77
|
Notice: no need of explanation if the user message is rude.
|
|
80
78
|
|
|
81
|
-
Provide the
|
|
79
|
+
Provide the JSON object within <guard_json> tags.
|
|
82
80
|
|
|
83
|
-
Just return the
|
|
81
|
+
Just return the JSON. Do not include any other explanation or commentary outside these tags.
|