feat: 同步精简接口并统一表单校验

This commit is contained in:
GJ committed 2026-09-10 22:34:47 +08:00
1 parent 82d7bde631
commit 2eea0ea72e
66 files changed
+1611 -1100

No files matched your search

+40 -37
View File
@@ -1,4 +1,7 @@
<script setup lang="ts">
import AppForm from '../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { integerRule } from '../../lib/form-rules'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import ActionMenu from '../../components/ui/ActionMenu.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
@@ -46,8 +49,6 @@ const {
maxRepairAttempts,
force,
allowed,
batchValid,
repairsValid,
blocked,
directionComplete,
hasCurrentEpisodeShots,
@@ -96,6 +97,8 @@ watch(
}
}
)
const formModel = computed(() => ({ concurrency: concurrency.value, maxRepairAttempts: maxRepairAttempts.value }))
const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: integerRule('状态自动修复次数', 0) }
</script>
<template>
@@ -156,42 +159,42 @@ watch(
>
</div>
<section class="mt-3" aria-label="分镜生成配置">
<div class="storyboard-controls">
<label
><span class="field-label">批量并发</span
><NInputNumber
<AppForm :model="formModel" :rules="rules" :disabled="operation.pending" validate-on-change>
<div class="form-controls storyboard-controls">
<NFormItem
path="concurrency"
label="批量并发"
:label-props="{ for: 'storyboard-concurrency' }"
><NInputNumber
:disabled="operation.pending"
:input-props="{ id: 'storyboard-concurrency' }"
:value="typeof concurrency === 'number' ? concurrency : null"
@update:value="concurrency = $event ?? 0"
:min="1"
:step="1"
></NInputNumber
></NFormItem>
<NFormItem
path="maxRepairAttempts"
label="状态自动修复次数"
:label-props="{ for: 'storyboard-repairs' }"
><NInputNumber
:disabled="operation.pending"
:input-props="{ id: 'storyboard-repairs' }"
:value="typeof maxRepairAttempts === 'number' ? maxRepairAttempts : null"
@update:value="maxRepairAttempts = $event ?? 0"
:min="0"
:step="1"
></NInputNumber
></NFormItem>
<NCheckbox
v-model:checked="force"
:disabled="operation.pending"
:input-props="{ id: 'storyboard-concurrency' }"
:value="typeof concurrency === 'number' ? concurrency : null"
@update:value="concurrency = $event ?? 0"
:min="1"
:step="1"
></NInputNumber
><span v-if="!batchValid" class="mt-1 block text-xs text-danger"
>请输入正整数</span
></label
>
<label
><span class="field-label">状态自动修复次数</span
><NInputNumber
:disabled="operation.pending"
:input-props="{ id: 'storyboard-repairs' }"
:value="typeof maxRepairAttempts === 'number' ? maxRepairAttempts : null"
@update:value="maxRepairAttempts = $event ?? 0"
:min="0"
:step="1"
></NInputNumber
><span v-if="!repairsValid" class="mt-1 block text-xs text-danger"
>请输入非负整数,0 表示不修复</span
></label
>
<NCheckbox
v-model:checked="force"
:disabled="operation.pending"
class="control-row-checkbox text-xs"
>批量覆盖已有结果</NCheckbox
>
</div>
class="control-row-checkbox text-xs"
>批量覆盖已有结果</NCheckbox
>
</div>
</AppForm>
</section>
<div class="storyboard-coverage grid grid-cols-2 gap-3">
<div v-for="item in coverage" :key="item.title" class="panel px-3 py-2">
@@ -77,7 +77,7 @@ async function generatePrompt() {
// 请求结果不确定时不要保留可能已被覆盖的旧正文。
delete session.prompts[shotId]
const result = await storyboardApi.generatePrompt(shotId, overwrite)
if (!result || result.id !== shotId || !result.videoPrompt)
if (!result || result.shotId !== shotId || !result.videoPrompt)
throw new Error('接口未返回此镜头的有效提示词,请检查后端记录后重试。')
session.prompts[shotId] = result
})
+2 -1
View File
@@ -145,7 +145,8 @@ export interface ShotReferences {
/** 视频提示词接口返回的 Shot 数据切片,不包含实际视频生成。 */
export interface ShotPromptResult {
id: string
shotId: string
updatedAt: string
videoPrompt: string | null
negativePrompt: string | null
status: string