feat(short-drama-agent-front): 完善分镜审核与制作准备流程
This commit is contained in:
1 parent
c4b43b9725
commit
1da56e0d46
72 files changed
+2801
-528
No files matched your search
@@ -4,7 +4,8 @@ import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHead
|
||||
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NFormItem, NSelect, NSpin } from 'naive-ui'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import { ApiError, errorMessage } from '../../../lib/http'
|
||||
import { showActionFeedback, useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import { generationConfigApi } from '../api'
|
||||
import type {
|
||||
CreativeProfileAspectRatio,
|
||||
@@ -33,15 +34,15 @@ const props = withDefaults(
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput]; busy: [saving: boolean] }>()
|
||||
/** 成功保存后通知当前项目生成表单更新默认值。 */
|
||||
const revision = useProjectGenerationRevision()
|
||||
/** 保存结果复用全局消息层,读取失败仍保留可核对的正文状态。 */
|
||||
const feedback = useActionMessage()
|
||||
|
||||
/** 配置和模型目录读取状态。 */
|
||||
const loading = ref(false)
|
||||
/** 配置保存状态。 */
|
||||
const saving = ref(false)
|
||||
/** 读取或保存错误。 */
|
||||
/** 配置读取失败的可恢复状态,不用于保存反馈。 */
|
||||
const error = ref('')
|
||||
/** 真实保存结果提示。 */
|
||||
const notice = ref('')
|
||||
/** 后端支持的图片与视频模型目录。 */
|
||||
const catalog = ref<GenerationModelCatalog | null>(null)
|
||||
/** 当前项目的独立编辑草稿。 */
|
||||
@@ -181,7 +182,6 @@ async function load() {
|
||||
catalog.value = null
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
try {
|
||||
const [nextCatalog, saved] = await Promise.all([
|
||||
generationConfigApi.catalog(signal),
|
||||
@@ -205,17 +205,17 @@ async function save() {
|
||||
const input = creativeProfileDraft(profile.value)
|
||||
saving.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
try {
|
||||
const saved = await generationConfigApi.saveProfile(projectId, input)
|
||||
if (disposed || props.projectId !== projectId) return
|
||||
if (saved.projectId !== projectId) throw new Error('保存结果与当前项目不匹配,请重新读取配置。')
|
||||
profile.value = creativeProfileDraft(saved)
|
||||
notice.value = '项目生成配置已保存,后续首帧和视频生成会继承此配置。'
|
||||
showActionFeedback(feedback, '项目生成配置已保存,后续制作将使用此配置。', 'success')
|
||||
revision.value++
|
||||
emit('saved', profile.value)
|
||||
} catch (cause) {
|
||||
if (!disposed && props.projectId === projectId) error.value = errorMessage(cause)
|
||||
if (!disposed && props.projectId === projectId)
|
||||
showActionFeedback(feedback, errorMessage(cause), cause instanceof ApiError && cause.status === 409 ? 'warning' : 'error')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
@@ -261,7 +261,6 @@ onScopeDispose(() => {
|
||||
<ContextNotice v-if="validationIssues.length" type="warning" :show-icon="false" class="mb-3">
|
||||
<p v-for="issue in validationIssues" :key="issue">{{ issue }}</p>
|
||||
</ContextNotice>
|
||||
<ContextNotice v-if="notice" type="success" :show-icon="false" class="mb-3">{{ notice }}</ContextNotice>
|
||||
<ContextNotice
|
||||
v-if="!loading && (!enabledImages.length || !enabledVideos.length)"
|
||||
type="warning"
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { SelectRenderLabel, SelectRenderTag } from 'naive-ui'
|
||||
import { projectsApi } from '../../projects/api'
|
||||
import { policyDraft, policyIssue } from '../../projects/quality-policy'
|
||||
import type { ProjectQualityPolicy, ProjectQualityPolicyResult } from '../../projects/types'
|
||||
import { invalidateQualityPolicyConfirmation, qualityPolicySignature } from '../../projects/quality-policy-confirmation'
|
||||
import { validateQualityPolicyReceipt, qualityPolicySignature } from '../../projects/quality-policy-confirmation'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
import QualityPolicyExceptions from './QualityPolicyExceptions.vue'
|
||||
@@ -31,8 +31,6 @@ const error = ref('')
|
||||
const notice = ref('')
|
||||
/** 服务端策略的独立草稿。 */
|
||||
const policy = ref<ProjectQualityPolicy | null>(null)
|
||||
/** 已保存内容用于区分真实规则变更与无变化保存。 */
|
||||
let savedSignature = ''
|
||||
/** 基础规则的原始内容,用于阻止覆盖其他入口并发修改的通用规则。 */
|
||||
let savedGeneralSignature = ''
|
||||
/** 整体表现方式及通俗示例,仅说明含义,不自动修改动作许可。 */
|
||||
@@ -117,8 +115,7 @@ async function load() {
|
||||
try {
|
||||
const result = props.initialPolicy ?? await projectsApi.qualityPolicy(id, controller.signal)
|
||||
if (current !== version) return
|
||||
if (result.projectId !== id) throw new Error('质量策略所属项目不一致,请重新读取。')
|
||||
savedSignature = qualityPolicySignature(result.policy)
|
||||
validateQualityPolicyReceipt(result, id)
|
||||
savedGeneralSignature = qualityPolicySignature({ ...result.policy, actionExceptions: [] })
|
||||
policy.value = policyDraft(result.policy)
|
||||
rulesText.value = policy.value.customRules.join('\n')
|
||||
@@ -153,8 +150,7 @@ async function save() {
|
||||
try {
|
||||
const latest = await projectsApi.qualityPolicy(id, controller.signal)
|
||||
if (current !== version || props.disabled) return
|
||||
if (latest.projectId !== id) throw new Error('质量规则所属项目不一致,请重新读取。')
|
||||
qualityPolicySignature(latest.policy)
|
||||
validateQualityPolicyReceipt(latest, id)
|
||||
if (qualityPolicySignature({ ...latest.policy, actionExceptions: [] }) !== savedGeneralSignature)
|
||||
throw new Error('质量规则已在其他位置更新,请重新打开配置后再保存。')
|
||||
// 例外由问题修订入口管理,基础配置永远合并服务端最新例外,不提交隐藏的旧副本。
|
||||
@@ -162,16 +158,13 @@ async function save() {
|
||||
else delete input.actionExceptions
|
||||
loading.value = false
|
||||
saving.value = true
|
||||
const result = await projectsApi.saveQualityPolicy(id, input)
|
||||
const result = await projectsApi.saveQualityPolicy(id, input, latest.revision)
|
||||
if (current !== version) return
|
||||
if (result.projectId !== id) throw new Error('质量策略保存回执所属项目不一致。')
|
||||
const signature = qualityPolicySignature(result.policy)
|
||||
if (signature !== savedSignature) invalidateQualityPolicyConfirmation(id)
|
||||
savedSignature = signature
|
||||
validateQualityPolicyReceipt(result, id)
|
||||
savedGeneralSignature = qualityPolicySignature({ ...result.policy, actionExceptions: [] })
|
||||
policy.value = policyDraft(result.policy)
|
||||
rulesText.value = policy.value.customRules.join('\n')
|
||||
notice.value = '质量策略已保存,后续创作、拆解和生成使用此策略。'
|
||||
notice.value = result.confirmed ? '质量规则已保存,当前版本已经确认。' : '质量规则已保存。下次启动拆解前需要核对并确认。'
|
||||
emit('saved')
|
||||
} catch (cause) {
|
||||
if (current === version) error.value = errorMessage(cause)
|
||||
|
||||
@@ -2,6 +2,8 @@ import { inject, ref, type InjectionKey, type Ref } from 'vue'
|
||||
|
||||
/** 项目内共享的配置修订号,成功保存后通知已挂载的生成表单重新读取。 */
|
||||
export const projectGenerationRevisionKey: InjectionKey<Ref<number>> = Symbol('project-generation-revision')
|
||||
/** 工作区辅助入口打开同一个项目配置抽屉,避免新建重复表单或覆盖当前路由。 */
|
||||
export const projectSettingsOpenKey: InjectionKey<() => void> = Symbol('project-settings-open')
|
||||
|
||||
/**
|
||||
* 读取项目配置修订号,独立使用组件时保留本地修订状态。
|
||||
|
||||
Reference in new issue
Block a user