mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-05-07 10:14:35 +08:00
AI3D 页面支持 dark 模式
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
.page-threed {
|
.page-threed {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background: #f5f5f5;
|
background: var(--theme-bg-all);
|
||||||
}
|
}
|
||||||
|
|
||||||
.params-panel {
|
.params-panel {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
background: white;
|
background: var(--card-bg);
|
||||||
border-right: 1px solid #e4e7ed;
|
border-right: 1px solid var(--line-box);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,14 +38,14 @@
|
|||||||
.label {
|
.label {
|
||||||
display: block;
|
display: block;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #414141;
|
color: var(--theme-text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.advanced-toggle-btn {
|
.advanced-toggle-btn {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #66b1ff;
|
color: var(--text-color-primary);
|
||||||
background: #f0f9ff;
|
background: var(--el-color-primary-light-9);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
.advanced-params {
|
.advanced-params {
|
||||||
padding: 10px 16px;
|
padding: 10px 16px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border-left: 4px solid #2196f3;
|
border-left: 4px solid var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,11 +74,11 @@
|
|||||||
.power-value {
|
.power-value {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.power-unit {
|
.power-unit {
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,13 +105,13 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background: var(--panel-bg);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
color: white;
|
color: var(--theme-text-color-primary);
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: white;
|
color: var(--theme-text-color-primary);
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -121,32 +121,32 @@
|
|||||||
content: '';
|
content: '';
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: white;
|
background: var(--theme-text-color-primary);
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
background: rgba(255, 255, 255, 0.2);
|
// background: rgba(255, 255, 255, 0.2);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
// border: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
color: white;
|
// color: white;
|
||||||
|
|
||||||
&:hover {
|
// &:hover {
|
||||||
background: rgba(255, 255, 255, 0.3);
|
// background: rgba(255, 255, 255, 0.3);
|
||||||
border-color: rgba(255, 255, 255, 0.5);
|
// border-color: rgba(255, 255, 255, 0.5);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-items {
|
.task-items {
|
||||||
.task-card {
|
.task-card {
|
||||||
background: white;
|
background: var(--card-bg);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
border: 1px solid #e4e7ed;
|
border: 1px solid var(--line-box);
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -161,22 +161,22 @@
|
|||||||
|
|
||||||
&.task-card-completed {
|
&.task-card-completed {
|
||||||
border-left: 4px solid #67c23a;
|
border-left: 4px solid #67c23a;
|
||||||
background: #f0f9eb;
|
background: var(--el-fill-color-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.task-card-processing {
|
&.task-card-processing {
|
||||||
border-left: 4px solid #409eff;
|
border-left: 4px solid var(--text-color-primary);
|
||||||
background: #ecf5ff;
|
background: var(--el-fill-color-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.task-card-failed {
|
&.task-card-failed {
|
||||||
border-left: 4px solid #f56c6c;
|
border-left: 4px solid #f56c6c;
|
||||||
background: #fef0f0;
|
background: var(--el-fill-color-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.task-card-default {
|
&.task-card-default {
|
||||||
border-left: 4px solid #909399;
|
border-left: 4px solid #909399;
|
||||||
background: #f4f4f4;
|
background: var(--el-fill-color-light);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,25 +196,25 @@
|
|||||||
.task-id {
|
.task-id {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: var(--theme-text-color-primary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-platform {
|
.task-platform {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,22 +233,22 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&.pending {
|
&.pending {
|
||||||
background: #fffbe6;
|
background: var(--el-fill-color-light);
|
||||||
color: #e6a23c;
|
color: #e6a23c;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.processing {
|
&.processing {
|
||||||
background: #e1f3d8;
|
background: var(--el-fill-color-light);
|
||||||
color: #67c23a;
|
color: #67c23a;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.completed {
|
&.completed {
|
||||||
background: #e1f3d8;
|
background: var(--el-fill-color-light);
|
||||||
color: #67c23a;
|
color: #67c23a;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.failed {
|
&.failed {
|
||||||
background: #fef0f0;
|
background: var(--el-fill-color-light);
|
||||||
color: #f56c6c;
|
color: #f56c6c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,14 +260,14 @@
|
|||||||
|
|
||||||
.task-power {
|
.task-power {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,11 +283,11 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #f0f0f0;
|
background: var(--chat-wel-bg);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: white;
|
color: var(--theme-text-color-primary);
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
@@ -363,7 +363,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #999;
|
color: var(--theme-text-color-secondary);
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 48px;
|
font-size: 48px;
|
||||||
@@ -385,20 +385,20 @@
|
|||||||
.task-model {
|
.task-model {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: var(--theme-text-color-primary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
color: #409eff;
|
color: var(--text-color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-prompt {
|
.task-prompt {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
@@ -406,13 +406,13 @@
|
|||||||
i {
|
i {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
color: #909399;
|
color: var(--theme-text-color-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-params {
|
.task-params {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
@@ -420,13 +420,13 @@
|
|||||||
i {
|
i {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
color: #909399;
|
color: var(--theme-text-color-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-time {
|
.task-time {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #999;
|
color: var(--theme-text-color-secondary);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
@@ -457,7 +457,7 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
border-top: 1px dashed #eee;
|
border-top: 1px dashed var(--line-box);
|
||||||
|
|
||||||
.task-actions {
|
.task-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -473,19 +473,19 @@
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
&.preview-btn {
|
&.preview-btn {
|
||||||
background: #409eff;
|
background: var(--text-color-primary);
|
||||||
color: white;
|
// color: var(--theme-text-color-primary);
|
||||||
border: 1px solid #409eff;
|
border: 1px solid var(--text-color-primary);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #66b1ff;
|
background: var(--text-color-primary);
|
||||||
border-color: #66b1ff;
|
border-color: var(--border-active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.download-btn {
|
&.download-btn {
|
||||||
background: #67c23a;
|
background: #67c23a;
|
||||||
color: white;
|
// color: var(--theme-text-color-primary);
|
||||||
border: 1px solid #67c23a;
|
border: 1px solid #67c23a;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -496,7 +496,7 @@
|
|||||||
|
|
||||||
&.delete-btn {
|
&.delete-btn {
|
||||||
background: #f56c6c;
|
background: #f56c6c;
|
||||||
color: white;
|
// color: var(--theme-text-color-primary);
|
||||||
border: 1px solid #f56c6c;
|
border: 1px solid #f56c6c;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -507,7 +507,7 @@
|
|||||||
|
|
||||||
&.processing-btn {
|
&.processing-btn {
|
||||||
background: #909399;
|
background: #909399;
|
||||||
color: white;
|
// color: var(--theme-text-color-primary);
|
||||||
border: 1px solid #909399;
|
border: 1px solid #909399;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
@@ -518,13 +518,13 @@
|
|||||||
.empty-state {
|
.empty-state {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
background: #f0f0f0;
|
background: var(--chat-wel-bg);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #999;
|
color: var(--theme-text-color-secondary);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
@@ -544,36 +544,36 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
min-height: 500px;
|
min-height: 500px;
|
||||||
background: #f0f0f0;
|
background: var(--chat-wel-bg);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.three-container {
|
.three-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
background: #f0f0f0;
|
background: var(--chat-wel-bg);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-placeholder {
|
.preview-placeholder {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 500px;
|
height: 500px;
|
||||||
background: #f0f0f0;
|
background: var(--chat-wel-bg);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #666;
|
color: var(--theme-text-color-secondary);
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 48px;
|
font-size: 48px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
color: #999;
|
color: var(--theme-text-color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
@@ -591,7 +591,7 @@
|
|||||||
.params-panel {
|
.params-panel {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
border-bottom: 1px solid #e4e7ed;
|
border-bottom: 1px solid var(--line-box);
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-card-content {
|
.task-card-content {
|
||||||
|
|||||||
361
web/src/store/ai3d.js
Normal file
361
web/src/store/ai3d.js
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
import { checkSession } from '@/store/cache'
|
||||||
|
import { showMessageError } from '@/utils/dialog'
|
||||||
|
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
||||||
|
import { replaceImg } from '@/utils/libs'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
|
export const useAI3DStore = defineStore('ai3d', () => {
|
||||||
|
// 响应式数据
|
||||||
|
const activePlatform = ref('gitee')
|
||||||
|
const loading = ref(false)
|
||||||
|
const previewVisible = ref(false)
|
||||||
|
const currentPage = ref(1)
|
||||||
|
const pageSize = ref(10)
|
||||||
|
const total = ref(0)
|
||||||
|
const taskList = ref([])
|
||||||
|
const currentPreviewTask = ref(null)
|
||||||
|
const giteeAdvancedVisible = ref(false)
|
||||||
|
|
||||||
|
const tencentDefaultForm = {
|
||||||
|
text3d: false,
|
||||||
|
prompt: '',
|
||||||
|
image_url: '',
|
||||||
|
model: '',
|
||||||
|
file_format: '',
|
||||||
|
enable_pbr: false,
|
||||||
|
model_desc: '',
|
||||||
|
power: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
const giteeDefaultForm = {
|
||||||
|
prompt: '',
|
||||||
|
image_url: '',
|
||||||
|
model: '',
|
||||||
|
file_format: '',
|
||||||
|
texture: false,
|
||||||
|
seed: 1234,
|
||||||
|
num_inference_steps: 5,
|
||||||
|
guidance_scale: 7.5,
|
||||||
|
octree_resolution: 128,
|
||||||
|
model_desc: '',
|
||||||
|
power: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
const tencentForm = ref({ ...tencentDefaultForm })
|
||||||
|
const giteeForm = ref({ ...giteeDefaultForm })
|
||||||
|
const currentPower = ref(0)
|
||||||
|
const tencentSupportedFormats = ref([])
|
||||||
|
const giteeSupportedFormats = ref([])
|
||||||
|
|
||||||
|
const configs = ref({
|
||||||
|
gitee: { models: [] },
|
||||||
|
tencent: { models: [] },
|
||||||
|
})
|
||||||
|
|
||||||
|
// 计算属性
|
||||||
|
const currentForm = computed(() =>
|
||||||
|
activePlatform.value === 'tencent' ? tencentForm.value : giteeForm.value
|
||||||
|
)
|
||||||
|
const selectedModel = computed(() => currentForm.value.model)
|
||||||
|
const currentPrompt = computed(() => currentForm.value.prompt)
|
||||||
|
const currentImage = computed(() =>
|
||||||
|
currentForm.value.image_url ? [{ url: currentForm.value.image_url }] : []
|
||||||
|
)
|
||||||
|
|
||||||
|
// 加载配置
|
||||||
|
const loadConfigs = async () => {
|
||||||
|
const response = await httpGet('/api/ai3d/configs')
|
||||||
|
configs.value = response.data
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleModelChange = (value) => {
|
||||||
|
if (activePlatform.value === 'tencent') {
|
||||||
|
const model = configs.value.tencent.models.find((m) => m.name === value)
|
||||||
|
if (!model) return
|
||||||
|
currentPower.value = model.power
|
||||||
|
tencentForm.value.power = model.power
|
||||||
|
tencentForm.value.model_desc = model.desc
|
||||||
|
tencentForm.value.file_format = model.formats[0]
|
||||||
|
tencentSupportedFormats.value = model.formats
|
||||||
|
} else {
|
||||||
|
const model = configs.value.gitee.models.find((m) => m.name === value)
|
||||||
|
if (!model) return
|
||||||
|
currentPower.value = model.power
|
||||||
|
giteeForm.value.power = model.power
|
||||||
|
giteeForm.value.model_desc = model.desc
|
||||||
|
giteeForm.value.file_format = model.formats[0]
|
||||||
|
giteeSupportedFormats.value = model.formats
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlatformChange = (value) => {
|
||||||
|
activePlatform.value = value
|
||||||
|
currentPower.value = value === 'tencent' ? tencentForm.value.power : giteeForm.value.power
|
||||||
|
}
|
||||||
|
|
||||||
|
const generate3D = async () => {
|
||||||
|
const requestData = {
|
||||||
|
...(activePlatform.value === 'tencent' ? tencentForm.value : giteeForm.value),
|
||||||
|
}
|
||||||
|
if (requestData.model === '') {
|
||||||
|
ElMessage.warning('请选择模型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (requestData.file_format === '') {
|
||||||
|
ElMessage.warning('请选择输出格式')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
requestData.type = activePlatform.value
|
||||||
|
if (requestData.image_url !== '') {
|
||||||
|
requestData.image_url = replaceImg(requestData.image_url[0].url)
|
||||||
|
}
|
||||||
|
const response = await httpPost('/api/ai3d/generate', requestData)
|
||||||
|
if (response.code === 0) {
|
||||||
|
ElMessage.success('任务创建成功')
|
||||||
|
tencentForm.value = { ...tencentDefaultForm }
|
||||||
|
giteeForm.value = { ...giteeDefaultForm }
|
||||||
|
currentPower.value = 0
|
||||||
|
await loadTasks()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.message || '创建任务失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('创建任务失败:' + error.message)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadTasks = async () => {
|
||||||
|
try {
|
||||||
|
const response = await httpGet('/api/ai3d/jobs/mock', {
|
||||||
|
page: currentPage.value,
|
||||||
|
page_size: pageSize.value,
|
||||||
|
})
|
||||||
|
if (response.code === 0) {
|
||||||
|
taskList.value = response.data.items
|
||||||
|
total.value = response.data.total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('加载任务列表失败:' + error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const refreshTasks = () => {
|
||||||
|
loadTasks()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageSizeChange = (size) => {
|
||||||
|
pageSize.value = size
|
||||||
|
currentPage.value = 1
|
||||||
|
loadTasks()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCurrentPageChange = (page) => {
|
||||||
|
currentPage.value = page
|
||||||
|
loadTasks()
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteTask = async (taskId) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确定要删除这个任务吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
const response = await httpGet(`/api/ai3d/job/delete?id=${taskId}`)
|
||||||
|
if (response.code === 0) {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
loadTasks()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.message || '删除失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
ElMessage.error('删除失败:' + error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const preview3D = (task) => {
|
||||||
|
currentPreviewTask.value = task
|
||||||
|
previewVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const closePreview = () => {
|
||||||
|
previewVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const downloadFile = async (item) => {
|
||||||
|
const url = replaceImg(item.file_url)
|
||||||
|
const downloadURL = `/api/download?url=${url}`
|
||||||
|
const urlObj = new URL(url)
|
||||||
|
const fileName = urlObj.pathname.split('/').pop()
|
||||||
|
item.downloading = true
|
||||||
|
try {
|
||||||
|
const response = await httpDownload(downloadURL)
|
||||||
|
const blob = new Blob([response.data])
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = URL.createObjectURL(blob)
|
||||||
|
link.download = fileName
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
URL.revokeObjectURL(link.href)
|
||||||
|
item.downloading = false
|
||||||
|
} catch (error) {
|
||||||
|
showMessageError('下载失败')
|
||||||
|
item.downloading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const downloadCurrentModel = () => {
|
||||||
|
if (currentPreviewTask.value) {
|
||||||
|
downloadFile(currentPreviewTask.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStatusText = (status) => {
|
||||||
|
const statusMap = {
|
||||||
|
pending: '等待中',
|
||||||
|
processing: '处理中',
|
||||||
|
completed: '已完成',
|
||||||
|
failed: '失败',
|
||||||
|
}
|
||||||
|
return statusMap[status] || status
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTaskCardClass = (status) => {
|
||||||
|
if (status === 'completed') return 'task-card-completed'
|
||||||
|
if (status === 'processing') return 'task-card-processing'
|
||||||
|
if (status === 'failed') return 'task-card-failed'
|
||||||
|
return 'task-card-default'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getPlatformIcon = (type) => {
|
||||||
|
if (type === 'gitee') return 'iconfont icon-gitee'
|
||||||
|
if (type === 'tencent') return 'iconfont icon-tencent'
|
||||||
|
return 'iconfont icon-question'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getPlatformName = (type) => {
|
||||||
|
if (type === 'gitee') return 'Gitee 模力方舟'
|
||||||
|
if (type === 'tencent') return '腾讯云混元3D'
|
||||||
|
return '未知平台'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStatusIcon = (status) => {
|
||||||
|
if (status === 'pending') return 'iconfont icon-pending'
|
||||||
|
if (status === 'processing') return 'iconfont icon-processing'
|
||||||
|
if (status === 'completed') return 'iconfont icon-completed'
|
||||||
|
if (status === 'failed') return 'iconfont icon-failed'
|
||||||
|
return 'iconfont icon-question'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTaskPrompt = (task) => {
|
||||||
|
try {
|
||||||
|
if (task.params) {
|
||||||
|
const parsedParams = JSON.parse(task.params)
|
||||||
|
return parsedParams.prompt || '文生3D任务'
|
||||||
|
}
|
||||||
|
return '文生3D任务'
|
||||||
|
} catch (e) {
|
||||||
|
return '文生3D任务'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTaskImageUrl = (task) => {
|
||||||
|
try {
|
||||||
|
if (task.params) {
|
||||||
|
const parsedParams = JSON.parse(task.params)
|
||||||
|
return parsedParams.image_url || null
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTaskParams = (task) => {
|
||||||
|
try {
|
||||||
|
if (task.params) {
|
||||||
|
const parsedParams = JSON.parse(task.params)
|
||||||
|
const params = []
|
||||||
|
if (parsedParams.texture) params.push('纹理')
|
||||||
|
if (parsedParams.enable_pbr) params.push('PBR材质')
|
||||||
|
if (parsedParams.num_inference_steps && parsedParams.num_inference_steps !== 5)
|
||||||
|
params.push(`迭代次数: ${parsedParams.num_inference_steps}`)
|
||||||
|
if (parsedParams.guidance_scale && parsedParams.guidance_scale !== 7.5)
|
||||||
|
params.push(`引导系数: ${parsedParams.guidance_scale}`)
|
||||||
|
if (parsedParams.octree_resolution && parsedParams.octree_resolution !== 128)
|
||||||
|
params.push(`精度: ${parsedParams.octree_resolution}`)
|
||||||
|
if (parsedParams.seed && parsedParams.seed !== 1234)
|
||||||
|
params.push(`种子: ${parsedParams.seed}`)
|
||||||
|
return params.join(',')
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
} catch (e) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生命周期:加载配置与任务
|
||||||
|
onMounted(() => {
|
||||||
|
loadConfigs()
|
||||||
|
checkSession()
|
||||||
|
.then(() => {
|
||||||
|
loadTasks()
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
// 状态
|
||||||
|
activePlatform,
|
||||||
|
loading,
|
||||||
|
previewVisible,
|
||||||
|
currentPage,
|
||||||
|
pageSize,
|
||||||
|
total,
|
||||||
|
taskList,
|
||||||
|
currentPreviewTask,
|
||||||
|
giteeAdvancedVisible,
|
||||||
|
tencentForm,
|
||||||
|
giteeForm,
|
||||||
|
currentPower,
|
||||||
|
tencentSupportedFormats,
|
||||||
|
giteeSupportedFormats,
|
||||||
|
configs,
|
||||||
|
currentForm,
|
||||||
|
selectedModel,
|
||||||
|
currentPrompt,
|
||||||
|
currentImage,
|
||||||
|
// 方法
|
||||||
|
loadConfigs,
|
||||||
|
handleModelChange,
|
||||||
|
handlePlatformChange,
|
||||||
|
generate3D,
|
||||||
|
loadTasks,
|
||||||
|
refreshTasks,
|
||||||
|
handlePageSizeChange,
|
||||||
|
handleCurrentPageChange,
|
||||||
|
deleteTask,
|
||||||
|
preview3D,
|
||||||
|
closePreview,
|
||||||
|
downloadFile,
|
||||||
|
downloadCurrentModel,
|
||||||
|
getStatusText,
|
||||||
|
getTaskCardClass,
|
||||||
|
getPlatformIcon,
|
||||||
|
getPlatformName,
|
||||||
|
getStatusIcon,
|
||||||
|
getTaskPrompt,
|
||||||
|
getTaskImageUrl,
|
||||||
|
getTaskParams,
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
|
|
||||||
<div class="task-time">
|
<div class="task-time">
|
||||||
<i class="iconfont icon-shijian mr-1"></i>
|
<i class="iconfont icon-shijian mr-1"></i>
|
||||||
{{ formatTime(task.created_at) }}
|
{{ dateFormat(task.created_at) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="task-error" v-if="task.status === 'failed' && task.err_msg">
|
<div class="task-error" v-if="task.status === 'failed' && task.err_msg">
|
||||||
@@ -448,364 +448,50 @@ import ThreeDPreview from '@/components/ThreeDPreview.vue'
|
|||||||
import CustomSwitch from '@/components/ui/CustomSwitch.vue'
|
import CustomSwitch from '@/components/ui/CustomSwitch.vue'
|
||||||
import CustomTabPane from '@/components/ui/CustomTabPane.vue'
|
import CustomTabPane from '@/components/ui/CustomTabPane.vue'
|
||||||
import CustomTabs from '@/components/ui/CustomTabs.vue'
|
import CustomTabs from '@/components/ui/CustomTabs.vue'
|
||||||
import { checkSession } from '@/store/cache'
|
import { useAI3DStore } from '@/store/ai3d'
|
||||||
import { httpDownload, httpGet, httpPost } from '@/utils/http'
|
import { storeToRefs } from 'pinia'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { dateFormat } from '../utils/libs'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
|
||||||
import { showMessageError } from '../utils/dialog'
|
|
||||||
import { replaceImg } from '../utils/libs'
|
|
||||||
|
|
||||||
// 响应式数据
|
const ai3d = useAI3DStore()
|
||||||
const activePlatform = ref('gitee')
|
const {
|
||||||
const loading = ref(false)
|
activePlatform,
|
||||||
const previewVisible = ref(false)
|
loading,
|
||||||
const currentPage = ref(1)
|
previewVisible,
|
||||||
const pageSize = ref(10)
|
currentPage,
|
||||||
const total = ref(0)
|
pageSize,
|
||||||
const taskList = ref([])
|
total,
|
||||||
const currentPreviewTask = ref(null)
|
taskList,
|
||||||
const giteeAdvancedVisible = ref(false) // 控制Gitee高级参数显示状态
|
currentPreviewTask,
|
||||||
const tencentDefaultForm = {
|
giteeAdvancedVisible,
|
||||||
text3d: false,
|
tencentForm,
|
||||||
prompt: '',
|
giteeForm,
|
||||||
image_url: '',
|
currentPower,
|
||||||
model: '',
|
tencentSupportedFormats,
|
||||||
file_format: '', // 输出文件格式
|
giteeSupportedFormats,
|
||||||
enable_pbr: false, // 是否开启PBR材质
|
configs,
|
||||||
model_desc: '', // 模型描述
|
} = storeToRefs(ai3d)
|
||||||
power: 0, // 算力消耗
|
|
||||||
}
|
|
||||||
const giteeDefaultForm = {
|
|
||||||
prompt: '',
|
|
||||||
image_url: '',
|
|
||||||
model: '',
|
|
||||||
file_format: '', // 输出文件格式
|
|
||||||
texture: false, // 是否开启纹理
|
|
||||||
seed: 1234, // 随机种子
|
|
||||||
num_inference_steps: 5, //迭代次数
|
|
||||||
guidance_scale: 7.5, //引导系数
|
|
||||||
octree_resolution: 128, // 3D 渲染精度,越高3D 细节越丰富
|
|
||||||
model_desc: '', // 模型描述
|
|
||||||
power: 0, // 算力消耗
|
|
||||||
}
|
|
||||||
const tencentForm = ref(tencentDefaultForm)
|
|
||||||
const giteeForm = ref(giteeDefaultForm)
|
|
||||||
const currentPower = ref(0)
|
|
||||||
const tencentSupportedFormats = ref([])
|
|
||||||
const giteeSupportedFormats = ref([])
|
|
||||||
|
|
||||||
// 计算属性:获取当前活跃平台的表单数据
|
const {
|
||||||
const currentForm = computed(() => {
|
handleModelChange,
|
||||||
return activePlatform.value === 'tencent' ? tencentForm.value : giteeForm.value
|
handlePlatformChange,
|
||||||
})
|
generate3D,
|
||||||
|
refreshTasks,
|
||||||
const selectedModel = computed(() => {
|
handlePageSizeChange,
|
||||||
return currentForm.value.model
|
handleCurrentPageChange,
|
||||||
})
|
deleteTask,
|
||||||
|
preview3D,
|
||||||
const currentPrompt = computed(() => {
|
closePreview,
|
||||||
return currentForm.value.prompt
|
downloadFile,
|
||||||
})
|
downloadCurrentModel,
|
||||||
|
getStatusText,
|
||||||
const currentImage = computed(() => {
|
getTaskCardClass,
|
||||||
return currentForm.value.image_url ? [{ url: currentForm.value.image_url }] : []
|
getPlatformIcon,
|
||||||
})
|
getPlatformName,
|
||||||
|
getStatusIcon,
|
||||||
const configs = ref({
|
getTaskPrompt,
|
||||||
gitee: { models: [] },
|
getTaskImageUrl,
|
||||||
tencent: { models: [] },
|
getTaskParams,
|
||||||
})
|
} = ai3d
|
||||||
|
|
||||||
const loadConfigs = async () => {
|
|
||||||
const response = await httpGet('/api/ai3d/configs')
|
|
||||||
configs.value = response.data
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleModelChange = (value) => {
|
|
||||||
if (activePlatform.value === 'tencent') {
|
|
||||||
const model = configs.value.tencent.models.find((model) => model.name === value)
|
|
||||||
currentPower.value = model.power
|
|
||||||
tencentForm.value.power = model.power
|
|
||||||
tencentForm.value.model_desc = model.desc
|
|
||||||
tencentForm.value.file_format = model.formats[0]
|
|
||||||
tencentSupportedFormats.value = model.formats
|
|
||||||
} else {
|
|
||||||
const model = configs.value.gitee.models.find((model) => model.name === value)
|
|
||||||
currentPower.value = model.power
|
|
||||||
giteeForm.value.power = model.power
|
|
||||||
giteeForm.value.model_desc = model.desc
|
|
||||||
giteeForm.value.file_format = model.formats[0]
|
|
||||||
giteeSupportedFormats.value = model.formats
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlePlatformChange = (value) => {
|
|
||||||
currentPower.value = value === 'tencent' ? tencentForm.value.power : giteeForm.value.power
|
|
||||||
}
|
|
||||||
|
|
||||||
const generate3D = async () => {
|
|
||||||
const requestData = {
|
|
||||||
...(activePlatform.value === 'tencent' ? tencentForm.value : giteeForm.value),
|
|
||||||
}
|
|
||||||
if (requestData.model === '') {
|
|
||||||
ElMessage.warning('请选择模型')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (requestData.file_format === '') {
|
|
||||||
ElMessage.warning('请选择输出格式')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
|
|
||||||
requestData.type = activePlatform.value
|
|
||||||
if (requestData.image_url !== '') {
|
|
||||||
requestData.image_url = replaceImg(requestData.image_url[0].url)
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await httpPost('/api/ai3d/generate', requestData)
|
|
||||||
|
|
||||||
if (response.code === 0) {
|
|
||||||
ElMessage.success('任务创建成功')
|
|
||||||
// 清空表单
|
|
||||||
tencentForm.value = tencentDefaultForm
|
|
||||||
giteeForm.value = giteeDefaultForm
|
|
||||||
currentPower.value = 0
|
|
||||||
// 刷新任务列表
|
|
||||||
loadTasks()
|
|
||||||
} else {
|
|
||||||
ElMessage.error(response.message || '创建任务失败')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
ElMessage.error('创建任务失败:' + error.message)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadTasks = async () => {
|
|
||||||
try {
|
|
||||||
const response = await httpGet('/api/ai3d/jobs/mock', {
|
|
||||||
page: currentPage.value,
|
|
||||||
page_size: pageSize.value,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (response.code === 0) {
|
|
||||||
taskList.value = response.data.items
|
|
||||||
total.value = response.data.total
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
ElMessage.error('加载任务列表失败:' + error.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const refreshTasks = () => {
|
|
||||||
loadTasks()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlePageSizeChange = (size) => {
|
|
||||||
pageSize.value = size
|
|
||||||
currentPage.value = 1
|
|
||||||
loadTasks()
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleCurrentPageChange = (page) => {
|
|
||||||
currentPage.value = page
|
|
||||||
loadTasks()
|
|
||||||
}
|
|
||||||
|
|
||||||
const deleteTask = async (taskId) => {
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm('确定要删除这个任务吗?', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
|
|
||||||
const response = await httpGet(`/api/ai3d/job/delete?id=${taskId}`)
|
|
||||||
if (response.code === 0) {
|
|
||||||
ElMessage.success('删除成功')
|
|
||||||
loadTasks()
|
|
||||||
} else {
|
|
||||||
ElMessage.error(response.message || '删除失败')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (error !== 'cancel') {
|
|
||||||
ElMessage.error('删除失败:' + error.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const preview3D = (task) => {
|
|
||||||
currentPreviewTask.value = task
|
|
||||||
previewVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const closePreview = () => {
|
|
||||||
previewVisible.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadFile = async (item) => {
|
|
||||||
const url = replaceImg(item.file_url)
|
|
||||||
const downloadURL = `/api/download?url=${url}`
|
|
||||||
const urlObj = new URL(url)
|
|
||||||
const fileName = urlObj.pathname.split('/').pop()
|
|
||||||
|
|
||||||
item.downloading = true
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await httpDownload(downloadURL)
|
|
||||||
const blob = new Blob([response.data])
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = URL.createObjectURL(blob)
|
|
||||||
link.download = fileName
|
|
||||||
document.body.appendChild(link)
|
|
||||||
link.click()
|
|
||||||
document.body.removeChild(link)
|
|
||||||
URL.revokeObjectURL(link.href)
|
|
||||||
item.downloading = false
|
|
||||||
} catch (error) {
|
|
||||||
showMessageError('下载失败')
|
|
||||||
item.downloading = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadCurrentModel = () => {
|
|
||||||
if (currentPreviewTask.value) {
|
|
||||||
downloadFile(currentPreviewTask.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getStatusText = (status) => {
|
|
||||||
const statusMap = {
|
|
||||||
pending: '等待中',
|
|
||||||
processing: '处理中',
|
|
||||||
completed: '已完成',
|
|
||||||
failed: '失败',
|
|
||||||
}
|
|
||||||
return statusMap[status] || status
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTaskCardClass = (status) => {
|
|
||||||
if (status === 'completed') {
|
|
||||||
return 'task-card-completed'
|
|
||||||
} else if (status === 'processing') {
|
|
||||||
return 'task-card-processing'
|
|
||||||
} else if (status === 'failed') {
|
|
||||||
return 'task-card-failed'
|
|
||||||
} else {
|
|
||||||
return 'task-card-default'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getPlatformIcon = (type) => {
|
|
||||||
if (type === 'gitee') {
|
|
||||||
return 'iconfont icon-gitee'
|
|
||||||
} else if (type === 'tencent') {
|
|
||||||
return 'iconfont icon-tencent'
|
|
||||||
}
|
|
||||||
return 'iconfont icon-question'
|
|
||||||
}
|
|
||||||
|
|
||||||
const getPlatformName = (type) => {
|
|
||||||
if (type === 'gitee') {
|
|
||||||
return 'Gitee 模力方舟'
|
|
||||||
} else if (type === 'tencent') {
|
|
||||||
return '腾讯云混元3D'
|
|
||||||
}
|
|
||||||
return '未知平台'
|
|
||||||
}
|
|
||||||
|
|
||||||
const getStatusIcon = (status) => {
|
|
||||||
if (status === 'pending') {
|
|
||||||
return 'iconfont icon-pending'
|
|
||||||
} else if (status === 'processing') {
|
|
||||||
return 'iconfont icon-processing'
|
|
||||||
} else if (status === 'completed') {
|
|
||||||
return 'iconfont icon-completed'
|
|
||||||
} else if (status === 'failed') {
|
|
||||||
return 'iconfont icon-failed'
|
|
||||||
}
|
|
||||||
return 'iconfont icon-question'
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTaskPrompt = (task) => {
|
|
||||||
try {
|
|
||||||
if (task.params) {
|
|
||||||
const parsedParams = JSON.parse(task.params)
|
|
||||||
return parsedParams.prompt || '文生3D任务'
|
|
||||||
}
|
|
||||||
return '文生3D任务'
|
|
||||||
} catch (e) {
|
|
||||||
return '文生3D任务'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTaskImageUrl = (task) => {
|
|
||||||
try {
|
|
||||||
if (task.params) {
|
|
||||||
const parsedParams = JSON.parse(task.params)
|
|
||||||
return parsedParams.image_url || null
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
} catch (e) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getTaskParams = (task) => {
|
|
||||||
try {
|
|
||||||
if (task.params) {
|
|
||||||
const parsedParams = JSON.parse(task.params)
|
|
||||||
const params = []
|
|
||||||
|
|
||||||
if (parsedParams.texture) {
|
|
||||||
params.push('纹理')
|
|
||||||
}
|
|
||||||
if (parsedParams.enable_pbr) {
|
|
||||||
params.push('PBR材质')
|
|
||||||
}
|
|
||||||
if (parsedParams.num_inference_steps && parsedParams.num_inference_steps !== 5) {
|
|
||||||
params.push(`迭代次数: ${parsedParams.num_inference_steps}`)
|
|
||||||
}
|
|
||||||
if (parsedParams.guidance_scale && parsedParams.guidance_scale !== 7.5) {
|
|
||||||
params.push(`引导系数: ${parsedParams.guidance_scale}`)
|
|
||||||
}
|
|
||||||
if (parsedParams.octree_resolution && parsedParams.octree_resolution !== 128) {
|
|
||||||
params.push(`精度: ${parsedParams.octree_resolution}`)
|
|
||||||
}
|
|
||||||
if (parsedParams.seed && parsedParams.seed !== 1234) {
|
|
||||||
params.push(`种子: ${parsedParams.seed}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
return params.join(',')
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
} catch (e) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatTime = (timestamp) => {
|
|
||||||
const date = new Date(timestamp)
|
|
||||||
const year = date.getFullYear()
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
||||||
const day = String(date.getDate()).padStart(2, '0')
|
|
||||||
const hours = String(date.getHours()).padStart(2, '0')
|
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生命周期
|
|
||||||
onMounted(() => {
|
|
||||||
loadConfigs()
|
|
||||||
checkSession()
|
|
||||||
.then(() => {
|
|
||||||
loadTasks()
|
|
||||||
})
|
|
||||||
.catch(() => {})
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user