feat(short-drama-agent-front): 完善镜头定位与项目配置
This commit is contained in:
1 parent
470b52e26d
commit
5b134207b8
66 files changed
+2042
-984
No files matched your search
@@ -18,7 +18,7 @@ import {
|
||||
} from 'naive-ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Check, Circle, RefreshCw, UserCheck } from '@lucide/vue'
|
||||
import { Check, Circle, UserCheck } from '@lucide/vue'
|
||||
import { AssetImage, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
|
||||
import { downloadText } from '../../lib/format'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
@@ -154,12 +154,6 @@ function exportReceipt() {
|
||||
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
||||
}
|
||||
|
||||
/** 目录刷新同时读取正式形态和 Character Casting,避免无形态角色状态滞后。 */
|
||||
function refreshDirectory() {
|
||||
thumbnailRefreshKey.value++
|
||||
void Promise.all([catalog.refresh(), castingQuery.refresh()])
|
||||
}
|
||||
|
||||
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||
async function submitIdentityImage(input: Parameters<typeof generateImage>[0]) {
|
||||
await generateImage(input)
|
||||
@@ -273,8 +267,8 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
||||
}
|
||||
})
|
||||
|
||||
/** 原配置恢复入口打开标题栏共用的全局配置弹窗。 */
|
||||
function openProfileSettings() {
|
||||
toolsOpen.value = true
|
||||
if (route.query.configure !== 'profile') void router.replace({ query: { ...route.query, configure: 'profile' } })
|
||||
}
|
||||
|
||||
@@ -301,14 +295,6 @@ async function profileSaved() {
|
||||
operation.value.error = ''
|
||||
await profileQuery.refresh()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query.configure,
|
||||
value => {
|
||||
if (value === 'profile') openProfileSettings()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -343,7 +329,11 @@ watch(
|
||||
title="角色选角总览与批量操作"
|
||||
:has-receipt="!!session.receipt"
|
||||
>
|
||||
<CreativeProfileSettings :project-id="projectId" @saved="profileSaved" />
|
||||
<CreativeProfileSettings
|
||||
:project-id="projectId"
|
||||
:disabled="operation.pending"
|
||||
@saved="profileSaved"
|
||||
/>
|
||||
<div class="identity-tools-intro flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold">主体身份</h2>
|
||||
@@ -633,16 +623,6 @@ watch(
|
||||
<h3>
|
||||
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
||||
</h3>
|
||||
<NButton
|
||||
:disabled="catalog.loading.value || castingQuery.loading.value"
|
||||
@click="refreshDirectory"
|
||||
quaternary
|
||||
class="icon-button"
|
||||
size="small"
|
||||
aria-label="刷新主体目录"
|
||||
title="刷新主体目录"
|
||||
><template #icon><RefreshCw :size="14" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
<div class="directory-filters">
|
||||
<NInput
|
||||
|
||||
@@ -4,11 +4,7 @@ import { computed, ref, watch } from 'vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import AppForm from '../../../components/ui/AppForm.vue'
|
||||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||
import type {
|
||||
CreativeProfile,
|
||||
GenerationModelCatalog,
|
||||
GenerationOptions
|
||||
} from '../../generation-config/types'
|
||||
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||
import type { GenerateCastingCandidateInput } from '../types'
|
||||
|
||||
/** Character 选角候选表单固定使用 primary,每次独立生成且不会自动选择演员。 */
|
||||
@@ -32,7 +28,8 @@ const valid = computed(() => Boolean(provider.value))
|
||||
function reset() {
|
||||
prompt.value = ''
|
||||
provider.value = props.profile.imageProvider
|
||||
const selected = props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
const selected =
|
||||
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||
props.catalog.images.find(item => item.enabled)
|
||||
provider.value = selected?.provider ?? ''
|
||||
generationOptions.value = {
|
||||
@@ -40,7 +37,10 @@ function reset() {
|
||||
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||
}
|
||||
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||
if (sizeSchema?.options?.length && !sizeSchema.options.some(option => option.value === generationOptions.value.size)) {
|
||||
if (
|
||||
sizeSchema?.options?.length &&
|
||||
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||
) {
|
||||
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||
}
|
||||
acknowledged.value = false
|
||||
@@ -110,15 +110,15 @@ const formModel = computed(() => ({ prompt: prompt.value }))
|
||||
</NCheckbox>
|
||||
</AppForm>
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton
|
||||
:disabled="disabled || !valid || !acknowledged"
|
||||
:loading="disabled"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
{{ disabled ? '生成中…' : '确认生成候选' }}
|
||||
</NButton>
|
||||
<NButton @click="open = false">取消</NButton>
|
||||
<NButton
|
||||
:disabled="disabled || !valid || !acknowledged"
|
||||
:loading="disabled"
|
||||
type="primary"
|
||||
@click="formRef?.validate(submit)"
|
||||
>
|
||||
{{ disabled ? '生成中…' : '确认生成候选' }}
|
||||
</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -6,7 +6,7 @@ import { NFormItem } from 'naive-ui'
|
||||
import { fieldRule } from '../../../lib/form-rules'
|
||||
import { NAlert, NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDialog, FieldLabel } from '../../../components/ui'
|
||||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||
import { subjectIdentityApi } from '../api'
|
||||
@@ -197,7 +197,14 @@ const rules = {
|
||||
path="referenceImageId"
|
||||
label="身份锚定来源"
|
||||
:label-props="{ for: 'identity-reference' }"
|
||||
><NSelect
|
||||
>
|
||||
<template #label>
|
||||
<FieldLabel
|
||||
label="身份锚定来源"
|
||||
description="只能选择此主体已完成的图片。后端需取得图片服务可访问的远程地址;本地预览可见不保证远程地址仍有效。"
|
||||
/>
|
||||
</template>
|
||||
<NSelect
|
||||
id="identity-reference"
|
||||
v-model:value="referenceImageId"
|
||||
:options="[
|
||||
@@ -213,9 +220,6 @@ const rules = {
|
||||
class="select-control"
|
||||
></NSelect
|
||||
></NFormItem>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
只能选择此主体已完成的图片。后端需取得 Provider 可访问的远程地址;本地预览可见不保证远程地址仍有效。
|
||||
</p>
|
||||
<NFormItem
|
||||
class="block"
|
||||
path="prompt"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { usePolling } from '../../composables/usePolling'
|
||||
import { visualStyleApi } from '../visual-style'
|
||||
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||
import { generationConfigApi } from '../generation-config/api'
|
||||
import { subjectImagesApi } from '../subject-images/api'
|
||||
import { hasRunningImages } from '../subject-images/model'
|
||||
@@ -35,7 +36,7 @@ export function useSubjectIdentity() {
|
||||
const concurrency = ref(3)
|
||||
const candidateLimit = ref(3)
|
||||
const force = ref(false)
|
||||
/** 目录与身份已有刷新按钮,查询只在进入、切换和手动刷新时读取。 */
|
||||
/** 主体与模型查询只在进入、切换和自身操作完成后读取。 */
|
||||
const generationModelsQuery = usePolling(
|
||||
projectId,
|
||||
async (_id, signal) => generationConfigApi.catalog(signal),
|
||||
@@ -67,9 +68,17 @@ export function useSubjectIdentity() {
|
||||
},
|
||||
false
|
||||
)
|
||||
/** 全局配置成功保存后重新读取主体生图的实际默认参数。 */
|
||||
const generationRevision = useProjectGenerationRevision()
|
||||
/** 配置查询按当前项目和修订号隔离。 */
|
||||
const profileKey = computed(() => JSON.stringify([projectId.value, generationRevision.value]))
|
||||
/** 主体身份使用保存后的正式项目配置。 */
|
||||
const profileQuery = usePolling(
|
||||
projectId,
|
||||
async (id, signal) => ({ profile: await generationConfigApi.profile(id, signal) }),
|
||||
profileKey,
|
||||
async (key, signal) => {
|
||||
const [id] = JSON.parse(key) as [string, number]
|
||||
return { profile: await generationConfigApi.profile(id, signal) }
|
||||
},
|
||||
false
|
||||
)
|
||||
const castingQuery = usePolling(
|
||||
|
||||
Reference in new issue
Block a user