@rslsp1/fa-app-tools 2.0.54 → 2.0.57
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.
|
@@ -116,11 +116,16 @@ async function loadHFState(namespace, token) {
|
|
|
116
116
|
meta: JSON.parse(metaStr)
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
-
async function loadPendingEvents(namespace, token, sinceTs) {
|
|
119
|
+
async function loadPendingEvents(namespace, token, sinceTs, knownPaths) {
|
|
120
120
|
const files = await hfListDir(namespace, "events", token);
|
|
121
|
-
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs).sort((a, b) => a.path.localeCompare(b.path));
|
|
121
|
+
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs && !knownPaths?.has(f.path)).sort((a, b) => a.path.localeCompare(b.path));
|
|
122
|
+
if (!pending.length) return [];
|
|
122
123
|
const raw = await Promise.all(
|
|
123
|
-
pending.map((f) =>
|
|
124
|
+
pending.map(async (f) => {
|
|
125
|
+
const result = await hfDownloadJsonByPath(f.path, token);
|
|
126
|
+
knownPaths?.add(f.path);
|
|
127
|
+
return result;
|
|
128
|
+
})
|
|
124
129
|
);
|
|
125
130
|
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
126
131
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -589,7 +589,7 @@ declare function hfBatchArchive(moves: Array<{
|
|
|
589
589
|
}>, token: string, summary: string): Promise<void>;
|
|
590
590
|
declare function tsFromEventPath(repoPath: string): number;
|
|
591
591
|
declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
|
|
592
|
-
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number): Promise<HFEvent[]>;
|
|
592
|
+
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number, knownPaths?: Set<string>): Promise<HFEvent[]>;
|
|
593
593
|
declare function getSessionClientId(): string;
|
|
594
594
|
declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[]): Promise<HFEvent<P>>;
|
|
595
595
|
declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
|
|
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
641
641
|
declare function findForks(dag: Dag): DagFork[];
|
|
642
642
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
643
643
|
|
|
644
|
-
declare const LIB_VERSION = "2.0.
|
|
644
|
+
declare const LIB_VERSION = "2.0.57";
|
|
645
645
|
|
|
646
646
|
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, ServerTab, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -589,7 +589,7 @@ declare function hfBatchArchive(moves: Array<{
|
|
|
589
589
|
}>, token: string, summary: string): Promise<void>;
|
|
590
590
|
declare function tsFromEventPath(repoPath: string): number;
|
|
591
591
|
declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
|
|
592
|
-
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number): Promise<HFEvent[]>;
|
|
592
|
+
declare function loadPendingEvents(namespace: string, token: string, sinceTs: number, knownPaths?: Set<string>): Promise<HFEvent[]>;
|
|
593
593
|
declare function getSessionClientId(): string;
|
|
594
594
|
declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[]): Promise<HFEvent<P>>;
|
|
595
595
|
declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
|
|
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
641
641
|
declare function findForks(dag: Dag): DagFork[];
|
|
642
642
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
643
643
|
|
|
644
|
-
declare const LIB_VERSION = "2.0.
|
|
644
|
+
declare const LIB_VERSION = "2.0.57";
|
|
645
645
|
|
|
646
646
|
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, ServerTab, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
|
package/dist/index.js
CHANGED
|
@@ -404,11 +404,16 @@ async function loadHFState(namespace, token) {
|
|
|
404
404
|
meta: JSON.parse(metaStr)
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
async function loadPendingEvents(namespace, token, sinceTs) {
|
|
407
|
+
async function loadPendingEvents(namespace, token, sinceTs, knownPaths) {
|
|
408
408
|
const files = await hfListDir(namespace, "events", token);
|
|
409
|
-
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs).sort((a, b) => a.path.localeCompare(b.path));
|
|
409
|
+
const pending = files.filter((f) => f.type === "file" && tsFromEventPath(f.path) > sinceTs && !knownPaths?.has(f.path)).sort((a, b) => a.path.localeCompare(b.path));
|
|
410
|
+
if (!pending.length) return [];
|
|
410
411
|
const raw = await Promise.all(
|
|
411
|
-
pending.map((f) =>
|
|
412
|
+
pending.map(async (f) => {
|
|
413
|
+
const result = await hfDownloadJsonByPath(f.path, token);
|
|
414
|
+
knownPaths?.add(f.path);
|
|
415
|
+
return result;
|
|
416
|
+
})
|
|
412
417
|
);
|
|
413
418
|
return raw.flatMap((e) => Array.isArray(e) ? e : [e]);
|
|
414
419
|
}
|
|
@@ -2714,6 +2719,7 @@ function useHFState(token, namespace) {
|
|
|
2714
2719
|
const [lastEventTs, setLastEventTs] = (0, import_react16.useState)(0);
|
|
2715
2720
|
const [hasStateZip, setHasStateZip] = (0, import_react16.useState)(false);
|
|
2716
2721
|
const knownEventPaths = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
|
|
2722
|
+
const knownFilePaths = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
|
|
2717
2723
|
const allEventsRef = (0, import_react16.useRef)([]);
|
|
2718
2724
|
const applyNewEvents = (0, import_react16.useCallback)((snapshot, newEvents) => {
|
|
2719
2725
|
if (!newEvents.length && allEventsRef.current.length === 0) {
|
|
@@ -2733,6 +2739,7 @@ function useHFState(token, namespace) {
|
|
|
2733
2739
|
if (!token || !namespace) return;
|
|
2734
2740
|
setIsLoading(true);
|
|
2735
2741
|
setError(null);
|
|
2742
|
+
knownFilePaths.current = /* @__PURE__ */ new Set();
|
|
2736
2743
|
try {
|
|
2737
2744
|
const snapshot = await loadHFState(namespace, token);
|
|
2738
2745
|
setHasStateZip(snapshot !== null);
|
|
@@ -2741,7 +2748,7 @@ function useHFState(token, namespace) {
|
|
|
2741
2748
|
tags: { by_category: {}, all: [] },
|
|
2742
2749
|
meta: { consolidatedAt: 0, version: 1 }
|
|
2743
2750
|
};
|
|
2744
|
-
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2751
|
+
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2745
2752
|
const hfEventKeys = new Set(hfEvents.map((e) => `${e.ts}_${e.clientId}`));
|
|
2746
2753
|
const localOnlyEvents = allEventsRef.current.filter(
|
|
2747
2754
|
(e) => !hfEventKeys.has(`${e.ts}_${e.clientId}`)
|
|
@@ -2766,7 +2773,7 @@ function useHFState(token, namespace) {
|
|
|
2766
2773
|
}
|
|
2767
2774
|
writeOfflineBuffer(failed);
|
|
2768
2775
|
setPendingBufferCount(failed.length);
|
|
2769
|
-
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2776
|
+
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2770
2777
|
freshEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
2771
2778
|
setState((prev) => prev ? applyNewEvents(base, freshEvents) : prev);
|
|
2772
2779
|
}
|
|
@@ -2779,7 +2786,7 @@ function useHFState(token, namespace) {
|
|
|
2779
2786
|
const pollNew = (0, import_react16.useCallback)(async () => {
|
|
2780
2787
|
if (!token || !namespace || !state) return;
|
|
2781
2788
|
try {
|
|
2782
|
-
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt);
|
|
2789
|
+
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt, knownFilePaths.current);
|
|
2783
2790
|
const newEvents = events.filter((e) => !knownEventPaths.current.has(`${e.ts}_${e.clientId}`));
|
|
2784
2791
|
if (!newEvents.length) return;
|
|
2785
2792
|
newEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
@@ -5087,8 +5094,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5087
5094
|
return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
|
|
5088
5095
|
});
|
|
5089
5096
|
const sortedEntries = [...hfState.metadata].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
|
|
5097
|
+
const galleryRepIds = new Set(groupByPrompt(skeletons).slice(0, 20).map((g) => g.representative.id));
|
|
5098
|
+
const historyIds = new Set(sortedEntries.slice(0, 20).map((e) => e.id));
|
|
5099
|
+
const initialIds = /* @__PURE__ */ new Set([...galleryRepIds, ...historyIds]);
|
|
5100
|
+
const toLoad = sortedEntries.filter((e) => initialIds.has(e.id));
|
|
5090
5101
|
(async () => {
|
|
5091
|
-
for (const entry of
|
|
5102
|
+
for (const entry of toLoad) {
|
|
5092
5103
|
if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
|
|
5093
5104
|
if (hfImageNotFoundRef.current.has(entry.id)) continue;
|
|
5094
5105
|
try {
|
|
@@ -5343,6 +5354,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5343
5354
|
const group = groups.find((gr) => gr.prompt === currentResult.prompt);
|
|
5344
5355
|
return group ? group.items : [];
|
|
5345
5356
|
}, [galleryItems, currentResult?.prompt]);
|
|
5357
|
+
(0, import_react27.useEffect)(() => {
|
|
5358
|
+
if (!currentResult?.prompt || !hfToken || !effectiveNamespace || !hfState) return;
|
|
5359
|
+
const siblings = galleryItemsRef.current.filter(
|
|
5360
|
+
(g) => g.prompt === currentResult.prompt && !g.base64 && !hfImageNotFoundRef.current.has(g.id)
|
|
5361
|
+
);
|
|
5362
|
+
if (!siblings.length) return;
|
|
5363
|
+
(async () => {
|
|
5364
|
+
for (const sib of siblings) {
|
|
5365
|
+
const meta = hfState.metadata.find((m) => m.id === sib.id);
|
|
5366
|
+
if (!meta) continue;
|
|
5367
|
+
try {
|
|
5368
|
+
const b64 = await hfLoadImageAsBase64(sib.id, hfToken, effectiveNamespace, meta.filename, void 0, meta.mimeType, meta.hasThumb);
|
|
5369
|
+
if (!b64) {
|
|
5370
|
+
hfImageNotFoundRef.current.set(sib.id, Date.now());
|
|
5371
|
+
continue;
|
|
5372
|
+
}
|
|
5373
|
+
const prefix = `data:${meta.mimeType || "image/jpeg"};base64,`;
|
|
5374
|
+
setGalleryItems((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
|
|
5375
|
+
setHistory((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
|
|
5376
|
+
} catch {
|
|
5377
|
+
hfImageNotFoundRef.current.set(sib.id, Date.now());
|
|
5378
|
+
}
|
|
5379
|
+
}
|
|
5380
|
+
})();
|
|
5381
|
+
}, [currentResult?.id, currentResult?.prompt]);
|
|
5346
5382
|
const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
|
|
5347
5383
|
const isGenerating = activeGenerationsCount > 0;
|
|
5348
5384
|
useKeyboardNavigation(history, currentResult, setCurrentResult);
|
|
@@ -6712,7 +6748,7 @@ function FaApp({
|
|
|
6712
6748
|
// src/index.ts
|
|
6713
6749
|
init_hfStateService();
|
|
6714
6750
|
init_hfStateService();
|
|
6715
|
-
var LIB_VERSION = "2.0.
|
|
6751
|
+
var LIB_VERSION = "2.0.57";
|
|
6716
6752
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6717
6753
|
0 && (module.exports = {
|
|
6718
6754
|
AvatarArchitectApp,
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
setHFToken,
|
|
22
22
|
tsFromEventPath,
|
|
23
23
|
writeHFEvent
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VVLKEBHL.mjs";
|
|
25
25
|
|
|
26
26
|
// src/hooks/useOnClickOutside.ts
|
|
27
27
|
import { useEffect } from "react";
|
|
@@ -1666,7 +1666,7 @@ var ProjectSyncTab = ({
|
|
|
1666
1666
|
{
|
|
1667
1667
|
onClick: async () => {
|
|
1668
1668
|
try {
|
|
1669
|
-
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
1669
|
+
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-PHK6676C.mjs");
|
|
1670
1670
|
const file = await hfDownloadProject2(p.path, hfToken);
|
|
1671
1671
|
onHfLoad(file);
|
|
1672
1672
|
} catch (e) {
|
|
@@ -2030,6 +2030,7 @@ function useHFState(token, namespace) {
|
|
|
2030
2030
|
const [lastEventTs, setLastEventTs] = useState9(0);
|
|
2031
2031
|
const [hasStateZip, setHasStateZip] = useState9(false);
|
|
2032
2032
|
const knownEventPaths = useRef6(/* @__PURE__ */ new Set());
|
|
2033
|
+
const knownFilePaths = useRef6(/* @__PURE__ */ new Set());
|
|
2033
2034
|
const allEventsRef = useRef6([]);
|
|
2034
2035
|
const applyNewEvents = useCallback((snapshot, newEvents) => {
|
|
2035
2036
|
if (!newEvents.length && allEventsRef.current.length === 0) {
|
|
@@ -2049,6 +2050,7 @@ function useHFState(token, namespace) {
|
|
|
2049
2050
|
if (!token || !namespace) return;
|
|
2050
2051
|
setIsLoading(true);
|
|
2051
2052
|
setError(null);
|
|
2053
|
+
knownFilePaths.current = /* @__PURE__ */ new Set();
|
|
2052
2054
|
try {
|
|
2053
2055
|
const snapshot = await loadHFState(namespace, token);
|
|
2054
2056
|
setHasStateZip(snapshot !== null);
|
|
@@ -2057,7 +2059,7 @@ function useHFState(token, namespace) {
|
|
|
2057
2059
|
tags: { by_category: {}, all: [] },
|
|
2058
2060
|
meta: { consolidatedAt: 0, version: 1 }
|
|
2059
2061
|
};
|
|
2060
|
-
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2062
|
+
const hfEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2061
2063
|
const hfEventKeys = new Set(hfEvents.map((e) => `${e.ts}_${e.clientId}`));
|
|
2062
2064
|
const localOnlyEvents = allEventsRef.current.filter(
|
|
2063
2065
|
(e) => !hfEventKeys.has(`${e.ts}_${e.clientId}`)
|
|
@@ -2082,7 +2084,7 @@ function useHFState(token, namespace) {
|
|
|
2082
2084
|
}
|
|
2083
2085
|
writeOfflineBuffer(failed);
|
|
2084
2086
|
setPendingBufferCount(failed.length);
|
|
2085
|
-
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt);
|
|
2087
|
+
const freshEvents = await loadPendingEvents(namespace, token, base.meta.consolidatedAt, knownFilePaths.current);
|
|
2086
2088
|
freshEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
2087
2089
|
setState((prev) => prev ? applyNewEvents(base, freshEvents) : prev);
|
|
2088
2090
|
}
|
|
@@ -2095,7 +2097,7 @@ function useHFState(token, namespace) {
|
|
|
2095
2097
|
const pollNew = useCallback(async () => {
|
|
2096
2098
|
if (!token || !namespace || !state) return;
|
|
2097
2099
|
try {
|
|
2098
|
-
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt);
|
|
2100
|
+
const events = await loadPendingEvents(namespace, token, state.meta.consolidatedAt, knownFilePaths.current);
|
|
2099
2101
|
const newEvents = events.filter((e) => !knownEventPaths.current.has(`${e.ts}_${e.clientId}`));
|
|
2100
2102
|
if (!newEvents.length) return;
|
|
2101
2103
|
newEvents.forEach((e) => knownEventPaths.current.add(`${e.ts}_${e.clientId}`));
|
|
@@ -4403,8 +4405,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4403
4405
|
return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
|
|
4404
4406
|
});
|
|
4405
4407
|
const sortedEntries = [...hfState.metadata].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
|
|
4408
|
+
const galleryRepIds = new Set(groupByPrompt(skeletons).slice(0, 20).map((g) => g.representative.id));
|
|
4409
|
+
const historyIds = new Set(sortedEntries.slice(0, 20).map((e) => e.id));
|
|
4410
|
+
const initialIds = /* @__PURE__ */ new Set([...galleryRepIds, ...historyIds]);
|
|
4411
|
+
const toLoad = sortedEntries.filter((e) => initialIds.has(e.id));
|
|
4406
4412
|
(async () => {
|
|
4407
|
-
for (const entry of
|
|
4413
|
+
for (const entry of toLoad) {
|
|
4408
4414
|
if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
|
|
4409
4415
|
if (hfImageNotFoundRef.current.has(entry.id)) continue;
|
|
4410
4416
|
try {
|
|
@@ -4659,6 +4665,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4659
4665
|
const group = groups.find((gr) => gr.prompt === currentResult.prompt);
|
|
4660
4666
|
return group ? group.items : [];
|
|
4661
4667
|
}, [galleryItems, currentResult?.prompt]);
|
|
4668
|
+
useEffect7(() => {
|
|
4669
|
+
if (!currentResult?.prompt || !hfToken || !effectiveNamespace || !hfState) return;
|
|
4670
|
+
const siblings = galleryItemsRef.current.filter(
|
|
4671
|
+
(g) => g.prompt === currentResult.prompt && !g.base64 && !hfImageNotFoundRef.current.has(g.id)
|
|
4672
|
+
);
|
|
4673
|
+
if (!siblings.length) return;
|
|
4674
|
+
(async () => {
|
|
4675
|
+
for (const sib of siblings) {
|
|
4676
|
+
const meta = hfState.metadata.find((m) => m.id === sib.id);
|
|
4677
|
+
if (!meta) continue;
|
|
4678
|
+
try {
|
|
4679
|
+
const b64 = await hfLoadImageAsBase64(sib.id, hfToken, effectiveNamespace, meta.filename, void 0, meta.mimeType, meta.hasThumb);
|
|
4680
|
+
if (!b64) {
|
|
4681
|
+
hfImageNotFoundRef.current.set(sib.id, Date.now());
|
|
4682
|
+
continue;
|
|
4683
|
+
}
|
|
4684
|
+
const prefix = `data:${meta.mimeType || "image/jpeg"};base64,`;
|
|
4685
|
+
setGalleryItems((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
|
|
4686
|
+
setHistory((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
|
|
4687
|
+
} catch {
|
|
4688
|
+
hfImageNotFoundRef.current.set(sib.id, Date.now());
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
})();
|
|
4692
|
+
}, [currentResult?.id, currentResult?.prompt]);
|
|
4662
4693
|
const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
|
|
4663
4694
|
const isGenerating = activeGenerationsCount > 0;
|
|
4664
4695
|
useKeyboardNavigation(history, currentResult, setCurrentResult);
|
|
@@ -5195,7 +5226,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5195
5226
|
onClick: async () => {
|
|
5196
5227
|
setIsLoadingFromHF(true);
|
|
5197
5228
|
try {
|
|
5198
|
-
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
5229
|
+
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-PHK6676C.mjs");
|
|
5199
5230
|
const projects = await hfListProjects2(hfToken);
|
|
5200
5231
|
if (projects.length > 0) {
|
|
5201
5232
|
const file = await hfDownloadProject2(projects[0].path, hfToken);
|
|
@@ -6026,7 +6057,7 @@ function FaApp({
|
|
|
6026
6057
|
}
|
|
6027
6058
|
|
|
6028
6059
|
// src/index.ts
|
|
6029
|
-
var LIB_VERSION = "2.0.
|
|
6060
|
+
var LIB_VERSION = "2.0.57";
|
|
6030
6061
|
export {
|
|
6031
6062
|
AvatarArchitectApp,
|
|
6032
6063
|
CollapsibleCard,
|