Skip to content

Commit 61856f0

Browse files
authored
feat: redesign and make easy rebranding possible (#20)
This pull request introduces several improvements to the frontend applications, focusing on UI customization, environment variable management, Node.js version updates, and better handling of document deletion in the admin app. The most significant changes are the addition of a comprehensive UI customization guide, updates to environment variable documentation and usage, and enhancements to document deletion logic and tests. **UI Customization and Documentation Improvements** * Added a new `docs/UI_Customization.md` guide detailing how to customize bot name, logo, and theme for the frontend apps using environment variables, including instructions for Docker and Kubernetes deployments. * Updated `README.md` and `services/frontend/README.md` to reference the new UI customization guide and document new environment variables for branding and theming. [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L111-R111) [[2]](diffhunk://#diff-d75aa0c448ddadae4b29e6c34aa5f7331fbacb37d08d956e9c2b23eedd46d3e7R75-R103) **Environment and Build System Updates** * Updated Node.js version requirements to 24 in workflow files, Dockerfiles, and documentation for improved compatibility and future-proofing. [[1]](diffhunk://#diff-9a979a1e38ba79e2c75e54c4bf21fe1a2a1b935e1736666565f992e634dadd0fL10-R10) [[2]](diffhunk://#diff-f3e59bc57dbbc3efc3a523180fc10892d015c070e3da98d9c4f4544a46bbe09fL1-R1) [[3]](diffhunk://#diff-28f7bf29a152b8f8fdc5459c9348fc51e5cfcb8c13a7199c9789ddcadbd8577dL1-R1) [[4]](diffhunk://#diff-d75aa0c448ddadae4b29e6c34aa5f7331fbacb37d08d956e9c2b23eedd46d3e7L23-R23) **Frontend Development Workflow** * Added a VSCode task (`.vscode/tasks.json`) for running frontend admin linting to streamline developer experience. **Admin App Document Deletion Logic and Testing** * Added and updated Cypress E2E tests (`delete-disable.cy.ts`, `delete-processing.cy.ts`, and `app.cy.ts`) to ensure that documents in `PROCESSING` state cannot be deleted, while those in `READY` state can be deleted, improving reliability and user experience. [[1]](diffhunk://#diff-ea1c0a3264e5b41498094ec17883df134f4dad44d474fd3ac2c3cb929d6d86c7R1-R25) [[2]](diffhunk://#diff-4a605b706d35a31bc48f1af8bfdb3360829ba6f0d59c2dd3dd54972333567c3dR1-R20) [[3]](diffhunk://#diff-4edb9e8548cdd91e3f89e64d6c9458fb20da803f73759bc7613c2ccd42abb98eR6-R25) **Code and Style Consistency** * Refactored `App.vue` files for both chat and admin apps to use consistent import and style conventions, and improved theme initialization in chat app. [[1]](diffhunk://#diff-aec53716ff6c4f2c234b589983906d2ffddd1cc67eabf7cd5c676fad77ff0751L1-R5) [[2]](diffhunk://#diff-aec53716ff6c4f2c234b589983906d2ffddd1cc67eabf7cd5c676fad77ff0751L15-R28) [[3]](diffhunk://#diff-98ed9fb0f39bd9e26a573ebe1296e1e723eb79275bd4b4d6064c64dbf81dcefaL1-R35) **[[1]](diffhunk://#diff-a4d41f884f97f18943db8c18e934c6fbba2c61f180314fae2211a771d11054e4R1-R351) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L111-R111) [[3]](diffhunk://#diff-d75aa0c448ddadae4b29e6c34aa5f7331fbacb37d08d956e9c2b23eedd46d3e7R75-R103) [[4]](diffhunk://#diff-9a979a1e38ba79e2c75e54c4bf21fe1a2a1b935e1736666565f992e634dadd0fL10-R10) [[5]](diffhunk://#diff-f3e59bc57dbbc3efc3a523180fc10892d015c070e3da98d9c4f4544a46bbe09fL1-R1)**
1 parent 6c4969a commit 61856f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1915
-688
lines changed

.github/workflows/lint-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
env:
10-
NODE_VERSION: '22.12.x'
10+
NODE_VERSION: '24'
1111
PYTHON_VERSION: '3.13'
1212

1313
jobs:

.vscode/tasks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "frontend-admin-lint",
6+
"type": "shell",
7+
"command": "npm run -w services/frontend eslint",
8+
"problemMatcher": [
9+
"$eslint-stylish"
10+
],
11+
"group": "build"
12+
}
13+
]
14+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The frontend provides user-friendly interfaces for both chat and document manage
108108
- **Chat App**: Interface for interacting with the RAG system
109109
- **Admin App**: Interface for managing documents and system configuration
110110

