@rslsp1/fa-app-tools 1.3.13 → 1.3.15
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 +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +115 -1
- package/dist/index.mjs +113 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -316,6 +316,44 @@ interface AvatarArchitectAppProps {
|
|
|
316
316
|
}
|
|
317
317
|
declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete }: AvatarArchitectAppProps): react_jsx_runtime.JSX.Element;
|
|
318
318
|
|
|
319
|
+
interface FaAppProps {
|
|
320
|
+
onGenerateImage: (params: Record<string, any>) => Promise<{
|
|
321
|
+
base64: string;
|
|
322
|
+
mediaId?: string;
|
|
323
|
+
}>;
|
|
324
|
+
onGeneratePrompt: (prompt: string, options?: {
|
|
325
|
+
images?: {
|
|
326
|
+
base64: string;
|
|
327
|
+
mimeType: string;
|
|
328
|
+
}[];
|
|
329
|
+
systemInstruction?: string;
|
|
330
|
+
}) => Promise<{
|
|
331
|
+
text: string;
|
|
332
|
+
}>;
|
|
333
|
+
onGenerateVideo?: (params: Record<string, any>) => Promise<{
|
|
334
|
+
base64: string;
|
|
335
|
+
mimeType: string;
|
|
336
|
+
}>;
|
|
337
|
+
onDownload: (base64: string, mimeType: string, filename: string) => Promise<void>;
|
|
338
|
+
onSelectMedia: () => Promise<MediaItem[]>;
|
|
339
|
+
onFlowSave?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
340
|
+
mediaId: string;
|
|
341
|
+
}>;
|
|
342
|
+
onFlowUpload?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
343
|
+
mediaId: string;
|
|
344
|
+
}>;
|
|
345
|
+
onFlowMediaUpload?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
346
|
+
mediaId: string;
|
|
347
|
+
}>;
|
|
348
|
+
libToken?: string;
|
|
349
|
+
onFetchServerProjects?: () => Promise<ProjectMeta[]>;
|
|
350
|
+
onServerSave?: (zipBase64: string, name: string) => Promise<ProjectMeta>;
|
|
351
|
+
onServerLoad?: (id: string) => Promise<File>;
|
|
352
|
+
onServerDelete?: (id: string) => Promise<void>;
|
|
353
|
+
buildInfo?: string;
|
|
354
|
+
}
|
|
355
|
+
declare function FaApp({ onGenerateImage, onGeneratePrompt, onGenerateVideo: _onGenerateVideo, onDownload, onSelectMedia, onFlowSave: _onFlowSave, onFlowUpload: _onFlowUpload, onFlowMediaUpload: _onFlowMediaUpload, libToken, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete, buildInfo, }: FaAppProps): react_jsx_runtime.JSX.Element;
|
|
356
|
+
|
|
319
357
|
interface CollapsibleCardProps {
|
|
320
358
|
title: string;
|
|
321
359
|
icon?: ReactNode;
|
|
@@ -479,6 +517,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
|
|
|
479
517
|
declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
|
|
480
518
|
declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
|
|
481
519
|
|
|
482
|
-
declare const LIB_VERSION = "1.3.
|
|
520
|
+
declare const LIB_VERSION = "1.3.15";
|
|
483
521
|
|
|
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 };
|
|
522
|
+
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaApp, type FaAppProps, 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
|
@@ -316,6 +316,44 @@ interface AvatarArchitectAppProps {
|
|
|
316
316
|
}
|
|
317
317
|
declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete }: AvatarArchitectAppProps): react_jsx_runtime.JSX.Element;
|
|
318
318
|
|
|
319
|
+
interface FaAppProps {
|
|
320
|
+
onGenerateImage: (params: Record<string, any>) => Promise<{
|
|
321
|
+
base64: string;
|
|
322
|
+
mediaId?: string;
|
|
323
|
+
}>;
|
|
324
|
+
onGeneratePrompt: (prompt: string, options?: {
|
|
325
|
+
images?: {
|
|
326
|
+
base64: string;
|
|
327
|
+
mimeType: string;
|
|
328
|
+
}[];
|
|
329
|
+
systemInstruction?: string;
|
|
330
|
+
}) => Promise<{
|
|
331
|
+
text: string;
|
|
332
|
+
}>;
|
|
333
|
+
onGenerateVideo?: (params: Record<string, any>) => Promise<{
|
|
334
|
+
base64: string;
|
|
335
|
+
mimeType: string;
|
|
336
|
+
}>;
|
|
337
|
+
onDownload: (base64: string, mimeType: string, filename: string) => Promise<void>;
|
|
338
|
+
onSelectMedia: () => Promise<MediaItem[]>;
|
|
339
|
+
onFlowSave?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
340
|
+
mediaId: string;
|
|
341
|
+
}>;
|
|
342
|
+
onFlowUpload?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
343
|
+
mediaId: string;
|
|
344
|
+
}>;
|
|
345
|
+
onFlowMediaUpload?: (base64: string, mimeType: string, name: string) => Promise<{
|
|
346
|
+
mediaId: string;
|
|
347
|
+
}>;
|
|
348
|
+
libToken?: string;
|
|
349
|
+
onFetchServerProjects?: () => Promise<ProjectMeta[]>;
|
|
350
|
+
onServerSave?: (zipBase64: string, name: string) => Promise<ProjectMeta>;
|
|
351
|
+
onServerLoad?: (id: string) => Promise<File>;
|
|
352
|
+
onServerDelete?: (id: string) => Promise<void>;
|
|
353
|
+
buildInfo?: string;
|
|
354
|
+
}
|
|
355
|
+
declare function FaApp({ onGenerateImage, onGeneratePrompt, onGenerateVideo: _onGenerateVideo, onDownload, onSelectMedia, onFlowSave: _onFlowSave, onFlowUpload: _onFlowUpload, onFlowMediaUpload: _onFlowMediaUpload, libToken, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete, buildInfo, }: FaAppProps): react_jsx_runtime.JSX.Element;
|
|
356
|
+
|
|
319
357
|
interface CollapsibleCardProps {
|
|
320
358
|
title: string;
|
|
321
359
|
icon?: ReactNode;
|
|
@@ -479,6 +517,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
|
|
|
479
517
|
declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
|
|
480
518
|
declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
|
|
481
519
|
|
|
482
|
-
declare const LIB_VERSION = "1.3.
|
|
520
|
+
declare const LIB_VERSION = "1.3.15";
|
|
483
521
|
|
|
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 };
|
|
522
|
+
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaApp, type FaAppProps, 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
|
@@ -504,6 +504,7 @@ __export(index_exports, {
|
|
|
504
504
|
AvatarArchitectApp: () => AvatarArchitectApp,
|
|
505
505
|
CollapsibleCard: () => CollapsibleCard,
|
|
506
506
|
CompactDropdown: () => CompactDropdown,
|
|
507
|
+
FaApp: () => FaApp,
|
|
507
508
|
FaToolsBadge: () => FaToolsBadge,
|
|
508
509
|
GLOBAL_STYLES: () => GLOBAL_STYLES,
|
|
509
510
|
HistoryPanel: () => HistoryPanel,
|
|
@@ -3488,6 +3489,10 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
3488
3489
|
const [edges, setEdges] = (0, import_react21.useState)([]);
|
|
3489
3490
|
const [history, setHistory] = (0, import_react21.useState)([]);
|
|
3490
3491
|
const [galleryItems, setGalleryItems] = (0, import_react21.useState)([]);
|
|
3492
|
+
const galleryItemsRef = (0, import_react21.useRef)([]);
|
|
3493
|
+
(0, import_react21.useEffect)(() => {
|
|
3494
|
+
galleryItemsRef.current = galleryItems;
|
|
3495
|
+
}, [galleryItems]);
|
|
3491
3496
|
const [activePrompt, setActivePrompt] = (0, import_react21.useState)("");
|
|
3492
3497
|
const [isSynthesizing, setIsSynthesizing] = (0, import_react21.useState)(false);
|
|
3493
3498
|
const [activeGenerationsCount, setActiveGenerationsCount] = (0, import_react21.useState)(0);
|
|
@@ -4082,6 +4087,36 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4082
4087
|
}).catch(() => {
|
|
4083
4088
|
});
|
|
4084
4089
|
}
|
|
4090
|
+
const localOnlyItems = galleryItemsRef.current.filter((g) => !hfIds.has(g.id) && g.base64 && g.status === "done");
|
|
4091
|
+
if (localOnlyItems.length > 0) {
|
|
4092
|
+
hfMetaSaveQueue.current = hfMetaSaveQueue.current.then(async () => {
|
|
4093
|
+
try {
|
|
4094
|
+
let currentMeta = await hfLoadMetadata(token);
|
|
4095
|
+
const existingIds = new Set((currentMeta || []).map((e) => e.id));
|
|
4096
|
+
for (const gen of localOnlyItems) {
|
|
4097
|
+
if (existingIds.has(gen.id)) continue;
|
|
4098
|
+
const raw = gen.base64.includes(",") ? gen.base64.split(",")[1] : gen.base64;
|
|
4099
|
+
const mimeType = gen.base64.startsWith("data:image/png") ? "image/png" : "image/jpeg";
|
|
4100
|
+
await hfUploadImage(raw, gen.id, token, mimeType).catch(() => {
|
|
4101
|
+
});
|
|
4102
|
+
const entry = {
|
|
4103
|
+
id: gen.id,
|
|
4104
|
+
prompt: gen.prompt || void 0,
|
|
4105
|
+
seed: gen.seed,
|
|
4106
|
+
model: gen.model,
|
|
4107
|
+
tags: gen.tags || [],
|
|
4108
|
+
timestamp: gen.timestamp,
|
|
4109
|
+
mimeType
|
|
4110
|
+
};
|
|
4111
|
+
currentMeta = [...currentMeta || [], entry];
|
|
4112
|
+
existingIds.add(gen.id);
|
|
4113
|
+
}
|
|
4114
|
+
await hfSaveMetadata(currentMeta, token);
|
|
4115
|
+
setHfMetadata(currentMeta);
|
|
4116
|
+
} catch {
|
|
4117
|
+
}
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
4085
4120
|
} finally {
|
|
4086
4121
|
setIsHfRefreshing(false);
|
|
4087
4122
|
}
|
|
@@ -4918,14 +4953,93 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4918
4953
|
] });
|
|
4919
4954
|
}
|
|
4920
4955
|
|
|
4956
|
+
// src/components/FaApp.tsx
|
|
4957
|
+
var import_react22 = require("react");
|
|
4958
|
+
init_hfStateService();
|
|
4959
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4960
|
+
function TokenDialog({ onSubmit }) {
|
|
4961
|
+
const [value, setValue] = (0, import_react22.useState)("");
|
|
4962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { minHeight: "100vh", background: "#0e0e0e", display: "flex", alignItems: "center", justifyContent: "center", padding: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { width: "100%", maxWidth: 400, background: "#171717", border: "1px solid #262626", borderRadius: 8, padding: 24, position: "relative", overflow: "hidden" }, children: [
|
|
4963
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { position: "absolute", top: 0, left: 0, width: "100%", height: 3, background: "linear-gradient(to right, #3b82f6, #a855f7, #ec4899)" } }),
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { marginBottom: 20 }, children: [
|
|
4965
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { color: "#fff", fontSize: 14, fontWeight: 700, marginBottom: 4 }, children: "Lib Token" }),
|
|
4966
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { color: "#525252", fontSize: 11, fontFamily: "monospace" }, children: "Kein Token konfiguriert \u2014 bitte manuell eingeben" })
|
|
4967
|
+
] }),
|
|
4968
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4969
|
+
"input",
|
|
4970
|
+
{
|
|
4971
|
+
type: "password",
|
|
4972
|
+
value,
|
|
4973
|
+
onChange: (e) => setValue(e.target.value),
|
|
4974
|
+
onKeyDown: (e) => e.key === "Enter" && value.trim() && onSubmit(value.trim()),
|
|
4975
|
+
placeholder: "Token eingeben\u2026",
|
|
4976
|
+
autoFocus: true,
|
|
4977
|
+
style: { width: "100%", background: "#000", border: "1px solid #404040", borderRadius: 4, color: "#fff", padding: "10px 12px", fontSize: 12, fontFamily: "monospace", outline: "none", boxSizing: "border-box", marginBottom: 12 }
|
|
4978
|
+
}
|
|
4979
|
+
),
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4981
|
+
"button",
|
|
4982
|
+
{
|
|
4983
|
+
onClick: () => value.trim() && onSubmit(value.trim()),
|
|
4984
|
+
style: { width: "100%", background: "#3b82f6", border: "none", borderRadius: 4, color: "#fff", padding: "10px", fontSize: 12, fontWeight: 700, cursor: "pointer", fontFamily: "inherit" },
|
|
4985
|
+
children: "Best\xE4tigen"
|
|
4986
|
+
}
|
|
4987
|
+
)
|
|
4988
|
+
] }) });
|
|
4989
|
+
}
|
|
4990
|
+
function FaApp({
|
|
4991
|
+
onGenerateImage,
|
|
4992
|
+
onGeneratePrompt,
|
|
4993
|
+
onGenerateVideo: _onGenerateVideo,
|
|
4994
|
+
onDownload,
|
|
4995
|
+
onSelectMedia,
|
|
4996
|
+
onFlowSave: _onFlowSave,
|
|
4997
|
+
onFlowUpload: _onFlowUpload,
|
|
4998
|
+
onFlowMediaUpload: _onFlowMediaUpload,
|
|
4999
|
+
libToken,
|
|
5000
|
+
onFetchServerProjects,
|
|
5001
|
+
onServerSave,
|
|
5002
|
+
onServerLoad,
|
|
5003
|
+
onServerDelete,
|
|
5004
|
+
buildInfo
|
|
5005
|
+
}) {
|
|
5006
|
+
const [token, setToken] = (0, import_react22.useState)(libToken || "");
|
|
5007
|
+
(0, import_react22.useEffect)(() => {
|
|
5008
|
+
if (libToken) setToken(libToken);
|
|
5009
|
+
}, [libToken]);
|
|
5010
|
+
(0, import_react22.useEffect)(() => {
|
|
5011
|
+
if (token) setHFToken(token);
|
|
5012
|
+
}, [token]);
|
|
5013
|
+
if (!token) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TokenDialog, { onSubmit: setToken });
|
|
5014
|
+
const wrappedPrompt = async (text, options) => {
|
|
5015
|
+
const result = await onGeneratePrompt(text, options);
|
|
5016
|
+
return result.text;
|
|
5017
|
+
};
|
|
5018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5019
|
+
AvatarArchitectApp,
|
|
5020
|
+
{
|
|
5021
|
+
onGenerateImage,
|
|
5022
|
+
onGeneratePrompt: wrappedPrompt,
|
|
5023
|
+
onDownload,
|
|
5024
|
+
onSelectMedia,
|
|
5025
|
+
onFetchServerProjects,
|
|
5026
|
+
onServerSave,
|
|
5027
|
+
onServerLoad,
|
|
5028
|
+
onServerDelete,
|
|
5029
|
+
buildInfo
|
|
5030
|
+
}
|
|
5031
|
+
);
|
|
5032
|
+
}
|
|
5033
|
+
|
|
4921
5034
|
// src/index.ts
|
|
4922
5035
|
init_hfStateService();
|
|
4923
|
-
var LIB_VERSION = "1.3.
|
|
5036
|
+
var LIB_VERSION = "1.3.15";
|
|
4924
5037
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4925
5038
|
0 && (module.exports = {
|
|
4926
5039
|
AvatarArchitectApp,
|
|
4927
5040
|
CollapsibleCard,
|
|
4928
5041
|
CompactDropdown,
|
|
5042
|
+
FaApp,
|
|
4929
5043
|
FaToolsBadge,
|
|
4930
5044
|
GLOBAL_STYLES,
|
|
4931
5045
|
HistoryPanel,
|
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
|
}
|
|
@@ -4361,12 +4395,90 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4361
4395
|
] });
|
|
4362
4396
|
}
|
|
4363
4397
|
|
|
4398
|
+
// src/components/FaApp.tsx
|
|
4399
|
+
import { useState as useState15, useEffect as useEffect6 } from "react";
|
|
4400
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4401
|
+
function TokenDialog({ onSubmit }) {
|
|
4402
|
+
const [value, setValue] = useState15("");
|
|
4403
|
+
return /* @__PURE__ */ jsx21("div", { style: { minHeight: "100vh", background: "#0e0e0e", display: "flex", alignItems: "center", justifyContent: "center", padding: 16 }, children: /* @__PURE__ */ jsxs19("div", { style: { width: "100%", maxWidth: 400, background: "#171717", border: "1px solid #262626", borderRadius: 8, padding: 24, position: "relative", overflow: "hidden" }, children: [
|
|
4404
|
+
/* @__PURE__ */ jsx21("div", { style: { position: "absolute", top: 0, left: 0, width: "100%", height: 3, background: "linear-gradient(to right, #3b82f6, #a855f7, #ec4899)" } }),
|
|
4405
|
+
/* @__PURE__ */ jsxs19("div", { style: { marginBottom: 20 }, children: [
|
|
4406
|
+
/* @__PURE__ */ jsx21("div", { style: { color: "#fff", fontSize: 14, fontWeight: 700, marginBottom: 4 }, children: "Lib Token" }),
|
|
4407
|
+
/* @__PURE__ */ jsx21("div", { style: { color: "#525252", fontSize: 11, fontFamily: "monospace" }, children: "Kein Token konfiguriert \u2014 bitte manuell eingeben" })
|
|
4408
|
+
] }),
|
|
4409
|
+
/* @__PURE__ */ jsx21(
|
|
4410
|
+
"input",
|
|
4411
|
+
{
|
|
4412
|
+
type: "password",
|
|
4413
|
+
value,
|
|
4414
|
+
onChange: (e) => setValue(e.target.value),
|
|
4415
|
+
onKeyDown: (e) => e.key === "Enter" && value.trim() && onSubmit(value.trim()),
|
|
4416
|
+
placeholder: "Token eingeben\u2026",
|
|
4417
|
+
autoFocus: true,
|
|
4418
|
+
style: { width: "100%", background: "#000", border: "1px solid #404040", borderRadius: 4, color: "#fff", padding: "10px 12px", fontSize: 12, fontFamily: "monospace", outline: "none", boxSizing: "border-box", marginBottom: 12 }
|
|
4419
|
+
}
|
|
4420
|
+
),
|
|
4421
|
+
/* @__PURE__ */ jsx21(
|
|
4422
|
+
"button",
|
|
4423
|
+
{
|
|
4424
|
+
onClick: () => value.trim() && onSubmit(value.trim()),
|
|
4425
|
+
style: { width: "100%", background: "#3b82f6", border: "none", borderRadius: 4, color: "#fff", padding: "10px", fontSize: 12, fontWeight: 700, cursor: "pointer", fontFamily: "inherit" },
|
|
4426
|
+
children: "Best\xE4tigen"
|
|
4427
|
+
}
|
|
4428
|
+
)
|
|
4429
|
+
] }) });
|
|
4430
|
+
}
|
|
4431
|
+
function FaApp({
|
|
4432
|
+
onGenerateImage,
|
|
4433
|
+
onGeneratePrompt,
|
|
4434
|
+
onGenerateVideo: _onGenerateVideo,
|
|
4435
|
+
onDownload,
|
|
4436
|
+
onSelectMedia,
|
|
4437
|
+
onFlowSave: _onFlowSave,
|
|
4438
|
+
onFlowUpload: _onFlowUpload,
|
|
4439
|
+
onFlowMediaUpload: _onFlowMediaUpload,
|
|
4440
|
+
libToken,
|
|
4441
|
+
onFetchServerProjects,
|
|
4442
|
+
onServerSave,
|
|
4443
|
+
onServerLoad,
|
|
4444
|
+
onServerDelete,
|
|
4445
|
+
buildInfo
|
|
4446
|
+
}) {
|
|
4447
|
+
const [token, setToken] = useState15(libToken || "");
|
|
4448
|
+
useEffect6(() => {
|
|
4449
|
+
if (libToken) setToken(libToken);
|
|
4450
|
+
}, [libToken]);
|
|
4451
|
+
useEffect6(() => {
|
|
4452
|
+
if (token) setHFToken(token);
|
|
4453
|
+
}, [token]);
|
|
4454
|
+
if (!token) return /* @__PURE__ */ jsx21(TokenDialog, { onSubmit: setToken });
|
|
4455
|
+
const wrappedPrompt = async (text, options) => {
|
|
4456
|
+
const result = await onGeneratePrompt(text, options);
|
|
4457
|
+
return result.text;
|
|
4458
|
+
};
|
|
4459
|
+
return /* @__PURE__ */ jsx21(
|
|
4460
|
+
AvatarArchitectApp,
|
|
4461
|
+
{
|
|
4462
|
+
onGenerateImage,
|
|
4463
|
+
onGeneratePrompt: wrappedPrompt,
|
|
4464
|
+
onDownload,
|
|
4465
|
+
onSelectMedia,
|
|
4466
|
+
onFetchServerProjects,
|
|
4467
|
+
onServerSave,
|
|
4468
|
+
onServerLoad,
|
|
4469
|
+
onServerDelete,
|
|
4470
|
+
buildInfo
|
|
4471
|
+
}
|
|
4472
|
+
);
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4364
4475
|
// src/index.ts
|
|
4365
|
-
var LIB_VERSION = "1.3.
|
|
4476
|
+
var LIB_VERSION = "1.3.15";
|
|
4366
4477
|
export {
|
|
4367
4478
|
AvatarArchitectApp,
|
|
4368
4479
|
CollapsibleCard,
|
|
4369
4480
|
CompactDropdown,
|
|
4481
|
+
FaApp,
|
|
4370
4482
|
FaToolsBadge,
|
|
4371
4483
|
GLOBAL_STYLES,
|
|
4372
4484
|
HistoryPanel,
|