@rslsp1/fa-app-tools 2.0.13 → 2.0.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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/lib/hfStateService.ts
|
|
2
2
|
import JSZip from "jszip";
|
|
3
|
+
import { uploadFile } from "@huggingface/hub";
|
|
3
4
|
|
|
4
5
|
// src/lib/hfEventTypes.ts
|
|
5
6
|
var CURRENT_EVENT_VERSION = { major: 1, minor: 0 };
|
|
@@ -173,24 +174,14 @@ async function hfBootstrapFromLegacy(namespace, token, onProgress) {
|
|
|
173
174
|
const ts = snapshot.meta.consolidatedAt;
|
|
174
175
|
const stateFilename = `state-${new Date(ts).toISOString().replace(/:/g, "-").replace(".", "-")}.zip`;
|
|
175
176
|
const repoPath = `${namespace}${stateFilename}`;
|
|
176
|
-
let binary = "";
|
|
177
|
-
zipBytes.forEach((b) => {
|
|
178
|
-
binary += String.fromCharCode(b);
|
|
179
|
-
});
|
|
180
|
-
const b64 = btoa(binary);
|
|
181
177
|
log("Lade state.zip hoch \u2026");
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
].join("\n")
|
|
178
|
+
await uploadFile({
|
|
179
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
180
|
+
credentials: { accessToken: token },
|
|
181
|
+
file: { path: repoPath, content: new Blob([zipBytes.buffer], { type: "application/zip" }) },
|
|
182
|
+
branch: "main",
|
|
183
|
+
commitTitle: `Bootstrap: initialer State aus Legacy-Daten`
|
|
189
184
|
});
|
|
190
|
-
if (!commitRes.ok) {
|
|
191
|
-
const err = await commitRes.text().catch(() => "");
|
|
192
|
-
throw new Error(`HF commit failed: ${commitRes.status} \u2014 ${err.slice(0, 300)}`);
|
|
193
|
-
}
|
|
194
185
|
log(`Fertig \u2014 ${stateFilename}`);
|
|
195
186
|
}
|
|
196
187
|
async function hfListProjects(token) {
|
|
@@ -221,65 +212,14 @@ async function hfUploadProject(zipBase64, name, token) {
|
|
|
221
212
|
const binary = atob(zipBase64);
|
|
222
213
|
const bytes = new Uint8Array(binary.length);
|
|
223
214
|
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const sample = btoa(sampleBinary);
|
|
231
|
-
const preRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/preupload/main`, {
|
|
232
|
-
method: "POST",
|
|
233
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
234
|
-
body: JSON.stringify({ files: [{ path: filename, size, sample }] })
|
|
215
|
+
await uploadFile({
|
|
216
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
217
|
+
credentials: { accessToken: token },
|
|
218
|
+
file: { path: filename, content: new Blob([bytes], { type: "application/zip" }) },
|
|
219
|
+
branch: "main",
|
|
220
|
+
commitTitle: `Upload ${filename}`
|
|
235
221
|
});
|
|
236
|
-
|
|
237
|
-
const preData = await preRes.json();
|
|
238
|
-
const fileInfo = preData.files?.[0];
|
|
239
|
-
if (!fileInfo?.uploadMode) throw new Error(`HF preupload kein fileInfo: ${JSON.stringify(preData)}`);
|
|
240
|
-
if (fileInfo.uploadMode === "lfs" && fileInfo.uploadUrl) {
|
|
241
|
-
let uploadStatus = 0;
|
|
242
|
-
try {
|
|
243
|
-
const uploadRes = await fetch(fileInfo.uploadUrl, {
|
|
244
|
-
method: "PUT",
|
|
245
|
-
redirect: "follow",
|
|
246
|
-
headers: { "Content-Type": "application/octet-stream", ...fileInfo.header || {} },
|
|
247
|
-
body: bytes
|
|
248
|
-
});
|
|
249
|
-
uploadStatus = uploadRes.status;
|
|
250
|
-
if (!uploadRes.ok) {
|
|
251
|
-
const uploadErr = await uploadRes.text().catch(() => "");
|
|
252
|
-
throw new Error(`HF LFS upload failed: ${uploadRes.status} \u2014 ${uploadErr.slice(0, 300)}`);
|
|
253
|
-
}
|
|
254
|
-
} catch (e) {
|
|
255
|
-
if (uploadStatus === 0) throw new Error(`HF LFS upload network error (CORS/redirect?): ${e.message}`);
|
|
256
|
-
throw e;
|
|
257
|
-
}
|
|
258
|
-
if (fileInfo.verifyUrl) {
|
|
259
|
-
const verifyRes = await fetch(fileInfo.verifyUrl, {
|
|
260
|
-
method: "POST",
|
|
261
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...fileInfo.verifyHeader || {} },
|
|
262
|
-
body: JSON.stringify({ oid, size })
|
|
263
|
-
});
|
|
264
|
-
if (!verifyRes.ok) {
|
|
265
|
-
const verifyErr = await verifyRes.text().catch(() => "");
|
|
266
|
-
throw new Error(`HF LFS verify failed: ${verifyRes.status} \u2014 ${verifyErr.slice(0, 200)}`);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const commitRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
271
|
-
method: "POST",
|
|
272
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
273
|
-
body: [
|
|
274
|
-
JSON.stringify({ key: "header", value: { summary: `Upload ${filename}`, description: "" } }),
|
|
275
|
-
JSON.stringify({ key: "lfsFile", value: { path: filename, algo: "sha256", oid, size } })
|
|
276
|
-
].join("\n")
|
|
277
|
-
});
|
|
278
|
-
if (!commitRes.ok) {
|
|
279
|
-
const err = await commitRes.text();
|
|
280
|
-
throw new Error(`HF commit failed: ${commitRes.status} \u2014 ${err}`);
|
|
281
|
-
}
|
|
282
|
-
return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size, isLfs: true };
|
|
222
|
+
return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
|
|
283
223
|
}
|
|
284
224
|
async function hfUploadProjectForm(_zipBase64, _name, _token) {
|
|
285
225
|
throw new Error("hfUploadProjectForm is deprecated. Use hfUploadProject instead.");
|
|
@@ -330,32 +270,12 @@ async function hfUploadImage(base64, id, token, mimeType = "image/jpeg") {
|
|
|
330
270
|
const binary = atob(base64);
|
|
331
271
|
const bytes = new Uint8Array(binary.length);
|
|
332
272
|
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
340
|
-
body: JSON.stringify({ files: [{ path: filename, size }] })
|
|
341
|
-
});
|
|
342
|
-
if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status}`);
|
|
343
|
-
const preData = await preRes.json();
|
|
344
|
-
const fileInfo = preData.files?.[0];
|
|
345
|
-
if (fileInfo?.uploadUrl) {
|
|
346
|
-
await fetch(fileInfo.uploadUrl, {
|
|
347
|
-
method: "PUT",
|
|
348
|
-
headers: { "Content-Type": mimeType, ...fileInfo.header || {} },
|
|
349
|
-
body: bytes
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
353
|
-
method: "POST",
|
|
354
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
355
|
-
body: [
|
|
356
|
-
JSON.stringify({ key: "header", value: { summary: `Add image ${id}`, description: "" } }),
|
|
357
|
-
JSON.stringify({ key: "lfsFile", value: { path: filename, algo: "sha256", oid, size } })
|
|
358
|
-
].join("\n")
|
|
273
|
+
await uploadFile({
|
|
274
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
275
|
+
credentials: { accessToken: token },
|
|
276
|
+
file: { path: `images/${id}.${ext}`, content: new Blob([bytes], { type: mimeType }) },
|
|
277
|
+
branch: "main",
|
|
278
|
+
commitTitle: `Add image ${id}`
|
|
359
279
|
});
|
|
360
280
|
}
|
|
361
281
|
async function hfLoadImageAsBase64(id, token) {
|
package/dist/index.d.mts
CHANGED
|
@@ -612,6 +612,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
612
612
|
declare function findForks(dag: Dag): DagFork[];
|
|
613
613
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
614
614
|
|
|
615
|
-
declare const LIB_VERSION = "2.0.
|
|
615
|
+
declare const LIB_VERSION = "2.0.15";
|
|
616
616
|
|
|
617
617
|
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, 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, 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
|
@@ -612,6 +612,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
612
612
|
declare function findForks(dag: Dag): DagFork[];
|
|
613
613
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
614
614
|
|
|
615
|
-
declare const LIB_VERSION = "2.0.
|
|
615
|
+
declare const LIB_VERSION = "2.0.15";
|
|
616
616
|
|
|
617
617
|
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, 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, 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
|
@@ -461,24 +461,14 @@ async function hfBootstrapFromLegacy(namespace, token, onProgress) {
|
|
|
461
461
|
const ts = snapshot.meta.consolidatedAt;
|
|
462
462
|
const stateFilename = `state-${new Date(ts).toISOString().replace(/:/g, "-").replace(".", "-")}.zip`;
|
|
463
463
|
const repoPath = `${namespace}${stateFilename}`;
|
|
464
|
-
let binary = "";
|
|
465
|
-
zipBytes.forEach((b) => {
|
|
466
|
-
binary += String.fromCharCode(b);
|
|
467
|
-
});
|
|
468
|
-
const b64 = btoa(binary);
|
|
469
464
|
log("Lade state.zip hoch \u2026");
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
].join("\n")
|
|
465
|
+
await (0, import_hub.uploadFile)({
|
|
466
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
467
|
+
credentials: { accessToken: token },
|
|
468
|
+
file: { path: repoPath, content: new Blob([zipBytes.buffer], { type: "application/zip" }) },
|
|
469
|
+
branch: "main",
|
|
470
|
+
commitTitle: `Bootstrap: initialer State aus Legacy-Daten`
|
|
477
471
|
});
|
|
478
|
-
if (!commitRes.ok) {
|
|
479
|
-
const err = await commitRes.text().catch(() => "");
|
|
480
|
-
throw new Error(`HF commit failed: ${commitRes.status} \u2014 ${err.slice(0, 300)}`);
|
|
481
|
-
}
|
|
482
472
|
log(`Fertig \u2014 ${stateFilename}`);
|
|
483
473
|
}
|
|
484
474
|
async function hfListProjects(token) {
|
|
@@ -509,65 +499,14 @@ async function hfUploadProject(zipBase64, name, token) {
|
|
|
509
499
|
const binary = atob(zipBase64);
|
|
510
500
|
const bytes = new Uint8Array(binary.length);
|
|
511
501
|
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const sample = btoa(sampleBinary);
|
|
519
|
-
const preRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/preupload/main`, {
|
|
520
|
-
method: "POST",
|
|
521
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
522
|
-
body: JSON.stringify({ files: [{ path: filename, size, sample }] })
|
|
502
|
+
await (0, import_hub.uploadFile)({
|
|
503
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
504
|
+
credentials: { accessToken: token },
|
|
505
|
+
file: { path: filename, content: new Blob([bytes], { type: "application/zip" }) },
|
|
506
|
+
branch: "main",
|
|
507
|
+
commitTitle: `Upload ${filename}`
|
|
523
508
|
});
|
|
524
|
-
|
|
525
|
-
const preData = await preRes.json();
|
|
526
|
-
const fileInfo = preData.files?.[0];
|
|
527
|
-
if (!fileInfo?.uploadMode) throw new Error(`HF preupload kein fileInfo: ${JSON.stringify(preData)}`);
|
|
528
|
-
if (fileInfo.uploadMode === "lfs" && fileInfo.uploadUrl) {
|
|
529
|
-
let uploadStatus = 0;
|
|
530
|
-
try {
|
|
531
|
-
const uploadRes = await fetch(fileInfo.uploadUrl, {
|
|
532
|
-
method: "PUT",
|
|
533
|
-
redirect: "follow",
|
|
534
|
-
headers: { "Content-Type": "application/octet-stream", ...fileInfo.header || {} },
|
|
535
|
-
body: bytes
|
|
536
|
-
});
|
|
537
|
-
uploadStatus = uploadRes.status;
|
|
538
|
-
if (!uploadRes.ok) {
|
|
539
|
-
const uploadErr = await uploadRes.text().catch(() => "");
|
|
540
|
-
throw new Error(`HF LFS upload failed: ${uploadRes.status} \u2014 ${uploadErr.slice(0, 300)}`);
|
|
541
|
-
}
|
|
542
|
-
} catch (e) {
|
|
543
|
-
if (uploadStatus === 0) throw new Error(`HF LFS upload network error (CORS/redirect?): ${e.message}`);
|
|
544
|
-
throw e;
|
|
545
|
-
}
|
|
546
|
-
if (fileInfo.verifyUrl) {
|
|
547
|
-
const verifyRes = await fetch(fileInfo.verifyUrl, {
|
|
548
|
-
method: "POST",
|
|
549
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...fileInfo.verifyHeader || {} },
|
|
550
|
-
body: JSON.stringify({ oid, size })
|
|
551
|
-
});
|
|
552
|
-
if (!verifyRes.ok) {
|
|
553
|
-
const verifyErr = await verifyRes.text().catch(() => "");
|
|
554
|
-
throw new Error(`HF LFS verify failed: ${verifyRes.status} \u2014 ${verifyErr.slice(0, 200)}`);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
const commitRes = await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
559
|
-
method: "POST",
|
|
560
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
561
|
-
body: [
|
|
562
|
-
JSON.stringify({ key: "header", value: { summary: `Upload ${filename}`, description: "" } }),
|
|
563
|
-
JSON.stringify({ key: "lfsFile", value: { path: filename, algo: "sha256", oid, size } })
|
|
564
|
-
].join("\n")
|
|
565
|
-
});
|
|
566
|
-
if (!commitRes.ok) {
|
|
567
|
-
const err = await commitRes.text();
|
|
568
|
-
throw new Error(`HF commit failed: ${commitRes.status} \u2014 ${err}`);
|
|
569
|
-
}
|
|
570
|
-
return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size, isLfs: true };
|
|
509
|
+
return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
|
|
571
510
|
}
|
|
572
511
|
async function hfUploadProjectForm(_zipBase64, _name, _token) {
|
|
573
512
|
throw new Error("hfUploadProjectForm is deprecated. Use hfUploadProject instead.");
|
|
@@ -618,32 +557,12 @@ async function hfUploadImage(base64, id, token, mimeType = "image/jpeg") {
|
|
|
618
557
|
const binary = atob(base64);
|
|
619
558
|
const bytes = new Uint8Array(binary.length);
|
|
620
559
|
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
|
|
628
|
-
body: JSON.stringify({ files: [{ path: filename, size }] })
|
|
629
|
-
});
|
|
630
|
-
if (!preRes.ok) throw new Error(`HF preupload failed: ${preRes.status}`);
|
|
631
|
-
const preData = await preRes.json();
|
|
632
|
-
const fileInfo = preData.files?.[0];
|
|
633
|
-
if (fileInfo?.uploadUrl) {
|
|
634
|
-
await fetch(fileInfo.uploadUrl, {
|
|
635
|
-
method: "PUT",
|
|
636
|
-
headers: { "Content-Type": mimeType, ...fileInfo.header || {} },
|
|
637
|
-
body: bytes
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
await fetch(`${HF_BASE}/api/datasets/${HF_REPO}/commit/main`, {
|
|
641
|
-
method: "POST",
|
|
642
|
-
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/x-ndjson" },
|
|
643
|
-
body: [
|
|
644
|
-
JSON.stringify({ key: "header", value: { summary: `Add image ${id}`, description: "" } }),
|
|
645
|
-
JSON.stringify({ key: "lfsFile", value: { path: filename, algo: "sha256", oid, size } })
|
|
646
|
-
].join("\n")
|
|
560
|
+
await (0, import_hub.uploadFile)({
|
|
561
|
+
repo: { type: "dataset", name: HF_REPO },
|
|
562
|
+
credentials: { accessToken: token },
|
|
563
|
+
file: { path: `images/${id}.${ext}`, content: new Blob([bytes], { type: mimeType }) },
|
|
564
|
+
branch: "main",
|
|
565
|
+
commitTitle: `Add image ${id}`
|
|
647
566
|
});
|
|
648
567
|
}
|
|
649
568
|
async function hfLoadImageAsBase64(id, token) {
|
|
@@ -667,11 +586,12 @@ async function hfLoadImageAsBase64(id, token) {
|
|
|
667
586
|
}
|
|
668
587
|
return null;
|
|
669
588
|
}
|
|
670
|
-
var import_jszip2, HF_BASE, HF_REPO, HF_TOKEN_KEY, SESSION_CLIENT_ID;
|
|
589
|
+
var import_jszip2, import_hub, HF_BASE, HF_REPO, HF_TOKEN_KEY, SESSION_CLIENT_ID;
|
|
671
590
|
var init_hfStateService = __esm({
|
|
672
591
|
"src/lib/hfStateService.ts"() {
|
|
673
592
|
"use strict";
|
|
674
593
|
import_jszip2 = __toESM(require("jszip"));
|
|
594
|
+
import_hub = require("@huggingface/hub");
|
|
675
595
|
init_hfEventTypes();
|
|
676
596
|
HF_BASE = "https://huggingface.co";
|
|
677
597
|
HF_REPO = "RolandSch/fa-app-state";
|
|
@@ -4008,11 +3928,11 @@ async function uploadViaHubLib(token, path, bytes, mimeType) {
|
|
|
4008
3928
|
const s = { label: "uploadFile() via @huggingface/hub", method: "import()+call", url: "@huggingface/hub", reqHeaders: {} };
|
|
4009
3929
|
const t0 = Date.now();
|
|
4010
3930
|
try {
|
|
4011
|
-
const { uploadFile } = await import(
|
|
3931
|
+
const { uploadFile: uploadFile2 } = await import(
|
|
4012
3932
|
/* @vite-ignore */
|
|
4013
3933
|
"@huggingface/hub"
|
|
4014
3934
|
);
|
|
4015
|
-
await
|
|
3935
|
+
await uploadFile2({
|
|
4016
3936
|
repo: { type: "dataset", name: HF_REPO2 },
|
|
4017
3937
|
credentials: { accessToken: token },
|
|
4018
3938
|
file: { path, content: new Blob([bytes], { type: mimeType }) },
|
|
@@ -4033,11 +3953,11 @@ async function uploadViaCdnLib(token, path, bytes, mimeType) {
|
|
|
4033
3953
|
const s = { label: "uploadFile() via esm.sh/@huggingface/hub", method: "import()+call", url: "https://esm.sh/@huggingface/hub", reqHeaders: {} };
|
|
4034
3954
|
const t0 = Date.now();
|
|
4035
3955
|
try {
|
|
4036
|
-
const { uploadFile } = await import(
|
|
3956
|
+
const { uploadFile: uploadFile2 } = await import(
|
|
4037
3957
|
/* @vite-ignore */
|
|
4038
3958
|
"https://esm.sh/@huggingface/hub"
|
|
4039
3959
|
);
|
|
4040
|
-
await
|
|
3960
|
+
await uploadFile2({
|
|
4041
3961
|
repo: { type: "dataset", name: HF_REPO2 },
|
|
4042
3962
|
credentials: { accessToken: token },
|
|
4043
3963
|
file: { path, content: new Blob([bytes], { type: mimeType }) },
|
|
@@ -5266,7 +5186,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5266
5186
|
layoutChoice === "mobile-desktop" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-white/20 text-[9px] text-center", children: "Mobil-Layout skaliert f\xFCr Desktop-Modus" }),
|
|
5267
5187
|
layoutChoice === "tablet-landscape" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-white/20 text-[9px] text-center", children: "2-Spalten-Layout f\xFCr Landscape-Tablet im Desktop-Mode" })
|
|
5268
5188
|
] }),
|
|
5269
|
-
|
|
5189
|
+
allowDevNamespace && !hfNamespace && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-3 w-full max-w-[280px]", children: [
|
|
5270
5190
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-white/25 text-[10px] uppercase tracking-widest font-bold", children: "State:" }),
|
|
5271
5191
|
["app.art-by-rolands.de/", "dev-app.art-by-rolands.de/"].map((ns, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5272
5192
|
"button",
|
|
@@ -5939,7 +5859,7 @@ function FaApp({
|
|
|
5939
5859
|
// src/index.ts
|
|
5940
5860
|
init_hfStateService();
|
|
5941
5861
|
init_hfStateService();
|
|
5942
|
-
var LIB_VERSION = "2.0.
|
|
5862
|
+
var LIB_VERSION = "2.0.15";
|
|
5943
5863
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5944
5864
|
0 && (module.exports = {
|
|
5945
5865
|
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-D2WTLDI7.mjs";
|
|
25
25
|
|
|
26
26
|
// src/hooks/useOnClickOutside.ts
|
|
27
27
|
import { useEffect } from "react";
|
|
@@ -1598,7 +1598,7 @@ var ProjectSyncTab = ({
|
|
|
1598
1598
|
{
|
|
1599
1599
|
onClick: async () => {
|
|
1600
1600
|
try {
|
|
1601
|
-
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
1601
|
+
const { hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-OAECMP4M.mjs");
|
|
1602
1602
|
const file = await hfDownloadProject2(p.path, hfToken);
|
|
1603
1603
|
onHfLoad(file);
|
|
1604
1604
|
} catch (e) {
|
|
@@ -4444,7 +4444,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4444
4444
|
onClick: async () => {
|
|
4445
4445
|
setIsLoadingFromHF(true);
|
|
4446
4446
|
try {
|
|
4447
|
-
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-
|
|
4447
|
+
const { hfListProjects: hfListProjects2, hfDownloadProject: hfDownloadProject2 } = await import("./hfStateService-OAECMP4M.mjs");
|
|
4448
4448
|
const projects = await hfListProjects2(hfToken);
|
|
4449
4449
|
if (projects.length > 0) {
|
|
4450
4450
|
const file = await hfDownloadProject2(projects[0].path, hfToken);
|
|
@@ -4518,7 +4518,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
4518
4518
|
layoutChoice === "mobile-desktop" && /* @__PURE__ */ jsx21("span", { className: "text-white/20 text-[9px] text-center", children: "Mobil-Layout skaliert f\xFCr Desktop-Modus" }),
|
|
4519
4519
|
layoutChoice === "tablet-landscape" && /* @__PURE__ */ jsx21("span", { className: "text-white/20 text-[9px] text-center", children: "2-Spalten-Layout f\xFCr Landscape-Tablet im Desktop-Mode" })
|
|
4520
4520
|
] }),
|
|
4521
|
-
|
|
4521
|
+
allowDevNamespace && !hfNamespace && /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-3 w-full max-w-[280px]", children: [
|
|
4522
4522
|
/* @__PURE__ */ jsx21("span", { className: "text-white/25 text-[10px] uppercase tracking-widest font-bold", children: "State:" }),
|
|
4523
4523
|
["app.art-by-rolands.de/", "dev-app.art-by-rolands.de/"].map((ns, i) => /* @__PURE__ */ jsx21(
|
|
4524
4524
|
"button",
|
|
@@ -5189,7 +5189,7 @@ function FaApp({
|
|
|
5189
5189
|
}
|
|
5190
5190
|
|
|
5191
5191
|
// src/index.ts
|
|
5192
|
-
var LIB_VERSION = "2.0.
|
|
5192
|
+
var LIB_VERSION = "2.0.15";
|
|
5193
5193
|
export {
|
|
5194
5194
|
AvatarArchitectApp,
|
|
5195
5195
|
CollapsibleCard,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslsp1/fa-app-tools",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Shared tools and hooks for Fine Art flow apps",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"react": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@huggingface/hub": "^2.13.0",
|
|
28
29
|
"jszip": "^3.10.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|