From 4d76899488f4c363423d306b39831b51c9ab0dfe Mon Sep 17 00:00:00 2001 From: WangLeo <690854599@qq.com> Date: Mon, 15 Jun 2026 16:55:34 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=20env=20=E5=BA=9F?= =?UTF-8?q?=E5=BC=83=E5=8F=98=E9=87=8F=E3=80=81=E7=A7=BB=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=85=8D=E7=BD=AE=EF=BC=8C=E8=A1=A5=E5=85=85?= =?UTF-8?q?=20Music=20=E5=B9=B3=E5=8F=B0=E6=96=87=E6=A1=A3=E4=B8=8E?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E5=BD=92=E4=B8=80=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .env 文件移除未使用的 VITE_API_PAY_* 变量,更新生产环境 URL - 删除 5 个已废弃的 model-configs JSON 文件 - CLAUDE.md 新增 Music 平台架构说明与计费类型映射 - getPlatformCode / getChargeType 增加输入大小写归一化 --- .env.development | 4 -- .env.production | 16 ++--- CLAUDE.md | 44 ++++++++++++- model-configs/hailuo-02-fast.json | 39 ----------- model-configs/ltx-2.3image.json | 47 -------------- model-configs/ltx-2.3text.json | 40 ------------ .../vidu-start-end-to-video-q3-turbo.json | 64 ------------------- .../vidu-text-to-video-q3-turbo.json | 55 ---------------- src/utils/modelApi.js | 3 +- src/utils/taskPolling.js | 3 +- 10 files changed, 51 insertions(+), 264 deletions(-) delete mode 100644 model-configs/hailuo-02-fast.json delete mode 100644 model-configs/ltx-2.3image.json delete mode 100644 model-configs/ltx-2.3text.json delete mode 100644 model-configs/vidu-start-end-to-video-q3-turbo.json delete mode 100644 model-configs/vidu-text-to-video-q3-turbo.json diff --git a/.env.development b/.env.development index bdee987..b6c773f 100644 --- a/.env.development +++ b/.env.development @@ -5,10 +5,6 @@ VITE_BASE = '/' VITE_API_PREFIX = '/api' VITE_API_BASE_URL = 'http://test.xueai.art/newapi/api' # http://huanda.xueai.art http://106.54.11.219/api 43.248.131.153:8003 -# 支付服务 -VITE_API_PAY_PREFIX = '/pay' -VITE_API_PAY_TARGET = 'http://test.xueai.art' # http://43.248.133.202 test.xueai.art - # 任务处理模块 VITE_API_WORKFLOW_UPLOAD = 'http://test.xueai.art/AIGC/Temp/uploadImage' # https://sxwz.xueai.art/workflow https://designtools.xueai.art/workflow VITE_API_TASK_PREFIX = '/suanli' diff --git a/.env.production b/.env.production index c14eeb0..06cce7d 100644 --- a/.env.production +++ b/.env.production @@ -6,21 +6,15 @@ VITE_BUILD_MOCK = false # 主服务 VITE_API_PREFIX = '/api' -VITE_API_BASE_URL = 'https://sxwz.xueai.art/api' - -# 支付服务 -VITE_API_PAY_PREFIX = '/pay' -VITE_API_PAY_TARGET = 'https://sxwz.xueai.art' # http://43.248.133.202 +VITE_API_BASE_URL = 'https://sxwz.xueai.art/newapi/api' # 任务处理模块 -VITE_API_WORKFLOW_UPLOAD = 'https://designtools.xueai.art/workflow/file/upload' # https://sxwz.xueai.art/workflow https://designtools.xueai.art/workflow +VITE_API_WORKFLOW_UPLOAD = 'https://resources.xueai.art/AIGC/Temp/uploadImage' # https://sxwz.xueai.art/workflow https://designtools.xueai.art/workflow VITE_API_TASK_PREFIX = '/suanli' -VITE_API_TASK_TARGET = 'http://test.xueai.art' - -# 模型资源 -VITE_API_MODEL_RESOURCE = 'https://resources.xueai.art/AIGC' +VITE_API_TASK_TARGET = 'https://sxwz.xueai.art' # 是否开启KKFileView FILE_OPEN_PREVIEW = false # KKFileView服务器地址 -# FILE_VIEW_SERVER_URL = 'http://192.168.122.209:8012' \ No newline at end of file +# FILE_VIEW_SERVER_URL = 'http://192.168.122.209:8012'. + diff --git a/CLAUDE.md b/CLAUDE.md index 5a6584d..c656f0b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,9 +18,9 @@ Vue 3 (Composition API) + Vite 7 + Pinia + Vue Router + Element Plus + `vue-elem ## 架构概览 -AI 绘画/视频生成前端操作平台,通过 HTTP 接口对接算力调度后端(suanli),提交生成任务并轮询结果。 +AI 绘画/视频/音乐生成前端操作平台,通过 HTTP 接口对接算力调度后端(suanli),提交生成任务并轮询结果。 -**核心架构:Platform Descriptor 模式。** Painting 和 Video 是两个独立的平台包,通过统一的注册表动态加载。dialogBox 是通用编排壳,不包含任何平台特定逻辑。 +**核心架构:Platform Descriptor 模式。** Painting、Video 和 Music 是三个独立的平台包,通过统一的注册表动态加载。dialogBox 是通用编排壳,不包含任何平台特定逻辑。 ### 关键目录 @@ -54,6 +54,15 @@ src/ │ ├── pattern.vue │ ├── proportion.vue │ └── time.vue +│ └── music/ # Music 平台 +│ ├── index.js # defineMusicPlatform() +│ ├── modelSelector.vue +│ ├── imageUploader.vue +│ └── controls/ +│ ├── modeSelector.vue # 模式选择(常用/专业/Remix/编辑) +│ ├── pureMusicGroup.vue # 纯音乐开关 + 歌词输入弹窗 +│ ├── lyricsInput.vue # 专业模式歌词输入 +│ └── timeControl.vue # 时长滑块(常用模式) ├── stores/ # Pinia 状态管理 │ ├── user.js # 用户认证、信息(含 sessionId),pinia persist 持久化 token │ ├── display.js # 生成历史列表、UI 状态(滚动、画布等) @@ -234,6 +243,36 @@ Video 的 `getDefaultModel()` 返回 `''`,不硬编码 UUID;模型列表加 } ``` +### Music 平台特有行为 + +Music 平台与 Painting/Video 的关键差异: + +- **模式驱动控件显隐**:`mode` ref(常用模式/专业模式/Remix模式/编辑模式)决定大部分控件的 `show()`。切换模式时 `visibleControls` 自动更新。 +- **纯音乐/歌词互斥**:常用模式下 `pureMusicGroup` 控件内含纯音乐开关 + 歌词输入弹窗。开关开启时清空歌词;关闭时弹出歌词输入框。`buildTaskBody` 中 `pureMusic` 为 true 时 `lyrics` 为空字符串。 +- **参考音频**:`imageUploader` 用于上传音频文件(非图片),仅在专业模式下显示(`showImageUploader()` → `mode === '专业模式'`),且为必填(`isImageRequired()` → true)。 +- **数量限制**:专业模式下 `quantity` 强制为 1(`props()` 中做 `Math.min(mode === '专业模式' ? 1 : maxQty)`)。 +- **Music 独有控件**: + +| 控件 | `name` | `beforeModel` | 作用 | +|------|--------|---------------|------| +| `ModeSelector` | `modeSelector` | `true`(在模型选择器前) | 常用/专业/Remix/编辑 四选一 | +| `PureMusicGroup` | `pureMusicGroup` | `false` | 纯音乐开关 + 歌词输入(仅常用模式显示) | +| `LyricsInput` | `lyricsInput` | `false` | 歌词输入(仅专业模式显示) | +| `TimeControl` | `timeControl` | `false` | 时长滑块 min~max(仅常用模式显示) | + +- **`handledUis`**(Music ParamGroup 过滤用):`['textarea', 'proportion', 'imageUpload', 'hidden', 'quantity']`,额外按名称排除 `['mode', 'pureMusic', 'lyrics', 'duration', 'quantity']`。 + +### 计费类型映射(`getChargeType`) + +`taskPolling.js` 中的 `getChargeType(chargeType)` 将平台类型映射为计费数字: + +| 平台 | 计费码 | +|------|--------| +| Painting | 1 | +| Video | 4 | +| Music | 5 | +| 其他 | 2 | + ### 组件规范 **禁止在项目组件中使用外部 UI 库**(Element Plus 等),图标除外。自定义组件使用项目自研的 `Select`、`Popover` 或纯 CSS 实现。`SwitchControl` 即为一例——纯 CSS 滑动开关,不依赖 `el-switch`。 @@ -358,6 +397,7 @@ FILE_OPEN_PREVIEW = true # 是否开启 KKFileView 预览 |------|----------| | Painting | `ai_painting_talk` | | Video | `ai_video_talk` | +| Music | `ai_music_talk` | 映射函数 `getPlatformCode()` 位于 `utils/modelApi.js`。 diff --git a/model-configs/hailuo-02-fast.json b/model-configs/hailuo-02-fast.json deleted file mode 100644 index 34e0058..0000000 --- a/model-configs/hailuo-02-fast.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "modelName": "海螺 02-fast 图生视频", - "modelDescription": "RunningHub MiniMax 海螺 02-fast 图生视频模型,基于参考图生成快节奏电影感动画", - "endpoint": "/minimax/hailuo-02/fast", - "params": [ - { - "name": "prompt", - "ui": "textarea", - "label": "提示词", - "required": false - }, - { - "name": "enablePromptExpansion", - "ui": "switch", - "label": "提示词扩展", - "default": true, - "required": true - }, - { - "name": "imageUrl", - "ui": "imageUpload", - "label": "参考图片", - "maxCount": 1, - "required": true, - "maxSizeMB": 10 - }, - { - "name": "duration", - "ui": "select", - "label": "时长(秒)", - "default": "6", - "options": ["6", "10"], - "required": true - } - ], - "promptPlaceholder": "描述基于原图的动画效果(可选)。", - "inputType": "image", - "maxImages": 1 -} diff --git a/model-configs/ltx-2.3image.json b/model-configs/ltx-2.3image.json deleted file mode 100644 index bbd7926..0000000 --- a/model-configs/ltx-2.3image.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "modelName": "LTX-2.3 图生视频", - "modelDescription": "RunningHub LTX-2.3 图生视频模型,基于图片生成视频", - "endpoint": "/rhart-video/ltx-2.3/image-to-video", - "params": [ - { - "name": "imageUrl", - "ui": "imageUpload", - "label": "参考图片", - "maxCount": 1, - "required": true - }, - { - "name": "prompt", - "ui": "textarea", - "label": "提示词", - "required": true - }, - { - "name": "aspectRatio", - "ui": "proportion", - "label": "画面比例", - "default": "16:9", - "options": ["9:16", "16:9"], - "required": true - }, - { - "name": "resolution", - "ui": "resolution", - "label": "分辨率", - "default": "720p", - "options": ["480p", "720p", "1080p"], - "required": true - }, - { - "name": "duration", - "ui": "select", - "label": "时长(秒)", - "default": 5, - "options": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], - "required": true - } - ], - "promptPlaceholder": "描述图片和期望的视频运动效果。", - "inputType": "image", - "maxImages": 1 -} diff --git a/model-configs/ltx-2.3text.json b/model-configs/ltx-2.3text.json deleted file mode 100644 index c2c2cde..0000000 --- a/model-configs/ltx-2.3text.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "modelName": "LTX-2.3 文生视频", - "modelDescription": "RunningHub LTX-2.3 文生视频模型(Text-to-Video),基于文本生成视频", - "endpoint": "/rhart-video/ltx-2.3/text-to-video", - "params": [ - { - "name": "prompt", - "ui": "textarea", - "label": "提示词", - "required": true - }, - { - "name": "resolution", - "ui": "select", - "label": "分辨率", - "default": "720p", - "options": ["1080p", "720p", "480p"], - "required": true - }, - { - "name": "aspectRatio", - "ui": "proportion", - "label": "画面比例", - "default": "16:9", - "options": ["16:9", "9:16"], - "required": true - }, - { - "name": "duration", - "ui": "number", - "label": "时长(秒)", - "default": 5, - "min": 5, - "max": 15, - "required": true - } - ], - "promptPlaceholder": "描述你想生成的画面和动作。", - "inputType": "text" -} diff --git a/model-configs/vidu-start-end-to-video-q3-turbo.json b/model-configs/vidu-start-end-to-video-q3-turbo.json deleted file mode 100644 index 4ebee2d..0000000 --- a/model-configs/vidu-start-end-to-video-q3-turbo.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "modelName": "Vidu 首尾帧生视频 q3-turbo", - "modelDescription": "RunningHub Vidu 首尾帧生视频 q3-turbo 模型,通过首尾帧图片驱动视频生成,支持音视频直出", - "endpoint": "/vidu/start-end-to-video-q3-turbo", - "params": [ - { - "name": "prompt", - "ui": "textarea", - "label": "提示词", - "required": true, - "maxLength": 4000 - }, - { - "name": "firstImageUrl", - "ui": "imageUpload", - "label": "首帧图片", - "maxCount": 1, - "required": true, - "maxSizeMB": 50 - }, - { - "name": "lastImageUrl", - "ui": "imageUpload", - "label": "尾帧图片", - "maxCount": 1, - "required": true, - "maxSizeMB": 50 - }, - { - "name": "duration", - "ui": "select", - "label": "时长(秒)", - "default": "5", - "options": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"], - "required": true - }, - { - "name": "resolution", - "ui": "resolution", - "label": "分辨率", - "default": "720p", - "options": ["540p", "720p", "1080p"], - "required": true - }, - { - "name": "movementAmplitude", - "ui": "select", - "label": "运动幅度", - "default": "auto", - "options": ["auto", "small", "medium", "large"], - "required": true - }, - { - "name": "audio", - "ui": "switch", - "label": "音频直出", - "default": true, - "required": true - } - ], - "promptPlaceholder": "描述首尾帧之间的动作补全。文本长度限制 1-4000。", - "inputType": "image", - "maxImages": 2 -} diff --git a/model-configs/vidu-text-to-video-q3-turbo.json b/model-configs/vidu-text-to-video-q3-turbo.json deleted file mode 100644 index c7cdd1f..0000000 --- a/model-configs/vidu-text-to-video-q3-turbo.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "modelName": "Vidu 文生视频 q3-turbo", - "modelDescription": "RunningHub Vidu 文生视频 q3-turbo 模型,支持音视频直出", - "endpoint": "/vidu/text-to-video-q3-turbo", - "params": [ - { - "name": "prompt", - "ui": "textarea", - "label": "提示词", - "required": true, - "maxLength": 4000 - }, - { - "name": "style", - "ui": "select", - "label": "风格", - "default": "general", - "options": ["general", "anime"], - "required": true - }, - { - "name": "aspectRatio", - "ui": "proportion", - "label": "画面比例", - "default": "16:9", - "options": ["4:3", "3:4", "16:9", "9:16", "1:1"], - "required": true - }, - { - "name": "resolution", - "ui": "resolution", - "label": "分辨率", - "default": "720p", - "options": ["540p", "720p", "1080p"], - "required": true - }, - { - "name": "duration", - "ui": "select", - "label": "时长(秒)", - "default": "5", - "options": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"], - "required": true - }, - { - "name": "audio", - "ui": "switch", - "label": "音频直出", - "default": true, - "required": true - } - ], - "promptPlaceholder": "描述你想生成的视频画面和音频。文本长度限制 1-4000。", - "inputType": "text" -} diff --git a/src/utils/modelApi.js b/src/utils/modelApi.js index b78262b..1375a03 100644 --- a/src/utils/modelApi.js +++ b/src/utils/modelApi.js @@ -39,7 +39,8 @@ function saveToCache(code, models) { // 类型 → 平台编码映射 export function getPlatformCode(type) { - switch (type) { + const normalized = type.charAt(0).toUpperCase() + type.slice(1).toLowerCase() + switch (normalized) { case 'Painting': return 'ai_painting_talk' case 'Video': diff --git a/src/utils/taskPolling.js b/src/utils/taskPolling.js index a272ca6..af31a48 100644 --- a/src/utils/taskPolling.js +++ b/src/utils/taskPolling.js @@ -5,7 +5,8 @@ import { useDisplayStore, useUserStore } from '@/stores' import { userError } from '@/utils/tokenError' export function getChargeType(chargeType) { - switch (chargeType) { + const normalized = chargeType.charAt(0).toUpperCase() + chargeType.slice(1).toLowerCase() + switch (normalized) { case 'Painting': return 1 case 'Video':