iotsaas/backend/sql/V13__add_aliyun_platform_config.sql
2995840376 0ce191c448 chore: 初始化 iotsaas 版本库基线
纳入范围:
- backend/  Spring Boot 多模块后端(iot-common/device/rule/data/alarm/auth)
- frontend/admin/  Vue3 + Element Plus 管理后台
- Android/   涂鸦原生 APP (com.xhai.iot)
- backend/sql/  Flyway 风格迁移脚本(V2~V21)
- docs/       对接文档与设计文档

排除范围:
- 构建产物: node_modules/ target/ build/ dist/ .gradle/
- 签名密钥: *.jks *.keystore (严禁入库)
- 本机配置: Android/local.properties
- 运行日志: logs/ *.log
- AI 协作本地数据 .codebuddy/ 与第三方 demo tuya-demo/

.gitattributes 统一以 LF 存储, Windows 批处理保留 CRLF
2026-10-27 12:00:41 +08:00

23 lines
1.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- V13: 新增「阿里云(通义千问 / DashScope)」平台配置
-- 用途:在后台管理页面「平台集成」中维护阿里云大模型凭证,
-- 供 iot-rule 的 AI 自然语言指令解析(L1 大模型兜底)使用。
-- 优先级:platform_config(aliyun, enabled=1 且有 key) > application.yml 的 ai.llm.* > 仅走 L0 规则模板
-- 1. 扩展平台配置表:大模型相关字段
ALTER TABLE `platform_config`
ADD COLUMN `api_key` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '阿里云DashScope API Key' AFTER `access_secret`,
ADD COLUMN `model_name` VARCHAR(64) NOT NULL DEFAULT 'qwen-turbo' COMMENT '大模型名称(qwen-turbo/qwen-plus/qwen-max)' AFTER `api_key`,
ADD COLUMN `base_url` VARCHAR(255) NOT NULL DEFAULT 'https://dashscope.aliyuncs.com/compatible-mode/v1' COMMENT 'API基础地址(OpenAI兼容模式)' AFTER `model_name`,
ADD COLUMN `timeout_ms` INT NOT NULL DEFAULT 3000 COMMENT '调用超时时间(毫秒)' AFTER `base_url`;
-- 2. 插入阿里云平台配置占位记录(需在后台改为真实 API Key 并启用)
INSERT INTO `platform_config`
(`id`, `platform_code`, `platform_name`, `tenant_id`, `enabled`, `access_id`, `access_secret`,
`api_key`, `model_name`, `base_url`, `timeout_ms`, `api_region`, `region`, `remark`,
`create_time`, `update_time`, `deleted`)
VALUES
(2, 'aliyun', '阿里云(通义千问)', 0, 0, '', '',
'', 'qwen-turbo', 'https://dashscope.aliyuncs.com/compatible-mode/v1', 3000, 'cn', 'cn-hangzhou',
'在阿里云百炼(DashScope)控制台创建 API Key 后填入并启用,用于 AI 自然语言控制的大模型解析',
NOW(), NOW(), 0);