feat(short-drama-agent-front): 接入图片持续授权与视频费用审计
This commit is contained in:
1 parent
3915566994
commit
1e9ef33d1d
39 files changed
+3442
-51
No files matched your search
@@ -51,10 +51,15 @@ const directionSummary = computed(() =>
|
||||
.join(' · ')
|
||||
: ''
|
||||
)
|
||||
/** 本次目录与模型参数仅用于首帧。 */
|
||||
const generationCatalog = ref<GenerationModelCatalog | null>(null)
|
||||
/** 模型读取错误。 */
|
||||
const generationCatalogError = ref('')
|
||||
/** 实际项目及镜头配置解析后的模型。 */
|
||||
const imageProvider = ref('')
|
||||
/** 本次明确参数。 */
|
||||
const imageGenerationOptions = ref<GenerationOptions>({})
|
||||
/** 项目画幅。 */
|
||||
const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
|
||||
/** 预览和生成复用当前请求字段,生成时再附加版本及候选标记。 */
|
||||
const generationInput = computed(() => ({
|
||||
@@ -65,6 +70,8 @@ const generationInput = computed(() => ({
|
||||
const {
|
||||
preview,
|
||||
acknowledged,
|
||||
requiresCostConfirmation,
|
||||
chargeNotice,
|
||||
loading,
|
||||
submitting,
|
||||
error,
|
||||
@@ -75,6 +82,12 @@ const {
|
||||
submit: submitPreview
|
||||
} = useImageGenerationPreview({
|
||||
open,
|
||||
chargeContext: () => ({
|
||||
projectId: props.projectId,
|
||||
scope: 'keyframe',
|
||||
targetId: props.shotId,
|
||||
exactPreview: true
|
||||
}),
|
||||
recoveryTarget: () => (props.shotId ? 'keyframe:' + props.shotId : ''),
|
||||
previousCandidateIds: () => props.previousCandidateIds,
|
||||
target: () => JSON.stringify([props.shotId, props.direction, props.visualState]),
|
||||
@@ -106,16 +119,26 @@ watch(
|
||||
generationCatalogError.value = ''
|
||||
imageProvider.value = ''
|
||||
try {
|
||||
const [catalog, profile] = await Promise.all([
|
||||
const [catalog, profile, resolved] = await Promise.all([
|
||||
generationConfigApi.catalog(controller.signal),
|
||||
generationConfigApi.profile(projectId, controller.signal)
|
||||
generationConfigApi.profile(projectId, controller.signal),
|
||||
generationConfigApi.resolve(
|
||||
projectId,
|
||||
'image',
|
||||
{
|
||||
target: { targetType: 'shot', targetId: props.shotId }
|
||||
},
|
||||
controller.signal
|
||||
)
|
||||
])
|
||||
if (controller.signal.aborted) return
|
||||
if (!resolved.provider || !resolved.model || !resolved.options)
|
||||
throw new Error('当前镜头模型配置不完整,请重新读取。')
|
||||
generationCatalog.value = catalog
|
||||
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
|
||||
imageProvider.value = profile?.imageProvider || catalog.defaults.imageProvider
|
||||
imageProvider.value = resolved.provider
|
||||
const selected = catalog.images.find(item => item.provider === imageProvider.value)
|
||||
imageGenerationOptions.value = { ...selected?.defaults, ...profile?.imageOptions }
|
||||
imageGenerationOptions.value = { ...selected?.defaults, ...resolved.options }
|
||||
} catch (cause) {
|
||||
if (!controller.signal.aborted) generationCatalogError.value = errorMessage(cause)
|
||||
}
|
||||
@@ -209,7 +232,9 @@ watch(
|
||||
/>
|
||||
<!-- 以下是正式画幅、尺寸及连续性诊断 -->
|
||||
<KeyframePreviewChecks v-if="preview" :preview="preview" class="mt-3" />
|
||||
<p v-if="chargeNotice" class="text-sm text-muted" role="status">{{ chargeNotice }}</p>
|
||||
<NCheckbox
|
||||
v-if="requiresCostConfirmation"
|
||||
id="confirm-keyframe-cost"
|
||||
v-model:checked="acknowledged"
|
||||
:disabled="!preview || preview.specConsistencySummary?.blocking || submitting || !!recoveryNotice"
|
||||
|
||||
@@ -8,7 +8,7 @@ import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import ProviderInputInspector from './ProviderInputInspector.vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NSelect, NTag, NTabs, NTabPane } from 'naive-ui'
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { ImagePlus, RefreshCw } from '@lucide/vue'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
@@ -43,9 +43,10 @@ import KeyframeCard from './KeyframeCard.vue'
|
||||
import VideoCard from './VideoCard.vue'
|
||||
import ProductionStageStatus from './ProductionStageStatus.vue'
|
||||
import QualityDialog from './QualityDialog.vue'
|
||||
import VideoAuditPanel from './VideoAuditPanel.vue'
|
||||
import VideoQualityDiagnostics from './VideoQualityDiagnostics.vue'
|
||||
import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDialog, AppDrawer } from '../../../components/ui'
|
||||
import ModelCapabilities from './ModelCapabilities.vue'
|
||||
import type { QualityTarget } from '../quality.types'
|
||||
import KeyframeInputDetails from './KeyframeInputDetails.vue'
|
||||
@@ -253,6 +254,12 @@ const candidatesOpen = ref(false)
|
||||
const videoCandidatesOpen = ref(false)
|
||||
/** 仅点击视频卡片入口后显示已有质量记录。 */
|
||||
const videoHistoryOpen = ref(false)
|
||||
/** 费用审计和原质量共用视频详情,独立标签与固定底栏。 */
|
||||
const videoHistoryTab = ref('quality')
|
||||
/** 费用事务提交期间锁住关闭及切换。 */
|
||||
const videoAuditBusy = ref(false)
|
||||
/** 固定底栏调用当前原任务表单。 */
|
||||
const videoAuditForm = ref<InstanceType<typeof VideoAuditPanel> | null>(null)
|
||||
/** 当前查看记录的视频 ID,按资产隔离主视频和候选。 */
|
||||
const videoHistoryId = ref('')
|
||||
/** 历史弹窗按用户选择的候选独立判断过期,不套用主视频结论。 */
|
||||
@@ -331,9 +338,11 @@ function openQuality(kind: 'keyframe' | 'video', assetId: string, repair = false
|
||||
/**
|
||||
* 从主视频或候选卡片打开只读记录,关闭候选弹窗以避免弹窗叠加。
|
||||
* @param videoId 当前选中视频 ID
|
||||
* @param tab 本次打开的记录分类
|
||||
*/
|
||||
function openVideoHistory(videoId: string) {
|
||||
function openVideoHistory(videoId: string, tab: 'quality' | 'audit' = 'quality') {
|
||||
videoCandidatesOpen.value = false
|
||||
videoHistoryTab.value = tab
|
||||
videoHistoryId.value = videoId
|
||||
videoHistoryOpen.value = true
|
||||
}
|
||||
@@ -868,6 +877,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
@quality="openQuality('video', currentVideo.id)"
|
||||
@repair="openQuality('video', currentVideo.id, true)"
|
||||
@history="openVideoHistory(currentVideo.id)"
|
||||
@audit="openVideoHistory(currentVideo.id, 'audit')"
|
||||
/>
|
||||
</div>
|
||||
<p v-else class="mt-4 text-xs text-muted">
|
||||
@@ -1156,6 +1166,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
@quality="openQuality('video', item.id)"
|
||||
@repair="openQuality('video', item.id, true)"
|
||||
@history="openVideoHistory(item.id)"
|
||||
@audit="openVideoHistory(item.id, 'audit')"
|
||||
@select="confirmingVideo = item.id"
|
||||
@confirm="setPrimaryVideo"
|
||||
@cancel="confirmingVideo = ''"
|
||||
@@ -1164,16 +1175,44 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
<p v-else class="text-xs text-muted">暂无其它视频候选。</p>
|
||||
</AppDialog>
|
||||
<!-- 以下是指定视频质量记录弹窗模块,打开后直接展示结果与修改建议 -->
|
||||
<AppDialog v-model:open="videoHistoryOpen" title="视频质量记录" description="免费查看视频检查记录。" wide>
|
||||
<VideoQualityDiagnostics
|
||||
v-if="videoHistoryOpen && videoHistoryId"
|
||||
:key="`${shot.shotId}:${videoHistoryId}`"
|
||||
:shot-id="shot.shotId"
|
||||
:video-id="videoHistoryId"
|
||||
:stale="videoHistoryStale"
|
||||
:stale-reason="videoHistoryId === currentVideo?.id ? videoStaleReason : videoHistoryAsset?.staleReason"
|
||||
/>
|
||||
</AppDialog>
|
||||
<AppDrawer v-model:open="videoHistoryOpen" title="视频记录" :busy="videoAuditBusy">
|
||||
<NTabs v-if="videoHistoryOpen && videoHistoryId" v-model:value="videoHistoryTab" type="line">
|
||||
<NTabPane name="quality" tab="视频质量" :disabled="videoAuditBusy" display-directive="show:lazy">
|
||||
<VideoQualityDiagnostics
|
||||
:key="`${shot.shotId}:${videoHistoryId}:${reviewRevision}`"
|
||||
:shot-id="shot.shotId"
|
||||
:video-id="videoHistoryId"
|
||||
:stale="videoHistoryStale"
|
||||
:stale-reason="
|
||||
videoHistoryId === currentVideo?.id ? videoStaleReason : videoHistoryAsset?.staleReason
|
||||
"
|
||||
/>
|
||||
</NTabPane>
|
||||
<NTabPane name="audit" tab="费用审计" :disabled="videoAuditBusy" display-directive="show:lazy">
|
||||
<VideoAuditPanel
|
||||
ref="videoAuditForm"
|
||||
:key="`${shot.shotId}:${videoHistoryId}`"
|
||||
:project-id="projectId"
|
||||
:shot-id="shot.shotId"
|
||||
:video-id="videoHistoryId"
|
||||
:disabled="disabled"
|
||||
@busy="videoAuditBusy = $event"
|
||||
@changed="refreshAfterReview"
|
||||
/>
|
||||
</NTabPane>
|
||||
</NTabs>
|
||||
<template #footer>
|
||||
<NButton :disabled="videoAuditBusy" @click="videoHistoryOpen = false">关闭</NButton>
|
||||
<NButton
|
||||
v-if="videoHistoryTab === 'audit' && videoAuditForm"
|
||||
type="primary"
|
||||
:disabled="!videoAuditForm.canSubmit"
|
||||
:loading="videoAuditBusy"
|
||||
@click="videoAuditForm.submit()"
|
||||
>{{ videoAuditForm.submitLabel }}</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDrawer>
|
||||
<AppDialog v-model:open="historyOpen" title="首帧记录" :busy="historyAuthorizationPending" wide>
|
||||
<div v-if="historyOpen && historyKeyframeId" :key="historyKeyframeId" class="workspace-section-stack">
|
||||
<!-- 以下是按需读取的候选生成证据 -->
|
||||
|
||||
@@ -0,0 +1,447 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NSelect } from 'naive-ui'
|
||||
import { Trash2 } from '@lucide/vue'
|
||||
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||
import WorkspaceActionTooltip from '../../../components/ui/WorkspaceActionTooltip.vue'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
import { useVideoAudit } from '../useVideoAudit'
|
||||
import {
|
||||
auditArtifactLabels,
|
||||
auditFindingLabels,
|
||||
auditOutcomeLabels,
|
||||
auditStatusLabels,
|
||||
auditRequestStatusLabels,
|
||||
auditStepLabels
|
||||
} from '../video-audit'
|
||||
|
||||
/** 在原视频详情中处理原质检任务费用,不修改质量。 */
|
||||
const props = defineProps<{
|
||||
/** 原项目。 */ projectId: string
|
||||
/** 原镜头。 */ shotId: string
|
||||
/** 原候选。 */ videoId: string
|
||||
/** 活动写入锁。 */ disabled?: boolean
|
||||
}>()
|
||||
/** 原数据写入后刷新当前视频列表与质量。 */
|
||||
const emit = defineEmits<{ changed: []; busy: [value: boolean] }>()
|
||||
/** 整个表单复用既有请求与取消机制。 */
|
||||
const form = useVideoAudit(props, () => emit('changed'))
|
||||
/** 当前原审计,费用与质量各自显示。 */
|
||||
const audit = computed(() => form.query.data.value?.audit)
|
||||
/** 原任务质量和费用保持原输出。 */
|
||||
const original = computed(() => form.query.data.value?.original)
|
||||
/** 真实步骤选项。 */
|
||||
const stepOptions = computed(
|
||||
() =>
|
||||
audit.value?.steps.map(step => ({ label: auditStepLabels[step.name] ?? '原请求阶段', value: step.name })) ?? []
|
||||
)
|
||||
/** 证据包选项只来自当前步骤服务端记录。 */
|
||||
const evidenceOptions = computed(
|
||||
() =>
|
||||
form.step.value?.evidence.map(row => ({
|
||||
label: `${row.body.operator} · ${formatDate(row.createdAt)} · ${row.id}`,
|
||||
value: row.id
|
||||
})) ?? []
|
||||
)
|
||||
/** 下拉选项保留实际枚举值。 */
|
||||
const artifactKinds = Object.entries(auditArtifactLabels).map(([value, label]) => ({ value, label }))
|
||||
/** 执行结果选项。 */
|
||||
const outcomeOptions = Object.entries(auditOutcomeLabels).map(([value, label]) => ({ value, label }))
|
||||
/** 费用结果选项。 */
|
||||
const findingOptions = Object.entries(auditFindingLabels).map(([value, label]) => ({ value, label }))
|
||||
watch(form.saving, value => emit('busy', value), { flush: 'sync' })
|
||||
/** 主操作由原抽屉固定 footer 提供。 */
|
||||
defineExpose({ canSubmit: form.canSubmit, saving: form.saving, submit: form.submit, submitLabel: form.submitLabel })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是正式原任务发现与手动只读查询模块 -->
|
||||
<div class="workspace-section-stack min-w-0">
|
||||
<WorkspaceSectionHeading
|
||||
title="视频费用审计"
|
||||
description="登记原件后仍需独立人工复核。费用核清仅影响未来收费门禁,视频质量、版本与主视频资格继续按原记录核对。"
|
||||
/>
|
||||
<p v-if="form.discovery.loading.value" role="status" class="text-sm">正在读取原质检任务…</p>
|
||||
<p v-if="form.discovery.data.value?.notice" class="text-sm text-muted">
|
||||
{{ form.discovery.data.value.notice }}
|
||||
</p>
|
||||
<div v-if="form.discovery.data.value?.rows.length" class="workspace-form-field">
|
||||
<span>原质检历史任务</span
|
||||
><NSelect
|
||||
aria-label="原质检历史任务"
|
||||
v-model:value="form.taskId.value"
|
||||
:disabled="form.saving.value"
|
||||
:options="
|
||||
form.discovery.data.value.rows.map(row => ({
|
||||
label: `${row.taskStatus === 'failed' ? '原执行失败' : row.taskStatus === 'completed' ? '原执行完成' : '原执行状态待核对'} · ${row.taskId}`,
|
||||
value: row.taskId
|
||||
}))
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-end gap-3">
|
||||
<label class="workspace-form-field min-w-0 flex-1"
|
||||
><span>按原任务编号查询</span
|
||||
><NInput
|
||||
v-model:value="form.taskInput.value"
|
||||
:disabled="form.saving.value"
|
||||
placeholder="填写历史质检任务编号,不能填写供应方请求号"
|
||||
@keyup.enter="form.lookup"
|
||||
/></label>
|
||||
<NButton :disabled="form.saving.value || !form.taskInput.value.trim()" @click="form.lookup">读取</NButton>
|
||||
</div>
|
||||
<NButton
|
||||
class="self-start"
|
||||
v-if="form.taskId.value"
|
||||
:loading="form.query.loading.value"
|
||||
:disabled="form.saving.value"
|
||||
@click="form.refresh"
|
||||
>刷新原任务与审计</NButton
|
||||
>
|
||||
<p v-if="form.query.error.value" role="alert" class="text-sm">{{ form.query.error.value }}</p>
|
||||
<p v-if="form.query.loading.value && !audit" role="status" class="text-sm">正在读取费用审计…</p>
|
||||
<template v-if="audit && original">
|
||||
<!-- 以下是费用及原质量互相独立的摘要模块 -->
|
||||
<section class="surface-inset p-4 space-y-3 min-w-0">
|
||||
<p class="font-semibold">{{ audit.billingBlocked ? '当前任务费用仍阻断' : '当前任务无费用阻断' }}</p>
|
||||
<p class="text-sm">
|
||||
原执行
|
||||
{{
|
||||
audit.originalTaskStatus === 'failed'
|
||||
? '失败'
|
||||
: audit.originalTaskStatus === 'completed'
|
||||
? '完成'
|
||||
: '尚未结束'
|
||||
}}
|
||||
· 原执行记录
|
||||
{{
|
||||
audit.originalWorkflowStatus === 'failed'
|
||||
? '失败'
|
||||
: audit.originalWorkflowStatus === 'completed'
|
||||
? '完成'
|
||||
: '尚未结束'
|
||||
}}
|
||||
· {{ original.needsReview ? '原质量待审' : '质量以原视频检查记录为准' }}
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
{{ original.current ? '原版本仍适用' : '原版本已过期或不可确认,费用审计仍绑定原请求' }}
|
||||
</p>
|
||||
<p class="text-xs wrap-anywhere">
|
||||
原任务 {{ audit.taskId }} · 原执行记录 {{ audit.workflowExecutionId }}
|
||||
</p>
|
||||
<RawDataDetails
|
||||
:value="{
|
||||
billing: original.output.billing,
|
||||
steps: original.output.steps,
|
||||
result: original.output.result,
|
||||
needsReview: original.needsReview,
|
||||
current: original.current,
|
||||
staleReason: original.staleReason
|
||||
}"
|
||||
title="原始费用状态与质量观察"
|
||||
/>
|
||||
</section>
|
||||
<div class="workspace-form-field">
|
||||
<span>原请求阶段</span
|
||||
><NSelect
|
||||
aria-label="原请求阶段"
|
||||
v-model:value="form.stepName.value"
|
||||
:options="stepOptions"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<p v-if="!audit.steps.length" class="text-sm">此任务暂无完整的原请求标记,无法登记审计。</p>
|
||||
<template v-if="form.step.value">
|
||||
<section class="space-y-2 text-sm min-w-0">
|
||||
<p class="font-semibold">{{ auditStatusLabels[form.step.value.status] }}</p>
|
||||
<p class="wrap-anywhere">
|
||||
原请求状态 {{ auditRequestStatusLabels[form.step.value.requestStatus] ?? '原状态待核对' }} ·
|
||||
{{ form.step.value.identity.provider }} /
|
||||
{{ form.step.value.identity.model }}
|
||||
</p>
|
||||
<p class="wrap-anywhere">
|
||||
原供应方请求号 {{ form.step.value.originalProviderRequestId ?? '未知' }}
|
||||
</p>
|
||||
<p class="wrap-anywhere">
|
||||
原 SDK 回执号 {{ form.step.value.originalSdkReceiptId ?? '未知' }} ·
|
||||
{{ form.step.value.hasOriginalReceipt ? '已有原 SDK 完成回执' : '暂无原 SDK 回执' }}
|
||||
</p>
|
||||
<RawDataDetails
|
||||
:value="{
|
||||
identity: form.step.value.identity,
|
||||
taskFingerprint: audit.taskFingerprint,
|
||||
evidenceSetFingerprint: form.step.value.evidenceSetFingerprint,
|
||||
reviewFingerprint: form.step.value.reviewFingerprint
|
||||
}"
|
||||
title="原请求身份、来源与并发版本(只读)"
|
||||
/>
|
||||
</section>
|
||||
<div class="workspace-form-field">
|
||||
<span>本次操作</span
|
||||
><NSelect
|
||||
aria-label="本次操作"
|
||||
v-model:value="form.action.value"
|
||||
:disabled="form.saving.value"
|
||||
:options="[
|
||||
{ label: '登记外部证据', value: 'evidence' },
|
||||
{ label: '独立人工复核', value: 'review' }
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<!-- 以下是外部原件登记表单,默认未知,原件引用不执行 URL -->
|
||||
<section v-if="form.action.value === 'evidence'" class="workspace-section-stack">
|
||||
<p class="text-sm text-muted">
|
||||
请保存原件并填写非敏感定位说明。真实供应方请求号与本地请求、LangSmith
|
||||
编号分别记录,不能互相代用。
|
||||
</p>
|
||||
<label class="workspace-form-field"
|
||||
><span>登记人</span
|
||||
><NInput v-model:value="form.operator.value" :maxlength="120" :disabled="form.saving.value"
|
||||
/></label>
|
||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
||||
<div class="workspace-form-field">
|
||||
<span>与原请求的关联</span
|
||||
><NSelect
|
||||
aria-label="与原请求的关联"
|
||||
v-model:value="form.correlation.value"
|
||||
:disabled="form.saving.value"
|
||||
:options="[
|
||||
{ label: '尚未核实', value: 'unverified' },
|
||||
{ label: '关联有歧义', value: 'ambiguous' },
|
||||
{ label: '已唯一关联', value: 'unique' }
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<label class="workspace-form-field"
|
||||
><span>真实供应方请求号(未知留空)</span
|
||||
><NInput
|
||||
v-model:value="form.providerRequestId.value"
|
||||
:maxlength="200"
|
||||
:disabled="form.saving.value"
|
||||
/></label>
|
||||
</div>
|
||||
<article
|
||||
v-for="(item, index) in form.artifacts.value"
|
||||
:key="index"
|
||||
class="surface-inset p-4 workspace-section-stack min-w-0"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<h3 class="font-semibold">原件 {{ index + 1 }}</h3>
|
||||
<WorkspaceActionTooltip label="删除原件"
|
||||
><NButton
|
||||
class="workspace-action-button icon-button"
|
||||
:disabled="form.saving.value"
|
||||
aria-label="删除原件"
|
||||
@click="form.removeArtifact(index)"
|
||||
><Trash2 :size="16" /></NButton
|
||||
></WorkspaceActionTooltip>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
||||
<label class="workspace-form-field"
|
||||
><span>包内引用键</span
|
||||
><NInput v-model:value="item.id" :maxlength="120" :disabled="form.saving.value"
|
||||
/></label>
|
||||
<div class="workspace-form-field">
|
||||
<span>原件来源</span
|
||||
><NSelect
|
||||
aria-label="原件来源"
|
||||
v-model:value="item.kind"
|
||||
:options="artifactKinds"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<label class="workspace-form-field"
|
||||
><span>原件记录编号</span
|
||||
><NInput v-model:value="item.recordId" :maxlength="200" :disabled="form.saving.value"
|
||||
/></label>
|
||||
<label class="workspace-form-field"
|
||||
><span>原件 SHA256</span
|
||||
><NInput v-model:value="item.sha256" :maxlength="64" :disabled="form.saving.value"
|
||||
/></label>
|
||||
<label class="workspace-form-field"
|
||||
><span>非敏感原件定位说明</span
|
||||
><NInput
|
||||
v-model:value="item.reference"
|
||||
type="textarea"
|
||||
:maxlength="1000"
|
||||
:disabled="form.saving.value"
|
||||
/></label>
|
||||
</article>
|
||||
<NButton
|
||||
:disabled="form.saving.value || form.artifacts.value.length >= 20"
|
||||
@click="form.addArtifact"
|
||||
>添加原件</NButton
|
||||
>
|
||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
||||
<div class="workspace-form-field">
|
||||
<span>供应方执行结果</span
|
||||
><NSelect
|
||||
aria-label="供应方执行结果"
|
||||
v-model:value="form.outcome.value"
|
||||
:options="outcomeOptions"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<div class="workspace-form-field">
|
||||
<span>执行依据原件</span
|
||||
><NSelect
|
||||
aria-label="执行依据原件"
|
||||
v-model:value="form.executionIds.value"
|
||||
multiple
|
||||
:options="form.artifactOptions.value"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<div class="workspace-form-field">
|
||||
<span>原始费用结论</span
|
||||
><NSelect
|
||||
aria-label="原始费用结论"
|
||||
v-model:value="form.finding.value"
|
||||
:options="findingOptions"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<div class="workspace-form-field">
|
||||
<span>费用依据原件</span
|
||||
><NSelect
|
||||
aria-label="费用依据原件"
|
||||
v-model:value="form.billingIds.value"
|
||||
multiple
|
||||
:options="form.artifactOptions.value"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<label class="workspace-form-field"
|
||||
><span>实际金额({{ audit.currency }},未知留空)</span
|
||||
><NInputNumber
|
||||
v-model:value="form.amount.value"
|
||||
:min="0"
|
||||
clearable
|
||||
:disabled="form.saving.value"
|
||||
/></label>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 以下是独立人工复核表单,资料不足时保留阻断 -->
|
||||
<section v-else class="workspace-section-stack">
|
||||
<div class="workspace-form-field">
|
||||
<span>选择已登记证据包</span
|
||||
><NSelect
|
||||
aria-label="选择已登记证据包"
|
||||
v-model:value="form.evidenceId.value"
|
||||
:options="evidenceOptions"
|
||||
:disabled="form.saving.value"
|
||||
/>
|
||||
</div>
|
||||
<template v-if="form.selectedEvidence.value">
|
||||
<p class="text-sm">
|
||||
{{ auditOutcomeLabels[form.selectedEvidence.value.body.evidence.execution.outcome] }} ·
|
||||
{{ auditFindingLabels[form.selectedEvidence.value.body.evidence.billing.finding] }} ·
|
||||
{{
|
||||
form.selectedEvidence.value.body.evidence.billing.amount === null
|
||||
? '金额未知'
|
||||
: `${form.selectedEvidence.value.body.evidence.billing.currency} ${form.selectedEvidence.value.body.evidence.billing.amount}`
|
||||
}}
|
||||
·
|
||||
{{
|
||||
form.selectedEvidence.value.body.evidence.correlation === 'unique'
|
||||
? '声明已唯一关联'
|
||||
: '唯一关联尚未确认'
|
||||
}}
|
||||
</p>
|
||||
<RawDataDetails
|
||||
:value="form.selectedEvidence.value.body.evidence"
|
||||
title="核对选中原件、原始身份与实际金额"
|
||||
/>
|
||||
</template>
|
||||
<div class="workspace-form-field">
|
||||
<span>费用处置</span
|
||||
><NSelect
|
||||
aria-label="费用处置"
|
||||
v-model:value="form.decision.value"
|
||||
:disabled="form.saving.value"
|
||||
:options="[
|
||||
{ label: '保留费用阻断', value: 'keep_blocked' },
|
||||
{
|
||||
label: '确认核清费用',
|
||||
value: 'release_future_charges',
|
||||
disabled: !!form.releaseIssues.value.length
|
||||
}
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<ul v-if="form.releaseIssues.value.length" class="text-sm text-muted space-y-1">
|
||||
<li v-for="issue in form.releaseIssues.value" :key="issue">{{ issue }}</li>
|
||||
</ul>
|
||||
<label class="workspace-form-field"
|
||||
><span>复核人</span
|
||||
><NInput v-model:value="form.reviewer.value" :maxlength="120" :disabled="form.saving.value"
|
||||
/></label>
|
||||
<label class="workspace-form-field"
|
||||
><span>复核说明</span
|
||||
><NInput
|
||||
v-model:value="form.reason.value"
|
||||
type="textarea"
|
||||
:maxlength="2000"
|
||||
:disabled="form.saving.value"
|
||||
/></label>
|
||||
<label class="workspace-form-field"
|
||||
><span>人工确认材料 SHA256</span
|
||||
><NInput
|
||||
v-model:value="form.confirmationSha256.value"
|
||||
:maxlength="64"
|
||||
:disabled="form.saving.value"
|
||||
/></label>
|
||||
</section>
|
||||
<NCheckbox
|
||||
v-model:checked="form.confirmed.value"
|
||||
:disabled="form.saving.value || form.query.loading.value || !!form.query.error.value"
|
||||
>我已核对当前版本及原始材料,确认提交本次{{
|
||||
form.action.value === 'evidence' ? '登记声明' : '人工费用复核'
|
||||
}}。</NCheckbox
|
||||
>
|
||||
<p v-if="form.validation.value" role="alert" class="text-sm">{{ form.validation.value }}</p>
|
||||
</template>
|
||||
<!-- 以下是跨版本审计历史,单调复核序号与原版本都保留 -->
|
||||
<NCollapse
|
||||
><NCollapseItem name="history" title="完整审计历史">
|
||||
<p
|
||||
v-if="!audit.history.evidence.length && !audit.history.reviews.length"
|
||||
class="text-sm text-muted"
|
||||
>
|
||||
暂无外部证据或人工复核。
|
||||
</p>
|
||||
<article
|
||||
v-for="item in audit.history.evidence"
|
||||
:key="item.id"
|
||||
class="mb-4 surface-inset p-4 space-y-2 min-w-0"
|
||||
>
|
||||
<p class="font-semibold text-sm">
|
||||
证据登记 · {{ item.body.operator }} · {{ formatDate(item.createdAt) }} ·
|
||||
{{ item.taskFingerprint === audit.taskFingerprint ? '当前原任务版本' : '历史原任务版本' }}
|
||||
</p>
|
||||
<p class="text-sm">
|
||||
{{ auditStepLabels[item.stepName] ?? '原阶段' }} ·
|
||||
{{ auditOutcomeLabels[item.body.evidence.execution.outcome] }} ·
|
||||
{{ auditFindingLabels[item.body.evidence.billing.finding] }}
|
||||
</p>
|
||||
<RawDataDetails :value="item" title="原件与登记详情" />
|
||||
</article>
|
||||
<article
|
||||
v-for="item in [...audit.history.reviews].sort((a, b) => (b.revision ?? 0) - (a.revision ?? 0))"
|
||||
:key="item.id"
|
||||
class="mb-4 surface-inset p-4 space-y-2 min-w-0"
|
||||
>
|
||||
<p class="font-semibold text-sm">
|
||||
人工复核 {{ item.revision }} · {{ item.body.reviewer }} ·
|
||||
{{ item.body.decision === 'keep_blocked' ? '保留阻断' : '核清未来费用' }} ·
|
||||
{{ item.taskFingerprint === audit.taskFingerprint ? '当前原任务版本' : '历史原任务版本' }}
|
||||
</p>
|
||||
<p class="text-sm whitespace-pre-wrap wrap-anywhere">{{ item.body.reason }}</p>
|
||||
<RawDataDetails :value="item" title="原人工复核版本与材料" />
|
||||
</article> </NCollapseItem
|
||||
></NCollapse>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,6 +4,7 @@ import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
|
||||
import { ReceiptText } from '@lucide/vue'
|
||||
import { computed } from 'vue'
|
||||
import { NButton, NTag } from 'naive-ui'
|
||||
import { AssetOpenLink, StatusBadge } from '../../../components/ui'
|
||||
@@ -32,7 +33,7 @@ const props = defineProps<{
|
||||
confirming: boolean
|
||||
}>()
|
||||
/** 交由父面板执行检查与切换,卡片不直接调用生成接口。 */
|
||||
const emit = defineEmits<{ quality: []; repair: []; history: []; select: []; confirm: []; cancel: [] }>()
|
||||
const emit = defineEmits<{ quality: []; repair: []; history: []; audit: []; select: []; confirm: []; cancel: [] }>()
|
||||
/** 播放和外链共用经过协议与资源路径校验的地址。 */
|
||||
const videoUrl = computed(() => (props.item.videoUrl ? mediaAssetUrl(props.item.videoUrl) : null))
|
||||
/** 优先显示本次会话的检查结果,否则显示此视频已有的记录。 */
|
||||
@@ -120,6 +121,9 @@ const canSelect = computed(
|
||||
>创建修复候选</NButton
|
||||
>
|
||||
<NButton text size="small" @click="emit('history')">查看质量记录</NButton>
|
||||
<NButton class="workspace-action-button" size="small" @click="emit('audit')"
|
||||
><template #icon><ReceiptText :size="16" /></template>费用审计</NButton
|
||||
>
|
||||
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
|
||||
设为主视频
|
||||
</NButton>
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { ApiError, errorMessage } from '../../lib/http'
|
||||
import { useActionMessage, showActionFeedback } from '../../components/ui/useActionMessage'
|
||||
import { workflowExecutionApi } from '../workflows/execution-api'
|
||||
import { videoAuditApi } from './video-audit-api'
|
||||
import { auditEvidenceIssues, auditReleaseIssues } from './video-audit'
|
||||
import type { VideoAuditArtifact, VideoAuditEvidence, VideoExecutionSummary } from './video-audit.types'
|
||||
|
||||
/**
|
||||
* 管理原任务发现、独立登记及人工复核,不执行任何收费或质量动作。
|
||||
* @param props 当前原候选及项目
|
||||
* @param changed 写入完成后通知刷新原视频质量与列表
|
||||
* @returns 原资源、表单与固定底栏操作
|
||||
*/
|
||||
export function useVideoAudit(
|
||||
props: { projectId: string; shotId: string; videoId: string; disabled?: boolean },
|
||||
changed: () => void
|
||||
) {
|
||||
/** 页面离开后不再回填原操作结果。 */
|
||||
let disposed = false
|
||||
onScopeDispose(() => {
|
||||
disposed = true
|
||||
})
|
||||
/** 当前候选隔离查询。 */
|
||||
const context = computed(() => JSON.stringify([props.projectId, props.shotId, props.videoId]))
|
||||
/** 正式发现历史,当前版本无法准备新质检时仍可读取最新原任务。 */
|
||||
const discovery = useQuery(context, async (_, signal) => {
|
||||
const [preview, latest] = await Promise.allSettled([
|
||||
videoAuditApi.history(props.shotId, props.videoId, signal),
|
||||
workflowExecutionApi.latest(props.projectId, 'video-validation', signal)
|
||||
])
|
||||
const rows: VideoExecutionSummary[] =
|
||||
preview.status === 'fulfilled' ? preview.value.history.filter(item => item.videoId === props.videoId) : []
|
||||
const execution = latest.status === 'fulfilled' ? latest.value : null
|
||||
if (
|
||||
execution?.metadata?.shotId === props.shotId &&
|
||||
execution.metadata.videoId === props.videoId &&
|
||||
typeof execution.metadata.taskId === 'string' &&
|
||||
!rows.some(row => row.taskId === execution.metadata!.taskId)
|
||||
)
|
||||
rows.push({
|
||||
taskId: execution.metadata.taskId,
|
||||
executionId: execution.id,
|
||||
videoId: props.videoId,
|
||||
taskStatus: execution.status,
|
||||
needsReview: false
|
||||
})
|
||||
return {
|
||||
rows,
|
||||
notice:
|
||||
preview.status === 'rejected'
|
||||
? '当前视频无法准备新的质检计划。可读取已发现的原任务,或使用原任务编号查询历史费用。'
|
||||
: ''
|
||||
}
|
||||
})
|
||||
/** 人工从原历史记录取得的任务号,不是供应方编号。 */
|
||||
const taskId = ref('')
|
||||
/** 供输入后明确查询,不逐字发起请求。 */
|
||||
const taskInput = ref('')
|
||||
/** 审计资源绑定原项目、镜头、候选及任务。 */
|
||||
const key = computed(() =>
|
||||
taskId.value ? JSON.stringify([props.projectId, props.shotId, props.videoId, taskId.value]) : ''
|
||||
)
|
||||
/** 真实原任务及当前证据同时回读并核对归属。 */
|
||||
const query = useQuery(key, async (value, signal) => {
|
||||
if (!value) return null
|
||||
const [project, shot, video, task] = JSON.parse(value) as string[]
|
||||
const [audit, original] = await Promise.all([
|
||||
videoAuditApi.get(shot!, task!, signal),
|
||||
videoAuditApi.task(shot!, task!, signal)
|
||||
])
|
||||
if (
|
||||
audit.projectId !== project ||
|
||||
audit.shotId !== shot ||
|
||||
audit.taskId !== task ||
|
||||
original.taskId !== task ||
|
||||
original.executionId !== audit.workflowExecutionId ||
|
||||
original.plan.projectId !== project ||
|
||||
original.plan.shotId !== shot ||
|
||||
original.plan.videoId !== video ||
|
||||
original.plan.purpose !== 'video_validation' ||
|
||||
audit.steps.some(
|
||||
step =>
|
||||
step.identity.taskId !== task ||
|
||||
step.identity.videoId !== video ||
|
||||
step.identity.workflowExecutionId !== audit.workflowExecutionId
|
||||
)
|
||||
)
|
||||
throw new Error('原任务归属与当前视频不匹配,请核对历史任务编号。')
|
||||
return { audit, original }
|
||||
})
|
||||
/** 当前选择的真实原请求阶段。 */
|
||||
const stepName = ref('')
|
||||
/** 登记和人工复核始终为两个独立操作。 */
|
||||
const action = ref<'evidence' | 'review'>('evidence')
|
||||
/** 实际登记人。 */
|
||||
const operator = ref('')
|
||||
/** 人工取得的真实供应方请求编号,绝不回填本地编号。 */
|
||||
const providerRequestId = ref('')
|
||||
/** 默认未核实关联。 */
|
||||
const correlation = ref<VideoAuditEvidence['correlation']>('unverified')
|
||||
/** 原件表单,空白原件不是实际证据。 */
|
||||
const artifacts = ref<VideoAuditArtifact[]>([])
|
||||
/** 默认执行事实未知。 */
|
||||
const outcome = ref<VideoAuditEvidence['execution']['outcome']>('unknown')
|
||||
/** 默认收费事实未知。 */
|
||||
const finding = ref<VideoAuditEvidence['billing']['finding']>('unknown')
|
||||
/** 未知金额不推断零。 */
|
||||
const amount = ref<number | null>(null)
|
||||
/** 人工选择的执行原件引用。 */
|
||||
const executionIds = ref<string[]>([])
|
||||
/** 人工选择的账单原件引用。 */
|
||||
const billingIds = ref<string[]>([])
|
||||
/** 已登记证据的选择。 */
|
||||
const evidenceId = ref('')
|
||||
/** 实际复核人。 */
|
||||
const reviewer = ref('')
|
||||
/** 实际复核说明。 */
|
||||
const reason = ref('')
|
||||
/** 原确认材料摘要,不由浏览器生成替代。 */
|
||||
const confirmationSha256 = ref('')
|
||||
/** 默认保留费用阻断,核清须主动切换。 */
|
||||
const decision = ref<'keep_blocked' | 'release_future_charges'>('keep_blocked')
|
||||
/** 提交前核对当前版本,刷新或冲突后取消确认。 */
|
||||
const confirmed = ref(false)
|
||||
/** 当前同步写入,阻止切换和重复操作。 */
|
||||
const saving = ref(false)
|
||||
/** 主动提交后的表单问题。 */
|
||||
const validation = ref('')
|
||||
/** 原步骤不使用当前新镜头的身份。 */
|
||||
const step = computed(() => query.data.value?.audit.steps.find(item => item.name === stepName.value))
|
||||
/** 人工选择的已登记原件包。 */
|
||||
const selectedEvidence = computed(() => step.value?.evidence.find(item => item.id === evidenceId.value))
|
||||
/** 原件引用选项共用实际包内键。 */
|
||||
const artifactOptions = computed(() =>
|
||||
artifacts.value
|
||||
.filter(item => item.id.trim())
|
||||
.map(item => ({ label: `${item.id} · ${item.recordId || '未填记录编号'}`, value: item.id }))
|
||||
)
|
||||
/** 已登记证据才有核清资格,默认未知保持阻断。 */
|
||||
const releaseIssues = computed(() =>
|
||||
step.value && query.data.value
|
||||
? auditReleaseIssues(selectedEvidence.value?.body.evidence, step.value, query.data.value.audit)
|
||||
: ['请读取原任务。']
|
||||
)
|
||||
/** 底栏名称明确区分登记与处置。 */
|
||||
const submitLabel = computed(() =>
|
||||
action.value === 'evidence'
|
||||
? '登记外部证据'
|
||||
: decision.value === 'keep_blocked'
|
||||
? '确认保留阻断'
|
||||
: '确认核清费用'
|
||||
)
|
||||
/** 资源完整且用户核对当前版本后才提供写操作。 */
|
||||
const canSubmit = computed(
|
||||
() =>
|
||||
!!step.value &&
|
||||
!saving.value &&
|
||||
!props.disabled &&
|
||||
!query.loading.value &&
|
||||
!query.error.value &&
|
||||
confirmed.value &&
|
||||
(action.value !== 'review' || decision.value !== 'release_future_charges' || !releaseIssues.value.length)
|
||||
)
|
||||
/** 消息反馈使用全局 NMessage。 */
|
||||
const message = useActionMessage()
|
||||
watch(
|
||||
context,
|
||||
() => {
|
||||
taskId.value = ''
|
||||
taskInput.value = ''
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
watch(
|
||||
key,
|
||||
() => {
|
||||
stepName.value = ''
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
watch(
|
||||
() => discovery.data.value?.rows,
|
||||
rows => {
|
||||
if (!taskId.value && rows?.length) taskId.value = rows[0]!.taskId
|
||||
}
|
||||
)
|
||||
watch(
|
||||
stepName,
|
||||
() => {
|
||||
operator.value = ''
|
||||
providerRequestId.value = ''
|
||||
correlation.value = 'unverified'
|
||||
artifacts.value = []
|
||||
outcome.value = 'unknown'
|
||||
finding.value = 'unknown'
|
||||
amount.value = null
|
||||
executionIds.value = []
|
||||
billingIds.value = []
|
||||
evidenceId.value = ''
|
||||
decision.value = 'keep_blocked'
|
||||
reviewer.value = ''
|
||||
reason.value = ''
|
||||
confirmationSha256.value = ''
|
||||
confirmed.value = false
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
watch(
|
||||
() => query.data.value,
|
||||
data => {
|
||||
confirmed.value = false
|
||||
if (data && !data.audit.steps.some(item => item.name === stepName.value))
|
||||
stepName.value = data.audit.steps[0]?.name ?? ''
|
||||
}
|
||||
)
|
||||
watch(
|
||||
[
|
||||
stepName,
|
||||
action,
|
||||
evidenceId,
|
||||
decision,
|
||||
operator,
|
||||
providerRequestId,
|
||||
correlation,
|
||||
artifacts,
|
||||
outcome,
|
||||
finding,
|
||||
amount,
|
||||
executionIds,
|
||||
billingIds,
|
||||
reviewer,
|
||||
reason,
|
||||
confirmationSha256
|
||||
],
|
||||
() => {
|
||||
validation.value = ''
|
||||
confirmed.value = false
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 显式查询用户输入的原任务,不写入供应方身份。 */
|
||||
function lookup() {
|
||||
if (!saving.value && taskInput.value.trim()) taskId.value = taskInput.value.trim()
|
||||
}
|
||||
/** 添加空白原件,只有实际填写材料后才能登记。 */
|
||||
function addArtifact() {
|
||||
if (artifacts.value.length < 20)
|
||||
artifacts.value.push({ id: '', kind: 'provider-execution', recordId: '', sha256: '', reference: '' })
|
||||
}
|
||||
/**
|
||||
* 删除原件并同步清除对应引用。
|
||||
* @param index 表单原件顺序
|
||||
*/
|
||||
function removeArtifact(index: number) {
|
||||
const id = artifacts.value[index]?.id
|
||||
artifacts.value.splice(index, 1)
|
||||
executionIds.value = executionIds.value.filter(value => value !== id)
|
||||
billingIds.value = billingIds.value.filter(value => value !== id)
|
||||
}
|
||||
/** 只读刷新原审计和任务,取消旧的提交确认。 */
|
||||
async function refresh() {
|
||||
confirmed.value = false
|
||||
await query.refresh()
|
||||
}
|
||||
/** 独立登记或人工复核,所有冲突刷新后等待人工重新核查。 */
|
||||
async function submit() {
|
||||
if (!canSubmit.value || !step.value || !query.data.value) return
|
||||
const { audit } = query.data.value
|
||||
const originalStep = step.value
|
||||
const target = key.value
|
||||
const evidence: VideoAuditEvidence = {
|
||||
identity: { ...originalStep.identity },
|
||||
correlation: correlation.value,
|
||||
providerRequestId: providerRequestId.value.trim() || null,
|
||||
artifacts: artifacts.value.map(item => ({ ...item })),
|
||||
execution: { outcome: outcome.value, evidenceIds: [...executionIds.value] },
|
||||
billing: {
|
||||
finding: finding.value,
|
||||
amount: amount.value,
|
||||
currency: audit.currency,
|
||||
evidenceIds: [...billingIds.value]
|
||||
}
|
||||
}
|
||||
const issues =
|
||||
action.value === 'evidence'
|
||||
? [...auditEvidenceIssues(evidence), ...(!operator.value.trim() ? ['请填写登记人。'] : [])]
|
||||
: [
|
||||
...(!selectedEvidence.value ? ['请选择已登记证据包。'] : []),
|
||||
...(!reviewer.value.trim() ||
|
||||
reason.value.trim().length < 4 ||
|
||||
!/^[a-f0-9]{64}$/.test(confirmationSha256.value)
|
||||
? ['请填写复核人、至少 4 字说明及真实确认材料 SHA256。']
|
||||
: [])
|
||||
]
|
||||
if (issues.length) {
|
||||
validation.value = issues.join(' ')
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
confirmed.value = false
|
||||
try {
|
||||
if (action.value === 'evidence') {
|
||||
await videoAuditApi.register(props.shotId, audit.taskId, {
|
||||
expectedTaskFingerprint: audit.taskFingerprint,
|
||||
stepName: originalStep.name,
|
||||
operator: operator.value.trim(),
|
||||
evidence
|
||||
})
|
||||
if (disposed || target !== key.value) return
|
||||
showActionFeedback(message, '证据已登记,等待人工核查。', 'info')
|
||||
} else {
|
||||
const result = await videoAuditApi.review(props.shotId, audit.taskId, {
|
||||
stepName: originalStep.name,
|
||||
evidenceId: evidenceId.value,
|
||||
expectedTaskFingerprint: audit.taskFingerprint,
|
||||
expectedEvidenceSetFingerprint: originalStep.evidenceSetFingerprint,
|
||||
expectedReviewFingerprint: originalStep.reviewFingerprint,
|
||||
decision: decision.value,
|
||||
reviewer: reviewer.value.trim(),
|
||||
reason: reason.value.trim(),
|
||||
confirmationSha256: confirmationSha256.value
|
||||
})
|
||||
if (disposed || target !== key.value) return
|
||||
showActionFeedback(
|
||||
message,
|
||||
result.billingBlocked
|
||||
? '复核已记录,当前任务仍有费用阻断。'
|
||||
: '费用已核清,旧视频质量与版本继续按原记录核对。',
|
||||
'info'
|
||||
)
|
||||
}
|
||||
await Promise.all([refresh(), discovery.refresh()])
|
||||
if (!disposed && target === key.value) changed()
|
||||
} catch (cause) {
|
||||
if (disposed || target !== key.value) return
|
||||
showActionFeedback(message, errorMessage(cause), 'error')
|
||||
if (cause instanceof ApiError && cause.status === 409) await refresh()
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
return {
|
||||
discovery,
|
||||
query,
|
||||
taskId,
|
||||
taskInput,
|
||||
lookup,
|
||||
stepName,
|
||||
step,
|
||||
action,
|
||||
operator,
|
||||
providerRequestId,
|
||||
correlation,
|
||||
artifacts,
|
||||
outcome,
|
||||
finding,
|
||||
amount,
|
||||
executionIds,
|
||||
billingIds,
|
||||
evidenceId,
|
||||
reviewer,
|
||||
reason,
|
||||
confirmationSha256,
|
||||
decision,
|
||||
confirmed,
|
||||
saving,
|
||||
validation,
|
||||
selectedEvidence,
|
||||
artifactOptions,
|
||||
releaseIssues,
|
||||
submitLabel,
|
||||
canSubmit,
|
||||
addArtifact,
|
||||
removeArtifact,
|
||||
refresh,
|
||||
submit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import { request } from '../../lib/http'
|
||||
import type {
|
||||
RegisterVideoAudit,
|
||||
ReviewVideoAudit,
|
||||
VideoAuditView,
|
||||
VideoExecutionDetail,
|
||||
VideoExecutionSummary
|
||||
} from './video-audit.types'
|
||||
|
||||
/**
|
||||
* 原任务路径不使用当前新版镜头替代身份。
|
||||
* @param shotId 原镜头
|
||||
* @param taskId 原任务
|
||||
* @returns 正式执行路径
|
||||
*/
|
||||
function root(shotId: string, taskId: string) {
|
||||
return `/storyboard-shots/${encodeURIComponent(shotId)}/video-executions/${encodeURIComponent(taskId)}`
|
||||
}
|
||||
/** 当前视频免费计划的原历史任务。 */
|
||||
interface VideoAuditDiscovery {
|
||||
/** 当前候选历史。 */ history: VideoExecutionSummary[]
|
||||
/** 本镜头仍阻断费用的原任务。 */ blockingTasks: VideoExecutionSummary[]
|
||||
}
|
||||
/** 费用审计同步事务,不调用模型或恢复旧任务。 */
|
||||
export const videoAuditApi = {
|
||||
/**
|
||||
* 免费发现候选原质检任务,过期候选可按原任务编号直接查询。
|
||||
* @param shotId 原镜头
|
||||
* @param videoId 原候选
|
||||
* @param signal 取消旧候选请求
|
||||
* @returns 服务端原任务摘要
|
||||
*/
|
||||
history: (shotId: string, videoId: string, signal?: AbortSignal) =>
|
||||
request<VideoAuditDiscovery>(
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/videos/${encodeURIComponent(videoId)}/validation/preview`,
|
||||
{ method: 'POST', body: {}, signal }
|
||||
),
|
||||
/**
|
||||
* 读取原任务质量、费用和版本状态。
|
||||
* @param shotId 原镜头
|
||||
* @param taskId 原任务
|
||||
* @param signal 取消旧读取
|
||||
* @returns 原任务详情
|
||||
*/
|
||||
task: (shotId: string, taskId: string, signal?: AbortSignal) =>
|
||||
request<VideoExecutionDetail>(root(shotId, taskId), { signal }),
|
||||
/**
|
||||
* 读取当前完整证据集合及并发版本。
|
||||
* @param shotId 原镜头
|
||||
* @param taskId 原任务
|
||||
* @param signal 取消旧读取
|
||||
* @returns 费用审计资源
|
||||
*/
|
||||
get: (shotId: string, taskId: string, signal?: AbortSignal) =>
|
||||
request<VideoAuditView>(root(shotId, taskId) + '/audit', { signal }),
|
||||
/**
|
||||
* 幂等登记外部原件引用,登记本身不核清费用。
|
||||
* @param shotId 原镜头
|
||||
* @param taskId 原任务
|
||||
* @param body 用户提供的真实材料与版本
|
||||
* @returns 同步登记结果
|
||||
*/
|
||||
register: (shotId: string, taskId: string, body: RegisterVideoAudit) =>
|
||||
request<{ evidenceId: string; reused: boolean; billingBlocked: boolean }>(
|
||||
root(shotId, taskId) + '/audit/evidence',
|
||||
{ method: 'POST', body }
|
||||
),
|
||||
/**
|
||||
* 独立人工复核当前完整证据,不启动质量操作。
|
||||
* @param shotId 原镜头
|
||||
* @param taskId 原任务
|
||||
* @param body 用户核验材料及三个服务端版本
|
||||
* @returns 当前费用状态
|
||||
*/
|
||||
review: (shotId: string, taskId: string, body: ReviewVideoAudit) =>
|
||||
request<{ reviewId: string; status: string; reused: boolean; billingBlocked: boolean }>(
|
||||
root(shotId, taskId) + '/audit/reviews',
|
||||
{ method: 'POST', body }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
import type { VideoAuditEvidence, VideoAuditStep, VideoAuditView } from './video-audit.types'
|
||||
|
||||
/** 原件来源使用中文选项,提交保留原枚举。 */
|
||||
export const auditArtifactLabels = {
|
||||
'provider-execution': '供应方执行原件',
|
||||
'provider-billing': '供应方账单原件',
|
||||
'provider-support': '供应方官方支持材料',
|
||||
langsmith: 'LangSmith 观测记录',
|
||||
'client-log': '客户端日志'
|
||||
}
|
||||
/** 原执行结论不替代质量结论。 */
|
||||
export const auditOutcomeLabels = {
|
||||
'not-received': '供应方未接收',
|
||||
succeeded: '供应方执行完成',
|
||||
failed: '供应方执行失败',
|
||||
unknown: '执行结果未知'
|
||||
}
|
||||
/** 原收费结论不以零 Token 推断。 */
|
||||
export const auditFindingLabels = { charged: '已收费', 'no-charge': '未收费', unknown: '费用未知' }
|
||||
/** 费用审计状态中文。 */
|
||||
export const auditStatusLabels = { unreviewed: '等待人工核查', blocked: '保留费用阻断', released: '此步骤费用已核清' }
|
||||
/** 原请求步骤名称。 */
|
||||
export const auditStepLabels: Record<string, string> = {
|
||||
visualResult: '画面检查',
|
||||
propLocator: '道具定位',
|
||||
motionResult: '运动检查',
|
||||
spatialInteractionResult: '空间互动检查',
|
||||
physicalStructureResult: '物理结构检查',
|
||||
physicalJointResult: '连接关系检查'
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交前检查真实材料及引用格式,未知事实允许登记。
|
||||
* @param evidence 用户填写的证据包
|
||||
* @returns 校验问题
|
||||
*/
|
||||
export function auditEvidenceIssues(evidence: VideoAuditEvidence): string[] {
|
||||
const issues: string[] = []
|
||||
const ids = evidence.artifacts.map(item => item.id)
|
||||
if (!ids.length || ids.length > 20 || new Set(ids).size !== ids.length)
|
||||
issues.push('请提供 1~20 项原件,引用键不能重复。')
|
||||
if (
|
||||
evidence.artifacts.some(
|
||||
item =>
|
||||
!item.id.trim() ||
|
||||
item.id.length > 120 ||
|
||||
!item.recordId.trim() ||
|
||||
item.recordId.length > 200 ||
|
||||
!/^[a-f0-9]{64}$/.test(item.sha256) ||
|
||||
!item.reference.trim() ||
|
||||
item.reference.length > 1000
|
||||
)
|
||||
)
|
||||
issues.push('请填写每项原件的引用键、记录编号、64 位小写 SHA256 及定位说明。')
|
||||
if ([...evidence.execution.evidenceIds, ...evidence.billing.evidenceIds].some(id => !ids.includes(id)))
|
||||
issues.push('执行或费用引用的原件已不存在,请重新选择。')
|
||||
if (evidence.billing.amount !== null && (!Number.isFinite(evidence.billing.amount) || evidence.billing.amount < 0))
|
||||
issues.push('实际金额需为非负数,未知请留空。')
|
||||
if (
|
||||
evidence.providerRequestId &&
|
||||
([
|
||||
evidence.identity.requestId,
|
||||
evidence.identity.taskId,
|
||||
evidence.identity.workflowExecutionId,
|
||||
evidence.identity.videoId
|
||||
].includes(evidence.providerRequestId) ||
|
||||
evidence.artifacts.some(item => item.kind === 'langsmith' && item.recordId === evidence.providerRequestId))
|
||||
)
|
||||
issues.push('本地任务、请求或 LangSmith 编号不能作为供应方请求号。')
|
||||
return issues
|
||||
}
|
||||
/**
|
||||
* 资料不完整时禁用核清,最终真实性与唯一认领仍由人工及服务端核验。
|
||||
* @param evidence 已登记证据
|
||||
* @param step 原请求及 SDK 事实
|
||||
* @param view 原任务版本与币种
|
||||
* @returns 不可确认核清的原因
|
||||
*/
|
||||
export function auditReleaseIssues(
|
||||
evidence: VideoAuditEvidence | undefined,
|
||||
step: VideoAuditStep,
|
||||
view: VideoAuditView
|
||||
): string[] {
|
||||
if (!evidence) return ['请先选择已经登记的证据包。']
|
||||
const issues = auditEvidenceIssues(evidence)
|
||||
const execution = evidence.artifacts.filter(item => evidence.execution.evidenceIds.includes(item.id))
|
||||
const billing = evidence.artifacts.filter(item => evidence.billing.evidenceIds.includes(item.id))
|
||||
if (evidence.correlation !== 'unique') issues.push('原件尚未唯一关联原请求。')
|
||||
if (
|
||||
evidence.execution.outcome === 'unknown' ||
|
||||
evidence.billing.finding === 'unknown' ||
|
||||
evidence.billing.amount === null
|
||||
)
|
||||
issues.push('执行终态或实际费用仍未知。')
|
||||
if (evidence.billing.currency !== view.currency) issues.push('币种与原批准不符。')
|
||||
if (evidence.billing.finding === 'no-charge' && evidence.billing.amount !== 0)
|
||||
issues.push('未收费必须有明确的零金额依据。')
|
||||
if (
|
||||
!execution.some(item => ['provider-execution', 'provider-support'].includes(item.kind)) ||
|
||||
!billing.some(item => ['provider-billing', 'provider-support'].includes(item.kind))
|
||||
)
|
||||
issues.push('执行与计费分别需要供应方原件,观测记录不能替代。')
|
||||
if (evidence.execution.outcome === 'not-received') {
|
||||
if (evidence.billing.finding !== 'no-charge' || !execution.some(item => item.kind === 'provider-support'))
|
||||
issues.push('未接收需要官方支持原件及未收费说明。')
|
||||
} else if (!evidence.providerRequestId) issues.push('请核对真实供应方请求号。')
|
||||
if (step.hasOriginalReceipt && evidence.execution.outcome !== 'succeeded')
|
||||
issues.push('原 SDK 回执已证明执行完成,外部声明与原事实冲突。')
|
||||
if (step.originalProviderRequestId && step.originalProviderRequestId !== evidence.providerRequestId)
|
||||
issues.push('供应方编号与原回执不一致。')
|
||||
if (
|
||||
['pending', 'running'].includes(view.originalTaskStatus) ||
|
||||
['pending', 'running'].includes(view.originalWorkflowStatus)
|
||||
)
|
||||
issues.push('原任务和执行记录尚未结束。')
|
||||
if (
|
||||
Object.entries(step.identity).some(
|
||||
([key, value]) => evidence.identity[key as keyof typeof evidence.identity] !== value
|
||||
)
|
||||
)
|
||||
issues.push('证据身份与原请求不一致。')
|
||||
return issues
|
||||
}
|
||||
|
||||
/** 原请求的费用状态名称,不推断费用为零。 */
|
||||
export const auditRequestStatusLabels: Record<string, string> = {
|
||||
pending: '尚未发送',
|
||||
running: '请求执行中',
|
||||
sending: '正在发送',
|
||||
received: '已取得回执',
|
||||
completed: '原步骤完成',
|
||||
failed: '原步骤失败',
|
||||
unknown: '结果或费用未知',
|
||||
unresolved: '结果或费用待核实'
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/** 历史费用审计状态。 */
|
||||
export type VideoAuditStatus = 'unreviewed' | 'blocked' | 'released'
|
||||
/** 原历史请求身份,提交时原样复制。 */
|
||||
export interface VideoAuditIdentity {
|
||||
/** 原任务。 */ taskId: string
|
||||
/** 原执行记录。 */ workflowExecutionId: string
|
||||
/** 本地请求编号。 */ requestId: string
|
||||
/** 原请求指纹。 */ requestFingerprint: string
|
||||
/** 原计划指纹。 */ planFingerprint: string
|
||||
/** 原来源指纹。 */ sourceFingerprint: string
|
||||
/** 原视频。 */ videoId: string
|
||||
/** 原供应方。 */ provider: string
|
||||
/** 原型号。 */ model: string
|
||||
}
|
||||
/** 外部原件定位,引用始终按纯文本显示。 */
|
||||
export interface VideoAuditArtifact {
|
||||
/** 包内引用键。 */ id: string
|
||||
/** 原件来源声明。 */ kind:
|
||||
| 'provider-execution'
|
||||
| 'provider-billing'
|
||||
| 'provider-support'
|
||||
| 'langsmith'
|
||||
| 'client-log'
|
||||
/** 原件记录编号。 */ recordId: string
|
||||
/** 人工取得的原件摘要。 */ sha256: string
|
||||
/** 非敏感定位说明。 */ reference: string
|
||||
}
|
||||
/** 待人工核验的外部事实。 */
|
||||
export interface VideoAuditEvidence {
|
||||
/** 原请求身份。 */ identity: VideoAuditIdentity
|
||||
/** 唯一关联程度。 */ correlation: 'unique' | 'ambiguous' | 'unverified'
|
||||
/** 真实供应方请求号。 */ providerRequestId: string | null
|
||||
/** 外部原件。 */ artifacts: VideoAuditArtifact[]
|
||||
/** 原供应方执行结果,与质量独立。 */ execution: {
|
||||
/** 执行事实。 */ outcome: 'not-received' | 'succeeded' | 'failed' | 'unknown'
|
||||
/** 所引原件。 */ evidenceIds: string[]
|
||||
}
|
||||
/** 实际账单事实。 */ billing: {
|
||||
/** 是否收费。 */ finding: 'charged' | 'no-charge' | 'unknown'
|
||||
/** 实际金额,未知保留 null。 */ amount: number | null
|
||||
/** 原批准币种。 */ currency: string
|
||||
/** 所引原件。 */ evidenceIds: string[]
|
||||
}
|
||||
}
|
||||
/** 外部证据登记。 */
|
||||
export interface RegisterVideoAudit {
|
||||
/** 原任务版本。 */ expectedTaskFingerprint: string
|
||||
/** 原步骤。 */ stepName: string
|
||||
/** 实际登记人。 */ operator: string
|
||||
/** 外部材料与事实声明。 */ evidence: VideoAuditEvidence
|
||||
}
|
||||
/** 独立人工复核。 */
|
||||
export interface ReviewVideoAudit {
|
||||
/** 原步骤。 */ stepName: string
|
||||
/** 已登记证据。 */ evidenceId: string
|
||||
/** 原任务版本。 */ expectedTaskFingerprint: string
|
||||
/** 完整证据集合版本。 */ expectedEvidenceSetFingerprint: string
|
||||
/** 复核并发版本。 */ expectedReviewFingerprint: string
|
||||
/** 仅影响未来收费。 */ decision: 'keep_blocked' | 'release_future_charges'
|
||||
/** 实际复核人。 */ reviewer: string
|
||||
/** 复核原因。 */ reason: string
|
||||
/** 实际确认材料摘要。 */ confirmationSha256: string
|
||||
}
|
||||
/** 原不可变审计事件。 */
|
||||
export interface VideoAuditEvent<T> {
|
||||
/** 原事件编号。 */ id: string
|
||||
/** 原任务版本。 */ taskFingerprint: string
|
||||
/** 原步骤。 */ stepName: string
|
||||
/** 事件时间。 */ createdAt: string
|
||||
/** 原事件正文。 */ body: T
|
||||
/** 原事件摘要。 */ digest: string
|
||||
/** 人工复核单调序号。 */ revision?: number
|
||||
}
|
||||
/** 原步骤审计视图。 */
|
||||
export interface VideoAuditStep {
|
||||
/** 步骤名。 */ name: string
|
||||
/** 原请求状态。 */ requestStatus: string
|
||||
/** 原供应方请求号,与 SDK 编号分开。 */ originalProviderRequestId: string | null
|
||||
/** 原 SDK 回执号。 */ originalSdkReceiptId: string | null
|
||||
/** 原 SDK 已存在完成回执。 */ hasOriginalReceipt: boolean
|
||||
/** 原请求精确身份。 */ identity: VideoAuditIdentity
|
||||
/** 当前集合版本。 */ evidenceSetFingerprint: string
|
||||
/** 当前复核版本。 */ reviewFingerprint: string
|
||||
/** 当前费用状态。 */ status: VideoAuditStatus
|
||||
/** 有效核清。 */ released: boolean
|
||||
/** 当前有效复核编号。 */ reviewId: string | null
|
||||
/** 当前版本证据。 */ evidence: VideoAuditEvent<RegisterVideoAudit>[]
|
||||
/** 当前版本复核。 */ reviews: VideoAuditEvent<ReviewVideoAudit>[]
|
||||
}
|
||||
/** 原任务完整费用审计资源。 */
|
||||
export interface VideoAuditView {
|
||||
/** 原项目。 */ projectId: string
|
||||
/** 原镜头。 */ shotId: string
|
||||
/** 原任务。 */ taskId: string
|
||||
/** 原执行记录。 */ workflowExecutionId: string
|
||||
/** 原批准币种。 */ currency: string
|
||||
/** 原任务版本。 */ taskFingerprint: string
|
||||
/** 原执行状态。 */ originalTaskStatus: string
|
||||
/** 原执行记录状态。 */ originalWorkflowStatus: string
|
||||
/** 当前整体费用阻断。 */ billingBlocked: boolean
|
||||
/** 有真实原请求的步骤。 */ steps: VideoAuditStep[]
|
||||
/** 全部版本历史。 */ history: {
|
||||
/** 全部外部证据。 */ evidence: VideoAuditEvent<RegisterVideoAudit>[]
|
||||
/** 全部人工复核。 */ reviews: VideoAuditEvent<ReviewVideoAudit>[]
|
||||
}
|
||||
}
|
||||
/** 受控任务只读概要,不从费用结果重写质量。 */
|
||||
export interface VideoExecutionSummary {
|
||||
/** 原任务。 */ taskId: string
|
||||
/** 原任务状态。 */ taskStatus: string
|
||||
/** 原执行记录。 */ executionId: string
|
||||
/** 原视频。 */ videoId: string | null
|
||||
/** 原待审标记。 */ needsReview: boolean
|
||||
/** 当前费用阻断,旧摘要可缺省。 */ billingBlocked?: boolean
|
||||
}
|
||||
/** 原受控任务详情,完整质量及费用存于原输出中。 */
|
||||
export interface VideoExecutionDetail extends VideoExecutionSummary {
|
||||
/** 原执行记录状态。 */ workflowStatus: string
|
||||
/** 原版本是否当前。 */ current: boolean
|
||||
/** 版本说明。 */ staleReason: string | null
|
||||
/** 原冻结计划。 */ plan: {
|
||||
/** 原用途。 */ purpose: string
|
||||
/** 原项目。 */ projectId: string
|
||||
/** 原镜头。 */ shotId: string
|
||||
/** 原视频。 */ videoId: string | null
|
||||
/** 原计划指纹。 */ fingerprint: string
|
||||
}
|
||||
/** 原状态、步骤、费用及质量观察保持不变。 */ output: Record<string, unknown>
|
||||
}
|
||||
Reference in new issue
Block a user