@paroicms/site-generator-plugin 0.1.0
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/README.md +9 -0
- package/gen-backend/dist/context.js +2 -0
- package/gen-backend/dist/data-format.js +37 -0
- package/gen-backend/dist/generator/actions.js +35 -0
- package/gen-backend/dist/generator/fake-content-generator.ts/create-database-with-fake-content.js +227 -0
- package/gen-backend/dist/generator/fake-content-generator.ts/create-node-contents.js +156 -0
- package/gen-backend/dist/generator/fake-content-generator.ts/fake-content-types.js +1 -0
- package/gen-backend/dist/generator/fake-content-generator.ts/generate-fake-content.js +127 -0
- package/gen-backend/dist/generator/fake-content-generator.ts/invoke-generate-fake-content.js +49 -0
- package/gen-backend/dist/generator/generator-types.js +1 -0
- package/gen-backend/dist/generator/helpers/esm-module.helper.js +6 -0
- package/gen-backend/dist/generator/helpers/js-utils.js +14 -0
- package/gen-backend/dist/generator/lib/common-types.js +1 -0
- package/gen-backend/dist/generator/lib/create-prompt.js +44 -0
- package/gen-backend/dist/generator/lib/debug-utils.js +118 -0
- package/gen-backend/dist/generator/lib/images-lib.js +16 -0
- package/gen-backend/dist/generator/lib/llm-invoke-types.js +1 -0
- package/gen-backend/dist/generator/lib/llm-tokens.js +10 -0
- package/gen-backend/dist/generator/lib/markdown-bulleted-list-parser.js +147 -0
- package/gen-backend/dist/generator/lib/parse-llm-response.js +160 -0
- package/gen-backend/dist/generator/lib/tasks.js +112 -0
- package/gen-backend/dist/generator/lib/utils.js +13 -0
- package/gen-backend/dist/generator/llm-queries/invoke-message-guard.js +86 -0
- package/gen-backend/dist/generator/llm-queries/invoke-new-site-analysis.js +169 -0
- package/gen-backend/dist/generator/llm-queries/invoke-update-site-schema.js +94 -0
- package/gen-backend/dist/generator/site-generator/common-template-creator.js +108 -0
- package/gen-backend/dist/generator/site-generator/document-template-creator.js +329 -0
- package/gen-backend/dist/generator/site-generator/id-key-provider.js +14 -0
- package/gen-backend/dist/generator/site-generator/jt-site-schema-helpers.js +55 -0
- package/gen-backend/dist/generator/site-generator/site-generator.js +75 -0
- package/gen-backend/dist/generator/site-generator/template-creator-types.js +1 -0
- package/gen-backend/dist/generator/site-generator/template-helpers.js +26 -0
- package/gen-backend/dist/generator/site-generator/theme-creator.js +180 -0
- package/gen-backend/dist/generator/site-generator/theme-css.js +323 -0
- package/gen-backend/dist/generator/site-schema-generator/analysis-types.js +1 -0
- package/gen-backend/dist/generator/site-schema-generator/create-l10n.js +42 -0
- package/gen-backend/dist/generator/site-schema-generator/create-site-schema.js +240 -0
- package/gen-backend/dist/generator/site-schema-generator/default-pages.js +38 -0
- package/gen-backend/dist/plugin.js +86 -0
- package/gen-backend/prompts/0-context.md +9 -0
- package/gen-backend/prompts/generate-fake-content-multiple.md +22 -0
- package/gen-backend/prompts/generate-fake-content-single.md +16 -0
- package/gen-backend/prompts/message-guard.md +89 -0
- package/gen-backend/prompts/new-site-1-analysis.md +214 -0
- package/gen-backend/prompts/new-site-2-fields.md +50 -0
- package/gen-backend/prompts/predefined-fields.json +110 -0
- package/gen-backend/prompts/test-message1.txt +1 -0
- package/gen-backend/prompts/update-site-schema-1-write-details.md +57 -0
- package/gen-backend/prompts/update-site-schema-2-execute.md +77 -0
- package/gen-front/dist/gen-front.css +1 -0
- package/gen-front/dist/gen-front.eot +0 -0
- package/gen-front/dist/gen-front.mjs +998 -0
- package/gen-front/dist/gen-front.svg +345 -0
- package/gen-front/dist/gen-front.ttf +0 -0
- package/gen-front/dist/gen-front.woff +0 -0
- package/gen-front/dist/gen-front.woff2 +0 -0
- package/gen-front/dist/gen-front2.woff2 +0 -0
- package/gen-front/dist/gen-front3.woff2 +0 -0
- package/package.json +79 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ChatAnthropic } from "@langchain/anthropic";
|
|
2
|
+
import { ChatMistralAI } from "@langchain/mistralai";
|
|
3
|
+
import { strVal } from "@paroi/data-formatters-lib";
|
|
4
|
+
import { pathExists } from "@paroicms/internal-server-lib";
|
|
5
|
+
import { escapeHtml } from "@paroicms/public-server-lib";
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { projectDir } from "./context.js";
|
|
9
|
+
import { formatGeneratorCommand, formatGeneratorPluginConfiguration } from "./data-format.js";
|
|
10
|
+
import { executeCommand } from "./generator/actions.js";
|
|
11
|
+
import { initializeImageNames } from "./generator/lib/images-lib.js";
|
|
12
|
+
const packageDir = dirname(projectDir);
|
|
13
|
+
const version = strVal(JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8")).version);
|
|
14
|
+
await initializeImageNames();
|
|
15
|
+
const plugin = {
|
|
16
|
+
version,
|
|
17
|
+
slug: "site-generator",
|
|
18
|
+
async siteInit(service) {
|
|
19
|
+
const pluginConf = formatGeneratorPluginConfiguration(service.pluginConf);
|
|
20
|
+
let debugDir = pluginConf.debugDir;
|
|
21
|
+
if (debugDir) {
|
|
22
|
+
if (!(await pathExists(debugDir))) {
|
|
23
|
+
service.logger.warn(`[generator] Debug directory (debugDir) doesn't exist: ${debugDir}`);
|
|
24
|
+
debugDir = undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const goodModel = new ChatAnthropic({
|
|
28
|
+
modelName: "claude-3-7-sonnet-20250219",
|
|
29
|
+
anthropicApiKey: pluginConf.anthropicApiKey,
|
|
30
|
+
temperature: 0.2,
|
|
31
|
+
// maxTokens: 50_000,
|
|
32
|
+
});
|
|
33
|
+
// const cheapModel = new ChatAnthropic({
|
|
34
|
+
// modelName: "claude-3-5-haiku-20241022",
|
|
35
|
+
// anthropicApiKey: pluginConf.anthropicApiKey,
|
|
36
|
+
// temperature: 0.6,
|
|
37
|
+
// maxTokens: 50_000,
|
|
38
|
+
// });
|
|
39
|
+
const cheapModel = new ChatMistralAI({
|
|
40
|
+
modelName: "ministral-8b-2410", // ministral-8b-2410
|
|
41
|
+
apiKey: pluginConf.mistralApiKey,
|
|
42
|
+
temperature: 0.2,
|
|
43
|
+
maxTokens: 50_000,
|
|
44
|
+
});
|
|
45
|
+
service.setPublicAssetsDirectory(join(packageDir, "gen-front", "dist"));
|
|
46
|
+
service.addHeadTag(`<link rel="stylesheet" href="${escapeHtml(`${service.pluginAssetsUrl}/gen-front.css`)}">`, `<script type="module" src="${escapeHtml(`${service.pluginAssetsUrl}/gen-front.mjs`)}"></script>`);
|
|
47
|
+
service.setPublicApiHandler(async (service, req, res, relativePath) => {
|
|
48
|
+
if (relativePath !== "") {
|
|
49
|
+
res.status(404).send({ status: 404 });
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const ctx = {
|
|
53
|
+
pluginConf,
|
|
54
|
+
service,
|
|
55
|
+
logger: service.logger,
|
|
56
|
+
goodModel,
|
|
57
|
+
goodModelName: goodModel.model,
|
|
58
|
+
cheapModel,
|
|
59
|
+
cheapModelName: cheapModel.model,
|
|
60
|
+
debugDir,
|
|
61
|
+
};
|
|
62
|
+
let command;
|
|
63
|
+
try {
|
|
64
|
+
command = formatGeneratorCommand(req.body);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
res.status(400).send({ status: 400, message: error.message });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const result = await executeCommand(ctx, command);
|
|
72
|
+
const buf = Buffer.from(JSON.stringify(result), "utf-8");
|
|
73
|
+
res.status(200);
|
|
74
|
+
res.append("Content-Type", "application/json");
|
|
75
|
+
res.append("Content-Length", buf.byteLength.toString());
|
|
76
|
+
res.send(buf);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
service.logger.error("Error while executing command:", error);
|
|
80
|
+
const response = { success: false };
|
|
81
|
+
res.status(500).send(response);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export default plugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
We use **ParoiCMS** technology. With this technology, a web page is called a **document**. A website is a tree of documents. The home page is a document, the site section with news posts is a document, each post is a document. Each document has its own path in the URL.
|
|
2
|
+
|
|
3
|
+
There is a special kind of documents that we want to detect: **routing documents** are the site sections. They can't be duplicated. They are never items of a list. For example, the homepage document, the search-page document, the "about us" document, the parent page of blog posts are _routing documents_. Other documents are **regular documents**, and they are always items of a list.
|
|
4
|
+
|
|
5
|
+
A document always has the following base attributes: a localized _title_, a _publish date_, an optional _featured image_, and a _draft_ flag. Additionally, a sequence of **fields** can be defined.
|
|
6
|
+
|
|
7
|
+
A document can contain lists of **parts**. A _part_ is a sub-section of a document, or of another _part_. A part always has a _publish date_ and a _draft_ flag. It may contain a sequence of fields and/or a sequence of child parts. A part is always an item of a list.
|
|
8
|
+
|
|
9
|
+
Important: In the current version, we don't support any taxonomy. No categories, no tags etc.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Generate the text content of **{count}** different web pages.
|
|
2
|
+
|
|
3
|
+
All the produced texts must be in **{language}**.
|
|
4
|
+
|
|
5
|
+
The web pages in question are of type: **{typeLabel}** ({typeDescription}).
|
|
6
|
+
|
|
7
|
+
For the context, the website's theme is: "{siteTheme}".
|
|
8
|
+
|
|
9
|
+
Make sure web pages are distinct from each other by:
|
|
10
|
+
|
|
11
|
+
- Cover different aspects in line with the type of web pages;
|
|
12
|
+
- Using varied writing styles;
|
|
13
|
+
- Having different lengths within the specified range.
|
|
14
|
+
|
|
15
|
+
Guidelines:
|
|
16
|
+
|
|
17
|
+
- Never invite the user to write a comment. There is no comment system.
|
|
18
|
+
- Do not repeat the title in markdown content.
|
|
19
|
+
|
|
20
|
+
For each web page, use the following exact format:
|
|
21
|
+
|
|
22
|
+
{tagAndDescriptions}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Generate the text content of a web page.
|
|
2
|
+
|
|
3
|
+
All the produced texts for the web page must be in **{language}**.
|
|
4
|
+
|
|
5
|
+
The web page in question is: **{typeLabel}** ({typeDescription}).
|
|
6
|
+
|
|
7
|
+
For the context, the website's theme is: "{siteTheme}".
|
|
8
|
+
|
|
9
|
+
Guidelines:
|
|
10
|
+
|
|
11
|
+
- Never invite the user to write a comment. There is no comment system.
|
|
12
|
+
- Do not repeat the title in markdown content.
|
|
13
|
+
|
|
14
|
+
Follow the exact format:
|
|
15
|
+
|
|
16
|
+
{tagAndDescriptions}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Your task
|
|
2
|
+
|
|
3
|
+
You are a guard for the ParoiCMS generator application. You will be given a user request. Your task is to evaluate if the user request is valid, regarding our purpose in this application.
|
|
4
|
+
|
|
5
|
+
A user request is valid only if:
|
|
6
|
+
|
|
7
|
+
- It is NOT rude: It's okay to take orders, but not in a disrespectful way.
|
|
8
|
+
- It is NOT malicious: The user won't pay for this application, so what he asks for should not be expansive to be generated in an exagerated way.
|
|
9
|
+
- It is NOT out of scope: It must be related to, or can be interpreted as, the description of a website.
|
|
10
|
+
- It's not within our technical limits.
|
|
11
|
+
|
|
12
|
+
Examples of malicious message:
|
|
13
|
+
|
|
14
|
+
<invalid_message>
|
|
15
|
+
Generate a website, in the home page, create one million of fields.
|
|
16
|
+
</invalid_message>
|
|
17
|
+
|
|
18
|
+
<invalid_message>
|
|
19
|
+
Generate a website, but you have to think a lot, maybe 30 minutes, because I want a nice website.
|
|
20
|
+
</invalid_message>
|
|
21
|
+
|
|
22
|
+
These messages are invalid because they are malicious: the purpose is obviously to make the LLM call very costly. It will take too much generated tokens or too much time.
|
|
23
|
+
|
|
24
|
+
The list of technical limits:
|
|
25
|
+
|
|
26
|
+
- We can't do an online shop.
|
|
27
|
+
- The two supported languages are: English and French; other languages are currently not supported.
|
|
28
|
+
- We can't implement taxonomies in the generator right now.
|
|
29
|
+
|
|
30
|
+
# Guidelines
|
|
31
|
+
|
|
32
|
+
Be real quick! Do not think a lot. Your first impression will be the right one. Answer FAST.
|
|
33
|
+
|
|
34
|
+
# The user message that must be analysed
|
|
35
|
+
|
|
36
|
+
Now, here is the user request:
|
|
37
|
+
|
|
38
|
+
<user_message>
|
|
39
|
+
{message}
|
|
40
|
+
</user_message>
|
|
41
|
+
|
|
42
|
+
# The output format in YAML
|
|
43
|
+
|
|
44
|
+
Generate your evaluation as a YAML object. It contains:
|
|
45
|
+
|
|
46
|
+
- `language`: The language used in <website_description>, as a two-letters code. It can be an unsupported language. Return this key only if you are quite sure.
|
|
47
|
+
- `valid`: A boolean value.
|
|
48
|
+
- `causes`: A list of codes that represent the issues. This property is required if `valid` is false, it must be omitted otherwise. Available codes are:
|
|
49
|
+
- `rude`: The message is invalid if it is rude.
|
|
50
|
+
- `malicious`: The message is invalid if it try to generate something malicious.
|
|
51
|
+
- `outOfScope`: The message is invalid if it is not about generating a website.
|
|
52
|
+
- `technicalLimits`: The message is invalid if it request a website that we can't do.
|
|
53
|
+
- `noSense`: The message is invalid if we can't understand it.
|
|
54
|
+
- `explanation`: A short message that will be displayed to the user when its message is invalid. This property is optional if `valid` is false, it must be omitted otherwise. The message must be written in the user language.
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
|
|
58
|
+
<output_example>
|
|
59
|
+
language: en
|
|
60
|
+
valid: true
|
|
61
|
+
</output_example>
|
|
62
|
+
|
|
63
|
+
<output_example>
|
|
64
|
+
language: en
|
|
65
|
+
valid: false
|
|
66
|
+
causes:
|
|
67
|
+
- technicalLimits
|
|
68
|
+
explanation: I'm very sorry, currently we can't implement online shop.
|
|
69
|
+
</output_example>
|
|
70
|
+
|
|
71
|
+
<output_example>
|
|
72
|
+
valid: false
|
|
73
|
+
causes:
|
|
74
|
+
- noSense
|
|
75
|
+
</output_example>
|
|
76
|
+
|
|
77
|
+
<output_example>
|
|
78
|
+
language: en
|
|
79
|
+
valid: false
|
|
80
|
+
causes:
|
|
81
|
+
- rude
|
|
82
|
+
- outOfScope
|
|
83
|
+
</output_example>
|
|
84
|
+
|
|
85
|
+
Notice: no need of explanation if the user message is rude.
|
|
86
|
+
|
|
87
|
+
Provide the YAML properties within <guard_yaml> tags.
|
|
88
|
+
|
|
89
|
+
Just return the YAML. Do not include any other explanation or commentary outside these tags.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
You will be given a description of a website's structure. Your task is to generate three things:
|
|
2
|
+
|
|
3
|
+
1. A YAML for website properties.
|
|
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 YAML key/value dictionnary to describe each node type.
|
|
6
|
+
|
|
7
|
+
Here is the website description:
|
|
8
|
+
|
|
9
|
+
<website_description>
|
|
10
|
+
{message}
|
|
11
|
+
</website_description>
|
|
12
|
+
|
|
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
|
+
|
|
15
|
+
## Step 1 - Instructions for the website properties YAML.
|
|
16
|
+
|
|
17
|
+
In the first step, you are tasked to write global properties of the website as a YAML.
|
|
18
|
+
|
|
19
|
+
Provide the following website properties:
|
|
20
|
+
|
|
21
|
+
- language: The language used in <website_description>, as a two-letters code. This is the website language.
|
|
22
|
+
- title: The website title, in the _website language_.
|
|
23
|
+
- theme: A description (5-40 words) that can be used as a tooltip to explain the main theme and/or purpose of the website. Write it in the _website language_.
|
|
24
|
+
|
|
25
|
+
In the following, we will refer to the term **website language** when we need it.
|
|
26
|
+
|
|
27
|
+
## Step 2 - Instructions for the hierarchical bulleted list
|
|
28
|
+
|
|
29
|
+
For this second step, follow these instructions for creating the bullet list:
|
|
30
|
+
|
|
31
|
+
1. Carefully read and analyze the website description.
|
|
32
|
+
2. Identify the main documents and parts of the website.
|
|
33
|
+
- Notice: Children are part of the definition of a node type. When 2 node types appear identical, but their children types are not the same, then they are 2 different node types and they should have 2 different names.
|
|
34
|
+
3. Determine the hierarchical relationships between documents and parts.
|
|
35
|
+
4. Create a tree structure using a limited Markdown format to represent the website's tree structure.
|
|
36
|
+
|
|
37
|
+
Guidelines for creating the hierarchical bullet list:
|
|
38
|
+
|
|
39
|
+
- Write in English.
|
|
40
|
+
- But, if the website description is not in English: do not translate book or post titles.
|
|
41
|
+
- Use a Markdown syntax. Indent with 2 spaces. Use indentation to show parent-child relationships between node types.
|
|
42
|
+
- Always include a homepage with key `home` at the top level.
|
|
43
|
+
- When you define an identifier for a node type name or a list name, use camel case and follow the identifier syntax of JavaScript.
|
|
44
|
+
- Use `contactPage` as the default type name for contact page, and `searchPage` for the search page.
|
|
45
|
+
- Bullet point format for a _routing document_:
|
|
46
|
+
- Start with a **bullet** (*).
|
|
47
|
+
- Write the **type name** within backquotes.
|
|
48
|
+
- End with `(routing document)`.
|
|
49
|
+
- Bullet point format for a list of _regular documents_:
|
|
50
|
+
- Start with a **bullet** (*).
|
|
51
|
+
- Write `"list of"`, and then the **type name** within backquotes.
|
|
52
|
+
- End with `(regular documents)`.
|
|
53
|
+
- Bullet point format for a list of _parts_:
|
|
54
|
+
- Start with a **bullet** (*).
|
|
55
|
+
- Write `"list of"`, and then the **type name** within backquotes.
|
|
56
|
+
- Append `(parts)`.
|
|
57
|
+
- Add a coma, then write: `"list name:"` and append an identifier for the list name.
|
|
58
|
+
- Each distinct node type must have a unique name through the whole tree structure.
|
|
59
|
+
- Reusing the same node type several times (for recursivity etc.):
|
|
60
|
+
- When the same node type is reused as a child in several places, then write its children only on the first occurence.
|
|
61
|
+
|
|
62
|
+
Here's an example of a correct output:
|
|
63
|
+
|
|
64
|
+
<correct_example>
|
|
65
|
+
* `home` (routing document)
|
|
66
|
+
* `pages` (routing document)
|
|
67
|
+
* list of `page` (regular documents)
|
|
68
|
+
</correct_example>
|
|
69
|
+
|
|
70
|
+
Here's an example of an incorrect output:
|
|
71
|
+
|
|
72
|
+
<incorrect_example>
|
|
73
|
+
* `home` (routing document)
|
|
74
|
+
* `pages` (regular document)
|
|
75
|
+
* list of `page` (regular documents)
|
|
76
|
+
</incorrect_example>
|
|
77
|
+
|
|
78
|
+
This incorrect example fails because the `pages` node type can't be a single regular document. Regular documents are always items in a list.
|
|
79
|
+
|
|
80
|
+
Here is another incorrect example:
|
|
81
|
+
|
|
82
|
+
<incorrect_example>
|
|
83
|
+
* `home` (routing document)
|
|
84
|
+
* `animals`
|
|
85
|
+
* `pages` (regular document)
|
|
86
|
+
* list of `page` (regular documents)
|
|
87
|
+
* `vegetals`
|
|
88
|
+
* `pages` (regular document)
|
|
89
|
+
* list of `page` (regular documents)
|
|
90
|
+
</incorrect_example>
|
|
91
|
+
|
|
92
|
+
This incorrect example fails because the children of `pages` node should not be written the second time we use this node type. Here is how to fix that:
|
|
93
|
+
|
|
94
|
+
<correct_example>
|
|
95
|
+
* `home` (routing document)
|
|
96
|
+
* `animals`
|
|
97
|
+
* `pages` (regular document)
|
|
98
|
+
* list of `page` (regular documents)
|
|
99
|
+
* `vegetals`
|
|
100
|
+
* `pages` (regular document)
|
|
101
|
+
</correct_example>
|
|
102
|
+
|
|
103
|
+
Notice: the `pages` node will have the same child types for both usage. But we describe them only the first time it appears on the tree.
|
|
104
|
+
|
|
105
|
+
Here's an example of correct output using parts, and with the default contact and search pages:
|
|
106
|
+
|
|
107
|
+
<correct_example>
|
|
108
|
+
* `home` (routing document)
|
|
109
|
+
* list of `homeSection` (parts), list name: `homeSections`
|
|
110
|
+
* `news` (routing document)
|
|
111
|
+
* list of `article` (regular documents)
|
|
112
|
+
* `pages` (routing document)
|
|
113
|
+
* list of `page` (regular documents)
|
|
114
|
+
* list of `pageSection` (parts), list name: `pageSections`
|
|
115
|
+
* `contactPage` (routing document)
|
|
116
|
+
* `searchPage` (routing document)
|
|
117
|
+
</correct_example>
|
|
118
|
+
|
|
119
|
+
## Step 3 - Instructions for the dictionnary YAML.
|
|
120
|
+
|
|
121
|
+
In the third step, you are tasked to produce a YAML that describes every node type and list of parts identified in the hierarchical YAML.
|
|
122
|
+
|
|
123
|
+
Guidelines for creating the dictionnary YAML:
|
|
124
|
+
|
|
125
|
+
- Use a YAML syntax: pay attention to the indentation.
|
|
126
|
+
- Keys: each key is the name of a node type or the name of a list of parts.
|
|
127
|
+
- Values contains the properties. For a node type, provide the following properties:
|
|
128
|
+
- confidence: Your confidence level for the accuracy of this node type (0.0-1.0).
|
|
129
|
+
- kind: Can be `routingDocument`, `regularDocument`, `part`.
|
|
130
|
+
- entryPage: A Boolean indicating whether this is one of the very few first pages the visitor lands on (optional, routing document only).
|
|
131
|
+
- temporal: A boolean to indicate if there is a temporal nature for this type of node (optional, regular document only).
|
|
132
|
+
- ogType: (optional, and document only) If you think of a particular Open-Graph type for this document, give it here.
|
|
133
|
+
- label: A label of the node type, in the _website language_.
|
|
134
|
+
- description: A description (5-40 words) for describing the purpose and theme of the node type. Write it in the _website language_.
|
|
135
|
+
- For a list type (only for part list, never for document list), provide the following properties:
|
|
136
|
+
- confidence: Your confidence level for the accuracy of this node type (0.0-1.0).
|
|
137
|
+
- kind: Must be `partList`.
|
|
138
|
+
- label: A label of the list type, in the _website language_.
|
|
139
|
+
- description: A description (5-40 words) for describing the purpose and theme of the list type. Write it in the _website language_.
|
|
140
|
+
|
|
141
|
+
Here is an example of expected output:
|
|
142
|
+
|
|
143
|
+
<correct_example>
|
|
144
|
+
home:
|
|
145
|
+
confidence: 1
|
|
146
|
+
kind: routingDocument
|
|
147
|
+
entryPage: true
|
|
148
|
+
label: Home page
|
|
149
|
+
description: This is the home page of the website.
|
|
150
|
+
homeSections:
|
|
151
|
+
confidence: 0.9
|
|
152
|
+
kind: partList
|
|
153
|
+
label: Sections
|
|
154
|
+
description: This list contains the main sections of the home page.
|
|
155
|
+
homeSection:
|
|
156
|
+
confidence: 0.7
|
|
157
|
+
kind: part
|
|
158
|
+
label: Section
|
|
159
|
+
description: A home section is a sub-part of the home page.
|
|
160
|
+
news:
|
|
161
|
+
confidence: 1
|
|
162
|
+
kind: routingDocument
|
|
163
|
+
entryPage: true
|
|
164
|
+
label: News
|
|
165
|
+
description: This is the blog section of the website. The news document contains all the topical articles.
|
|
166
|
+
article:
|
|
167
|
+
confidence: 0.8
|
|
168
|
+
kind: regularDocument
|
|
169
|
+
temporal: true
|
|
170
|
+
ogType: article
|
|
171
|
+
label: Article
|
|
172
|
+
description: A topical article about the subject of the website whatever it is.
|
|
173
|
+
pages:
|
|
174
|
+
confidence: 0.9
|
|
175
|
+
kind: routingDocument
|
|
176
|
+
label: Pages
|
|
177
|
+
description: This is the document for grouping all pages.
|
|
178
|
+
page:
|
|
179
|
+
confidence: 0.9
|
|
180
|
+
kind: regularDocument
|
|
181
|
+
temporal: false
|
|
182
|
+
label: Page
|
|
183
|
+
description: ...
|
|
184
|
+
pageSections:
|
|
185
|
+
confidence: 0.9
|
|
186
|
+
kind: partList
|
|
187
|
+
label: Sections
|
|
188
|
+
description: ...
|
|
189
|
+
pageSection:
|
|
190
|
+
confidence: 0.8
|
|
191
|
+
kind: part
|
|
192
|
+
label: Section
|
|
193
|
+
description: ...
|
|
194
|
+
</correct_example>
|
|
195
|
+
|
|
196
|
+
# Producing outputs
|
|
197
|
+
|
|
198
|
+
Before providing your final answer, use the scratchpad to organize your thoughts and plan the structure:
|
|
199
|
+
|
|
200
|
+
<scratchpad>
|
|
201
|
+
[Use this space to analyze the website description, identify node types, and plan the hierarchy]
|
|
202
|
+
</scratchpad>
|
|
203
|
+
|
|
204
|
+
Once you have organized your thoughts, provide the first YAML for website properties (step 1) within <website_properties_yaml> tags.
|
|
205
|
+
|
|
206
|
+
Then, provide the mardown representing the website tree structure (step 2) within <hierarchical_md> tags.
|
|
207
|
+
|
|
208
|
+
Provide the node types properties (step 3) within <dictionary_yaml> tags.
|
|
209
|
+
|
|
210
|
+
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.
|
|
211
|
+
|
|
212
|
+
Finally, extract and rephrase within <unused_information_md> tags the information from the site description that you weren't able to use in the previous elements, in the form of a short prompt, in markdown format. Do not invent anything. Do not imagine anything. If you used every valuable information, then let this tag empty.
|
|
213
|
+
|
|
214
|
+
Do not include any other explanation or commentary outside these tags.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
You are tasked of assigning predefined fields for each node type (routing document, regular document, or part).
|
|
2
|
+
|
|
3
|
+
1. Look at the list of available predefined fields (in JSON format):
|
|
4
|
+
|
|
5
|
+
<predefined_fields_json>
|
|
6
|
+
{predefinedFields}
|
|
7
|
+
</predefined_fields_json>
|
|
8
|
+
|
|
9
|
+
2. Examine the current site schema, which conforms to the `JtSiteSchema` type:
|
|
10
|
+
|
|
11
|
+
<site_schema_json>
|
|
12
|
+
{siteSchemaJson}
|
|
13
|
+
</site_schema_json>
|
|
14
|
+
|
|
15
|
+
3. Check if there are instructions about fields in these user instructions:
|
|
16
|
+
|
|
17
|
+
<user_request>
|
|
18
|
+
{message}
|
|
19
|
+
</user_request>
|
|
20
|
+
|
|
21
|
+
4. Now, here is what to do:
|
|
22
|
+
|
|
23
|
+
Create a key/value dictionnary. Keys are the node type names of the provided site schema. Value are arrays of field names.
|
|
24
|
+
|
|
25
|
+
Guidelines for creating the dictionnary YAML:
|
|
26
|
+
|
|
27
|
+
- Use a YAML syntax.
|
|
28
|
+
- All the node types must have a key in your result.
|
|
29
|
+
- If there is no need of a field for a node type, then leave an empty array.
|
|
30
|
+
- Documents and parts already contains a _publish date_ and a _draft_ flag.
|
|
31
|
+
- A document already contains a _title_ and a _featured image_, but a part doesn't. That's why the predefined `title` field can be used on part types when needed.
|
|
32
|
+
- Default values:
|
|
33
|
+
- By default, for most of node types, if you are not sure about what could be the best fields, then remember that a document is a webpage and just use a `[htmlContent]`.
|
|
34
|
+
- Except if there are specific instructions in the website description, here is the default value for the `_site` node type: `["logo", "footerMention"]`.
|
|
35
|
+
|
|
36
|
+
Here is an example of expected output:
|
|
37
|
+
|
|
38
|
+
<correct_example>
|
|
39
|
+
_site: [logo, footerMention]
|
|
40
|
+
home: [htmlContent]
|
|
41
|
+
searchPage: []
|
|
42
|
+
contactPage: ["introduction"]
|
|
43
|
+
regularDocumentExemple1: [gallery, htmlContent]
|
|
44
|
+
partExemple2: [title, image, htmlContent]
|
|
45
|
+
aBlogPostExample: [leadParagraph, htmlContent]
|
|
46
|
+
</correct_example>
|
|
47
|
+
|
|
48
|
+
Provide the YAML result within <yaml_result> tags. Do not write any explanation or commentary outside the tags.
|
|
49
|
+
|
|
50
|
+
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.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"fieldName": "leadParagraph",
|
|
4
|
+
"dataType": "quillDelta",
|
|
5
|
+
"localized": true,
|
|
6
|
+
"description": "Lead paragraph, or \"chapo\", of a post (HTML)"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"fieldName": "htmlContent",
|
|
10
|
+
"dataType": "quillDelta",
|
|
11
|
+
"localized": true,
|
|
12
|
+
"description": "HTML Content"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"fieldName": "introduction",
|
|
16
|
+
"dataType": "quillDelta",
|
|
17
|
+
"localized": true,
|
|
18
|
+
"description": "A short introduction (HTML)"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"fieldName": "footerMention",
|
|
22
|
+
"dataType": "quillDelta",
|
|
23
|
+
"localized": true,
|
|
24
|
+
"description": "The footer mention is used to display a legal notice or a disclaimer (HTML). Usually included as a site field."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"fieldName": "logo",
|
|
28
|
+
"dataType": "media",
|
|
29
|
+
"localized": false,
|
|
30
|
+
"description": "A logo is an image that represents a brand"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"fieldName": "slogan",
|
|
34
|
+
"dataType": "string",
|
|
35
|
+
"localized": true,
|
|
36
|
+
"description": "A slogan is a memorable motto or phrase as a repetitive expression of an idea or purpose"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"fieldName": "phone",
|
|
40
|
+
"dataType": "string",
|
|
41
|
+
"localized": false,
|
|
42
|
+
"description": "Phone number"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"fieldName": "phone2",
|
|
46
|
+
"dataType": "string",
|
|
47
|
+
"localized": false,
|
|
48
|
+
"description": "Secondary phone number"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"fieldName": "title",
|
|
52
|
+
"dataType": "string",
|
|
53
|
+
"localized": true,
|
|
54
|
+
"description": "Store a title"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"fieldName": "shortTitle",
|
|
58
|
+
"dataType": "string",
|
|
59
|
+
"localized": true,
|
|
60
|
+
"description": "A short title can be useful for buttons or menu items"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"fieldName": "gallery",
|
|
64
|
+
"dataType": "gallery",
|
|
65
|
+
"localized": false,
|
|
66
|
+
"description": "A collection of images. It can be used to create a gallery, a slider or a carousel."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"fieldName": "image",
|
|
70
|
+
"dataType": "media",
|
|
71
|
+
"localized": false,
|
|
72
|
+
"description": "An image"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"fieldName": "backgroundImage",
|
|
76
|
+
"dataType": "media",
|
|
77
|
+
"localized": false,
|
|
78
|
+
"description": "A background image"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"fieldName": "translatedImage",
|
|
82
|
+
"dataType": "media",
|
|
83
|
+
"localized": true,
|
|
84
|
+
"description": "Image that will be different depending on the language (localized)"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"fieldName": "featuredDocument",
|
|
88
|
+
"dataType": "string",
|
|
89
|
+
"localized": false,
|
|
90
|
+
"description": "A link to a featured document"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"fieldName": "phones",
|
|
94
|
+
"dataType": "json",
|
|
95
|
+
"localized": false,
|
|
96
|
+
"description": "A list of phone numbers"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"fieldName": "video",
|
|
100
|
+
"dataType": "string",
|
|
101
|
+
"localized": false,
|
|
102
|
+
"description": "A Youtube video"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"fieldName": "translatedVideo",
|
|
106
|
+
"dataType": "string",
|
|
107
|
+
"localized": true,
|
|
108
|
+
"description": "A Youtube video with translations"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Je souhaite créer un site web "Mon site personnel" qui contiendra une liste d'articles, ainsi qu'une section nommée "Moins Occidental", laquelle sera dédiée à un livre. Dans "Moins Occidental", il y aura les pages du livres, mais ces pages ne seront pas des pages web, elles seront plutôt des sous-sections et elles apparaîtront toutes dans la page web de "Moins Occidental". "Moins Occidental" contient aussi une liste de sous-pages web de critiques du livre.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
You are tasked with modifying a JSON object of a _site schema_, based on a given TypeScript type definition and an update message, and its localized labels. Follow these steps carefully:
|
|
2
|
+
|
|
3
|
+
1. Review the TypeScript type definition of the JSON structure:
|
|
4
|
+
|
|
5
|
+
<site_schema_ts_defs>
|
|
6
|
+
{siteSchemaTsDefs}
|
|
7
|
+
</site_schema_ts_defs>
|
|
8
|
+
|
|
9
|
+
2. Examine the current JSON data, which conforms to the `JtSiteSchema` type:
|
|
10
|
+
|
|
11
|
+
<site_schema_json>
|
|
12
|
+
{siteSchemaJson}
|
|
13
|
+
</site_schema_json>
|
|
14
|
+
|
|
15
|
+
Also, the attached localized labels:
|
|
16
|
+
|
|
17
|
+
<localized_labels_json>
|
|
18
|
+
{l10nJson}
|
|
19
|
+
</localized_labels_json>
|
|
20
|
+
|
|
21
|
+
3. Read the user message that describes the required changes:
|
|
22
|
+
|
|
23
|
+
<user_message>
|
|
24
|
+
{updateMessage}
|
|
25
|
+
</user_message>
|
|
26
|
+
|
|
27
|
+
4. When there is nothing to change
|
|
28
|
+
|
|
29
|
+
Evaluate wether the current schema already implements the update message. If there's nothing to do, provide an empty <task_details_md> tags and you're done.
|
|
30
|
+
|
|
31
|
+
5. When there are changes to do
|
|
32
|
+
|
|
33
|
+
Otherwise, if there is something to change, then rewrite the user's request as a detailed sequence of operations to be carried out one after the other.
|
|
34
|
+
|
|
35
|
+
Guidelines for reformulating into a detailed sequence of operations:
|
|
36
|
+
|
|
37
|
+
- All operations must be written in English.
|
|
38
|
+
- Write the list of operations as a bulleted list in Markdown format. Start each operation with the `*` character. And surround identifiers with backquotes.
|
|
39
|
+
- Operations will be executed sequentially, so they must be written in the order of execution.
|
|
40
|
+
- If the user's request is simple and doesn't need to be separated into several operations, write a list with a single operation.
|
|
41
|
+
- Describe each operation concisely in a few words.
|
|
42
|
+
- Make sure that the tree structure of node types is not broken. The `site` node is separate. Then, the root of the tree structure is the `home` routing document. Every other routing document type, regular document type, part type, must be the child of another node type.
|
|
43
|
+
|
|
44
|
+
Be the the less creative as possible. Follow the instructions. In particular:
|
|
45
|
+
|
|
46
|
+
- You are allowed to be proactive, but only when the user asks you to do something.
|
|
47
|
+
- Do not invent technical "fields" like sibling previous/next links. These are managed by the theme.
|
|
48
|
+
- Do not manage media policies unless the user ask specifically. There is a default one.
|
|
49
|
+
- Do not assume how works the CMS if you are not sure. Just use the provided information.
|
|
50
|
+
|
|
51
|
+
Provide the bullet list in Markdown within <task_details_md> tags.
|
|
52
|
+
|
|
53
|
+
6. Write an explanation
|
|
54
|
+
|
|
55
|
+
Also, write a short explanation of your choices, within <explanation_md> tags. Write the explanation in markdown and in the language of the update message. Your explanation message will be shown to the end-user.
|
|
56
|
+
|
|
57
|
+
Do not include any other explanation or commentary outside these tags.
|