feat(short-drama-agent-front): 接入图片持续授权与视频费用审计

This commit is contained in:
GJ committed 2026-11-13 17:59:50 +08:00
1 parent 3915566994
commit 1e9ef33d1d
39 files changed
+3442 -51

No files matched your search

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { imageGenerationDefaults } from '../../generation-config/image-defaults'
import { useAssetImageDefaults } from '../../generation-config/image-defaults'
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
import { useImageGenerationPreview, type ImageGenerationSubmission } from '../../subject-images/generation-preview'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
@@ -11,7 +11,7 @@ import { NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { AppDrawer, FieldLabel } from '../../../components/ui'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
import type { CreativeProfile, GenerationModelCatalog } from '../../generation-config/types'
import { subjectIdentityApi } from '../api'
import { currentAnchor, identityViewLabels } from '../model'
import type { GenerateIdentityImageInput, IdentityImage, IdentityViewType } from '../types'
@@ -47,10 +47,12 @@ const viewType = ref<IdentityViewType>('primary')
const referenceImageId = ref('')
/** prompt 的当前界面状态与输入绑定。 */
const prompt = ref('')
/** provider 的当前界面状态与输入绑定。 */
const provider = ref('')
/** 当前模型参数。 */
const generationOptions = ref<GenerationOptions>({})
/** 模型初值按项目与主体覆盖解析,用户后续手动选择独立保留。 */
const { provider, generationOptions, configLoading, configError } = useAssetImageDefaults(
open,
() => props.profile,
() => props.subjectId
)
/** anchor 的当前界面状态与输入绑定。 */
const anchor = computed(() => currentAnchor(props.images))
/** allowedViews 的当前界面状态与输入绑定。 */
@@ -79,9 +81,6 @@ watch(
: 'primary'
referenceImageId.value = ''
prompt.value = ''
const defaults = imageGenerationDefaults(props.catalog, props.profile)
provider.value = defaults.provider
generationOptions.value = defaults.options
},
{ immediate: true }
)
@@ -106,6 +105,8 @@ const generationInput = computed<GenerateIdentityImageInput>(() => ({
const {
preview,
acknowledged,
requiresCostConfirmation,
chargeNotice,
loading: previewLoading,
submitting,
error: previewError,
@@ -116,6 +117,12 @@ const {
submit
} = useImageGenerationPreview({
open,
chargeContext: () => ({
projectId: props.profile.projectId,
scope: 'identity',
targetId: props.subjectId,
exactPreview: viewType.value === 'primary' && !prompt.value.trim() && !referenceImageId.value
}),
recoveryTarget: () => (props.subjectId ? 'identity:' + props.subjectId : ''),
target: () =>
JSON.stringify([props.subjectId, props.images.filter(image => image.status === 'completed'), props.profile]),
@@ -154,6 +161,7 @@ const rules = {
<ContextNotice type="info" :show-icon="false" class="text-xs">
每次生成一张候选图,可能收费。审核通过后需手动设为母版。
</ContextNotice>
<p v-if="configError" class="text-sm" role="alert">{{ configError }}</p>
<!-- 以下是多视角与已有身份图选择模块,单一选项不显示选择器 -->
<NFormItem
v-if="allowedViews.length > 1"
@@ -215,7 +223,7 @@ const rules = {
:provider="provider"
:options="compatibleOptions"
:aspect-ratio="profile.aspectRatio"
:disabled="disabled || submitting"
:disabled="disabled || submitting || configLoading"
@update:provider="provider = $event"
@update:options="generationOptions = $event"
/>
@@ -228,7 +236,9 @@ const rules = {
:stale-notice="staleNotice || recoveryNotice"
@load="loadPreview"
/>
<p v-if="chargeNotice" class="text-sm text-muted" role="status">{{ chargeNotice }}</p>
<NCheckbox
v-if="requiresCostConfirmation"
id="identity-image-cost"
v-model:checked="acknowledged"
:disabled="!preview || submitting"