feat: connect resource library workflows

This commit is contained in:
afei A
2026-03-28 13:42:22 +08:00
parent c604e6ace1
commit 162d3e12d2
42 changed files with 4709 additions and 305 deletions

View File

@@ -9,7 +9,7 @@ export type ResourcePickerOption = LibraryItemVM & {
};
export type ModelPickerOption = ResourcePickerOption & {
poseId: number;
poseId?: number | null;
};
type ResourceBinding = {
@@ -68,9 +68,19 @@ export function getServiceModeForCustomerLevel(
export function mapModelOptions(items: LibraryItemVM[]): ModelPickerOption[] {
return items.flatMap((item) => {
if (typeof item.backendId === "number") {
return [
{
...item,
backendId: item.backendId,
poseId: item.poseId ?? null,
},
];
}
const binding = getResourceBinding(item.id);
if (!binding?.poseId) {
if (!binding) {
return [];
}
@@ -78,7 +88,7 @@ export function mapModelOptions(items: LibraryItemVM[]): ModelPickerOption[] {
{
...item,
backendId: binding.backendId,
poseId: binding.poseId,
poseId: binding.poseId ?? null,
},
];
});
@@ -88,6 +98,15 @@ export function mapResourceOptions(
items: LibraryItemVM[],
): ResourcePickerOption[] {
return items.flatMap((item) => {
if (typeof item.backendId === "number") {
return [
{
...item,
backendId: item.backendId,
},
];
}
const binding = getResourceBinding(item.id);
if (!binding) {