auto-save 2026-05-20 22:48 (~2)
This commit is contained in:
@@ -1839,6 +1839,13 @@
|
||||
"message": "fix: make video prompts material adaptive",
|
||||
"hash": "7106f3a",
|
||||
"files_changed": 1
|
||||
},
|
||||
{
|
||||
"ts": "2026-05-20T22:43:19+08:00",
|
||||
"type": "commit",
|
||||
"message": "auto-save 2026-05-20 22:43 (~2)",
|
||||
"hash": "33f87eb",
|
||||
"files_changed": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import type {
|
||||
AssetPack,
|
||||
AssetTemplate,
|
||||
CharacterSpec,
|
||||
ExportManifest,
|
||||
GenImage,
|
||||
@@ -289,11 +290,13 @@ export async function generateAssetPack(opts: {
|
||||
});
|
||||
const characterSpec = cleaned.characterSpec;
|
||||
const version = 'v01';
|
||||
const packId = `pack_${opts.kind}_${Date.now().toString(36)}_${randomBytes(3).toString('hex')}`;
|
||||
const createdAt = Date.now();
|
||||
const existingPack = opts.session.packs?.find(pack => pack.kind === opts.kind && pack.sourceImageId === opts.sourceImage.id && pack.status !== 'complete');
|
||||
const packId = existingPack?.id ?? `pack_${opts.kind}_${Date.now().toString(36)}_${randomBytes(3).toString('hex')}`;
|
||||
const createdAt = existingPack?.createdAt ?? Date.now();
|
||||
const provider = detectProvider();
|
||||
|
||||
const assets: ToyAsset[] = [];
|
||||
const templateIds = new Set(templates.map(template => template.id));
|
||||
const assets: ToyAsset[] = (existingPack?.assets ?? []).filter(asset => templateIds.has(asset.templateId));
|
||||
const pack: AssetPack = {
|
||||
id: packId,
|
||||
kind: opts.kind,
|
||||
@@ -302,14 +305,14 @@ export async function generateAssetPack(opts: {
|
||||
sourceImageUrl: opts.sourceImage.url,
|
||||
characterSpec,
|
||||
assets,
|
||||
manifestId: `manifest_${packId}`,
|
||||
manifestId: existingPack?.manifestId ?? `manifest_${packId}`,
|
||||
createdAt,
|
||||
version,
|
||||
status: 'draft',
|
||||
};
|
||||
|
||||
const remainingTemplates = [...templates];
|
||||
const generatedTemplateIds = new Set<string>();
|
||||
const generatedTemplateIds = new Set(assets.map(asset => asset.templateId));
|
||||
const remainingTemplates = templates.filter(template => !generatedTemplateIds.has(template.id));
|
||||
async function createAsset(template: AssetTemplate): Promise<ToyAsset> {
|
||||
const assetId = `${opts.kind}_${template.filenamePart}_${randomBytes(3).toString('hex')}`;
|
||||
const anchorAsset = template.anchorTemplateId
|
||||
|
||||
Reference in New Issue
Block a user