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