fix(custom-widgets): simplify error sharing
This commit is contained in:
10 files changed
+65
-115
No files matched your search
@@ -64,26 +64,6 @@ export function buildCustomWidgetAiPrompt(
|
||||
return embeddedSkill ? prompt : prompt.slice(0, 8_000);
|
||||
}
|
||||
|
||||
export function buildCustomWidgetFixPrompt(input: {
|
||||
currentConfig: Partial<HomarrCustomWidgetV2> | Record<string, unknown>;
|
||||
request?: string | null;
|
||||
documentationUrl?: string | null;
|
||||
diagnostics: string;
|
||||
journal: unknown;
|
||||
}) {
|
||||
const sections = [AUTHORING_PROMPT];
|
||||
if (input.documentationUrl) sections.push(`API documentation: ${redactUrl(input.documentationUrl)}`);
|
||||
sections.push(`Original request: ${redactText(input.request?.trim() || "Fix the current widget.")}`);
|
||||
sections.push(`Current widget:\n\n\`\`\`json\n${JSON.stringify(redactValue(input.currentConfig), null, 2)}\n\`\`\``);
|
||||
sections.push(
|
||||
`Validation diagnostics:\n\n\`\`\`text\n${redactText(input.diagnostics) || "No static diagnostics."}\n\`\`\``,
|
||||
);
|
||||
sections.push(
|
||||
`Redacted request journal:\n\n\`\`\`json\n${JSON.stringify(redactValue(input.journal), null, 2)}\n\`\`\``,
|
||||
);
|
||||
return sections.join("\n\n");
|
||||
}
|
||||
|
||||
const sensitiveKey =
|
||||
/(^|[-_])(authorization|api[-_]?keys?|passwords?|passwds?|secrets?|tokens?|access[-_]?tokens?|refresh[-_]?tokens?|client[-_]?secrets?)($|[-_])/iu;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Create one widget at a time. Repeat the workflow when the user asks for several
|
||||
- Include responsive loading, empty, error, and success states.
|
||||
- Keep actions explicit, permission-scoped, confirmed when destructive, and followed by targeted invalidation.
|
||||
|
||||
Read [references/schema.md](references/schema.md), [references/runtime.md](references/runtime.md), and [references/security.md](references/security.md) before offline authoring. When connected, prefer live resources because installed Mantine components can differ by Homarr release.
|
||||
When connected through MCP, use the live schema, component, example, and skill resources. If live resources are unavailable, follow this document and the authoring prompt; do not assume access to repository-relative files.
|
||||
`;
|
||||
|
||||
export function getCustomWidgetSkill() {
|
||||
|
||||
Reference in new issue
Block a user