@simmalugnt-se/payload-content-health 0.10.0 → 0.10.2
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/CHANGELOG.md +11 -0
- package/dist/assistant.d.ts +2 -0
- package/dist/assistant.js +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.2
|
|
4
|
+
|
|
5
|
+
- The assistant's findings name checks and categories as the work list does, in the editor's chat
|
|
6
|
+
language (with editor-assistant 0.17.0 or later): it said "orphan page" in Swedish, translating the
|
|
7
|
+
check's id, where the work list says "Inget länkar hit".
|
|
8
|
+
|
|
9
|
+
## 0.10.1
|
|
10
|
+
|
|
11
|
+
- Shorter instructions to the editor assistant: two rules the evals show it no longer needs are
|
|
12
|
+
removed.
|
|
13
|
+
|
|
3
14
|
## 0.10.0
|
|
4
15
|
|
|
5
16
|
- Links in globals: `globals: { header: { links: true }, footer: { links: true } }` checks every
|
package/dist/assistant.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export type AssistantExtensionContext = {
|
|
|
32
32
|
id?: string | number;
|
|
33
33
|
locale: string;
|
|
34
34
|
};
|
|
35
|
+
/** The editor's chat language (editor-assistant 0.17.0 or later); labels are given in it. */
|
|
36
|
+
language?: "sv" | "en";
|
|
35
37
|
};
|
|
36
38
|
export type AssistantExtensionResult = {
|
|
37
39
|
ok: true;
|
package/dist/assistant.js
CHANGED
|
@@ -47,8 +47,8 @@ export function assistantExtension({ scan: run = scanContentHealth, } = {}) {
|
|
|
47
47
|
id: EXTENSION_ID,
|
|
48
48
|
instructions: [
|
|
49
49
|
"Content health checks the site's content: SEO (meta titles, descriptions, share images, duplicates), structure (H1, heading levels, thin content, broken internal links, also in the header and footer, and pages nothing links to), translations (fields empty in a language) and accessibility (image alt texts).",
|
|
50
|
-
"When the editor asks what needs work, how the site or a page is doing, or what to fix first, call content-health.findings and answer from it, naming pages and problems.
|
|
51
|
-
'Each finding says how it is fixed: "batch" (many documents at once from the work list), "assistant" (on the document, with you) or "by hand". To start fixing, call content-health.open: with batch true for a batch check, else the work list. It takes the editor there; they start the fix and review each change themselves. Say where they are now ("The 9 missing alt texts are open; Fix 9 with the assistant starts them.")
|
|
50
|
+
"When the editor asks what needs work, how the site or a page is doing, or what to fix first, call content-health.findings and answer from it, naming pages and problems. Each finding's problem is the work list's name for it, in the editor's language when known: use it as it is.",
|
|
51
|
+
'Each finding says how it is fixed: "batch" (many documents at once from the work list), "assistant" (on the document, with you) or "by hand". To start fixing, call content-health.open: with batch true for a batch check, else the work list. It takes the editor there; they start the fix and review each change themselves. Say where they are now ("The 9 missing alt texts are open; Fix 9 with the assistant starts them."). Do not propose changes yourself for findings outside the open document. Do not mention findings the tool left out unless the editor asks for more.',
|
|
52
52
|
].join(" "),
|
|
53
53
|
views: [
|
|
54
54
|
{
|
|
@@ -97,7 +97,9 @@ export function assistantExtension({ scan: run = scanContentHealth, } = {}) {
|
|
|
97
97
|
],
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
async function findings(input, { req, open }, result) {
|
|
100
|
+
async function findings(input, { req, open, language }, result) {
|
|
101
|
+
// The work list's own names, in the editor's language, so the model need not translate them.
|
|
102
|
+
const names = language === "sv" ? "sv" : "en";
|
|
101
103
|
const custom = req.payload.config.admin?.custom;
|
|
102
104
|
const withAssistant = new Set(assistantCollections(custom));
|
|
103
105
|
const inBatches = new Set(batchCollections(custom));
|
|
@@ -126,7 +128,7 @@ async function findings(input, { req, open }, result) {
|
|
|
126
128
|
documentsNeedingAttention: countDocuments(result.findings),
|
|
127
129
|
categories: categoryStats(stats).map((stat) => ({
|
|
128
130
|
category: stat.category,
|
|
129
|
-
label: CATEGORY_LABELS
|
|
131
|
+
label: CATEGORY_LABELS[names][stat.category],
|
|
130
132
|
issues: stat.failing,
|
|
131
133
|
fieldsChecked: stat.checked,
|
|
132
134
|
})),
|
|
@@ -134,8 +136,8 @@ async function findings(input, { req, open }, result) {
|
|
|
134
136
|
scope: document ? "one document" : filtered ? "filtered" : "whole site",
|
|
135
137
|
findings: matching.slice(0, limit).map((finding) => ({
|
|
136
138
|
check: finding.check,
|
|
137
|
-
problem: CHECK_LABELS
|
|
138
|
-
detail: findingDetail(
|
|
139
|
+
problem: CHECK_LABELS[names][finding.check],
|
|
140
|
+
detail: findingDetail(names, finding),
|
|
139
141
|
collection: finding.collection,
|
|
140
142
|
id: finding.id,
|
|
141
143
|
...(finding.global ? { global: true } : {}),
|
package/package.json
CHANGED