Skip to main content

Settings

User preferences and application configuration.
apiKey
string
required
API key for accessing AI services
selectedModel
string
required
ID of the currently selected AI model
theme
'light' | 'dark'
required
UI theme preference:
  • light: Light theme
  • dark: Dark theme
accent
'violet' | 'blue' | 'green' | 'rose' | 'orange' | 'teal' | 'red' | 'cyan'
Accent color for the UI. Available options:
  • violet
  • blue
  • green
  • rose
  • orange
  • teal
  • red
  • cyan
systemPrompt
string
required
Default system instruction that sets the AI’s behavior and context
tone
'neutre' | 'formel' | 'amical' | 'professionnel' | 'enthousiaste'
Preferred tone for AI responses:
  • neutre: Neutral tone
  • formel: Formal tone
  • amical: Friendly tone
  • professionnel: Professional tone
  • enthousiaste: Enthusiastic tone
notificationsEnabled
boolean
Whether notifications are enabled
ragEnabled
boolean
Whether Retrieval-Augmented Generation (RAG) is enabled for enhanced context
hasOnboarded
boolean
Whether the user has completed the onboarding flow

Example

const settings: Settings = {
  apiKey: 'sk-...',
  selectedModel: 'gpt-4-turbo',
  theme: 'dark',
  accent: 'violet',
  systemPrompt: 'You are a helpful AI assistant.',
  tone: 'professionnel',
  notificationsEnabled: true,
  ragEnabled: false,
  hasOnboarded: true
};

Usage

Settings are typically stored in local storage and loaded on app initialization:
// Load settings
const loadSettings = (): Settings => {
  const stored = localStorage.getItem('polychat-settings');
  if (stored) {
    return JSON.parse(stored);
  }
  
  // Default settings
  return {
    apiKey: '',
    selectedModel: 'gpt-4',
    theme: 'dark',
    accent: 'violet',
    systemPrompt: 'You are a helpful AI assistant.',
    tone: 'neutre',
    notificationsEnabled: true,
    ragEnabled: false,
    hasOnboarded: false
  };
};

// Save settings
const saveSettings = (settings: Settings) => {
  localStorage.setItem('polychat-settings', JSON.stringify(settings));
};

System Prompt

The systemPrompt field is particularly important as it defines the AI’s behavior:
// Example system prompts for different use cases
const codingAssistant: string = 
  'You are an expert programming assistant. Provide clear, well-documented code with explanations.';

const creativeWriter: string = 
  'You are a creative writing assistant. Help users craft engaging stories and content.';

const dataAnalyst: string = 
  'You are a data analysis expert. Help users understand and interpret data with clear insights.';

Build docs developers (and LLMs) love