-- =================================================================
-- 修复 points_config 表的 task_type 数据
-- 时间: 2025-10-22
-- 描述: 修正所有模型的 task_type 分类
-- =================================================================

-- 指定数据库
USE `1818_user_server`;

-- 1. 修正 RunningHub Sora2 文生视频模型
UPDATE `points_config` 
SET `task_type` = 'text_to_video' 
WHERE `model_name` IN (
    'rh_sora2_text_portrait',     -- RunningHub 文生视频-竖屏
    'rh_sora2_text_landscape',    -- RunningHub 文生视频-横屏
    'rh_sora2_text_portrait_hd',  -- RunningHub 文生视频-高清竖屏
    'rh_sora2_text_landscape_hd', -- RunningHub 文生视频-高清横屏
    'rh_sora2_text_portrait_15s', -- RunningHub 文生视频-竖屏15秒
    'rh_sora2_text_landscape_15s'  -- RunningHub 文生视频-横屏15秒
);

-- 2. 修正 RunningHub Sora2 图生视频模型
UPDATE `points_config` 
SET `task_type` = 'image_to_video' 
WHERE `model_name` IN (
    'rh_sora2_img_portrait',     -- RunningHub 图生视频-竖屏
    'rh_sora2_img_landscape',    -- RunningHub 图生视频-横屏
    'rh_sora2_img_portrait_hd',  -- RunningHub 图生视频-高清竖屏
    'rh_sora2_img_landscape_hd', -- RunningHub 图生视频-高清横屏
    'rh_sora2_img_portrait_15s', -- RunningHub 图生视频-竖屏15秒
    'rh_sora2_img_landscape_15s' -- RunningHub 图生视频-横屏15秒
);

-- 3. 修正其他已知模型
UPDATE `points_config` 
SET `task_type` = 'text_to_image' 
WHERE `model_name` IN ('sora_image', 'gpt-4o-image');

UPDATE `points_config` 
SET `task_type` = 'text_to_video' 
WHERE `model_name` IN (
    'sora_video2',              -- 竖屏10秒
    'sora_video2-landscape',    -- 横屏10秒
    'sora_video2-15s',          -- 竖屏15秒
    'sora_video2-landscape-15s', -- 横屏15秒
    'sora-2-pro-all'            -- Sora Pro高清视频
);

-- 4. 验证更新结果
SELECT 
    model_name,
    provider_type,
    task_type,
    description
FROM points_config 
WHERE is_deleted = 0 
ORDER BY provider_type, task_type, model_name;

-- 5. 统计各类型的模型数量
SELECT 
    task_type,
    provider_type,
    COUNT(*) as count
FROM points_config 
WHERE is_deleted = 0 AND is_enabled = 1
GROUP BY task_type, provider_type
ORDER BY task_type, provider_type;
