CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.
TypeScript ai-agentsai-diagramai-presentationbomcadcanvasdiagramdiagram-generatordrawioflowchartinfographicspptppt-generatorpresentation-generatorreactsvgedittext-to-diagramtypescriptworkflow
fix(skill): validate the image provider in ppt-skill as cad-skill does
codingFeng1014e17e2a7323f
diff --git a/skill/ppt-skill/scripts/lib/gateway.mjs b/skill/ppt-skill/scripts/lib/gateway.mjsindex 531b381..ae80df7 100644--- a/skill/ppt-skill/scripts/lib/gateway.mjs+++ b/skill/ppt-skill/scripts/lib/gateway.mjs@@ -9,39 +9,6 @@ function joinUrl(baseUrl, endpoint) {return `${base}/${path.replace(/^\/+/, "")}`;}-function extractByPath(input, path) {- const normalized = String(path || "").trim();- if (!normalized) return input;- const tokens = normalized- .replace(/\[(\d+)\]/g, ".$1")- .split(".")- .map((token) => token.trim())- .filter(Boolean);- let current = input;- for (const token of tokens) {- if (current == null) return undefined;- current = current[token];- }- return current;-}--function applyTemplate(value, context) {- if (typeof value === "string") {- if (value.startsWith("$")) return context[value.slice(1)];- return value.replace(/\$([a-zA-Z0-9_]+)/g, (_, key) => {- const resolved = context[key];- return resolved == null ? "" : typeof resolved === "string" ? resolved : JSON.stringify(resolved);- });- }- if (Array.isArray(value)) return value.map((item) => applyTemplate(item, context));- if (value && typeof value === "object") {- const out = {};- for (const [key, item] of Object.entries(value)) out[key] = applyTemplate(item, context);- return out;- }- return value;-}-async function convertRemoteImageToDataUrl(url) {if (url.startsWith("data:image")) return url;const response = await fetch(url);diff --git a/skill/ppt-skill/scripts/lib/provider-registry.mjs b/skill/ppt-skill/scripts/lib/provider-registry.mjsindex 1ed0a0b..d15cd5b 100644--- a/skill/ppt-skill/scripts/lib/provider-registry.mjs+++ b/skill/ppt-skill/scripts/lib/provider-registry.mjs@@ -38,8 +38,8 @@ export function getDefaultBaseUrl(provider) {export function resolveImageRoute(channel) {const provider = String(channel.provider || "").toLowerCase();- if (provider === "custom") {- throw new Error("Custom image providers are not supported in ppt-skill.");+ if (!IMAGE_PROVIDER_OPTIONS.some((item) => item.id === provider)) {+ throw new Error(`Unsupported image provider: ${provider}`);}return {