CREATE TABLE IF NOT EXISTS wa2_settings (
  id tinyint unsigned NOT NULL DEFAULT 1,
  ai_enabled tinyint(1) NOT NULL DEFAULT 0,
  ai_mode varchar(16) NOT NULL DEFAULT 'refine',
  ai_model varchar(64) NOT NULL DEFAULT 'gpt-4o-mini',
  ai_temperature decimal(4,2) NOT NULL DEFAULT 0.35,
  ai_max_tokens int NOT NULL DEFAULT 420,
  api_key_enc text DEFAULT NULL,
  updated_at datetime DEFAULT NULL,
  created_at datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT IGNORE INTO wa2_settings (id, ai_enabled, ai_mode, ai_model, ai_temperature, ai_max_tokens, created_at)
VALUES (1, 0, 'refine', 'gpt-4o-mini', 0.35, 420, NOW());
