feat: add APIMart AI generation and guided Studio onboarding

This commit is contained in:
Clintchiz committed 2026-10-19 13:47:33 +05:30
1 parent 9a6a2e0a8d
commit 60467a4c05
9 files changed
+455 -2

No files matched your search

+16
View File
@@ -32,9 +32,15 @@ try {
"/design-studio/",
"/design-studio/studio.js",
"/design-studio/studio.css",
"/design-studio/site-help.js",
]) {
const response = await fetch(origin + path);
if (!response.ok) throw Error(`${path} returned ${response.status}`);
if (
path === "/design-studio/" &&
!(await response.clone().text()).includes("How to use Design Studio")
)
throw Error("Studio's usage guide was not included in the compiled app.");
const policy = response.headers.get("content-security-policy") ?? "";
if (path === "/" && !policy.includes("require-trusted-types-for"))
throw Error(
@@ -50,6 +56,16 @@ try {
const application = await (
await fetch(origin + "/design-studio/api/application")
).json();
const generation = await (
await fetch(origin + "/design-studio/api/generation")
).json();
if (
process.env.APIMART_API_KEY?.trim() &&
(generation.provider !== "APIMart" || generation.model !== "gpt-6-luna")
)
throw Error(
"The compiled app did not pick up its server-side AI configuration.",
);
if (application.enabled !== false)
throw Error("Hosted Studio must remain export-only.");
const preview = await fetch(origin + "/design-studio/api/preview", {