feat(short-drama-agent-front): 接入素材预览审核并完善创作流程
This commit is contained in:
1 parent
f8b0fbb8ca
commit
dc8bb17a23
66 files changed
+2864
-632
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from './types'
|
||||
|
||||
/**
|
||||
* 从当前项目与能力目录恢复单图配置,丢弃目录不支持的旧尺寸。
|
||||
* @param catalog 当前模型能力目录
|
||||
* @param profile 当前项目保存的配置
|
||||
* @returns 可用供应方及本次独立的参数副本
|
||||
*/
|
||||
export function imageGenerationDefaults(
|
||||
catalog: GenerationModelCatalog,
|
||||
profile: CreativeProfile
|
||||
): {
|
||||
/** 可用供应方。 */ provider: string
|
||||
/** 模型默认值与项目值合并后的参数。 */ options: GenerationOptions
|
||||
} {
|
||||
const selected =
|
||||
catalog.images.find(item => item.provider === profile.imageProvider && item.enabled) ??
|
||||
catalog.images.find(item => item.enabled)
|
||||
const options: GenerationOptions = {
|
||||
...selected?.defaults,
|
||||
...(selected?.provider === profile.imageProvider ? profile.imageOptions : {})
|
||||
}
|
||||
const size = selected?.generationOptions.find(item => item.key === 'size')
|
||||
if (size?.options?.length && !size.options.some(option => option.value === options.size))
|
||||
options.size = selected?.defaults.size ?? size.options[0]?.value ?? ''
|
||||
return { provider: selected?.provider ?? '', options }
|
||||
}
|
||||
Reference in new issue
Block a user