-- ----------------------------
-- AI模块数据库表结构 (PostgreSQL版本)
-- ----------------------------

-- ----------------------------
-- AI Provider配置表
-- ----------------------------
DROP TABLE IF EXISTS ai_provider_config;
CREATE TABLE ai_provider_config (
                                    id BIGSERIAL PRIMARY KEY,
                                    provider_name VARCHAR(100) NOT NULL,
                                    provider_type VARCHAR(50) NOT NULL,
                                    enabled BOOLEAN NOT NULL DEFAULT TRUE,
                                    priority INTEGER NOT NULL DEFAULT 0,
                                    weight INTEGER NOT NULL DEFAULT 1,
                                    max_concurrency INTEGER NOT NULL DEFAULT 10,
                                    timeout_seconds INTEGER NOT NULL DEFAULT 30,
                                    max_retries INTEGER NOT NULL DEFAULT 3,
                                    circuit_breaker_config JSONB,
                                    rate_limit_config JSONB,
                                    api_config JSONB,
                                    model_config JSONB,
                                    extension_config JSONB,
                                    health_check_url VARCHAR(500),
                                    health_check_interval INTEGER NOT NULL DEFAULT 60,
                                    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                    update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                    create_by VARCHAR(64),
                                    update_by VARCHAR(64),
                                    remark VARCHAR(500)
);

COMMENT ON TABLE ai_provider_config IS 'AI Provider配置表';
COMMENT ON COLUMN ai_provider_config.id IS 'ID';
COMMENT ON COLUMN ai_provider_config.provider_name IS 'Provider名称';
COMMENT ON COLUMN ai_provider_config.provider_type IS 'Provider类型';
COMMENT ON COLUMN ai_provider_config.enabled IS '是否启用(0=禁用 1=启用)';
COMMENT ON COLUMN ai_provider_config.priority IS '优先级(数字越小优先级越高)';
COMMENT ON COLUMN ai_provider_config.weight IS '权重(用于负载均衡)';
COMMENT ON COLUMN ai_provider_config.max_concurrency IS '最大并发数';
COMMENT ON COLUMN ai_provider_config.timeout_seconds IS '超时时间(秒)';
COMMENT ON COLUMN ai_provider_config.max_retries IS '最大重试次数';
COMMENT ON COLUMN ai_provider_config.circuit_breaker_config IS '熔断器配置';
COMMENT ON COLUMN ai_provider_config.rate_limit_config IS '限流配置';
COMMENT ON COLUMN ai_provider_config.api_config IS 'API配置';
COMMENT ON COLUMN ai_provider_config.model_config IS '模型配置';
COMMENT ON COLUMN ai_provider_config.extension_config IS '扩展配置';
COMMENT ON COLUMN ai_provider_config.health_check_url IS '健康检查URL';
COMMENT ON COLUMN ai_provider_config.health_check_interval IS '健康检查间隔(秒)';
COMMENT ON COLUMN ai_provider_config.create_time IS '创建时间';
COMMENT ON COLUMN ai_provider_config.update_time IS '更新时间';
COMMENT ON COLUMN ai_provider_config.create_by IS '创建者';
COMMENT ON COLUMN ai_provider_config.update_by IS '更新者';
COMMENT ON COLUMN ai_provider_config.remark IS '备注';

CREATE UNIQUE INDEX uk_provider_name ON ai_provider_config(provider_name);
CREATE INDEX idx_provider_type ON ai_provider_config(provider_type);
CREATE INDEX idx_enabled ON ai_provider_config(enabled);
CREATE INDEX idx_priority ON ai_provider_config(priority);

-- ----------------------------
-- AI Provider配置历史表
-- ----------------------------
DROP TABLE IF EXISTS ai_provider_config_history;
CREATE TABLE ai_provider_config_history (
                                            id BIGSERIAL PRIMARY KEY,
                                            config_id BIGINT NOT NULL,
                                            provider_name VARCHAR(100) NOT NULL,
                                            config_data JSONB NOT NULL,
                                            operation_type VARCHAR(20) NOT NULL,
                                            operation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                            operation_by VARCHAR(64),
                                            remark VARCHAR(500)
);

