@@ -136,4 +136,210 @@ The component uses PatternFly components and can be styled using:
136136- ✅ ** Component Composition** : Smaller, focused components
137137- ✅ ** Clear Documentation** : Comprehensive README and comments
138138
139- This organization makes the codebase much easier to understand, maintain, and extend!
139+ This organization makes the codebase much easier to understand, maintain, and extend!
140+
141+ ## 🎨 Frontend Customization Guide
142+
143+ ### Overview
144+ The Lightspeed Chatbot frontend is highly customizable, allowing you to tailor the experience to match your brand, requirements, and user preferences. This guide covers all available customization options.
145+
146+ ---
147+
148+ ### 🔧 Configuration Customization
149+
150+ #### Basic Configuration (` constants.ts ` )
151+ Modify the core configuration settings:
152+
153+ ``` typescript
154+ // API Configuration
155+ export const API_BASE_URL = ' https://your-api.domain.com' ;
156+
157+ // Avatar Customization
158+ export const USER_AVATAR = ' https://your-domain.com/user-avatar.png' ;
159+ export const BOT_AVATAR = ' https://your-domain.com/bot-avatar.png' ;
160+
161+ // Default AI Behavior
162+ export const DEFAULT_SYSTEM_PROMPT = ' You are a specialized assistant for [YOUR USE CASE].' ;
163+
164+ // Footnote Customization
165+ export const FOOTNOTE_PROPS = {
166+ label: ' Your App uses AI. Check for mistakes.' ,
167+ popover: {
168+ title: ' Custom Title' ,
169+ description: ' Your custom accuracy disclaimer...' ,
170+ cta: {
171+ label: ' Understood' ,
172+ onClick : () => { /* Custom action */ },
173+ },
174+ link: {
175+ label: ' Learn more' ,
176+ url: ' https://your-domain.com/ai-policy' ,
177+ },
178+ },
179+ };
180+ ```
181+
182+ #### Welcome Prompts
183+ Customize initial user interaction:
184+
185+ ``` typescript
186+ export const INITIAL_WELCOME_PROMPTS: WelcomePrompt [] = [
187+ { title: ' Quick Start' , message: ' Help me get started' },
188+ { title: ' Documentation' , message: ' Show me the documentation' },
189+ { title: ' Support' , message: ' I need technical support' },
190+ ];
191+ ```
192+
193+ ---
194+
195+ ### 🎭 Branding & Visual Identity
196+
197+ #### Logo Customization (` LightspeedChatbot.tsx ` )
198+ Replace the default logos with your brand:
199+
200+ ``` typescript
201+ // Horizontal logo for fullscreen mode
202+ const horizontalLogo = (
203+ <Bullseye >
204+ < img src = " /your-logo-horizontal.svg" alt = " Your Brand" height = " 40" / >
205+ < / Bullseye >
206+ );
207+
208+ // Icon logo for compact modes
209+ const iconLogo = (
210+ < img src = " /your-logo-icon.svg" alt = " YB" width = " 32" height = " 32" / >
211+ );
212+ ```
213+
214+ #### Welcome Message Customization
215+ ``` typescript
216+ < ChatbotWelcomePrompt
217+ title = " Welcome to Your Assistant"
218+ description = " How can I help you with [YOUR DOMAIN] today?"
219+ prompts = {CUSTOM_WELCOME_PROMPTS }
220+ / >
221+ ```
222+
223+ ---
224+
225+ ### 🔌 API Integration Customization
226+
227+ #### Custom Headers & Authentication
228+ Modify ` services/api.ts ` to add custom headers:
229+
230+ ``` typescript
231+ const defaultHeaders = {
232+ ' Content-Type' : ' application/json' ,
233+ ' Authorization' : ` Bearer ${getAuthToken ()} ` ,
234+ ' X-Custom-Header' : ' your-value' ,
235+ };
236+
237+ export const fetchModels = async (): Promise <Model []> => {
238+ const response = await fetch (` ${API_BASE_URL }/v1/models ` , {
239+ method: ' GET' ,
240+ headers: defaultHeaders ,
241+ });
242+ // ... rest of implementation
243+ };
244+ ```
245+
246+ #### Custom Error Handling
247+ ``` typescript
248+ const handleApiError = (error : any , operation : string ) => {
249+ console .error (` ${operation } failed: ` , error );
250+ // Custom error reporting
251+ if (window .errorReporting ) {
252+ window .errorReporting .reportError (error , operation );
253+ }
254+ throw new Error (` ${operation } failed. Please try again. ` );
255+ };
256+ ```
257+
258+ #### Response Transformation
259+ ``` typescript
260+ export const sendStreamingQuery = async (
261+ request : QueryRequest ,
262+ onToken : (token : string , tokenData ? : StreamTokenData ) => void ,
263+ onStart : (conversationId : string ) => void ,
264+ onEnd : (endData : StreamEndData ) => void ,
265+ ): Promise <void > => {
266+ // Custom request transformation
267+ const transformedRequest = {
268+ ... request ,
269+ custom_field: ' your-value' ,
270+ user_context: getUserContext (),
271+ };
272+
273+ // ... rest of implementation with custom processing
274+ };
275+ ```
276+
277+ ---
278+
279+ ### 📱 UI/UX Customization
280+
281+ #### File Attachment Customization
282+ Modify file handling rules:
283+
284+ ``` typescript
285+ // Custom file validation
286+ const validateCustomFile = (file : File ): string | null => {
287+ const allowedTypes = [' .pdf' , ' .docx' , ' .txt' , ' .md' , ' .json' ];
288+ const maxSize = 50 * 1024 * 1024 ; // 50MB
289+
290+ if (! allowedTypes .some (type => file .name .toLowerCase ().endsWith (type ))) {
291+ return ` File type not supported. Allowed: ${allowedTypes .join (' , ' )} ` ;
292+ }
293+
294+ if (file .size > maxSize ) {
295+ return ' File too large. Maximum size: 50MB' ;
296+ }
297+
298+ return null ;
299+ };
300+ ```
301+
302+ ---
303+
304+ ### 🔍 Advanced Features
305+
306+ #### Custom Tool Execution Display
307+ Enhance the ` ToolExecutionCards ` component:
308+
309+ ``` typescript
310+ // Enhanced tool execution with icons and descriptions
311+ const TOOL_CONFIGS = {
312+ ' web_search' : { icon: ' search-icon' , description: ' Searching the web...' },
313+ ' file_analysis' : { icon: ' file-icon' , description: ' Analyzing document...' },
314+ ' data_query' : { icon: ' database-icon' , description: ' Querying database...' },
315+ };
316+
317+ export const EnhancedToolExecutionCards: React .FC <ToolExecutionCardsProps > = ({ tools }) => {
318+ return (
319+ < div className = " custom-tool-execution" >
320+ {tools .map ((tool , index ) = > {
321+ const config = TOOL_CONFIGS [tool ] || { icon: ' default-icon' , description: tool };
322+ return (
323+ <Card key = {index } className = " tool-card" >
324+ <Icon name = {config.icon } / >
325+ <span >{config .description }</span >
326+ </Card >
327+ );
328+ })}
329+ < / div >
330+ );
331+ };
332+ ```
333+
334+ ### 💡 Best Practices
335+
336+ 1 . ** Gradual Customization** : Start with configuration changes, then move to styling and advanced features
337+ 2 . ** Theme Consistency** : Maintain consistent styling across all components
338+ 3 . ** Accessibility** : Ensure customizations don't break accessibility features
339+ 4 . ** Performance** : Test that customizations don't impact performance
340+ 5 . ** Maintainability** : Document custom changes for future team members
341+ 6 . ** User Testing** : Validate customizations with real users
342+ 7 . ** Responsive Design** : Test customizations across different screen sizes
343+ 8 . ** Error Handling** : Implement robust error handling for custom features
344+
345+ This comprehensive customization guide provides you with all the tools needed to tailor the Lightspeed Chatbot to your specific requirements while maintaining code quality and user experience standards.
0 commit comments