From 6be9299532539dbfab61b5240ba4224bf74e19df Mon Sep 17 00:00:00 2001 From: HCode <71808213+hyf-github-user@users.noreply.github.com> Date: Sat, 17 Aug 2024 01:49:20 +0800 Subject: [PATCH] add luma (#106) Co-authored-by: Germey --- ...-13da07e5-9db9-43ce-baf7-1fb4ccf03331.json | 7 + src/components/common/Navigator.vue | 15 +- src/components/common/TopHeader.vue | 1 + src/components/luma/ConfigPanel.vue | 78 +++ src/components/luma/DetailPanel.vue | 23 + src/components/luma/OperationPanel.vue | 77 +++ src/components/luma/RecentPanel.vue | 131 +++++ .../luma/config/EndImageUrlInput.vue | 59 +++ .../luma/config/EnhancementSelector.vue | 58 +++ src/components/luma/config/LoopSelector.vue | 58 +++ src/components/luma/config/PromptInput.vue | 70 +++ .../luma/config/StartImageUrlInput.vue | 59 +++ src/components/luma/task/Detail.vue | 176 +++++++ src/components/luma/task/Preview.vue | 292 +++++++++++ src/constants/index.ts | 1 + src/constants/luma.ts | 4 + src/i18n/index.ts | 1 + src/i18n/zh-CN/common.json | 8 + src/i18n/zh-CN/index.json | 4 + src/i18n/zh-CN/luma.json | 482 ++++++++++++++++++ src/i18n/zh-CN/site.json | 8 + src/layouts/Luma.vue | 80 +++ src/models/index.ts | 1 + src/models/luma.ts | 55 ++ src/models/site.ts | 1 + src/operators/index.ts | 1 + src/operators/luma.ts | 88 ++++ src/pages/luma/Index.vue | 195 +++++++ src/pages/site/Index.vue | 2 +- src/plugins/font-awesome.ts | 7 +- src/router/constants.ts | 3 + src/router/index.ts | 2 + src/router/luma.ts | 16 + src/store/common/models.ts | 2 + src/store/common/state.ts | 2 + src/store/index.ts | 13 +- src/store/luma/actions.ts | 148 ++++++ src/store/luma/index.ts | 14 + src/store/luma/models.ts | 21 + src/store/luma/mutations.ts | 66 +++ src/store/luma/persist.ts | 1 + src/store/luma/state.ts | 17 + 42 files changed, 2342 insertions(+), 5 deletions(-) create mode 100644 change/@acedatacloud-nexior-13da07e5-9db9-43ce-baf7-1fb4ccf03331.json create mode 100644 src/components/luma/ConfigPanel.vue create mode 100644 src/components/luma/DetailPanel.vue create mode 100644 src/components/luma/OperationPanel.vue create mode 100644 src/components/luma/RecentPanel.vue create mode 100644 src/components/luma/config/EndImageUrlInput.vue create mode 100644 src/components/luma/config/EnhancementSelector.vue create mode 100644 src/components/luma/config/LoopSelector.vue create mode 100644 src/components/luma/config/PromptInput.vue create mode 100644 src/components/luma/config/StartImageUrlInput.vue create mode 100644 src/components/luma/task/Detail.vue create mode 100644 src/components/luma/task/Preview.vue create mode 100644 src/constants/luma.ts create mode 100644 src/i18n/zh-CN/luma.json create mode 100644 src/layouts/Luma.vue create mode 100644 src/models/luma.ts create mode 100644 src/operators/luma.ts create mode 100644 src/pages/luma/Index.vue create mode 100644 src/router/luma.ts create mode 100644 src/store/luma/actions.ts create mode 100644 src/store/luma/index.ts create mode 100644 src/store/luma/models.ts create mode 100644 src/store/luma/mutations.ts create mode 100644 src/store/luma/persist.ts create mode 100644 src/store/luma/state.ts diff --git a/change/@acedatacloud-nexior-13da07e5-9db9-43ce-baf7-1fb4ccf03331.json b/change/@acedatacloud-nexior-13da07e5-9db9-43ce-baf7-1fb4ccf03331.json new file mode 100644 index 00000000..a10dd8ac --- /dev/null +++ b/change/@acedatacloud-nexior-13da07e5-9db9-43ce-baf7-1fb4ccf03331.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "finish luma ui", + "packageName": "@acedatacloud/nexior", + "email": "1348977728@qq.com", + "dependentChangeType": "patch" +} diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index 436e2612..fb353515 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -108,8 +108,10 @@ import { ROUTE_INDEX, ROUTE_MIDJOURNEY_INDEX, ROUTE_QRART_INDEX, - ROUTE_SUNO_INDEX, ROUTE_QRART_HISTORY, + ROUTE_LUMA_INDEX, + ROUTE_LUMA_HISTORY, + ROUTE_SUNO_INDEX, ROUTE_SUNO_HISTORY, ROUTE_SITE_INDEX } from '@/router/constants'; @@ -200,6 +202,17 @@ export default defineComponent({ routes: [ROUTE_SUNO_INDEX, ROUTE_SUNO_HISTORY] }); } + // Add luma's leftmost icon + if (this.$store?.state?.site?.features?.luma?.enabled) { + result.push({ + route: { + name: ROUTE_LUMA_INDEX + }, + displayName: this.$t('common.nav.luma'), + icon: 'fa-solid fa-film', + routes: [ROUTE_LUMA_INDEX, ROUTE_LUMA_HISTORY] + }); + } if (this.direction === 'row') { result.push({ diff --git a/src/components/common/TopHeader.vue b/src/components/common/TopHeader.vue index afb5f129..03ffe45d 100644 --- a/src/components/common/TopHeader.vue +++ b/src/components/common/TopHeader.vue @@ -13,6 +13,7 @@ > + diff --git a/src/components/luma/ConfigPanel.vue b/src/components/luma/ConfigPanel.vue new file mode 100644 index 00000000..82081c92 --- /dev/null +++ b/src/components/luma/ConfigPanel.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/src/components/luma/DetailPanel.vue b/src/components/luma/DetailPanel.vue new file mode 100644 index 00000000..fae99a5f --- /dev/null +++ b/src/components/luma/DetailPanel.vue @@ -0,0 +1,23 @@ + + + diff --git a/src/components/luma/OperationPanel.vue b/src/components/luma/OperationPanel.vue new file mode 100644 index 00000000..62a5f38c --- /dev/null +++ b/src/components/luma/OperationPanel.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/luma/RecentPanel.vue b/src/components/luma/RecentPanel.vue new file mode 100644 index 00000000..9de228a3 --- /dev/null +++ b/src/components/luma/RecentPanel.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/components/luma/config/EndImageUrlInput.vue b/src/components/luma/config/EndImageUrlInput.vue new file mode 100644 index 00000000..0ca1df3c --- /dev/null +++ b/src/components/luma/config/EndImageUrlInput.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/src/components/luma/config/EnhancementSelector.vue b/src/components/luma/config/EnhancementSelector.vue new file mode 100644 index 00000000..1c6d79fe --- /dev/null +++ b/src/components/luma/config/EnhancementSelector.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/components/luma/config/LoopSelector.vue b/src/components/luma/config/LoopSelector.vue new file mode 100644 index 00000000..4aa1ec6b --- /dev/null +++ b/src/components/luma/config/LoopSelector.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/components/luma/config/PromptInput.vue b/src/components/luma/config/PromptInput.vue new file mode 100644 index 00000000..8c45a4e2 --- /dev/null +++ b/src/components/luma/config/PromptInput.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/components/luma/config/StartImageUrlInput.vue b/src/components/luma/config/StartImageUrlInput.vue new file mode 100644 index 00000000..3683e8ee --- /dev/null +++ b/src/components/luma/config/StartImageUrlInput.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/src/components/luma/task/Detail.vue b/src/components/luma/task/Detail.vue new file mode 100644 index 00000000..a6e592d4 --- /dev/null +++ b/src/components/luma/task/Detail.vue @@ -0,0 +1,176 @@ + + + + + + + diff --git a/src/components/luma/task/Preview.vue b/src/components/luma/task/Preview.vue new file mode 100644 index 00000000..aaa673f7 --- /dev/null +++ b/src/components/luma/task/Preview.vue @@ -0,0 +1,292 @@ + + + + + + + diff --git a/src/constants/index.ts b/src/constants/index.ts index 43f3d75c..6bfa94dc 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -5,6 +5,7 @@ export * from './chat'; export * from './chatdoc'; export * from './midjourney'; export * from './qrart'; +export * from './luma'; export * from './suno'; export * from './mapping'; export * from './surface'; diff --git a/src/constants/luma.ts b/src/constants/luma.ts new file mode 100644 index 00000000..7f743f82 --- /dev/null +++ b/src/constants/luma.ts @@ -0,0 +1,4 @@ +export const LUMA_SERVICE_ID = 'dff45a0d-2858-4936-8e2b-3d49c52aff11'; + +export const LUMA_DEFAULT_ENHANCEMENT = false; +export const LUMA_DEFAULT_LOOP = false; diff --git a/src/i18n/index.ts b/src/i18n/index.ts index ec58c62d..13027b84 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -71,6 +71,7 @@ export const loadLocaleMessages = async (i18n: I18n, locale: string) => { 'api', 'application', 'qrart', + 'luma', 'suno', 'common', 'console', diff --git a/src/i18n/zh-CN/common.json b/src/i18n/zh-CN/common.json index ae5c3b79..8d770c06 100644 --- a/src/i18n/zh-CN/common.json +++ b/src/i18n/zh-CN/common.json @@ -19,6 +19,10 @@ "message": "查看原图", "description": "按钮文本,用于查看原始图片" }, + "button.seeRawVideo": { + "message": "查看视频", + "description": "按钮文本,用于查看原始图片" + }, "button.edit": { "message": "编辑", "description": "按钮文本,用于编辑某些内容" @@ -295,6 +299,10 @@ "message": "Suno", "description": "网站导航栏中的文本,用于显示Suno页面,请不要翻译此字段,必须保持为'Suno'" }, + "nav.luma": { + "message": "Luma", + "description": "网站导航栏中的文本,用于显示Luma页面,请不要翻译此字段,必须保持为'Suno'" + }, "nav.distribution": { "message": "推荐收益", "description": "网站导航栏中的文本,用于显示推荐收益页面" diff --git a/src/i18n/zh-CN/index.json b/src/i18n/zh-CN/index.json index f16857f6..1aa719af 100644 --- a/src/i18n/zh-CN/index.json +++ b/src/i18n/zh-CN/index.json @@ -15,6 +15,10 @@ "message": "AI 音乐", "description": "AI 音乐章节标题" }, + "title.luma": { + "message": "AI 视频", + "description": "AI 视频章节标题" + }, "title.comments": { "message": "客户评价", "description": "客户评价章节标题" diff --git a/src/i18n/zh-CN/luma.json b/src/i18n/zh-CN/luma.json new file mode 100644 index 00000000..78311c6d --- /dev/null +++ b/src/i18n/zh-CN/luma.json @@ -0,0 +1,482 @@ +{ + "name.taskId": { + "message": "任务 ID", + "description": "任务的 ID" + }, + "name.type": { + "message": "类型", + "description": "要生成的 QR 码的内容类型,如'链接'、'文本'等" + }, + "name.failure": { + "message": "失败", + "description": "任务的失败状态" + }, + "name.failureReason": { + "message": "失败原因", + "description": "任务失败的原因" + }, + "name.status": { + "message": "状态", + "description": "任务的状态" + }, + "name.traceId": { + "message": "追踪 ID", + "description": "任务的追踪 ID" + }, + "name.size": { + "message": "尺寸", + "description": "要生成的 QR 码的尺寸" + }, + "name.createdAt": { + "message": "创建时间", + "description": "生成 QR 码的日期和时间" + }, + "name.pixelStyle": { + "message": "像素风格", + "description": "要生成的 QR 码的像素风格" + }, + "name.startImageUrl": { + "message": "首帧图片", + "description": "要生成的 QR 码的种子" + }, + "name.endImageUrl": { + "message": "尾帧图片", + "description": "要生成的 QR 码的种子" + }, + "name.paddingLevel": { + "message": "填充级别", + "description": "要生成的 QR 码的填充级别" + }, + "name.paddingNoise": { + "message": "填充噪音", + "description": "要生成的 QR 码的填充噪音" + }, + "name.content": { + "message": "内容", + "description": "要生成的 QR 码的内容" + }, + "name.ecl": { + "message": "纠错级别", + "description": "要生成的 QR 码的纠错级别" + }, + "name.position": { + "message": "位置", + "description": "要生成的 QR 码的位置" + }, + "name.prompt": { + "message": "视频提示", + "description": "内容输入的提示" + }, + "name.rotate": { + "message": "旋转角度", + "description": "要生成的 QR 码的旋转" + }, + "name.enhancement": { + "message": "提示词增强", + "description": "要生成的 QR 码的高级设置" + }, + "name.loop": { + "message": "视频循环播放", + "description": "要生成的 QR 码的高级设置" + }, + "name.aspectRatio": { + "message": "宽高比", + "description": "要生成的 QR 码的宽高比" + }, + "name.markerShape": { + "message": "标记形状", + "description": "要生成的 QR 码的标记形状" + }, + "name.subMarker": { + "message": "子标记", + "description": "要生成的 QR 码的子标记" + }, + "name.qrw": { + "message": "可见度", + "description": "QR 码生成器的名称" + }, + "name.steps": { + "message": "生成步数", + "description": "生成 QR 码的步数" + }, + "name.preset": { + "message": "预设风格", + "description": "要生成的 QR 码的预设" + }, + "name.lumaBot": { + "message": "Luma Bot", + "description": "Luma 视频生成器的名称" + }, + "name.contentImageUrl": { + "message": "内容图片链接", + "description": "要生成的 QR 码的内容图片 URL" + }, + "inputWay.input": { + "message": "输入内容", + "description": "输入方式" + }, + "inputWay.upload": { + "message": "上传二维码", + "description": "输入方式" + }, + "description.loop": { + "message": "为生成的视频启用循环。", + "description": "参数'qrw'的描述" + }, + "description.enhancement": { + "message": "如果您不确定如何书写提示文字,请启用输入提示文字的增强功能。", + "description": "参数'qrw'的描述" + }, + "description.startImageUrl": { + "message": "首帧图像的 URL,它将是生成视频的第一帧。", + "description": "参数'steps'的描述" + }, + "description.endImageUrl": { + "message": "尾帧图像的 URL,它将是生成视频的最后一帧。", + "description": "参数'steps'的描述" + }, + "description.prompt": { + "message": "生成Luma视频的提示词", + "description": "参数'prompt'的描述" + }, + "status.pending": { + "message": "等待中", + "description": "任务的等待状态" + }, + "placeholder.paddingNoise": { + "message": "请选择...", + "description": "填充噪音输入的占位符" + }, + "placeholder.paddingLevel": { + "message": "请选择...", + "description": "填充级别的占位符" + }, + "placeholder.prompt": { + "message": "输入要生成的视频风格的提示词,例如:Astronauts shuttle from space to volcano", + "description": "提示字段中的占位文本" + }, + "placeholder.startImageUrl": { + "message": "首帧图片链接", + "description": "种子输入的占位符" + }, + "placeholder.endImageUrl": { + "message": "尾帧图片链接", + "description": "种子输入的占位符" + }, + "placeholder.position": { + "message": "请选择...", + "description": "位置输入的占位符" + }, + "placeholder.content": { + "message": "输入要生成的 QR 码的内容,例如:https://www.google.com", + "description": "内容字段中的占位文本" + }, + "placeholder.aspectRatio": { + "message": "请选择...", + "description": "宽高比输入的占位符" + }, + "placeholder.preset": { + "message": "请选择...", + "description": "预设输入的占位符" + }, + "placeholder.markerShape": { + "message": "请选择...", + "description": "标记形状输入的占位符" + }, + "placeholder.rotate": { + "message": "请选择...", + "description": "旋转输入的占位符" + }, + "placeholder.subMarker": { + "message": "请选择...", + "description": "子标记输入的占位符" + }, + "button.generate": { + "message": "生成", + "description": "生成Luma视频的按钮文本" + }, + "button.extend": { + "message": "继续生成", + "description": "继续生成按钮文本" + }, + "button.uploadQr": { + "message": "上传二维码", + "description": "上传二维码的按钮文本" + }, + "preset.sunset": { + "message": "日落", + "description": "要生成的 QR 码的预设风格" + }, + "preset.floral": { + "message": "花卉", + "description": "要生成的 QR 码的预设风格" + }, + "preset.snowflakes": { + "message": "雪花", + "description": "要生成的 QR 码的预设风格" + }, + "preset.feathers": { + "message": "羽毛", + "description": "要生成的 QR 码的预设风格" + }, + "preset.raindrops": { + "message": "雨滴", + "description": "要生成的 QR 码的预设风格" + }, + "preset.ultraRealism": { + "message": "超现实", + "description": "要生成的 QR 码的预设风格" + }, + "preset.epicRealms": { + "message": "史诗王国", + "description": "要生成的 QR 码的预设风格" + }, + "preset.intricateStudio": { + "message": "复杂工作室", + "description": "要生成的 QR 码的预设风格" + }, + "preset.symmetricMasterpiece": { + "message": "对称杰作", + "description": "要生成的 QR 码的预设风格" + }, + "preset.luminousHighway": { + "message": "发光之路", + "description": "要生成的 QR 码的预设风格" + }, + "preset.celestialJourney": { + "message": "天体之旅", + "description": "要生成的 QR 码的预设风格" + }, + "preset.neonMech": { + "message": "霓虹机械", + "description": "要生成的 QR 码的预设风格" + }, + "preset.etherealLowPoly": { + "message": "空灵低多边形", + "description": "要生成的 QR 码的预设风格" + }, + "preset.goldenVista": { + "message": "金色景观", + "description": "要生成的 QR 码的预设风格" + }, + "preset.cinematicExpanse": { + "message": "电影般的广阔", + "description": "要生成的 QR 码的预设风格" + }, + "preset.cinematicWarm": { + "message": "电影般的温暖", + "description": "要生成的 QR 码的预设风格" + }, + "preset.desolateWilderness": { + "message": "荒凉荒野", + "description": "要生成的 QR 码的预设风格" + }, + "preset.vibrantPalette": { + "message": "充满活力的调色板", + "description": "要生成的 QR 码的预设风格" + }, + "preset.enigmaticJourney": { + "message": "神秘之旅", + "description": "要生成的 QR 码的预设风格" + }, + "preset.timelessCinematic": { + "message": "永恒的电影", + "description": "要生成的 QR 码的预设风格" + }, + "preset.regalGalaxy": { + "message": "华丽星系", + "description": "要生成的 QR 码的预设风格" + }, + "preset.illustriousCanvas": { + "message": "杰出画布", + "description": "要生成的 QR 码的预设风格" + }, + "preset.expressiveMural": { + "message": "富有表现力的壁画", + "description": "要生成的 QR 码的预设风格" + }, + "preset.sereneHaze": { + "message": "宁静薄雾", + "description": "要生成的 QR 码的预设风格" + }, + "message.uploadQr": { + "message": "上传二维码图片,可生成和二维码内容一致的艺术二维码", + "description": "上传二维码的说明" + }, + "message.promptPlaceholder": { + "message": "请输入描述要生成的图像的句子,例如:一只可爱的猫。额外参数将覆盖默认预设参数", + "description": "提示字段中的占位文本" + }, + "message.uploadReferencesExceed": { + "message": "最多可上传 5 张图片", + "description": "上传的图片数量超过限制时的错误消息" + }, + "message.uploadReferencesSuccess": { + "message": "成功上传图片", + "description": "成功上传图片时的成功消息" + }, + "message.uploadReferencesError": { + "message": "上传图片失败,请稍后重试", + "description": "图片上传失败时的错误消息" + }, + "message.startingTask": { + "message": "正在启动任务...", + "description": "绘图任务开始时的消息" + }, + "message.startTaskSuccess": { + "message": "成功发起生成任务", + "description": "成功启动任务时的成功消息" + }, + "message.startTaskFailed": { + "message": "发起任务失败,请联系管理员", + "description": "启动绘图任务失败时的错误消息" + }, + "message.usedUp": { + "message": "您的积分已用完,请购买更多积分后继续使用", + "description": "已用完时的消息" + }, + "message.generating": { + "message": "生成中...", + "description": "图像正在生成时的消息" + }, + "message.generateFailed": { + "message": "生成图像失败", + "description": "图像生成失败时的消息" + }, + "message.noOperations": { + "message": "没有可用操作", + "description": "没有可用操作时的消息" + }, + "message.noTasks": { + "message": "没有历史任务,请点击左方生成视频", + "description": "没有任务时的消息" + }, + "markerShape.square": { + "message": "正方形", + "description": "用于生成QR码的标记形状" + }, + "markerShape.circle": { + "message": "圆形", + "description": "用于生成QR码的标记形状" + }, + "markerShape.plus": { + "message": "加号", + "description": "用于生成QR码的标记形状" + }, + "markerShape.box": { + "message": "方框", + "description": "用于生成QR码的标记形状" + }, + "markerShape.octagon": { + "message": "八边形", + "description": "用于生成QR码的标记形状" + }, + "markerShape.tinyPlus": { + "message": "微加号", + "description": "用于生成QR码的标记形状" + }, + "markerShape.random": { + "message": "随机", + "description": "用于生成QR码的标记形状" + }, + "subMarker.square": { + "message": "正方形", + "description": "用于生成QR码的子标记形状" + }, + "subMarker.circle": { + "message": "圆形", + "description": "用于生成QR码的子标记形状" + }, + "subMarker.plus": { + "message": "加号", + "description": "用于生成QR码的子标记形状" + }, + "subMarker.box": { + "message": "方框", + "description": "用于生成QR码的子标记形状" + }, + "subMarker.random": { + "message": "随机", + "description": "用于生成QR码的子标记形状" + }, + "position.center": { + "message": "中心", + "description": "用于生成QR码的位置" + }, + "position.topLeft": { + "message": "左上", + "description": "用于生成QR码的位置" + }, + "position.topRight": { + "message": "右上", + "description": "用于生成QR码的位置" + }, + "position.bottomLeft": { + "message": "左下", + "description": "用于生成QR码的位置" + }, + "position.bottomRight": { + "message": "右下", + "description": "用于生成QR码的位置" + }, + "position.top": { + "message": "顶部", + "description": "用于生成QR码的位置" + }, + "position.bottom": { + "message": "底部", + "description": "用于生成QR码的位置" + }, + "position.left": { + "message": "左侧", + "description": "用于生成QR码的位置" + }, + "position.right": { + "message": "右侧", + "description": "用于生成QR码的位置" + }, + "pixelStyle.row": { + "message": "行", + "description": "用于生成QR码的像素风格" + }, + "pixelStyle.column": { + "message": "列", + "description": "用于生成QR码的像素风格" + }, + "pixelStyle.square": { + "message": "正方形", + "description": "用于生成QR码的像素风格" + }, + "pixelStyle.rounded": { + "message": "圆角", + "description": "用于生成QR码的像素风格" + }, + "pixelStyle.dot": { + "message": "点", + "description": "用于生成QR码的像素风格" + }, + "pixelStyle.squircle": { + "message": "圆角矩形", + "description": "用于生成QR码的像素风格" + }, + "type.text": { + "message": "文本", + "description": "用于生成QR码的内容类型" + }, + "type.link": { + "message": "链接", + "description": "用于生成QR码的内容类型" + }, + "type.email": { + "message": "邮件", + "description": "用于生成QR码的内容类型" + }, + "type.phone": { + "message": "电话", + "description": "用于生成QR码的内容类型" + }, + "type.sms": { + "message": "短信", + "description": "用于生成QR码的内容类型" + } +} diff --git a/src/i18n/zh-CN/site.json b/src/i18n/zh-CN/site.json index a40e307a..7833fcea 100644 --- a/src/i18n/zh-CN/site.json +++ b/src/i18n/zh-CN/site.json @@ -59,6 +59,10 @@ "message": "Qrart", "description": "展示在编辑框的标题" }, + "field.featuresLuma": { + "message": "Luma", + "description": "展示在编辑框的标题" + }, "field.featuresSuno": { "message": "Suno", "description": "展示在编辑框的标题" @@ -251,6 +255,10 @@ "message": "打开或关闭 Suno 功能模块。", "description": "Suno 功能的描述" }, + "message.featuresLuma": { + "message": "打开或关闭 Luma 功能模块。", + "description": "Luma 功能的描述" + }, "message.featuresSupport": { "message": "打开或关闭客服支持", "description": "Support 功能的描述" diff --git a/src/layouts/Luma.vue b/src/layouts/Luma.vue new file mode 100644 index 00000000..d8442a46 --- /dev/null +++ b/src/layouts/Luma.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/models/index.ts b/src/models/index.ts index e9af0d2e..7c61cd7a 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -12,6 +12,7 @@ export * from './user'; export * from './service'; export * from './credential'; export * from './qrart'; +export * from './luma'; export * from './suno'; export * from './site'; export * from './exchange'; diff --git a/src/models/luma.ts b/src/models/luma.ts new file mode 100644 index 00000000..3f1722cd --- /dev/null +++ b/src/models/luma.ts @@ -0,0 +1,55 @@ +export interface ILumaConfig { + action?: string; + video_id?: string; + prompt?: string; + video_url?: string; + start_image_url?: string; + end_image_url?: string; + enhancement?: boolean; + loop?: boolean; +} + +export interface ILumaGenerateRequest { + action?: string; + video_id?: string; + prompt?: string; + video_url?: string; + start_image_url?: string; + end_image_url?: string; + enhancement?: boolean; + loop?: boolean; + callback_url?: string; +} + +export interface ILumaGenerateResponse { + success: boolean; + task_id: string; + video_id: string; + prompt: string; + video_url: string; + video_height: number; + video_width: number; + state: string; + thumbnail_url: string; + thumbnail_width: number; + thumbnail_height: number; + trace_id: string; + error: { + code?: string; + message?: string; + }; +} + +export interface ILumaTask { + id: string; + created_at?: string; + request?: ILumaGenerateRequest; + response?: ILumaGenerateResponse; +} + +export type ILumaTaskResponse = ILumaTask; + +export interface ILumaTasksResponse { + count: number; + items: ILumaTask[]; +} diff --git a/src/models/site.ts b/src/models/site.ts index ddaf90f2..03364077 100644 --- a/src/models/site.ts +++ b/src/models/site.ts @@ -3,6 +3,7 @@ export interface ISiteFeatures { midjourney?: any; chatdoc?: any; qrart?: any; + luma?: any; suno?: any; support?: any; } diff --git a/src/operators/index.ts b/src/operators/index.ts index 6bd43adf..2c69b3ae 100644 --- a/src/operators/index.ts +++ b/src/operators/index.ts @@ -12,6 +12,7 @@ export * from './auth'; export * from './service'; export * from './credential'; export * from './qrart'; +export * from './luma'; export * from './site'; export * from './suno'; export * from './exchange'; diff --git a/src/operators/luma.ts b/src/operators/luma.ts new file mode 100644 index 00000000..1117c4ed --- /dev/null +++ b/src/operators/luma.ts @@ -0,0 +1,88 @@ +import axios, { AxiosResponse } from 'axios'; +import { ILumaGenerateRequest, ILumaGenerateResponse, ILumaTaskResponse, ILumaTasksResponse } from '@/models'; +import { BASE_URL_API } from '@/constants'; + +class LumaOperator { + async task(id: string, options: { token: string }): Promise> { + return await axios.post( + `/luma/tasks`, + { + action: 'retrieve', + id: id + }, + { + headers: { + accept: 'application/json', + 'content-type': 'application/json', + authorization: `Bearer ${options.token}`, + 'x-record-exempt': 'true' + }, + baseURL: BASE_URL_API + } + ); + } + + async tasks( + filter: { ids?: string[]; applicationId?: string; userId?: string; limit?: number; offset?: number }, + options: { token: string } + ): Promise> { + return await axios.post( + `/luma/tasks`, + { + action: 'retrieve_batch', + ...(filter.ids + ? { + ids: filter.ids + } + : {}), + ...(filter.applicationId + ? { + application_id: filter.applicationId + } + : {}), + ...(filter.userId + ? { + user_id: filter.userId + } + : {}), + ...(filter.limit !== undefined + ? { + limit: filter.limit + } + : {}), + ...(filter.offset !== undefined + ? { + offset: filter.offset + } + : {}) + }, + { + headers: { + accept: 'application/json', + 'content-type': 'application/json', + authorization: `Bearer ${options.token}`, + 'x-record-exempt': 'true' + }, + baseURL: BASE_URL_API + } + ); + } + + async generate( + data: ILumaGenerateRequest, + options: { + token: string; + } + ): Promise> { + return await axios.post('/luma/videos', data, { + headers: { + authorization: `Bearer ${options.token}`, + 'content-type': 'application/json', + accept: 'application/x-ndjson' + }, + baseURL: BASE_URL_API + }); + } +} + +export const lumaOperator = new LumaOperator(); diff --git a/src/pages/luma/Index.vue b/src/pages/luma/Index.vue new file mode 100644 index 00000000..cc06dc66 --- /dev/null +++ b/src/pages/luma/Index.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/src/pages/site/Index.vue b/src/pages/site/Index.vue index 615f93ef..4e449deb 100644 --- a/src/pages/site/Index.vue +++ b/src/pages/site/Index.vue @@ -174,7 +174,7 @@ diff --git a/src/plugins/font-awesome.ts b/src/plugins/font-awesome.ts index 9e71213f..f2b9b288 100644 --- a/src/plugins/font-awesome.ts +++ b/src/plugins/font-awesome.ts @@ -10,8 +10,9 @@ import { } from '@fortawesome/free-regular-svg-icons'; import { faDiscord as faBrandsDiscord, faWeixin as faBrandsWeixin } from '@fortawesome/free-brands-svg-icons'; import { - faSync as faSolidSync, + faPlayCircle as faSolidPlayCircle, faDownload as faSolidDownload, + faFilm as faSolidFilm, faMusic as faSolidMusic, faLanguage as faSolidLanguage, faUser as faSolidUser, @@ -74,7 +75,9 @@ import { faWandMagic as faSolidWandMagic, faAngleDown as faSolidAngleDown } from '@fortawesome/free-solid-svg-icons'; -library.add(faSolidSync); +// add icons +library.add(faSolidPlayCircle); +library.add(faSolidFilm); library.add(faSolidMusic); library.add(faRegularCopy); library.add(faRegularMessage); diff --git a/src/router/constants.ts b/src/router/constants.ts index 0d282991..3f5efa09 100644 --- a/src/router/constants.ts +++ b/src/router/constants.ts @@ -13,6 +13,9 @@ export const ROUTE_MIDJOURNEY_INDEX = 'midjourney-index'; export const ROUTE_QRART_INDEX = 'qrart-index'; export const ROUTE_QRART_HISTORY = 'qrart-history'; +export const ROUTE_LUMA_INDEX = 'luma-index'; +export const ROUTE_LUMA_HISTORY = 'luma-history'; + export const ROUTE_CHATDOC_INDEX = 'chatdoc-index'; export const ROUTE_CHATDOC_CONVERSATION = 'chatdoc-conversation'; export const ROUTE_CHATDOC_CONVERSATION_NEW = 'chatdoc-conversation-new'; diff --git a/src/router/index.ts b/src/router/index.ts index ed987228..23516a96 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,6 +6,7 @@ import midjourney from './midjourney'; import distribution from './distribution'; import chatdoc from './chatdoc'; import qrart from './qrart'; +import luma from './luma'; import suno from './suno'; import site from './site'; import profile from './profile'; @@ -31,6 +32,7 @@ const routes = [ auth, chat, qrart, + luma, suno, midjourney, distribution, diff --git a/src/router/luma.ts b/src/router/luma.ts new file mode 100644 index 00000000..44bf719d --- /dev/null +++ b/src/router/luma.ts @@ -0,0 +1,16 @@ +import { ROUTE_LUMA_INDEX } from './constants'; + +export default { + path: '/luma', + meta: { + auth: true + }, + component: () => import('@/layouts/Main.vue'), + children: [ + { + path: '', + name: ROUTE_LUMA_INDEX, + component: () => import('@/pages/luma/Index.vue') + } + ] +}; diff --git a/src/store/common/models.ts b/src/store/common/models.ts index 1a7cd766..f44a39d7 100644 --- a/src/store/common/models.ts +++ b/src/store/common/models.ts @@ -3,6 +3,7 @@ import { IMidjourneyState } from '../midjourney/models'; import { IChatState } from '../chat/models'; import { IChatdocState } from '../chatdoc/models'; import { IQrartState } from '../qrart/models'; +import { ILumaState } from '../luma/models'; import { ISunoState } from '../suno/models'; export interface ISetting {} @@ -29,5 +30,6 @@ export interface IRootState extends ICommonState { chat: IChatState; chatdoc: IChatdocState; qrart: IQrartState; + luma: ILumaState; suno: ISunoState; } diff --git a/src/store/common/state.ts b/src/store/common/state.ts index fcae95ea..1fbe579e 100644 --- a/src/store/common/state.ts +++ b/src/store/common/state.ts @@ -3,6 +3,7 @@ import chatState from '../chat/state'; import midjourneyState from '../midjourney/state'; import chatdocState from '../chatdoc/state'; import qrartState from '../qrart/state'; +import lumaState from '../luma/state'; import sunoState from '../suno/state'; export default (): IRootState => { @@ -25,6 +26,7 @@ export default (): IRootState => { chat: chatState(), midjourney: midjourneyState(), qrart: qrartState(), + luma: lumaState(), suno: sunoState() }; }; diff --git a/src/store/index.ts b/src/store/index.ts index 3a6e7aa6..a02d3c97 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -4,12 +4,14 @@ import midjourney from './midjourney'; import chat from './chat'; import chatdoc from './chatdoc'; import qrart from './qrart'; +import luma from './luma'; import suno from './suno'; import root from './common'; import persistChat from './chat/persist'; import persistMidjourney from './midjourney/persist'; import persistChatdoc from './chatdoc/persist'; import persistQrart from './qrart/persist'; +import persistLuma from './luma/persist'; import persistSuno from './suno/persist'; import persistRoot from './common/persist'; @@ -19,12 +21,21 @@ const store = createStore({ midjourney: midjourney, chat: chat, qrart: qrart, + luma: luma, suno: suno, chatdoc: chatdoc }, plugins: [ createPersistedState({ - paths: [...persistRoot, ...persistChat, ...persistMidjourney, ...persistChatdoc, ...persistQrart, ...persistSuno] + paths: [ + ...persistRoot, + ...persistChat, + ...persistMidjourney, + ...persistChatdoc, + ...persistQrart, + ...persistLuma, + ...persistSuno + ] }) ] }); diff --git a/src/store/luma/actions.ts b/src/store/luma/actions.ts new file mode 100644 index 00000000..24477053 --- /dev/null +++ b/src/store/luma/actions.ts @@ -0,0 +1,148 @@ +import { applicationOperator, lumaOperator, serviceOperator } from '@/operators'; +import { ILumaState } from './models'; +import { ActionContext } from 'vuex'; +import { IRootState } from '../common/models'; +import { IApplication, ICredential, ILumaConfig, ILumaTask, IService, IApplicationType } from '@/models'; +import { Status } from '@/models/common'; +import { LUMA_SERVICE_ID } from '@/constants'; + +export const resetAll = ({ commit }: ActionContext): void => { + commit('resetAll'); +}; + +export const setCredential = async ({ commit }: any, payload: ICredential): Promise => { + console.debug('set credential', payload); + commit('setCredential', payload); +}; + +export const setConfig = ({ commit }: any, payload: ILumaConfig) => { + commit('setConfig', payload); +}; + +export const setService = async ({ commit }: any, payload: IService): Promise => { + console.debug('set service', payload); + commit('setService', payload); +}; + +export const setApplication = ({ commit }: any, payload: IApplication[]) => { + commit('setApplication', payload); +}; + +export const getApplications = async ({ + commit, + state, + rootState +}: ActionContext): Promise => { + console.debug('start to get applications for qrart'); + return new Promise((resolve, reject) => { + state.status.getApplications = Status.Request; + applicationOperator + .getAll({ + user_id: rootState?.user?.id, + service_id: LUMA_SERVICE_ID + }) + .then((response) => { + console.debug('get applications success', response?.data); + state.status.getApplications = Status.Success; + commit('setApplications', response.data.items); + // check if there is any application with 'Period' type + const application = response.data.items?.find((application) => application?.type === IApplicationType.PERIOD); + const application2 = response.data.items?.find((application) => application?.type === IApplicationType.USAGE); + if (application && application?.remaining_amount) { + console.debug('set application with Period', application); + commit('setApplication', application); + } else if (application2) { + console.debug('set application with Usage', application2); + commit('setApplication', application2); + } + resolve(response.data.items); + console.debug('save applications success', response.data.items); + }) + .catch((error) => { + console.error('get applications error', error); + state.status.getApplications = Status.Error; + reject(error); + }); + }); +}; + +export const setTasks = ({ commit }: any, payload: any) => { + commit('setTasks', payload); +}; + +export const setTasksItems = ({ commit }: any, payload: ILumaTask[]) => { + commit('setTasksItems', payload); +}; + +export const setTasksTotal = ({ commit }: any, payload: number) => { + commit('setTasksTotal', payload); +}; + +export const setTasksActive = ({ commit }: any, payload: ILumaTask) => { + commit('setTasksActive', payload); +}; + +export const getService = async ({ commit, state }: ActionContext): Promise => { + return new Promise((resolve, reject) => { + console.debug('start to get service for luma'); + state.status.getService = Status.Request; + serviceOperator + .get(LUMA_SERVICE_ID) + .then((response) => { + state.status.getService = Status.Success; + commit('setService', response.data); + resolve(response.data); + }) + .catch((error) => { + state.status.getService = Status.Error; + reject(error); + }); + }); +}; + +export const getTasks = async ( + { commit, state }: ActionContext, + { offset, limit }: { offset?: number; limit?: number } +): Promise => { + return new Promise((resolve, reject) => { + console.debug('start to get tasks', offset, limit); + const credential = state.credential; + const token = credential?.token; + if (!token) { + return reject('no token'); + } + lumaOperator + .tasks( + { + applicationId: state.application?.id + }, + { + token + } + ) + .then((response) => { + console.debug('get imagine tasks success', response.data.items); + commit('setTasksItems', response.data.items); + commit('setTasksTotal', response.data.count); + resolve(response.data.items); + }) + .catch((error) => { + return reject(error); + }); + }); +}; + +export default { + setService, + getService, + resetAll, + setCredential, + setConfig, + setApplication, + getApplications, + setTasks, + setTasksItems, + setTasksTotal, + setTasksActive, + getTasks +}; diff --git a/src/store/luma/index.ts b/src/store/luma/index.ts new file mode 100644 index 00000000..af67341b --- /dev/null +++ b/src/store/luma/index.ts @@ -0,0 +1,14 @@ +import { Module } from 'vuex'; +import { ILumaState } from './models'; +import actions from './actions'; +import mutations from './mutations'; +import state from './state'; + +export const luma: Module = { + namespaced: true, + state, + mutations, + actions +}; + +export default luma; diff --git a/src/store/luma/models.ts b/src/store/luma/models.ts new file mode 100644 index 00000000..3b94ddd4 --- /dev/null +++ b/src/store/luma/models.ts @@ -0,0 +1,21 @@ +import { IApplication, ICredential, IService, Status } from '@/models'; +import { ILumaConfig, ILumaTask } from '@/models'; + +export interface ILumaState { + application: IApplication | undefined; + service: IService | undefined; + credential: ICredential | undefined; + config: ILumaConfig | undefined; + tasks: + | { + items: ILumaTask[] | undefined; + total: number | undefined; + active: ILumaTask | undefined; + } + | undefined; + status: { + getService: Status; + getApplications: Status; + getTasks: Status; + }; +} diff --git a/src/store/luma/mutations.ts b/src/store/luma/mutations.ts new file mode 100644 index 00000000..37b48101 --- /dev/null +++ b/src/store/luma/mutations.ts @@ -0,0 +1,66 @@ +import { IApplication, ICredential, ILumaConfig, ILumaTask, IService } from '@/models'; +import { ILumaState } from './models'; + +export const resetAll = (state: ILumaState): void => { + state.service = undefined; + state.application = undefined; + state.config = undefined; + state.credential = undefined; + state.tasks = undefined; +}; + +export const setService = (state: ILumaState, payload: IService): void => { + state.service = payload; +}; + +export const setCredential = (state: ILumaState, payload: ICredential): void => { + state.credential = payload; +}; + +export const setApplication = (state: ILumaState, payload: IApplication): void => { + state.application = payload; +}; + +export const setConfig = (state: ILumaState, payload: ILumaConfig): void => { + state.config = payload; +}; + +export const setTasksItems = (state: ILumaState, payload: ILumaTask[]): void => { + const newPayload = { + ...state.tasks, + items: payload + } as typeof state.tasks; + state.tasks = newPayload; +}; + +export const setTasksTotal = (state: ILumaState, payload: number): void => { + const newPayload = { + ...state.tasks, + total: payload + } as typeof state.tasks; + state.tasks = newPayload; +}; + +export const setTasksActive = (state: ILumaState, payload: ILumaTask): void => { + const newPayload = { + ...state.tasks, + active: payload + } as typeof state.tasks; + state.tasks = newPayload; +}; + +export const setTasks = (state: ILumaState, payload: any): void => { + state.tasks = payload; +}; + +export default { + setTasks, + setApplication, + setConfig, + setCredential, + setService, + setTasksActive, + setTasksItems, + setTasksTotal, + resetAll +}; diff --git a/src/store/luma/persist.ts b/src/store/luma/persist.ts new file mode 100644 index 00000000..11ad26eb --- /dev/null +++ b/src/store/luma/persist.ts @@ -0,0 +1 @@ +export default ['luma.config', 'luma.credential', 'luma.application', 'luma.tasks']; diff --git a/src/store/luma/state.ts b/src/store/luma/state.ts new file mode 100644 index 00000000..11709d9f --- /dev/null +++ b/src/store/luma/state.ts @@ -0,0 +1,17 @@ +import { ILumaState } from './models'; +import { Status } from '@/models'; + +export default (): ILumaState => { + return { + service: undefined, + application: undefined, + tasks: undefined, + credential: undefined, + config: undefined, + status: { + getService: Status.None, + getApplications: Status.None, + getTasks: Status.None + } + }; +};