fix(short-drama-agent-front): 优化拆解引导与质量规则配置
This commit is contained in:
1 parent
c6ef595a8e
commit
2db8549818
13 files changed
+626
-225
No files matched your search
@@ -1,20 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NButton, NTabs, NTabPane } from 'naive-ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import type { CreativeProfileInput } from '../types'
|
||||
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||
import QualityPolicySettings from './QualityPolicySettings.vue'
|
||||
import type { ProjectSettingsTab } from '../context'
|
||||
|
||||
/** 项目全局配置全屏抽屉参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||
disabled: boolean
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||
disabled: boolean
|
||||
/** 辅助入口指定本次打开的配置分类。 */ initialTab?: ProjectSettingsTab
|
||||
}>(),
|
||||
{ initialTab: 'generation' }
|
||||
)
|
||||
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
const emit = defineEmits<{
|
||||
/** 生成配置已真实保存。 */ saved: [profile: CreativeProfileInput]
|
||||
/** 质量规则已真实保存,需要重新读取项目阶段状态。 */ qualitySaved: []
|
||||
}>()
|
||||
/** 项目配置全屏抽屉显隐状态。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 保存进行中时禁止关闭抽屉,避免重复写入。 */
|
||||
@@ -22,7 +30,11 @@ const saving = ref(false)
|
||||
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||
/** 项目级配置分类保持同一个全屏抽屉与底栏。 */
|
||||
const tab = ref('generation')
|
||||
const tab = ref<ProjectSettingsTab>(props.initialTab)
|
||||
/** 每次打开定位本次请求的分类,保存中不打断当前表单。 */
|
||||
watch([open, () => props.initialTab, () => props.projectId], ([shown]) => {
|
||||
if (shown && !saving.value) tab.value = props.initialTab
|
||||
})
|
||||
/** 质量策略表单实例。 */
|
||||
const qualityForm = ref<InstanceType<typeof QualityPolicySettings> | null>(null)
|
||||
/** 当前标签的独立保存入口,避免跨接口混合保存。 */
|
||||
@@ -32,7 +44,9 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
<template>
|
||||
<!-- 以下是内容铺满视口的项目全局配置抽屉模块 -->
|
||||
<AppDrawer v-model:open="open" title="项目全局配置" :busy="saving">
|
||||
<template #description>设置生成模型、画布与质量规则,后续制作使用已保存的项目配置。</template>
|
||||
<template #description
|
||||
>生成配置用于后续生图和视频;质量规则用于拆解与分镜检查,启动拆解时会引导核对确认。</template
|
||||
>
|
||||
<!-- 以下是生成配置与质量规则分类导航,保存期间禁止切换 -->
|
||||
<NTabs v-if="open" v-model:value="tab" type="line" size="small">
|
||||
<NTabPane name="generation" tab="生成配置" :disabled="saving" display-directive="show:lazy">
|
||||
@@ -54,6 +68,7 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
:project-id="props.projectId"
|
||||
:disabled="props.disabled"
|
||||
@busy="saving = $event"
|
||||
@saved="emit('qualitySaved')"
|
||||
/>
|
||||
</NTabPane>
|
||||
</NTabs>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import type { ProjectQualityPolicy } from '../../projects/types'
|
||||
import QualityPolicyExceptions from './QualityPolicyExceptions.vue'
|
||||
|
||||
/** 已保存规则只读核对,不创建可编辑草稿或修改动作许可。 */
|
||||
defineProps<{
|
||||
/** 本次检查使用的真实规则。 */ policy: ProjectQualityPolicy
|
||||
}>()
|
||||
/** 物理表现方式仅翻译显示名称,原始规则保持不变。 */
|
||||
const physicsLabels = { realistic: '写实物理', stylized: '风格化表现', fantasy: '幻想表现' }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是当前规则的简短只读摘要,编辑统一前往项目配置 -->
|
||||
<div class="grid min-w-0 gap-4 text-sm leading-7">
|
||||
<p>物理表现:{{ physicsLabels[policy.physicsMode] }}</p>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-2 text-muted">
|
||||
<span>夸张动作:{{ policy.allowExaggeratedMotion ? '允许' : '不允许' }}</span>
|
||||
<span>非物理动作:{{ policy.allowNonPhysicalActions ? '允许' : '不允许' }}</span>
|
||||
<span>超自然能力:{{ policy.allowSupernaturalAbilities ? '允许' : '不允许' }}</span>
|
||||
</div>
|
||||
<div v-if="policy.customRules.length" class="grid gap-2">
|
||||
<p class="font-medium">自定义规则</p>
|
||||
<ul class="list-inside list-disc space-y-1">
|
||||
<li v-for="(rule, index) in policy.customRules" :key="index" class="whitespace-pre-wrap wrap-anywhere">
|
||||
{{ rule }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p v-else class="text-muted">未添加自定义规则。</p>
|
||||
<QualityPolicyExceptions :exceptions="policy.actionExceptions ?? []" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,9 +1,12 @@
|
||||
import { inject, ref, type InjectionKey, type Ref } from 'vue'
|
||||
|
||||
/** 项目配置沿用同一个抽屉,可直接定位生成配置或质量规则。 */
|
||||
export type ProjectSettingsTab = 'generation' | 'quality'
|
||||
|
||||
/** 项目内共享的配置修订号,成功保存后通知已挂载的生成表单重新读取。 */
|
||||
export const projectGenerationRevisionKey: InjectionKey<Ref<number>> = Symbol('project-generation-revision')
|
||||
/** 工作区辅助入口打开同一个项目配置抽屉,避免新建重复表单或覆盖当前路由。 */
|
||||
export const projectSettingsOpenKey: InjectionKey<() => void> = Symbol('project-settings-open')
|
||||
export const projectSettingsOpenKey: InjectionKey<(tab?: ProjectSettingsTab) => void> = Symbol('project-settings-open')
|
||||
|
||||
/**
|
||||
* 读取项目配置修订号,独立使用组件时保留本地修订状态。
|
||||
|
||||
Reference in new issue
Block a user