feat(short-drama-agent-front): 优化项目查询与工作区界面

This commit is contained in:
GJ committed 2026-09-21 19:36:47 +08:00
1 parent 227db5450d
commit e6d02a20a7
33 files changed
+439 -513

No files matched your search

+16 -20
View File
@@ -1,5 +1,5 @@
import { computed, ref } from 'vue'
import { usePolling } from '../../composables/usePolling'
import { useQuery } from '../../composables/useQuery'
import { useProjectContext } from '../projects/context'
import { mergeDesignedShots } from '../storyboard/model'
import { storyboardApi } from '../storyboard/api'
@@ -45,24 +45,20 @@ export function useProduction() {
)
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value, force.value]))
/** 生产页已有刷新按钮,就绪状态改为手动更新。 */
const query = usePolling(
queryKey,
async (key, signal) => {
const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean]
if (!projectId || !number) return null
const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([
storyboardApi.directions(projectId, number, signal),
productionApi.promptReadiness(projectId, overwrite, signal),
productionApi.keyframeReadiness(projectId, overwrite, signal),
productionApi.videoReadiness(projectId, overwrite, signal),
productionApi.projectVideoStatus(projectId, signal)
])
if (directions.projectId !== projectId || directions.episodeNo !== number)
throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。')
return { directions, prompts, keyframes, videos, videoStatus }
},
false
)
const query = useQuery(queryKey, async (key, signal) => {
const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean]
if (!projectId || !number) return null
const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([
storyboardApi.directions(projectId, number, signal),
productionApi.promptReadiness(projectId, overwrite, signal),
productionApi.keyframeReadiness(projectId, overwrite, signal),
productionApi.videoReadiness(projectId, overwrite, signal),
productionApi.projectVideoStatus(projectId, signal)
])
if (directions.projectId !== projectId || directions.episodeNo !== number)
throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。')
return { directions, prompts, keyframes, videos, videoStatus }
})
const source = computed(() => sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value))
const shots = computed(() => mergeDesignedShots(query.data.value?.directions ?? null, null, source.value))
const shot = computed(() => shots.value.find(item => item.shotId === selectedShot.value) ?? shots.value[0])
@@ -99,7 +95,7 @@ export function useProduction() {
context.project.value?.status !== 'completed'
)
/** 批量操作只向就绪镜头提交;最终资产状态由轮询查询确认。 */
/** 批量操作只向就绪镜头提交;最终资产状态由显式刷新确认。 */
async function run(command: ProductionCommand) {
if (
blocked.value ||