fix(backend): 修复视频生成接口401认证失败问题
- 修正可灵视频任务提交时认证失败导致的视频生成错误 - 解决接口返回500错误的问题 - 优化视频生成相关的错误日志提示 - 保证上传目录准备状态的正确显示 - 提升后台服务日志的稳定性和连续性
This commit is contained in:
@@ -52,6 +52,7 @@ export interface DesignListResponse {
|
||||
export interface GenerateDesignParams {
|
||||
category_id: number
|
||||
sub_type_id?: number
|
||||
sub_type_name?: string
|
||||
color_id?: number
|
||||
prompt: string
|
||||
carving_technique?: string
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
v-for="subType in subTypes"
|
||||
:key="subType.id"
|
||||
class="subtype-card"
|
||||
:class="{ active: currentSubType?.id === subType.id }"
|
||||
:class="{ active: !useCustomSubType && currentSubType?.id === subType.id }"
|
||||
@click="handleSelectSubType(subType)"
|
||||
>
|
||||
<div class="card-preview">
|
||||
@@ -44,9 +44,33 @@
|
||||
<span class="card-name">{{ subType.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 自定义类型卡片 -->
|
||||
<div
|
||||
class="subtype-card custom-card"
|
||||
:class="{ active: useCustomSubType }"
|
||||
@click="enableCustomSubType"
|
||||
>
|
||||
<div class="card-preview">
|
||||
<div class="card-placeholder custom-placeholder">
|
||||
<span>+</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<span class="card-name">自定义</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 自定义输入框 -->
|
||||
<div v-if="useCustomSubType" class="custom-input-area">
|
||||
<el-input
|
||||
v-model="customSubTypeName"
|
||||
placeholder="请输入自定义类型名称"
|
||||
size="large"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
<!-- 选择子类型后显示颜色选择(如有颜色数据) -->
|
||||
<template v-if="currentSubType && colors.length > 0">
|
||||
<template v-if="(currentSubType || (useCustomSubType && customSubTypeName)) && colors.length > 0">
|
||||
<ColorPicker
|
||||
v-model="selectedColor"
|
||||
:colors="colors"
|
||||
@@ -57,7 +81,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else-if="currentSubType" class="action-bar">
|
||||
<div v-else-if="currentSubType || (useCustomSubType && customSubTypeName)" class="action-bar">
|
||||
<button class="btn-primary" @click="goToGenerate">
|
||||
开始设计
|
||||
</button>
|
||||
@@ -73,15 +97,31 @@
|
||||
v-for="subType in subTypes"
|
||||
:key="subType.id"
|
||||
class="size-tag"
|
||||
:class="{ active: currentSubType?.id === subType.id }"
|
||||
:class="{ active: !useCustomSubType && currentSubType?.id === subType.id }"
|
||||
@click="handleSelectSubType(subType)"
|
||||
>
|
||||
{{ subType.name }}
|
||||
</div>
|
||||
<div
|
||||
class="size-tag custom-tag"
|
||||
:class="{ active: useCustomSubType }"
|
||||
@click="enableCustomSubType"
|
||||
>
|
||||
+ 自定义
|
||||
</div>
|
||||
</div>
|
||||
<!-- 自定义输入框 -->
|
||||
<div v-if="useCustomSubType" class="custom-input-area">
|
||||
<el-input
|
||||
v-model="customSubTypeName"
|
||||
placeholder="请输入自定义规格"
|
||||
size="large"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 选择尺寸后显示颜色选择 -->
|
||||
<template v-if="currentSubType && colors.length > 0">
|
||||
<template v-if="(currentSubType || (useCustomSubType && customSubTypeName)) && colors.length > 0">
|
||||
<ColorPicker
|
||||
v-model="selectedColor"
|
||||
:colors="colors"
|
||||
@@ -148,6 +188,17 @@ const loading = computed(() => categoryStore.loading)
|
||||
// 本地颜色选择状态,用于 v-model 双向绑定
|
||||
const selectedColor = ref<ColorOption | null>(null)
|
||||
|
||||
// 自定义子类型状态
|
||||
const useCustomSubType = ref(false)
|
||||
const customSubTypeName = ref('')
|
||||
|
||||
const enableCustomSubType = () => {
|
||||
useCustomSubType.value = true
|
||||
customSubTypeName.value = ''
|
||||
categoryStore.selectSubType(null as any)
|
||||
selectedColor.value = null
|
||||
}
|
||||
|
||||
// size_color 流程的动态标题
|
||||
const sizeColorTitle = computed(() => {
|
||||
const name = currentCategory.value?.name || ''
|
||||
@@ -178,6 +229,8 @@ watch(currentSubType, () => {
|
||||
})
|
||||
|
||||
const handleSelectSubType = (subType: SubType) => {
|
||||
useCustomSubType.value = false
|
||||
customSubTypeName.value = ''
|
||||
categoryStore.selectSubType(subType)
|
||||
}
|
||||
|
||||
@@ -190,6 +243,8 @@ const goToGenerate = () => {
|
||||
|
||||
if (currentSubType.value) {
|
||||
query.subTypeId = String(currentSubType.value.id)
|
||||
} else if (useCustomSubType.value && customSubTypeName.value) {
|
||||
query.customSubType = customSubTypeName.value
|
||||
}
|
||||
|
||||
if (selectedColor.value) {
|
||||
@@ -377,6 +432,41 @@ $text-light: #999999;
|
||||
border-color: $primary-color;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.custom-tag {
|
||||
border-style: dashed;
|
||||
color: $primary-color;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 0.06);
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: $primary-color;
|
||||
border-color: $primary-color;
|
||||
border-style: solid;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义输入区域
|
||||
.custom-input-area {
|
||||
margin-top: 20px;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
// 自定义卡片
|
||||
.custom-card {
|
||||
.custom-placeholder {
|
||||
background: linear-gradient(135deg, rgba($primary-light, 0.5), rgba($primary-color, 0.5));
|
||||
border: 2px dashed rgba(#fff, 0.6);
|
||||
|
||||
span {
|
||||
font-size: 28px;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Simple 类型介绍
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
<div class="generate-action">
|
||||
<button
|
||||
class="btn-generate"
|
||||
:disabled="!prompt.trim() || generating"
|
||||
:disabled="generating"
|
||||
@click="handleGenerate"
|
||||
>
|
||||
<el-icon v-if="!generating"><MagicStick /></el-icon>
|
||||
@@ -277,6 +277,9 @@ const subTypeId = computed(() => {
|
||||
const id = route.query.sub_type_id || route.query.subTypeId
|
||||
return id ? Number(id) : null
|
||||
})
|
||||
const customSubType = computed(() => {
|
||||
return (route.query.customSubType as string) || ''
|
||||
})
|
||||
const colorId = computed(() => {
|
||||
const id = route.query.color_id || route.query.colorId
|
||||
return id ? Number(id) : null
|
||||
@@ -296,6 +299,7 @@ const categoryName = computed(() => {
|
||||
|
||||
const subTypeName = computed(() => {
|
||||
if (currentDesign.value?.sub_type?.name) return currentDesign.value.sub_type.name
|
||||
if (customSubType.value) return customSubType.value
|
||||
if (!subTypeId.value) return ''
|
||||
const st = categoryStore.subTypes.find(s => s.id === subTypeId.value)
|
||||
return st?.name || ''
|
||||
@@ -413,15 +417,11 @@ const handleGenerate = async () => {
|
||||
ElMessage.error('缺少品类参数')
|
||||
return
|
||||
}
|
||||
if (!prompt.value.trim()) {
|
||||
ElMessage.warning('请输入设计描述')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await designStore.generateDesign({
|
||||
category_id: categoryId.value,
|
||||
sub_type_id: subTypeId.value || undefined,
|
||||
sub_type_name: customSubType.value || undefined,
|
||||
color_id: colorId.value || undefined,
|
||||
prompt: _buildFinalPrompt(),
|
||||
carving_technique: carvingTechnique.value || customCarving.value || undefined,
|
||||
|
||||
Reference in New Issue
Block a user