fix(studio): keep AI provider and model details private

This commit is contained in:
Clintchiz committed 2026-10-19 23:20:50 +05:30
1 parent 5aec369054
commit 6d0c47fba7
5 files changed
+65 -51

No files matched your search

+7 -3
View File
@@ -61,6 +61,11 @@ try {
!(await response.clone().text()).includes("How to use Design Studio")
)
throw Error("Studio's usage guide was not included in the compiled app.");
if (
path.startsWith("/design-studio/") &&
/apimart|gpt-5-mini|gpt-6-luna/i.test(await response.clone().text())
)
throw Error("Public Studio content exposed private AI configuration.");
const policy = response.headers.get("content-security-policy") ?? "";
if (path === "/" && !policy.includes("require-trusted-types-for"))
throw Error(
@@ -103,9 +108,8 @@ try {
).json();
if (
process.env.APIMART_API_KEY?.trim() &&
(generation.provider !== "APIMart" ||
generation.model !==
(process.env.APIMART_MODEL?.trim() || "gpt-5-mini") ||
(generation.provider !== "AI" ||
generation.model !== undefined ||
generation.delivery !== "polling" ||
generation.maxAttempts !== 2 ||
generation.maxOutputTokens !== 8192 ||