diff --git a/docs/UI_Customization.md b/docs/UI_Customization.md index ca3644fe..52f148fd 100644 --- a/docs/UI_Customization.md +++ b/docs/UI_Customization.md @@ -24,8 +24,8 @@ All customization is done through environment variables that can be set at build | `VITE_UI_LOGO_PATH` | Common path to the main navigation logo (fallback for both light/dark) | "/assets/navigation-logo.svg" | "/assets/my-logo.png" | | `VITE_UI_LOGO_PATH_LIGHT` | Path to logo used in light mode (falls back to `VITE_UI_LOGO_PATH`) | — | "/assets/logo-light.svg" | | `VITE_UI_LOGO_PATH_DARK` | Path to logo used in dark mode (falls back to `VITE_UI_LOGO_PATH`) | — | "/assets/logo-dark.svg" | -| `VITE_UI_THEME_DEFAULT` | Default theme when user first visits | "light" | "dark" | -| `VITE_UI_THEME_OPTIONS` | Available theme options (comma-separated) | "light,dark" | "light,dark,auto" | +| `VITE_UI_THEME_DEFAULT` | Default theme when user first visits | "dark" | "light" | +| `VITE_UI_THEME_OPTIONS` | Available theme options (comma-separated) | "light,dark" | "light" | ### Bot Name Customization @@ -93,8 +93,8 @@ The logo appears in the navigation header of both chat and admin applications. Y **Fallback order:** -- Light: `VITE_UI_LOGO_PATH_LIGHT` → `VITE_UI_LOGO_PATH` → `/assets/navigation-logo.svg` (default asset exists in both apps: [chat](../services/frontend/apps/chat-app/public/assets/navigation-logo.svg), [admin](../services/frontend/apps/admin-app/public/assets/navigation-logo.svg)) -- Dark: `VITE_UI_LOGO_PATH_DARK` → `VITE_UI_LOGO_PATH` → `/assets/navigation-logo.svg` (default asset exists in both apps: [chat](../services/frontend/apps/chat-app/public/assets/navigation-logo.svg), [admin](../services/frontend/apps/admin-app/public/assets/navigation-logo.svg)) +- Light: `VITE_UI_LOGO_PATH_LIGHT` → `VITE_UI_LOGO_PATH` → `/assets/navigation-logo-light.svg` (default asset exists in both apps: [chat](../services/frontend/apps/chat-app/public/assets/navigation-logo-light.svg), [admin](../services/frontend/apps/admin-app/public/assets/navigation-logo-light.svg)) +- Dark: `VITE_UI_LOGO_PATH_DARK` → `VITE_UI_LOGO_PATH` → `/assets/navigation-logo-dark.svg` (default asset exists in both apps: [chat](../services/frontend/apps/chat-app/public/assets/navigation-logo-dark.svg), [admin](../services/frontend/apps/admin-app/public/assets/navigation-logo-dark.svg)) **Examples:** @@ -113,8 +113,8 @@ The application supports a flexible theme system with user preference persistenc **Available Themes:** -- `light`: Light mode (default) -- `dark`: Dark mode +- `light`: Light mode +- `dark`: Dark mode (default) **Theme Configuration:** @@ -139,7 +139,7 @@ The application supports a flexible theme system with user preference persistenc - Theme preference is saved in browser's localStorage - Theme persists across browser sessions -- Theme toggle button appears only when multiple options are available +- The built-in theme toggle is shown only when both `light` and `dark` are available - Manual theme switching overrides the default setting ## Development Setup @@ -284,9 +284,12 @@ Bot names and messages support internationalization: ### Bot Name Not Updating -- **Issue**: Bot name shows as `{bot_name}` instead of actual name -- **Cause**: Vue computed property not accessed correctly -- **Solution**: Use `initialMessage.value` instead of `initialMessage` in the store +- **Issue**: Bot name stays at the default or shows a placeholder value (e.g. `VITE_BOT_NAME`) +- **Cause**: Runtime env replacement did not run (Vite env vars are build-time by default) +- **Solutions**: + - Ensure `services/frontend/.env.production` contains placeholders for the variables you want to replace (this repo includes `VITE_BOT_NAME`, `VITE_UI_*`, etc.) + - Ensure the container runs `env.sh` after copying the built files into `/usr/share/nginx/html` + - Verify the variable is set in the container environment (Kubernetes `ConfigMap`/`Secret`, Docker `-e`, etc.) ### Logo Not Loading / Wrong for Theme @@ -312,6 +315,7 @@ Bot names and messages support internationalization: - **Issue**: Customization works in development but not production - **Cause**: Vite environment variables are build-time only - **Solutions**: + - Ensure the variables exist as placeholders at build time (see `services/frontend/.env.production`) - For Docker: Ensure `env.sh` script runs after copying files - For Kubernetes: Use ConfigMap/Secret with proper mounting - Verify environment variables are set in container diff --git a/services/frontend/.env.development b/services/frontend/.env.development index f020ae9a..ef0a99b0 100644 --- a/services/frontend/.env.development +++ b/services/frontend/.env.development @@ -1,6 +1,6 @@ -VITE_API_URL=http://doctopus.localhost/api -VITE_ADMIN_URL=http://admin.doctopus.localhost/api -VITE_CHAT_URL=http://localhost:4200 -VITE_AUTH_USERNAME=foo -VITE_AUTH_PASSWORD=bar -VITE_CHAT_AUTH_ENABLED=false +VITE_API_URL=VITE_API_URL +VITE_ADMIN_URL=VITE_ADMIN_URL +VITE_CHAT_URL=VITE_CHAT_URL +VITE_AUTH_USERNAME=VITE_AUTH_USERNAME +VITE_AUTH_PASSWORD=VITE_AUTH_PASSWORD +VITE_CHAT_AUTH_ENABLED=VITE_CHAT_AUTH_ENABLED diff --git a/services/frontend/.env.production b/services/frontend/.env.production index 72ac43f1..efd854f8 100644 --- a/services/frontend/.env.production +++ b/services/frontend/.env.production @@ -3,4 +3,10 @@ VITE_ADMIN_URL=VITE_ADMIN_URL VITE_CHAT_URL=VITE_CHAT_URL VITE_AUTH_USERNAME=VITE_AUTH_USERNAME VITE_AUTH_PASSWORD=VITE_AUTH_PASSWORD -VITE_CHAT_AUTH_ENABLED=true +VITE_CHAT_AUTH_ENABLED=VITE_CHAT_AUTH_ENABLED +VITE_BOT_NAME=VITE_BOT_NAME +VITE_UI_LOGO_PATH=VITE_UI_LOGO_PATH +VITE_UI_LOGO_PATH_LIGHT=VITE_UI_LOGO_PATH_LIGHT +VITE_UI_LOGO_PATH_DARK=VITE_UI_LOGO_PATH_DARK +VITE_UI_THEME_DEFAULT=VITE_UI_THEME_DEFAULT +VITE_UI_THEME_OPTIONS=VITE_UI_THEME_OPTIONS diff --git a/services/frontend/README.md b/services/frontend/README.md index aa19a7a0..5bf67b2b 100644 --- a/services/frontend/README.md +++ b/services/frontend/README.md @@ -91,9 +91,9 @@ To change the theme, open the `tailwind.config.js` file and refer to the availab ### UI Customization - VITE_BOT_NAME = The AI assistant's display name (default: "Knowledge Agent") -- VITE_UI_LOGO_PATH = Common path to the main navigation logo (default: "/assets/navigation-logo.svg"). Used as a fallback for both light/dark. -- VITE_UI_LOGO_PATH_LIGHT = Path to the logo used in light mode (fallbacks to VITE_UI_LOGO_PATH) -- VITE_UI_LOGO_PATH_DARK = Path to the logo used in dark mode (fallbacks to VITE_UI_LOGO_PATH) +- VITE_UI_LOGO_PATH = Common path to the main navigation logo (fallback for both light/dark, default: "/assets/navigation-logo.svg") +- VITE_UI_LOGO_PATH_LIGHT = Path to the logo used in light mode (fallbacks to VITE_UI_LOGO_PATH, default: "/assets/navigation-logo-light.svg") +- VITE_UI_LOGO_PATH_DARK = Path to the logo used in dark mode (fallbacks to VITE_UI_LOGO_PATH, default: "/assets/navigation-logo-dark.svg") - VITE_UI_THEME_DEFAULT = Default theme when user first visits (default: "dark") - VITE_UI_THEME_OPTIONS = Available theme options, comma-separated (default: "light,dark") diff --git a/services/frontend/apps/admin-app/env.d.ts b/services/frontend/apps/admin-app/env.d.ts index 64399764..6f7437fe 100644 --- a/services/frontend/apps/admin-app/env.d.ts +++ b/services/frontend/apps/admin-app/env.d.ts @@ -1,8 +1,6 @@ /// -/* eslint-disable */ declare module '*.vue' { -import type { DefineComponent } from 'vue'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const component: DefineComponent; -export default component; -} \ No newline at end of file + import type { DefineComponent } from 'vue'; + const component: DefineComponent; + export default component; +} diff --git a/services/frontend/apps/admin-app/src/App.vue b/services/frontend/apps/admin-app/src/App.vue index 11bb04fc..39f77f43 100644 --- a/services/frontend/apps/admin-app/src/App.vue +++ b/services/frontend/apps/admin-app/src/App.vue @@ -1,8 +1,8 @@