-- ===================================================== -- LLM SCHEMA - USER PREFERENCES TABLE -- ===================================================== -- Description: User preferences for LLM agent interactions -- Schema: llm -- Author: Database Agent -- Date: 2025-12-06 -- ===================================================== CREATE TABLE llm.user_preferences ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID NOT NULL UNIQUE REFERENCES auth.users(id) ON DELETE CASCADE, -- Preferencias de comunicación language VARCHAR(5) DEFAULT 'es', -- ISO 639-1 tone llm.communication_tone DEFAULT 'professional', verbosity llm.verbosity_level DEFAULT 'normal', -- Preferencias de trading preferred_symbols VARCHAR(20)[] DEFAULT '{}', preferred_timeframe VARCHAR(10) DEFAULT '1h', risk_tolerance VARCHAR(20) DEFAULT 'moderate', -- conservative, moderate, aggressive -- Preferencias de notificación proactive_alerts BOOLEAN DEFAULT true, alert_frequency llm.alert_frequency DEFAULT 'normal', notification_hours_start TIME DEFAULT '08:00:00', notification_hours_end TIME DEFAULT '22:00:00', timezone VARCHAR(50) DEFAULT 'America/Mexico_City', -- Intereses topics_of_interest TEXT[] DEFAULT '{}', -- trading, education, news, market_analysis -- Nivel de experiencia (para personalizar explicaciones) trading_experience_level VARCHAR(20) DEFAULT 'beginner', -- beginner, intermediate, advanced, expert -- Preferencias de análisis preferred_analysis_types TEXT[] DEFAULT '{}', -- technical, fundamental, sentiment, onchain -- Formato de respuestas include_charts BOOLEAN DEFAULT true, include_data_tables BOOLEAN DEFAULT true, include_explanations BOOLEAN DEFAULT true, -- Metadata onboarding_completed BOOLEAN DEFAULT false, onboarding_completed_at TIMESTAMPTZ, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); -- Índices CREATE UNIQUE INDEX idx_user_preferences_user ON llm.user_preferences(user_id); CREATE INDEX idx_user_preferences_language ON llm.user_preferences(language); -- Comentarios COMMENT ON TABLE llm.user_preferences IS 'User preferences for personalized LLM agent interactions'; COMMENT ON COLUMN llm.user_preferences.language IS 'Preferred language for responses (ISO 639-1 code)'; COMMENT ON COLUMN llm.user_preferences.tone IS 'Communication style: casual, professional, or technical'; COMMENT ON COLUMN llm.user_preferences.verbosity IS 'Response length preference: brief, normal, or detailed'; COMMENT ON COLUMN llm.user_preferences.preferred_symbols IS 'Trading pairs user is most interested in'; COMMENT ON COLUMN llm.user_preferences.proactive_alerts IS 'Whether agent should send proactive notifications'; COMMENT ON COLUMN llm.user_preferences.alert_frequency IS 'How often to receive alerts: low, normal, or high'; COMMENT ON COLUMN llm.user_preferences.notification_hours_start IS 'Start of notification window in user timezone'; COMMENT ON COLUMN llm.user_preferences.notification_hours_end IS 'End of notification window in user timezone'; COMMENT ON COLUMN llm.user_preferences.topics_of_interest IS 'Topics user wants to learn about or discuss'; COMMENT ON COLUMN llm.user_preferences.trading_experience_level IS 'User experience level for tailoring explanations';