111-
For further information, please consult the [Frontend README](./services/frontend/README.md).
111+
For further information, please consult the [Frontend README](./services/frontend/README.md). For branding, theming, and logo configuration, see the [UI Customization Guide](./docs/UI_Customization.md).
112112

113113
#### 1.1.6 Infrastructure
114114

docs/UI_Customization.md

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
# UI Customization Guide
2+
3+
This guide explains how to customize the RAG Template frontend applications, including bot branding, theming, and logo configuration.
4+
5+
Note: In this document, “frontend” refers to the folder at services/frontend in this repository. All links below point to files in that folder or elsewhere in this repo.
6+
7+
## Overview
8+
9+
The RAG Template frontend supports several customization options:
10+
11+
- **Bot Name**: Customize the AI assistant's name in chat messages
12+
- **Logo/Branding**: Replace the default logo with your organization's branding
13+
- **Theme System**: Switch between light and dark modes with user preference persistence
14+
15+
## Configuration Options
16+
17+
### Environment Variables
18+
19+
All customization is done through environment variables that can be set at build time or runtime:
20+
21+
| Variable | Description | Default Value | Example |
22+
|----------|-------------|---------------|---------|
23+
| `VITE_BOT_NAME` | The AI assistant's display name | "Knowledge Agent" | "DocBot" |
24+
| `VITE_UI_LOGO_PATH` | Common path to the main navigation logo (fallback for both light/dark) | "/assets/navigation-logo.svg" | "/assets/my-logo.png" |
25+
| `VITE_UI_LOGO_PATH_LIGHT` | Path to logo used in light mode (falls back to `VITE_UI_LOGO_PATH`) || "/assets/logo-light.svg" |
26+
| `VITE_UI_LOGO_PATH_DARK` | Path to logo used in dark mode (falls back to `VITE_UI_LOGO_PATH`) || "/assets/logo-dark.svg" |
27+
| `VITE_UI_THEME_DEFAULT` | Default theme when user first visits | "light" | "dark" |
28+
| `VITE_UI_THEME_OPTIONS` | Available theme options (comma-separated) | "light,dark" | "light,dark,auto" |
29+
30+
### Bot Name Customization
31+
32+
The bot name appears in the initial welcome message in the chat interface.
33+
34+
**Default Message:**
35+
36+
```text
37+
Hi 👋, I'm your AI Assistant Knowledge Agent, here to support you with any questions regarding the provided documents!
38+
```
39+
40+
**Setting Custom Bot Name:**
41+
42+
1. **Development Environment:**
43+
44+
```bash
45+
# In your .env file
46+
VITE_BOT_NAME=DocBot
47+
```
48+
49+
2. **Docker/Production:**
50+
51+
```bash
52+
# Environment variable
53+
export VITE_BOT_NAME="Your Custom Bot Name"
54+
```
55+
56+
3. **Kubernetes/Helm:**
57+
58+
```yaml
59+
# In your values.yaml or deployment
60+
env:
61+
- name: VITE_BOT_NAME
62+
value: "Corporate Knowledge Assistant"
63+
```
64+
65+
### Logo Customization
66+
67+
The logo appears in the navigation header of both chat and admin applications. You can configure separate logos for light and dark themes.
68+
69+
**Setting Custom Logos:**
70+
71+
1. Place your logo files in the app assets directory:
72+
73+
- Chat app: services/frontend/apps/chat-app/public/assets/ ([open folder](../services/frontend/apps/chat-app/public/assets))
74+
- Admin app: services/frontend/apps/admin-app/public/assets/ ([open folder](../services/frontend/apps/admin-app/public/assets))
75+
76+
1. Set the environment variables:
77+
78+
```bash
79+
# Preferred: specify light and dark explicitly
80+
VITE_UI_LOGO_PATH_LIGHT=/assets/my-logo-light.svg
81+
VITE_UI_LOGO_PATH_DARK=/assets/my-logo-dark.svg
82+
83+
# Optional: common fallback used when LIGHT/DARK are not set
84+
VITE_UI_LOGO_PATH=/assets/my-logo.svg
85+
```
86+
87+
**Logo Requirements:**
88+
89+
- **Format**: SVG, PNG, or JPG
90+
- **Size**: Optimized for 128px width (will be scaled to w-32 class)
91+
- **Background**: Transparent recommended for better theme compatibility
92+
- **Path**: Must be accessible from the public assets directory
93+
94+
**Fallback order:**
95+
96+
- 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))
97+
- 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))
98+
99+
**Examples:**
100+
101+
```bash
102+
# Separate light/dark logos
103+
VITE_UI_LOGO_PATH_LIGHT=/assets/company-logo-light.svg
104+
VITE_UI_LOGO_PATH_DARK=/assets/company-logo-dark.svg
105+
106+
# Only a common logo
107+
VITE_UI_LOGO_PATH=/assets/company-logo.svg
108+
```
109+
110+
### Theme System
111+
112+
The application supports a flexible theme system with user preference persistence.
113+
114+
**Available Themes:**
115+
116+
- `light`: Light mode (default)
117+
- `dark`: Dark mode
118+
119+
**Theme Configuration:**
120+
121+
1. **Set Default Theme:**
122+
123+
```bash
124+
# Users will see dark mode by default
125+
VITE_UI_THEME_DEFAULT=dark
126+
```
127+
128+
1. **Configure Available Options:**
129+
130+
```bash
131+
# Only allow light mode (remove theme toggle)
132+
VITE_UI_THEME_OPTIONS=light
133+
134+
# Support both themes (default)
135+
VITE_UI_THEME_OPTIONS=light,dark
136+
```
137+
138+
**Theme Behavior:**
139+
140+
- Theme preference is saved in browser's localStorage
141+
- Theme persists across browser sessions
142+
- Theme toggle button appears only when multiple options are available
143+
- Manual theme switching overrides the default setting
144+
145+
## Development Setup
146+
147+
### Local Development
148+
149+
1. **Create/modify `.env` file in frontend directory** (services/frontend/.env):
150+
151+
```bash
152+
# Bot customization
153+
VITE_BOT_NAME=Development Bot
154+
155+
# Logo customization
156+
VITE_UI_LOGO_PATH_LIGHT=/assets/dev-logo-light.svg
157+
VITE_UI_LOGO_PATH_DARK=/assets/dev-logo-dark.svg
158+
# Optional common fallback
159+
# VITE_UI_LOGO_PATH=/assets/dev-logo.svg
160+
161+
# Theme customization
162+
VITE_UI_THEME_DEFAULT=light
163+
VITE_UI_THEME_OPTIONS=light,dark
164+
```
165+
166+
1. **Start development server** (scripts are defined in [services/frontend/package.json](../services/frontend/package.json)):
167+
168+
```bash
169+
npm run chat:serve
170+
# or
171+
npm run admin:serve
172+
```
173+
174+
### Docker Deployment
175+
176+
For Docker deployments, the frontend uses a special script (services/frontend/env.sh) to replace environment variables at runtime:
177+
178+
1. **Set environment variables in your container:**
179+
180+
```dockerfile
181+
ENV VITE_BOT_NAME="Production Assistant"
182+
ENV VITE_UI_LOGO_PATH_LIGHT="/assets/prod-logo-light.svg"
183+
ENV VITE_UI_LOGO_PATH_DARK="/assets/prod-logo-dark.svg"
184+
ENV VITE_UI_THEME_DEFAULT="light"
185+
```
186+
187+
1. **The env.sh script automatically replaces variables** in built JS/CSS files when the container starts. See [services/frontend/env.sh](../services/frontend/env.sh).
188+
189+
### Kubernetes/Helm Deployment
190+
191+
1. **Configure in your Helm values.yaml** (example chart values at [infrastructure/rag/values.yaml](../infrastructure/rag/values.yaml)):
192+
193+
```yaml
194+
frontend:
195+
env:
196+
VITE_BOT_NAME: "Enterprise Knowledge Bot"
197+
VITE_UI_LOGO_PATH_LIGHT: "/assets/enterprise-logo-light.svg"
198+
VITE_UI_LOGO_PATH_DARK: "/assets/enterprise-logo-dark.svg"
199+
VITE_UI_THEME_DEFAULT: "dark"
200+
VITE_UI_THEME_OPTIONS: "light,dark"
201+
```
202+
203+
2. **Or use ConfigMap:**
204+
205+
```yaml
206+
apiVersion: v1
207+
kind: ConfigMap
208+
metadata:
209+
name: frontend-config
210+
data:
211+
VITE_BOT_NAME: "K8s Assistant"
212+
VITE_UI_LOGO_PATH_LIGHT: "/assets/k8s-logo-light.svg"
213+
VITE_UI_LOGO_PATH_DARK: "/assets/k8s-logo-dark.svg"
214+
```
215+
216+
## Advanced Customization
217+
218+
### Adding Custom Themes
219+
220+
To add custom themes beyond light/dark:
221+
222+
1. **Update the settings configuration** in [services/frontend/libs/shared/settings.ts](../services/frontend/libs/shared/settings.ts):
223+
224+
```typescript
225+
// frontend/libs/shared/settings.ts
226+
const defaultSettings: AppSettings = {
227+
ui: {
228+
theme: {
229+
default: "light",
230+
options: ["light", "dark", "custom"], // Add your theme
231+
},
232+
},
233+
};
234+
```
235+
236+
1. **Configure DaisyUI themes** in [services/frontend/tailwind.config.js](../services/frontend/tailwind.config.js):
237+
238+
```javascript
239+
module.exports = {
240+
daisyui: {
241+
themes: [
242+
"light",
243+
"dark",
244+
{
245+
custom: {
246+
"primary": "#your-color",
247+
"secondary": "#your-color",
248+
// ... more theme colors
249+
}
250+
}
251+
],
252+
},
253+
};
254+
```
255+
256+
### Internationalization
257+
258+
Bot names and messages support internationalization:
259+
260+
1. **Modify translation files:**
261+
262+
```json
263+
// services/frontend/libs/i18n/chat/en.json
264+
{
265+
"chat": {
266+
"initialMessage": "Hi 👋, I'm your AI Assistant {bot_name}, here to help!"
267+
}
268+
}
269+
```
270+
271+
1. **Add language-specific bot names:**
272+
273+
```json
274+
// services/frontend/libs/i18n/chat/de.json
275+
{
276+
"chat": {
277+
"initialMessage": "Hallo 👋, ich bin dein KI-Assistent {bot_name}, hier um zu helfen!"
278+
}
279+
}
280+
```
281+
Files: [en.json](../services/frontend/libs/i18n/chat/en.json), [de.json](../services/frontend/libs/i18n/chat/de.json)
282+
283+
## Troubleshooting
284+
285+
### Bot Name Not Updating
286+
287+
- **Issue**: Bot name shows as `{bot_name}` instead of actual name
288+
- **Cause**: Vue computed property not accessed correctly
289+
- **Solution**: Use `initialMessage.value` instead of `initialMessage` in the store
290+
291+
### Logo Not Loading / Wrong for Theme
292+
293+
- **Issue**: Logo doesn't appear or shows broken image
294+
- **Cause**: Incorrect path or missing asset
295+
- **Solutions**:
296+
- Verify files exist in `public/assets/` directory
297+
- Check `VITE_UI_LOGO_PATH_LIGHT` / `VITE_UI_LOGO_PATH_DARK` (or `VITE_UI_LOGO_PATH` fallback)
298+
- Ensure path starts with `/assets/`
299+
- Check browser network tab for 404 errors
300+
301+
### Theme Not Persisting
302+
303+
- **Issue**: Theme resets to default on page refresh
304+
- **Cause**: localStorage not being saved/loaded correctly
305+
- **Solutions**:
306+
- Check browser localStorage for `app-theme` key
307+
- Verify theme value is in available options
308+
- Clear localStorage and try again
309+
310+
### Environment Variables Not Working in Production
311+
312+
- **Issue**: Customization works in development but not production
313+
- **Cause**: Vite environment variables are build-time only
314+
- **Solutions**:
315+
- For Docker: Ensure `env.sh` script runs after copying files
316+
- For Kubernetes: Use ConfigMap/Secret with proper mounting
317+
- Verify environment variables are set in container
318+
319+
## Example Configurations
320+
321+
### Corporate Deployment
322+
323+
```bash
324+
VITE_BOT_NAME="Corporate Knowledge Assistant"
325+
VITE_UI_LOGO_PATH_LIGHT="/assets/corporate-logo-light.svg"
326+
VITE_UI_LOGO_PATH_DARK="/assets/corporate-logo-dark.svg"
327+
# Optional common fallback
328+
# VITE_UI_LOGO_PATH="/assets/corporate-logo.svg"
329+
VITE_UI_THEME_DEFAULT="light"
330+
VITE_UI_THEME_OPTIONS="light,dark"
331+
```
332+
333+
### Development Environment
334+
335+
```bash
336+
VITE_BOT_NAME="Dev Bot"
337+
VITE_UI_LOGO_PATH_LIGHT="/assets/dev-logo-light.png"
338+
VITE_UI_LOGO_PATH_DARK="/assets/dev-logo-dark.png"
339+
VITE_UI_THEME_DEFAULT="dark"
340+
VITE_UI_THEME_OPTIONS="light,dark"
341+
```
342+
343+
### Minimal Configuration
344+
345+
```bash
346+
VITE_BOT_NAME="Assistant"
347+
VITE_UI_THEME_DEFAULT="light"
348+
VITE_UI_THEME_OPTIONS="light"
349+
```
350+
351+
This customization system provides flexible branding options while maintaining a clean, maintainable codebase.

services/frontend/.env.production

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
VITE_API_URL = VITE_API_URL
2-
VITE_ADMIN_URL = VITE_ADMIN_URL
3-
VITE_CHAT_URL = VITE_CHAT_URL
4-
VITE_AUTH_USERNAME = VITE_AUTH_USERNAME
5-
VITE_AUTH_PASSWORD = VITE_AUTH_PASSWORD
6-
VITE_CHAT_AUTH_ENABLED = true
1+
VITE_API_URL=VITE_API_URL
2+
VITE_ADMIN_URL=VITE_ADMIN_URL
3+
VITE_CHAT_URL=VITE_CHAT_URL
4+
VITE_AUTH_USERNAME=VITE_AUTH_USERNAME
5+
VITE_AUTH_PASSWORD=VITE_AUTH_PASSWORD
6+
VITE_CHAT_AUTH_ENABLED=true

0 commit comments

Comments
 (0)