From 3b90d809464ffbf657ce24bf6a5fc14be10e066d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 6 Apr 2026 04:08:07 -0400 Subject: [PATCH] revert frontend changes --- frontend/apps/artcraft-website/.env.example | 3 -- .../src/components/navbar/navbar.tsx | 4 +-- frontend/apps/artcraft-website/src/main.tsx | 19 +++++------ frontend/libs/api/src/lib/ApiManager.ts | 4 +-- frontend/libs/api/src/lib/OmniGenApi.ts | 12 ++----- .../src/lib/config/StorytellerApiHostStore.ts | 5 +-- .../libs/components/promptbox/tsconfig.json | 33 +++++++------------ .../components/promptbox/tsconfig.lib.json | 33 +++++++------------ 8 files changed, 40 insertions(+), 73 deletions(-) diff --git a/frontend/apps/artcraft-website/.env.example b/frontend/apps/artcraft-website/.env.example index c74c3a33be..fcbd1e317e 100644 --- a/frontend/apps/artcraft-website/.env.example +++ b/frontend/apps/artcraft-website/.env.example @@ -2,6 +2,3 @@ # Get the Client ID from the Google Cloud Console: # https://console.cloud.google.com/apis/credentials VITE_GOOGLE_CLIENT_ID=YOUR_CLIENT_ID.apps.googleusercontent.com - -# API backend host. Defaults to https://api.storyteller.ai if unset. -# VITE_API_HOST=http://localhost:12345 diff --git a/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx b/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx index 88494cccae..bd80e51434 100644 --- a/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx +++ b/frontend/apps/artcraft-website/src/components/navbar/navbar.tsx @@ -17,8 +17,8 @@ import { TaskQueue } from "./task-queue"; const NAV_ITEMS = [ { name: "Home", href: "/" }, - { name: "Image", href: "/create-image" }, - { name: "Video", href: "/create-video" }, + // { name: "Image", href: "/create-image" }, + // { name: "Video", href: "/create-video" }, { name: "Tutorials", href: "/tutorials" }, { name: "News", href: "/news" }, { name: "FAQ", href: "/faq" }, diff --git a/frontend/apps/artcraft-website/src/main.tsx b/frontend/apps/artcraft-website/src/main.tsx index 16ce81572b..d966684c4b 100644 --- a/frontend/apps/artcraft-website/src/main.tsx +++ b/frontend/apps/artcraft-website/src/main.tsx @@ -11,16 +11,15 @@ const root = ReactDOM.createRoot( document.getElementById("root") as HTMLElement, ); -// In development, route API through the Vite dev server proxy to avoid CORS, -// unless VITE_API_HOST is explicitly set (eg. for an unsafe browser that ignores CORS). -//if (import.meta.env.DEV && !import.meta.env.VITE_API_HOST) { -// try { -// const origin = window.location.origin; -// StorytellerApiHostStore.getInstance().setApiSchemeAndHost(origin); -// } catch (e) { -// console.warn("Failed to set dev API host override", e); -// } -//} +// In development, route API through the Vite dev server origin to avoid CORS +if (import.meta.env.DEV) { + try { + const origin = window.location.origin; + StorytellerApiHostStore.getInstance().setApiSchemeAndHost(origin); + } catch (e) { + console.warn("Failed to set dev API host override", e); + } +} // Cache the referrer immediately — it can change or disappear on navigation. // Only set once so subsequent in-site navigations don't overwrite the original. diff --git a/frontend/libs/api/src/lib/ApiManager.ts b/frontend/libs/api/src/lib/ApiManager.ts index 883d1c6421..b700008336 100644 --- a/frontend/libs/api/src/lib/ApiManager.ts +++ b/frontend/libs/api/src/lib/ApiManager.ts @@ -26,9 +26,7 @@ export class ApiManager { } protected getApiSchemeAndHost(): string { - const host = StorytellerApiHostStore.getInstance().getApiSchemeAndHost(); - console.log('getSchemaAndHost()', host); - return host; + return StorytellerApiHostStore.getInstance().getApiSchemeAndHost(); } public async fetch( diff --git a/frontend/libs/api/src/lib/OmniGenApi.ts b/frontend/libs/api/src/lib/OmniGenApi.ts index 072eef82ba..85abc21464 100644 --- a/frontend/libs/api/src/lib/OmniGenApi.ts +++ b/frontend/libs/api/src/lib/OmniGenApi.ts @@ -176,10 +176,8 @@ export class OmniGenApi extends ApiManager { provider?: string, ): Promise { const query = provider ? { provider } : undefined; - const host = this.getApiSchemeAndHost(); - console.log('getImageModels() - host', host); return this.get({ - endpoint: `${host}/v1/omni_gen/models/image`, + endpoint: `${this.getApiSchemeAndHost()}/v1/omni_gen/models/image`, query, }); } @@ -219,10 +217,8 @@ export class OmniGenApi extends ApiManager { public async generateImage( body: OmniGenImageRequest, ): Promise { - const host = this.getApiSchemeAndHost(); - console.log('generateImage() - host', host); return this.post, OmniGenImageGenerateResponse>({ - endpoint: `${host}/v1/omni_gen/generate/image`, + endpoint: `${this.getApiSchemeAndHost()}/v1/omni_gen/generate/image`, body: stripNulls(body), }); } @@ -230,10 +226,8 @@ export class OmniGenApi extends ApiManager { public async generateVideo( body: OmniGenVideoRequest, ): Promise { - const host = this.getApiSchemeAndHost(); - console.log('generateVideo() - host', host); return this.post, OmniGenVideoGenerateResponse>({ - endpoint: `${host}/v1/omni_gen/generate/video`, + endpoint: `${this.getApiSchemeAndHost()}/v1/omni_gen/generate/video`, body: stripNulls(body), }); } diff --git a/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts b/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts index e8100e73ed..c90da8cb2f 100644 --- a/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts +++ b/frontend/libs/api/src/lib/config/StorytellerApiHostStore.ts @@ -1,8 +1,5 @@ // Artcraft / Storyteller API backend -// Set VITE_API_HOST=http://localhost:12345 for local dev, or leave unset for production. -//const DEFAULT_API_HOST = (import.meta as any).env?.VITE_API_HOST || "https://api.storyteller.ai"; - -const DEFAULT_API_HOST = "http://localhost:12345"; +const DEFAULT_API_HOST = "https://api.storyteller.ai"; // NB(bt,2025-09-25): 'nx' is creating multiple copies of the library with name // mangling, so the singleton pattern fails to resolve to a single instance. diff --git a/frontend/libs/components/promptbox/tsconfig.json b/frontend/libs/components/promptbox/tsconfig.json index cee5143d5e..4249f1fd55 100644 --- a/frontend/libs/components/promptbox/tsconfig.json +++ b/frontend/libs/components/promptbox/tsconfig.json @@ -2,9 +2,6 @@ "files": [], "include": [], "references": [ - { - "path": "../slider-v2" - }, { "path": "../button-icon-select" }, @@ -17,6 +14,9 @@ { "path": "../camera-settings-modal" }, + { + "path": "../toaster" + }, { "path": "../../tauri-utils" }, @@ -26,38 +26,29 @@ { "path": "../../model-list" }, + { + "path": "../modal" + }, { "path": "../popover" }, + { + "path": "../slider-v2" + }, { "path": "../../common" }, { - "path": "../tooltip" - }, - { - "path": "../action-reminder-modal" - }, - { - "path": "../label" - }, - { - "path": "../button" - }, - { - "path": "../input" + "path": "../../api" }, { "path": "../gallery-modal" }, { - "path": "../toaster" + "path": "../tooltip" }, { - "path": "../../api" - }, - { - "path": "../modal" + "path": "../button" }, { "path": "./tsconfig.lib.json" diff --git a/frontend/libs/components/promptbox/tsconfig.lib.json b/frontend/libs/components/promptbox/tsconfig.lib.json index 2bccad9144..0b331ea481 100644 --- a/frontend/libs/components/promptbox/tsconfig.lib.json +++ b/frontend/libs/components/promptbox/tsconfig.lib.json @@ -43,9 +43,6 @@ "src/**/*.tsx" ], "references": [ - { - "path": "../slider-v2/tsconfig.lib.json" - }, { "path": "../button-icon-select/tsconfig.lib.json" }, @@ -58,6 +55,9 @@ { "path": "../camera-settings-modal/tsconfig.lib.json" }, + { + "path": "../toaster/tsconfig.lib.json" + }, { "path": "../../tauri-utils/tsconfig.lib.json" }, @@ -67,38 +67,29 @@ { "path": "../../model-list/tsconfig.lib.json" }, + { + "path": "../modal/tsconfig.lib.json" + }, { "path": "../popover/tsconfig.lib.json" }, + { + "path": "../slider-v2/tsconfig.lib.json" + }, { "path": "../../common/tsconfig.lib.json" }, { - "path": "../tooltip/tsconfig.lib.json" - }, - { - "path": "../action-reminder-modal/tsconfig.lib.json" - }, - { - "path": "../label/tsconfig.lib.json" - }, - { - "path": "../button/tsconfig.lib.json" - }, - { - "path": "../input/tsconfig.lib.json" + "path": "../../api/tsconfig.lib.json" }, { "path": "../gallery-modal/tsconfig.lib.json" }, { - "path": "../toaster/tsconfig.lib.json" + "path": "../tooltip/tsconfig.lib.json" }, { - "path": "../../api/tsconfig.lib.json" - }, - { - "path": "../modal/tsconfig.lib.json" + "path": "../button/tsconfig.lib.json" } ] }