feat(short-drama-agent-front): 补齐后端生产与质量功能

This commit is contained in:
GJ committed 2026-10-08 18:28:35 +08:00
1 parent 967c4ebea1
commit 470b52e26d
52 files changed
+3754 -1075

No files matched your search

@@ -0,0 +1,109 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { NAlert, NButton, NCheckbox, NInputNumber } from 'naive-ui'
import { AppDialog } from '../../../components/ui'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
import type { StableAnchorQualityInput } from '../types'
/** 单主体稳定母版质量生成配置。 */
const props = defineProps<{
/** 正式主体 ID。 */
subjectId: string
/** 主体名称。 */
subjectName: string
/** 模型目录。 */
catalog: GenerationModelCatalog
/** 项目生成配置。 */
profile: CreativeProfile
/** 当前是否阻断提交。 */
disabled: boolean
}>()
/** 质量弹窗开关。 */
const open = defineModel<boolean>('open', { default: false })
/** 已确认费用的生成事件。 */
const emit = defineEmits<{ generate: [input: StableAnchorQualityInput] }>()
/** 本次供应方。 */
const provider = ref('')
/** 本次图片参数。 */
const options = ref<GenerationOptions>({})
/** 最多修复次数。 */
const maxRepairAttempts = ref(0)
/** 明确费用确认。 */
const acknowledged = ref(false)
/** 有限预算和供应方是否可用。 */
const valid = computed(
() =>
!!provider.value &&
Number.isInteger(maxRepairAttempts.value) &&
maxRepairAttempts.value >= 0 &&
maxRepairAttempts.value <= 3
)
/** 每次重新打开或切主体初始化项目参数。 */
watch(
() => [open.value, props.subjectId],
() => {
const selected =
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
props.catalog.images.find(item => item.enabled)
provider.value = selected?.provider ?? ''
options.value = {
...selected?.defaults,
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
}
maxRepairAttempts.value = 0
acknowledged.value = false
},
{ immediate: true }
)
/** 改变预算或模型后必须再次确认。 */
watch(
() => [provider.value, JSON.stringify(options.value), maxRepairAttempts.value],
() => {
acknowledged.value = false
}
)
/** 提交有限预算的模型生成参数。 */
function submit() {
if (props.disabled || !valid.value || !acknowledged.value) return
emit('generate', {
provider: provider.value,
generationOptions: { ...options.value },
maxRepairAttempts: maxRepairAttempts.value
})
open.value = false
}
</script>
<template>
<!-- 以下是单主体母版质量生成费用确认模块 -->
<AppDialog v-model:open="open" title="生成稳定母版并校验质量" :description="subjectName">
<div class="dialog-form-stack">
<NAlert type="warning" :show-icon="false"
>最多生成
{{ maxRepairAttempts + 1 }}
张候选,并逐张调用视觉校验;道具还可能调用结构编译模型,均可能产生费用。只有真实通过后,后端才会切换母版并锁定身份。</NAlert
>
<GenerationModelControls
type="image"
:catalog="catalog"
:provider="provider"
:options="options"
:aspect-ratio="profile.aspectRatio"
:disabled="disabled"
@update:provider="provider = $event"
@update:options="options = $event"
/>
<label
>最多修复次数(0–3)<NInputNumber v-model:value="maxRepairAttempts" :min="0" :max="3" :precision="0"
/></label>
<NCheckbox v-model:checked="acknowledged">我已确认本次候选数量、模型费用,且后台没有同项目任务。</NCheckbox>
</div>
<template #footer
><NButton @click="open = false">取消</NButton
><NButton type="primary" :disabled="disabled || !valid || !acknowledged" @click="submit"
>确认生成并校验</NButton
></template
>
</AppDialog>
</template>