COMMENT ON TABLE ai_provider_config_history IS 'AI Provider配置历史表';
COMMENT ON COLUMN ai_provider_config_history.id IS 'ID';
COMMENT ON COLUMN ai_provider_config_history.config_id IS '配置ID';
COMMENT ON COLUMN ai_provider_config_history.provider_name IS 'Provider名称';
COMMENT ON COLUMN ai_provider_config_history.config_data IS '配置数据';
COMMENT ON COLUMN ai_provider_config_history.operation_type IS '操作类型(CREATE/UPDATE/DELETE)';
COMMENT ON COLUMN ai_provider_config_history.operation_time IS '操作时间';
COMMENT ON COLUMN ai_provider_config_history.operation_by IS '操作者';
COMMENT ON COLUMN ai_provider_config_history.remark IS '备注';

CREATE INDEX idx_config_id ON ai_provider_config_history(config_id);
CREATE INDEX idx_provider_name ON ai_provider_config_history(provider_name);
CREATE INDEX idx_operation_time ON ai_provider_config_history(operation_time);

-- ----------------------------
-- AI聊天记录表
-- ----------------------------
DROP TABLE IF EXISTS ai_chat_record;
CREATE TABLE ai_chat_record (
                                id BIGSERIAL PRIMARY KEY,
                                session_id VARCHAR(100) NOT NULL,
                                user_id BIGINT NOT NULL,
                                provider_name VARCHAR(100) NOT NULL,
                                model_name VARCHAR(100),
                                message_type VARCHAR(20) NOT NULL,
                                content TEXT NOT NULL,
                                tokens_used INTEGER,
                                cost DECIMAL(10,6),
                                response_time INTEGER,
                                is_stream BOOLEAN NOT NULL DEFAULT FALSE,
                                error_message TEXT,
                                create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

COMMENT ON TABLE ai_chat_record IS 'AI聊天记录表';
COMMENT ON COLUMN ai_chat_record.id IS 'ID';
COMMENT ON COLUMN ai_chat_record.session_id IS '会话ID';
COMMENT ON COLUMN ai_chat_record.user_id IS '用户ID';
COMMENT ON COLUMN ai_chat_record.provider_name IS 'Provider名称';
COMMENT ON COLUMN ai_chat_record.model_name IS '模型名称';
COMMENT ON COLUMN ai_chat_record.message_type IS '消息类型(USER/ASSISTANT)';
COMMENT ON COLUMN ai_chat_record.content IS '消息内容';
COMMENT ON COLUMN ai_chat_record.tokens_used IS '使用的Token数';
COMMENT ON COLUMN ai_chat_record.cost IS '成本';
COMMENT ON COLUMN ai_chat_record.response_time IS '响应时间(毫秒)';
COMMENT ON COLUMN ai_chat_record.is_stream IS '是否流式响应';
COMMENT ON COLUMN ai_chat_record.error_message IS '错误信息';
COMMENT ON COLUMN ai_chat_record.create_time IS '创建时间';

CREATE INDEX idx_session_id ON ai_chat_record(session_id);
CREATE INDEX idx_user_id ON ai_chat_record(user_id);
CREATE INDEX idx_provider_name ON ai_chat_record(provider_name);
CREATE INDEX idx_create_time ON ai_chat_record(create_time);

-- ----------------------------
-- AI使用统计表
-- ----------------------------
DROP TABLE IF EXISTS ai_usage_stats;
CREATE TABLE ai_usage_stats (
                                id BIGSERIAL PRIMARY KEY,
                                user_id BIGINT NOT NULL,
                                provider_name VARCHAR(100) NOT NULL,
                                model_name VARCHAR(100),
                                stat_date DATE NOT NULL,
                                request_count INTEGER NOT NULL DEFAULT 0,
                                success_count INTEGER NOT NULL DEFAULT 0,
                                error_count INTEGER NOT NULL DEFAULT 0,
                                total_tokens BIGINT NOT NULL DEFAULT 0,
                                total_cost DECIMAL(10,6) NOT NULL DEFAULT 0.000000,
                                avg_response_time INTEGER NOT NULL DEFAULT 0,
                                create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

COMMENT ON TABLE ai_usage_stats IS 'AI使用统计表';
COMMENT ON COLUMN ai_usage_stats.id IS 'ID';
COMMENT ON COLUMN ai_usage_stats.user_id IS '用户ID';
COMMENT ON COLUMN ai_usage_stats.provider_name IS 'Provider名称';
COMMENT ON COLUMN ai_usage_stats.model_name IS '模型名称';
COMMENT ON COLUMN ai_usage_stats.stat_date IS '统计日期';
COMMENT ON COLUMN ai_usage_stats.request_count IS '请求次数';
COMMENT ON COLUMN ai_usage_stats.success_count IS '成功次数';
COMMENT ON COLUMN ai_usage_stats.error_count IS '错误次数';
COMMENT ON COLUMN ai_usage_stats.total_tokens IS '总Token数';
COMMENT ON COLUMN ai_usage_stats.total_cost IS '总成本';
COMMENT ON COLUMN ai_usage_stats.avg_response_time IS '平均响应时间(毫秒)';
COMMENT ON COLUMN ai_usage_stats.create_time IS '创建时间';
COMMENT ON COLUMN ai_usage_stats.update_time IS '更新时间';

CREATE UNIQUE INDEX uk_user_provider_date ON ai_usage_stats(user_id, provider_name, stat_date);
CREATE INDEX idx_provider_name ON ai_usage_stats(provider_name);
CREATE INDEX idx_stat_date ON ai_usage_stats(stat_date);

-- ----------------------------
-- AI评价记录表
-- ----------------------------
DROP TABLE IF EXISTS ai_rating_record;
CREATE TABLE ai_rating_record (
                                  id BIGSERIAL PRIMARY KEY,
                                  message_id VARCHAR(100) NOT NULL,
                                  user_id BIGINT NOT NULL,
                                  provider_name VARCHAR(100) NOT NULL,
                                  rating INTEGER NOT NULL,
                                  feedback TEXT,
                                  dimension VARCHAR(50),
                                  anonymous BOOLEAN NOT NULL DEFAULT FALSE,
                                  create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

COMMENT ON TABLE ai_rating_record IS 'AI评价记录表';
COMMENT ON COLUMN ai_rating_record.id IS 'ID';
COMMENT ON COLUMN ai_rating_record.message_id IS '消息ID';
COMMENT ON COLUMN ai_rating_record.user_id IS '用户ID';
COMMENT ON COLUMN ai_rating_record.provider_name IS 'Provider名称';
COMMENT ON COLUMN ai_rating_record.rating IS '评分(1-5)';
COMMENT ON COLUMN ai_rating_record.feedback IS '反馈内容';
COMMENT ON COLUMN ai_rating_record.dimension IS '评价维度';
COMMENT ON COLUMN ai_rating_record.anonymous IS '是否匿名';
COMMENT ON COLUMN ai_rating_record.create_time IS '创建时间';

CREATE UNIQUE INDEX uk_message_user ON ai_rating_record(message_id, user_id);
CREATE INDEX idx_provider_name ON ai_rating_record(provider_name);
CREATE INDEX idx_rating ON ai_rating_record(rating);
CREATE INDEX idx_create_time ON ai_rating_record(create_time);

-- ----------------------------
-- AI敏感词库表
-- ----------------------------
DROP TABLE IF EXISTS ai_sensitive_word;
CREATE TABLE ai_sensitive_word (
                                   id BIGSERIAL PRIMARY KEY,
                                   word VARCHAR(100) NOT NULL,
                                   word_type VARCHAR(50) NOT NULL,
                                   enabled BOOLEAN NOT NULL DEFAULT TRUE,
                                   priority INTEGER NOT NULL DEFAULT 0,
                                   remark VARCHAR(500),
                                   create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                   update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                   create_by VARCHAR(64),
                                   update_by VARCHAR(64)
);

COMMENT ON TABLE ai_sensitive_word IS 'AI敏感词库表';
COMMENT ON COLUMN ai_sensitive_word.id IS 'ID';
COMMENT ON COLUMN ai_sensitive_word.word IS '敏感词';
COMMENT ON COLUMN ai_sensitive_word.word_type IS '词类型(PROFANITY/HATE_SPEECH/VIOLENCE/SEXUAL_CONTENT/ILLEGAL_ACTIVITY/PERSONAL_INFO/SPAM/MALICIOUS_CODE/POLITICAL_SENSITIVE/COMMERCIAL_AD)';
COMMENT ON COLUMN ai_sensitive_word.enabled IS '是否启用(0=禁用 1=启用)';
COMMENT ON COLUMN ai_sensitive_word.priority IS '优先级(数字越大优先级越高)';
COMMENT ON COLUMN ai_sensitive_word.remark IS '备注';
COMMENT ON COLUMN ai_sensitive_word.create_time IS '创建时间';
COMMENT ON COLUMN ai_sensitive_word.update_time IS '更新时间';
COMMENT ON COLUMN ai_sensitive_word.create_by IS '创建者';
COMMENT ON COLUMN ai_sensitive_word.update_by IS '更新者';

CREATE UNIQUE INDEX uk_word ON ai_sensitive_word(word);
CREATE INDEX idx_word_type ON ai_sensitive_word(word_type);
CREATE INDEX idx_enabled ON ai_sensitive_word(enabled);

-- ----------------------------
-- AI绘画历史记录表
-- ----------------------------
DROP TABLE IF EXISTS ai_painting_record;
CREATE TABLE ai_painting_record (
                                    id BIGSERIAL PRIMARY KEY,
                                    task_id VARCHAR(100) NOT NULL,
                                    user_id BIGINT,
                                    engine_type VARCHAR(50) NOT NULL,
                                    prompt TEXT NOT NULL,
                                    params JSONB,
                                    status VARCHAR(50) NOT NULL,
                                    progress INTEGER NOT NULL DEFAULT 0,
                                    images JSONB,
                                    message TEXT,
                                    create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                    update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                    share_code VARCHAR(64),
                                    is_public BOOLEAN NOT NULL DEFAULT FALSE
);

COMMENT ON TABLE ai_painting_record IS 'AI绘画历史记录表';
COMMENT ON COLUMN ai_painting_record.id IS 'ID';
COMMENT ON COLUMN ai_painting_record.task_id IS '任务ID';
COMMENT ON COLUMN ai_painting_record.user_id IS '用户ID';
COMMENT ON COLUMN ai_painting_record.engine_type IS '绘画引擎类型(DALL_E_3/MIDJOURNEY/STABLE_DIFFUSION)';
COMMENT ON COLUMN ai_painting_record.prompt IS '提示词';
COMMENT ON COLUMN ai_painting_record.params IS '绘画参数(JSON)';
COMMENT ON COLUMN ai_painting_record.status IS '状态(PENDING/RUNNING/SUCCESS/FAILED)';
COMMENT ON COLUMN ai_painting_record.progress IS '进度(0-100)';
COMMENT ON COLUMN ai_painting_record.images IS '生成的图片URL列表(JSON数组)';
COMMENT ON COLUMN ai_painting_record.message IS '错误消息';
COMMENT ON COLUMN ai_painting_record.create_time IS '创建时间';
COMMENT ON COLUMN ai_painting_record.update_time IS '更新时间';
COMMENT ON COLUMN ai_painting_record.share_code IS '分享码（用于分享作品）';
COMMENT ON COLUMN ai_painting_record.is_public IS '是否公开分享(0=私有 1=公开)';

CREATE UNIQUE INDEX uk_task_id ON ai_painting_record(task_id);
CREATE UNIQUE INDEX uk_share_code ON ai_painting_record(share_code);
CREATE INDEX idx_user_id ON ai_painting_record(user_id);
CREATE INDEX idx_engine_type ON ai_painting_record(engine_type);
CREATE INDEX idx_status ON ai_painting_record(status);
CREATE INDEX idx_create_time ON ai_painting_record(create_time);
CREATE INDEX idx_is_public ON ai_painting_record(is_public);

-- ----------------------------
-- AI绘画参数模板表
-- ----------------------------
DROP TABLE IF EXISTS ai_painting_template;
CREATE TABLE ai_painting_template (
                                      id BIGSERIAL PRIMARY KEY,
                                      template_name VARCHAR(100) NOT NULL,
                                      user_id BIGINT,
                                      engine_type VARCHAR(50) NOT NULL,
                                      params JSONB NOT NULL,
                                      description VARCHAR(500),
                                      is_public BOOLEAN NOT NULL DEFAULT FALSE,
                                      sort INTEGER NOT NULL DEFAULT 0,
                                      create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                      update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                      create_by VARCHAR(64),
                                      update_by VARCHAR(64)
);

COMMENT ON TABLE ai_painting_template IS 'AI绘画参数模板表';
COMMENT ON COLUMN ai_painting_template.id IS 'ID';
COMMENT ON COLUMN ai_painting_template.template_name IS '模板名称';
COMMENT ON COLUMN ai_painting_template.user_id IS '用户ID(为空表示系统模板)';
COMMENT ON COLUMN ai_painting_template.engine_type IS '绘画引擎类型(DALL_E_3/MIDJOURNEY/STABLE_DIFFUSION)';
COMMENT ON COLUMN ai_painting_template.params IS '绘画参数(JSON)';
COMMENT ON COLUMN ai_painting_template.description IS '模板描述';
COMMENT ON COLUMN ai_painting_template.is_public IS '是否公开(0=私有 1=公开)';
COMMENT ON COLUMN ai_painting_template.sort IS '排序';
COMMENT ON COLUMN ai_painting_template.create_time IS '创建时间';
COMMENT ON COLUMN ai_painting_template.update_time IS '更新时间';
COMMENT ON COLUMN ai_painting_template.create_by IS '创建者';
COMMENT ON COLUMN ai_painting_template.update_by IS '更新者';

CREATE INDEX idx_user_id ON ai_painting_template(user_id);
CREATE INDEX idx_engine_type ON ai_painting_template(engine_type);
CREATE INDEX idx_is_public ON ai_painting_template(is_public);
CREATE INDEX idx_create_time ON ai_painting_template(create_time);

-- ----------------------------
-- AI用户配额管理表
-- ----------------------------
DROP TABLE IF EXISTS ai_user_quota;
CREATE TABLE ai_user_quota (
                               id BIGSERIAL PRIMARY KEY,
                               user_id BIGINT NOT NULL,
                               permission_level VARCHAR(50) NOT NULL DEFAULT 'BASIC',
                               daily_quota BIGINT NOT NULL DEFAULT 0,
                               monthly_quota BIGINT NOT NULL DEFAULT 0,
                               daily_used BIGINT NOT NULL DEFAULT 0,
                               monthly_used BIGINT NOT NULL DEFAULT 0,
                               last_reset_daily TIMESTAMP,
                               last_reset_monthly TIMESTAMP,
                               custom_limits JSONB,
                               remark VARCHAR(500),
                               create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                               update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                               create_by VARCHAR(64),
                               update_by VARCHAR(64)
);

COMMENT ON TABLE ai_user_quota IS 'AI用户配额管理表';
COMMENT ON COLUMN ai_user_quota.id IS 'ID';
COMMENT ON COLUMN ai_user_quota.user_id IS '用户ID';
COMMENT ON COLUMN ai_user_quota.permission_level IS '权限级别(GUEST/BASIC/PREMIUM/VIP/ADMIN)';
COMMENT ON COLUMN ai_user_quota.daily_quota IS '每日配额限制(0表示无限制)';
COMMENT ON COLUMN ai_user_quota.monthly_quota IS '每月配额限制(0表示无限制)';
COMMENT ON COLUMN ai_user_quota.daily_used IS '每日已使用配额';
COMMENT ON COLUMN ai_user_quota.monthly_used IS '每月已使用配额';
COMMENT ON COLUMN ai_user_quota.last_reset_daily IS '上次重置日配额时间';
COMMENT ON COLUMN ai_user_quota.last_reset_monthly IS '上次重置月配额时间';
COMMENT ON COLUMN ai_user_quota.custom_limits IS '自定义限制(JSON)';
COMMENT ON COLUMN ai_user_quota.remark IS '备注';
COMMENT ON COLUMN ai_user_quota.create_time IS '创建时间';
COMMENT ON COLUMN ai_user_quota.update_time IS '更新时间';
COMMENT ON COLUMN ai_user_quota.create_by IS '创建者';
COMMENT ON COLUMN ai_user_quota.update_by IS '更新者';

CREATE UNIQUE INDEX uk_user_id ON ai_user_quota(user_id);
CREATE INDEX idx_permission_level ON ai_user_quota(permission_level);
CREATE INDEX idx_create_time ON ai_user_quota(create_time);

-- ----------------------------
-- AI绘画作品收藏表
-- ----------------------------
DROP TABLE IF EXISTS ai_painting_favorite;
CREATE TABLE ai_painting_favorite (
                                      id BIGSERIAL PRIMARY KEY,
                                      user_id BIGINT NOT NULL,
                                      painting_record_id BIGINT NOT NULL,
                                      task_id VARCHAR(100),
                                      remark VARCHAR(500),
                                      create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

COMMENT ON TABLE ai_painting_favorite IS 'AI绘画作品收藏表';
COMMENT ON COLUMN ai_painting_favorite.id IS 'ID';
COMMENT ON COLUMN ai_painting_favorite.user_id IS '用户ID';
COMMENT ON COLUMN ai_painting_favorite.painting_record_id IS '绘画记录ID';
COMMENT ON COLUMN ai_painting_favorite.task_id IS '任务ID';
COMMENT ON COLUMN ai_painting_favorite.remark IS '备注';
COMMENT ON COLUMN ai_painting_favorite.create_time IS '收藏时间';

CREATE UNIQUE INDEX uk_user_painting ON ai_painting_favorite(user_id, painting_record_id);
CREATE INDEX idx_user_id ON ai_painting_favorite(user_id);
CREATE INDEX idx_painting_record_id ON ai_painting_favorite(painting_record_id);
CREATE INDEX idx_create_time ON ai_painting_favorite(create_time);

-- ----------------------------
-- 初始化AI Provider配置数据
-- ----------------------------
INSERT INTO ai_provider_config (provider_name, provider_type, enabled, priority, weight, max_concurrency, timeout_seconds, max_retries, api_config, model_config, remark) VALUES
                                                                                                                                                                              ('openai', 'OPENAI', FALSE, 1, 10, 10, 30, 3, '{"apiKey":"","baseUrl":"https://api.openai.com/v1","organization":""}', '{"defaultModel":"gpt-3.5-turbo","supportedModels":["gpt-3.5-turbo","gpt-4","gpt-4-turbo"]}', 'OpenAI官方API'),
                                                                                                                                                                              ('azure-openai', 'AZURE_OPENAI', FALSE, 2, 8, 8, 30, 3, '{"apiKey":"","endpoint":"","apiVersion":"2023-12-01-preview"}', '{"defaultModel":"gpt-35-turbo","supportedModels":["gpt-35-turbo","gpt-4"]}', 'Azure OpenAI服务'),
                                                                                                                                                                              ('chatglm', 'CHATGLM', FALSE, 3, 6, 6, 30, 3, '{"apiKey":"","baseUrl":"https://open.bigmodel.cn/api/paas/v4"}', '{"defaultModel":"glm-4","supportedModels":["glm-4","glm-3-turbo"]}', '智谱AI ChatGLM'),
                                                                                                                                                                              ('qwen', 'QWEN', FALSE, 4, 6, 6, 30, 3, '{"apiKey":"","baseUrl":"https://dashscope.aliyuncs.com/api/v1"}', '{"defaultModel":"qwen-turbo","supportedModels":["qwen-turbo","qwen-plus","qwen-max"]}', '阿里云通义千问'),
                                                                                                                                                                              ('zhipu', 'ZHIPU', FALSE, 5, 5, 5, 30, 3, '{"apiKey":"","baseUrl":"https://open.bigmodel.cn/api/paas/v4"}', '{"defaultModel":"glm-4","supportedModels":["glm-4","glm-3-turbo"]}', '智谱AI'),
                                                                                                                                                                              ('fastgpt', 'FASTGPT', FALSE, 6, 4, 4, 30, 3, '{"apiKey":"","baseUrl":"","chatId":""}', '{"defaultModel":"fastgpt","supportedModels":["fastgpt"]}', 'FastGPT平台'),
                                                                                                                                                                              ('coze', 'COZE', FALSE, 7, 3, 3, 30, 3, '{"apiKey":"","baseUrl":"https://www.coze.cn/api","botId":""}', '{"defaultModel":"coze","supportedModels":["coze"]}', 'Coze平台'),
                                                                                                                                                                              ('dify', 'DIFY', FALSE, 8, 3, 3, 30, 3, '{"apiKey":"","baseUrl":"","appId":""}', '{"defaultModel":"dify","supportedModels":["dify"]}', 'Dify平台'),
                                                                                                                                                                              ('knowledge', 'KNOWLEDGE', TRUE, 9, 2, 2, 30, 3, '{"enabled":true}', '{"defaultModel":"knowledge","supportedModels":["knowledge"]}', '内部知识库');
