Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
fix(v0.23.1): the video slot saves from the admin console + BYOK hints on AI failures
Ashiq Hussain Mir1b4fc9acf07c
diff --git a/src/app/api/admin/config/route.ts b/src/app/api/admin/config/route.tsindex 46902fe..bdc6fe4 100644--- a/src/app/api/admin/config/route.ts+++ b/src/app/api/admin/config/route.ts@@ -57,7 +57,11 @@ export const dynamic = 'force-dynamic'// v0.16.5 (A5) adds the stock section: { pexels?, pixabay? } keys// for the Photos AND Videos search rails — write-only, null clears,// env vars as fallback (the same precedence as every credential).-const SLOT_ORDER: AiSlot[] = ['text', 'vision', 'image', 'imageEdit']+// v0.22 (Wave 4): video joined the slot universe — it was missing here,+// so the sanitized GET never reported its resolution and the console's+// video row silently lost its saved binding on every reload (the save+// path itself was fine — validateSlots already accepted 'video').+const SLOT_ORDER: AiSlot[] = ['text', 'vision', 'image', 'imageEdit', 'video']function slotView(resolved: ResolvedSlot | null) {if (!resolved) return nulldiff --git a/src/components/editor/ImageAI.tsx b/src/components/editor/ImageAI.tsxindex c9cbff6..6e051a4 100644--- a/src/components/editor/ImageAI.tsx+++ b/src/components/editor/ImageAI.tsx@@ -112,10 +112,13 @@ async function runImageAI(// generations — the route's message already points at the local// tools that work on any image.const reason = r.code === 'SOURCE_NOT_EDITABLE' ? '' : providerReason(r.detail)+ // v0.23.1: provider failures often mean "no key on the slot" — a+ // nudge toward the user's own keys beats a dead end.+ const byokHint = " Tip: add your own AI key in Profile & AI keys (account menu) — it is used before this instance's providers."onDone(reason- ? `${r.error ?? 'The edit failed.'} — ${reason.slice(0, 220)}`- : (r.error ?? 'The edit failed. Please try again.'),+ ? `${r.error ?? 'The edit failed.'} — ${reason.slice(0, 220)}.${byokHint}`+ : `${r.error ?? 'The edit failed. Please try again.'}${byokHint}`,)return false}diff --git a/src/components/editor/apps/AIImageApp.tsx b/src/components/editor/apps/AIImageApp.tsxindex fd5e953..5962e68 100644--- a/src/components/editor/apps/AIImageApp.tsx+++ b/src/components/editor/apps/AIImageApp.tsx@@ -154,7 +154,16 @@ export function AIImageApp({ onClose }: AppPanelProps) {{busy ? 'Dreaming…' : 'Generate image'}</button>- {error && <p className="text-[11px] text-[#FF8095] mt-2.5">{error}</p>}+ {error && (+ <div className="mt-2.5">+ <p className="text-[11px] text-[#FF8095]">{error}</p>+ {/* v0.23.1: generation failures often mean "no key on the image slot" */}+ <p className="text-[10.5px] text-white/45 mt-1 leading-snug">+ Tip: add your own AI key in <span className="text-white/75 font-medium">Profile & AI keys</span> (account menu) — your key is used before this+ instance's providers.+ </p>+ </div>+ )}{busy && (<div className="mt-3 rounded-xl border border-white/10 bg-white/[0.03] aspect-square flex flex-col items-center justify-center gap-2">diff --git a/src/components/editor/apps/AssistantApp.tsx b/src/components/editor/apps/AssistantApp.tsxindex ef2238e..f752a29 100644--- a/src/components/editor/apps/AssistantApp.tsx+++ b/src/components/editor/apps/AssistantApp.tsx@@ -107,7 +107,9 @@ export function AssistantApp({ onClose }: AppPanelProps) {setTurns((ts) => [...ts, { role: 'assistant', content: data.reply!, actions: data.actions ?? [] }])} catch (e) {const message = e instanceof Error ? e.message : 'Something went wrong.'- setTurns((ts) => [...ts, { role: 'assistant', content: message }])+ // v0.23.1: assistant failures are often "no text-slot key" — nudge+ // toward the user's own providers instead of a dead end.+ setTurns((ts) => [...ts, { role: 'assistant', content: `${message}\n\nTip: add your own AI key in Profile & AI keys (account menu) — your key is used before this instance's providers.` }])} finally {setBusy(false)}diff --git a/src/components/editor/apps/MagicWriteApp.tsx b/src/components/editor/apps/MagicWriteApp.tsxindex 410854a..4cc10fa 100644--- a/src/components/editor/apps/MagicWriteApp.tsx+++ b/src/components/editor/apps/MagicWriteApp.tsx@@ -136,7 +136,16 @@ export function MagicWriteApp({ onClose }: AppPanelProps) {{busy ? 'Writing…' : 'Generate 3 options'}</button>- {error && <p className="text-[11px] text-[#FF8095] mt-2.5">{error}</p>}+ {error && (+ <div className="mt-2.5">+ <p className="text-[11px] text-[#FF8095]">{error}</p>+ {/* v0.23.1: text-slot failures often mean "no key" */}+ <p className="text-[10.5px] text-white/45 mt-1 leading-snug">+ Tip: add your own AI key in <span className="text-white/75 font-medium">Profile & AI keys</span> (account menu) — your key is used before this+ instance's providers.+ </p>+ </div>+ )}{options.length > 0 && (<div className="mt-3 space-y-1.5">diff --git a/src/components/editor/panels/AIVideoCard.tsx b/src/components/editor/panels/AIVideoCard.tsxindex 4a62324..5975777 100644--- a/src/components/editor/panels/AIVideoCard.tsx+++ b/src/components/editor/panels/AIVideoCard.tsx@@ -197,9 +197,17 @@ export function AIVideoCard() {)}{failed && (- <div className="mt-2.5 flex items-start gap-1.5 rounded-lg border border-red-400/30 bg-red-400/10 px-2.5 py-2 text-[11px] text-red-200">- <TriangleAlert size={12} className="mt-0.5 shrink-0" />- <span className="leading-snug">{failed}</span>+ <div className="mt-2.5">+ <div className="flex items-start gap-1.5 rounded-lg border border-red-400/30 bg-red-400/10 px-2.5 py-2 text-[11px] text-red-200">+ <TriangleAlert size={12} className="mt-0.5 shrink-0" />+ <span className="leading-snug">{failed}</span>+ </div>+ {/* v0.23.1: provider failures often mean "no key for this slot" —+ point people at their own profile keys before they give up */}+ <p className="mt-1.5 text-[10.5px] text-white/45 leading-snug">+ Tip: add your own AI key in <span className="text-white/75 font-medium">Profile & AI keys</span> (account menu) — your key is used before this+ instance's providers.+ </p></div>)}diff --git a/src/lib/admin/routes.test.ts b/src/lib/admin/routes.test.tsindex 750fe08..cb39463 100644--- a/src/lib/admin/routes.test.ts+++ b/src/lib/admin/routes.test.ts@@ -227,6 +227,30 @@ describe('PUT /api/admin/config × providers section (v0.16.2 A2)', () => {expect(upsertArg).toBeDefined()})+ it('the video slot round-trips — SLOT_ORDER regression (v0.22 Wave 4 / v0.23.1 fix)', async () => {+ // The sanitized GET built its per-slot resolution view from a hardcoded+ // list that missed 'video', so a saved video binding was dropped from+ // the console's view on reload (looked like "not saving"). The PUT path+ // always accepted it; this pins the GET echo too.+ dbMock.session.findUnique.mockResolvedValue(ADMIN_SESSION)+ dbMock.appConfig.findMany.mockResolvedValue([+ {+ key: 'ai.providers',+ value: {+ providers: [{ id: 'psora', label: 'Sora', baseUrl: 'https://sora.example/v1', apiKey: 'sk-video-secret-abcdef' }],+ slots: { video: { providerId: 'psora' } },+ },+ },+ ])+ const res = await configGet(req('http://localhost/api/admin/config'))+ expect(res.status).toBe(200)+ const body = (await res.json()) as {+ providers: { resolved: Record<string, { source: string; label: string | null } | null> }+ }+ expect(body.providers.resolved.video?.source).toBe('multi')+ expect(body.providers.resolved.video?.label).toBe('Sora')+ })+it('keeps a stored key when the payload omits it (write-only credential)', async () => {dbMock.session.findUnique.mockResolvedValue(ADMIN_SESSION)dbMock.appConfig.findMany.mockResolvedValue([