-- 初始化数据库表结构（如果使用 SQLAlchemy 自动创建，此文件可选）

-- 创建扩展
CREATE DATABASE IF NOT EXISTS huihui_ai_bot 
DEFAULT CHARACTER SET utf8mb4 
DEFAULT COLLATE utf8mb4_unicode_ci;

USE huihui_ai_bot;

-- 插入初始系统配置数据
INSERT INTO system_configs (config_key, config_value, config_type, description, is_active) VALUES
('schedule_config', '{"task_start_hour": 9, "task_end_hour": 22, "task_interval_min": 10, "task_interval_max": 30}', 'schedule', '定时任务配置', 1),
('limit_config', '{"max_tokens_per_day": 10000, "max_comments_per_user_per_day": 20, "max_replies_per_user_per_day": 10}', 'limit', '限额配置', 1),
('probability_config', '{"like_probability": 0.8, "favorite_probability": 0.5, "share_probability": 0.3}', 'probability', '概率配置', 1)
ON DUPLICATE KEY UPDATE config_value = VALUES(config_value);
