@rslsp1/fa-app-tools 1.3.13 → 1.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -479,6 +479,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
479
479
  declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
480
480
  declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
481
481
 
482
- declare const LIB_VERSION = "1.3.13";
482
+ declare const LIB_VERSION = "1.3.14";
483
483
 
484
484
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFMetadataEntry, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, groupGenerationsToLabItems, hfDeleteProject, hfDownloadProject, hfListProjects, hfLoadImageAsBase64, hfLoadMetadata, hfLoadTags, hfSaveMetadata, hfSaveTags, hfUploadImage, hfUploadProjectForm, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, setHFToken, useKeyboardNavigation, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -479,6 +479,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
479
479
  declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
480
480
  declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
481
481
 
482
- declare const LIB_VERSION = "1.3.13";
482
+ declare const LIB_VERSION = "1.3.14";
483
483
 
484
484
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFMetadataEntry, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, groupGenerationsToLabItems, hfDeleteProject, hfDownloadProject, hfListProjects, hfLoadImageAsBase64, hfLoadMetadata, hfLoadTags, hfSaveMetadata, hfSaveTags, hfUploadImage, hfUploadProjectForm, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, setHFToken, useKeyboardNavigation, useOnClickOutside };
package/dist/index.js CHANGED
@@ -3488,6 +3488,10 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3488
3488
  const [edges, setEdges] = (0, import_react21.useState)([]);
3489
3489
  const [history, setHistory] = (0, import_react21.useState)([]);
3490
3490
  const [galleryItems, setGalleryItems] = (0, import_react21.useState)([]);
3491
+ const galleryItemsRef = (0, import_react21.useRef)([]);
3492
+ (0, import_react21.useEffect)(() => {
3493
+ galleryItemsRef.current = galleryItems;
3494
+ }, [galleryItems]);
3491
3495
  const [activePrompt, setActivePrompt] = (0, import_react21.useState)("");
3492
3496
  const [isSynthesizing, setIsSynthesizing] = (0, import_react21.useState)(false);
3493
3497
  const [activeGenerationsCount, setActiveGenerationsCount] = (0, import_react21.useState)(0);
@@ -4082,6 +4086,36 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4082
4086
  }).catch(() => {
4083
4087
  });
4084
4088
  }
4089
+ const localOnlyItems = galleryItemsRef.current.filter((g) => !hfIds.has(g.id) && g.base64 && g.status === "done");
4090
+ if (localOnlyItems.length > 0) {
4091
+ hfMetaSaveQueue.current = hfMetaSaveQueue.current.then(async () => {
4092
+ try {
4093
+ let currentMeta = await hfLoadMetadata(token);
4094
+ const existingIds = new Set((currentMeta || []).map((e) => e.id));
4095
+ for (const gen of localOnlyItems) {
4096
+ if (existingIds.has(gen.id)) continue;
4097
+ const raw = gen.base64.includes(",") ? gen.base64.split(",")[1] : gen.base64;
4098
+ const mimeType = gen.base64.startsWith("data:image/png") ? "image/png" : "image/jpeg";
4099
+ await hfUploadImage(raw, gen.id, token, mimeType).catch(() => {
4100
+ });
4101
+ const entry = {
4102
+ id: gen.id,
4103
+ prompt: gen.prompt || void 0,
4104
+ seed: gen.seed,
4105
+ model: gen.model,
4106
+ tags: gen.tags || [],
4107
+ timestamp: gen.timestamp,
4108
+ mimeType
4109
+ };
4110
+ currentMeta = [...currentMeta || [], entry];
4111
+ existingIds.add(gen.id);
4112
+ }
4113
+ await hfSaveMetadata(currentMeta, token);
4114
+ setHfMetadata(currentMeta);
4115
+ } catch {
4116
+ }
4117
+ });
4118
+ }
4085
4119
  } finally {
4086
4120
  setIsHfRefreshing(false);
4087
4121
  }
@@ -4920,7 +4954,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4920
4954
 
4921
4955
  // src/index.ts
4922
4956
  init_hfStateService();
4923
- var LIB_VERSION = "1.3.13";
4957
+ var LIB_VERSION = "1.3.14";
4924
4958
  // Annotate the CommonJS export names for ESM import in node:
4925
4959
  0 && (module.exports = {
4926
4960
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -2931,6 +2931,10 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
2931
2931
  const [edges, setEdges] = useState14([]);
2932
2932
  const [history, setHistory] = useState14([]);
2933
2933
  const [galleryItems, setGalleryItems] = useState14([]);
2934
+ const galleryItemsRef = useRef6([]);
2935
+ useEffect5(() => {
2936
+ galleryItemsRef.current = galleryItems;
2937
+ }, [galleryItems]);
2934
2938
  const [activePrompt, setActivePrompt] = useState14("");
2935
2939
  const [isSynthesizing, setIsSynthesizing] = useState14(false);
2936
2940
  const [activeGenerationsCount, setActiveGenerationsCount] = useState14(0);
@@ -3525,6 +3529,36 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3525
3529
  }).catch(() => {
3526
3530
  });
3527
3531
  }
3532
+ const localOnlyItems = galleryItemsRef.current.filter((g) => !hfIds.has(g.id) && g.base64 && g.status === "done");
3533
+ if (localOnlyItems.length > 0) {
3534
+ hfMetaSaveQueue.current = hfMetaSaveQueue.current.then(async () => {
3535
+ try {
3536
+ let currentMeta = await hfLoadMetadata(token);
3537
+ const existingIds = new Set((currentMeta || []).map((e) => e.id));
3538
+ for (const gen of localOnlyItems) {
3539
+ if (existingIds.has(gen.id)) continue;
3540
+ const raw = gen.base64.includes(",") ? gen.base64.split(",")[1] : gen.base64;
3541
+ const mimeType = gen.base64.startsWith("data:image/png") ? "image/png" : "image/jpeg";
3542
+ await hfUploadImage(raw, gen.id, token, mimeType).catch(() => {
3543
+ });
3544
+ const entry = {
3545
+ id: gen.id,
3546
+ prompt: gen.prompt || void 0,
3547
+ seed: gen.seed,
3548
+ model: gen.model,
3549
+ tags: gen.tags || [],
3550
+ timestamp: gen.timestamp,
3551
+ mimeType
3552
+ };
3553
+ currentMeta = [...currentMeta || [], entry];
3554
+ existingIds.add(gen.id);
3555
+ }
3556
+ await hfSaveMetadata(currentMeta, token);
3557
+ setHfMetadata(currentMeta);
3558
+ } catch {
3559
+ }
3560
+ });
3561
+ }
3528
3562
  } finally {
3529
3563
  setIsHfRefreshing(false);
3530
3564
  }
@@ -4362,7 +4396,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4362
4396
  }
4363
4397
 
4364
4398
  // src/index.ts
4365
- var LIB_VERSION = "1.3.13";
4399
+ var LIB_VERSION = "1.3.14";
4366
4400
  export {
4367
4401
  AvatarArchitectApp,
4368
4402
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",