@rslsp1/fa-app-tools 2.0.24 → 2.0.28
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 +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +34 -25
- package/dist/index.mjs +34 -25
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -592,12 +592,14 @@ declare function hfUploadImage(base64: string, id: string, token: string, mimeTy
|
|
|
592
592
|
declare function hfLoadImageAsBase64(id: string, token: string, namespace?: string): Promise<string | null>;
|
|
593
593
|
|
|
594
594
|
type FaServerEnv = 'prod' | 'dev';
|
|
595
|
-
declare function faServerGet<T>(path: string, env?: FaServerEnv): Promise<T>;
|
|
596
|
-
declare function faServerPost<T>(path: string, body: unknown, env?: FaServerEnv): Promise<T>;
|
|
597
|
-
declare function faServerPut<T>(path: string, body: unknown, env?: FaServerEnv): Promise<T>;
|
|
598
|
-
declare function faServerDelete<T>(path: string, env?: FaServerEnv): Promise<T>;
|
|
595
|
+
declare function faServerGet<T>(path: string, env?: FaServerEnv, token?: string): Promise<T>;
|
|
596
|
+
declare function faServerPost<T>(path: string, body: unknown, env?: FaServerEnv, token?: string): Promise<T>;
|
|
597
|
+
declare function faServerPut<T>(path: string, body: unknown, env?: FaServerEnv, token?: string): Promise<T>;
|
|
598
|
+
declare function faServerDelete<T>(path: string, env?: FaServerEnv, token?: string): Promise<T>;
|
|
599
599
|
|
|
600
|
-
declare function ServerTab(
|
|
600
|
+
declare function ServerTab({ hfToken }: {
|
|
601
|
+
hfToken?: string;
|
|
602
|
+
}): react_jsx_runtime.JSX.Element;
|
|
601
603
|
|
|
602
604
|
interface HFStateResult {
|
|
603
605
|
state: HFStateSnapshot | null;
|
|
@@ -636,6 +638,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
636
638
|
declare function findForks(dag: Dag): DagFork[];
|
|
637
639
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
638
640
|
|
|
639
|
-
declare const LIB_VERSION = "2.0.
|
|
641
|
+
declare const LIB_VERSION = "2.0.28";
|
|
640
642
|
|
|
641
643
|
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, type FaServerEnv, 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, faServerDelete, faServerGet, faServerPost, faServerPut, 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
|
@@ -592,12 +592,14 @@ declare function hfUploadImage(base64: string, id: string, token: string, mimeTy
|
|
|
592
592
|
declare function hfLoadImageAsBase64(id: string, token: string, namespace?: string): Promise<string | null>;
|
|
593
593
|
|
|
594
594
|
type FaServerEnv = 'prod' | 'dev';
|
|
595
|
-
declare function faServerGet<T>(path: string, env?: FaServerEnv): Promise<T>;
|
|
596
|
-
declare function faServerPost<T>(path: string, body: unknown, env?: FaServerEnv): Promise<T>;
|
|
597
|
-
declare function faServerPut<T>(path: string, body: unknown, env?: FaServerEnv): Promise<T>;
|
|
598
|
-
declare function faServerDelete<T>(path: string, env?: FaServerEnv): Promise<T>;
|
|
595
|
+
declare function faServerGet<T>(path: string, env?: FaServerEnv, token?: string): Promise<T>;
|
|
596
|
+
declare function faServerPost<T>(path: string, body: unknown, env?: FaServerEnv, token?: string): Promise<T>;
|
|
597
|
+
declare function faServerPut<T>(path: string, body: unknown, env?: FaServerEnv, token?: string): Promise<T>;
|
|
598
|
+
declare function faServerDelete<T>(path: string, env?: FaServerEnv, token?: string): Promise<T>;
|
|
599
599
|
|
|
600
|
-
declare function ServerTab(
|
|
600
|
+
declare function ServerTab({ hfToken }: {
|
|
601
|
+
hfToken?: string;
|
|
602
|
+
}): react_jsx_runtime.JSX.Element;
|
|
601
603
|
|
|
602
604
|
interface HFStateResult {
|
|
603
605
|
state: HFStateSnapshot | null;
|
|
@@ -636,6 +638,6 @@ declare function findTips(dag: Dag): number[];
|
|
|
636
638
|
declare function findForks(dag: Dag): DagFork[];
|
|
637
639
|
declare function topoSort(events: HFEvent[]): HFEvent[];
|
|
638
640
|
|
|
639
|
-
declare const LIB_VERSION = "2.0.
|
|
641
|
+
declare const LIB_VERSION = "2.0.28";
|
|
640
642
|
|
|
641
643
|
export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, type FaServerEnv, 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, faServerDelete, faServerGet, faServerPost, faServerPut, 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
|
@@ -4646,9 +4646,9 @@ var import_react24 = require("react");
|
|
|
4646
4646
|
|
|
4647
4647
|
// src/lib/faHfServerService.ts
|
|
4648
4648
|
init_hfStateService();
|
|
4649
|
-
var FA_APP_SPACE = "https://
|
|
4650
|
-
async function request(method, path, env = "prod", body) {
|
|
4651
|
-
const token = getHFToken();
|
|
4649
|
+
var FA_APP_SPACE = "https://rolandsch-fa-app.hf.space";
|
|
4650
|
+
async function request(method, path, env = "prod", body, tokenOverride) {
|
|
4651
|
+
const token = tokenOverride || getHFToken();
|
|
4652
4652
|
if (!token) throw new Error("fa-app gateway: kein HF Token gesetzt");
|
|
4653
4653
|
const res = await fetch(`${FA_APP_SPACE}/${path.replace(/^\//, "")}`, {
|
|
4654
4654
|
method,
|
|
@@ -4665,17 +4665,17 @@ async function request(method, path, env = "prod", body) {
|
|
|
4665
4665
|
}
|
|
4666
4666
|
return res.json();
|
|
4667
4667
|
}
|
|
4668
|
-
function faServerGet(path, env = "prod") {
|
|
4669
|
-
return request("GET", path, env);
|
|
4668
|
+
function faServerGet(path, env = "prod", token) {
|
|
4669
|
+
return request("GET", path, env, void 0, token);
|
|
4670
4670
|
}
|
|
4671
|
-
function faServerPost(path, body, env = "prod") {
|
|
4672
|
-
return request("POST", path, env, body);
|
|
4671
|
+
function faServerPost(path, body, env = "prod", token) {
|
|
4672
|
+
return request("POST", path, env, body, token);
|
|
4673
4673
|
}
|
|
4674
|
-
function faServerPut(path, body, env = "prod") {
|
|
4675
|
-
return request("PUT", path, env, body);
|
|
4674
|
+
function faServerPut(path, body, env = "prod", token) {
|
|
4675
|
+
return request("PUT", path, env, body, token);
|
|
4676
4676
|
}
|
|
4677
|
-
function faServerDelete(path, env = "prod") {
|
|
4678
|
-
return request("DELETE", path, env);
|
|
4677
|
+
function faServerDelete(path, env = "prod", token) {
|
|
4678
|
+
return request("DELETE", path, env, void 0, token);
|
|
4679
4679
|
}
|
|
4680
4680
|
|
|
4681
4681
|
// src/components/ServerTab.tsx
|
|
@@ -4684,8 +4684,9 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
|
4684
4684
|
function StarRating({ rating = 0 }) {
|
|
4685
4685
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-[2px]", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: `material-symbols-outlined text-[12px] ${i <= rating ? "text-yellow-400" : "text-white/15"}`, children: "star" }, i)) });
|
|
4686
4686
|
}
|
|
4687
|
-
function ServerTab() {
|
|
4688
|
-
const
|
|
4687
|
+
function ServerTab({ hfToken }) {
|
|
4688
|
+
const token = hfToken || getHFToken() || "";
|
|
4689
|
+
const hasToken = !!token;
|
|
4689
4690
|
const [env, setEnv] = (0, import_react24.useState)("prod");
|
|
4690
4691
|
const [step, setStep] = (0, import_react24.useState)("user");
|
|
4691
4692
|
const [users, setUsers] = (0, import_react24.useState)([]);
|
|
@@ -4705,13 +4706,13 @@ function ServerTab() {
|
|
|
4705
4706
|
if (!hasToken) return;
|
|
4706
4707
|
setUsersLoading(true);
|
|
4707
4708
|
setUsersError(null);
|
|
4708
|
-
faServerGet("/api/v2/users", env).then(setUsers).catch((e) => setUsersError(String(e))).finally(() => setUsersLoading(false));
|
|
4709
|
+
faServerGet("/api/v2/users", env, token).then(setUsers).catch((e) => setUsersError(String(e))).finally(() => setUsersLoading(false));
|
|
4709
4710
|
}, [env, hasToken]);
|
|
4710
4711
|
const selectUser = async (user) => {
|
|
4711
4712
|
setSelectedUser(user);
|
|
4712
4713
|
setContextsLoading(true);
|
|
4713
4714
|
try {
|
|
4714
|
-
const data = await faServerGet(`/api/v2/contexts?user_id=${user.id}`, env);
|
|
4715
|
+
const data = await faServerGet(`/api/v2/contexts?user_id=${user.id}`, env, token);
|
|
4715
4716
|
if (data.length === 1) {
|
|
4716
4717
|
await loadLibrary(user, data[0]);
|
|
4717
4718
|
} else {
|
|
@@ -4731,8 +4732,8 @@ function ServerTab() {
|
|
|
4731
4732
|
setLibError(null);
|
|
4732
4733
|
try {
|
|
4733
4734
|
const [tagsRes, libRes] = await Promise.all([
|
|
4734
|
-
faServerGet(`/api/v2/tags?user_id=${user.id}`, env),
|
|
4735
|
-
faServerGet(`/api/v2/library?user_id=${user.id}&context_id=${ctx.id}&limit=100`, env)
|
|
4735
|
+
faServerGet(`/api/v2/tags?user_id=${user.id}`, env, token),
|
|
4736
|
+
faServerGet(`/api/v2/library?user_id=${user.id}&context_id=${ctx.id}&limit=100`, env, token)
|
|
4736
4737
|
]);
|
|
4737
4738
|
setTags(Array.isArray(tagsRes) ? tagsRes : []);
|
|
4738
4739
|
const raw = Array.isArray(libRes) ? libRes : libRes.data ?? [];
|
|
@@ -5869,6 +5870,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5869
5870
|
setMobileTab("stage");
|
|
5870
5871
|
}
|
|
5871
5872
|
} }) }),
|
|
5873
|
+
mobileTab === "server" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col flex-1 min-h-0 relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ServerTab, { hfToken: hfToken || void 0 }) }),
|
|
5872
5874
|
mobileTab === "tags" && workspaceTags && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5873
5875
|
TagManagerPanel,
|
|
5874
5876
|
{
|
|
@@ -6129,7 +6131,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
6129
6131
|
imageUploadStatus
|
|
6130
6132
|
}
|
|
6131
6133
|
) }),
|
|
6132
|
-
activeTab === "server" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ServerTab, {}) })
|
|
6134
|
+
activeTab === "server" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ServerTab, { hfToken: hfToken || void 0 }) })
|
|
6133
6135
|
] })
|
|
6134
6136
|
] }),
|
|
6135
6137
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex border-t border-white/10 bg-black shrink-0", style: { height: 56, paddingBottom: "env(safe-area-inset-bottom, 0px)" }, children: [
|
|
@@ -6137,7 +6139,8 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
6137
6139
|
{ id: "stage", icon: "palette", label: "Stage" },
|
|
6138
6140
|
{ id: "labs", icon: "science", label: "Labs" },
|
|
6139
6141
|
...workspaceTags ? [{ id: "tags", icon: "label", label: "Tags" }] : [],
|
|
6140
|
-
{ id: "browse", icon: "photo_library", label: "Galerie" }
|
|
6142
|
+
{ id: "browse", icon: "photo_library", label: "Galerie" },
|
|
6143
|
+
{ id: "server", icon: "storage", label: "Server" }
|
|
6141
6144
|
].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setMobileTab(tab.id), className: `flex-1 flex flex-col items-center justify-center gap-0.5 transition-colors ${mobileTab === tab.id ? "text-white" : "text-white/30"}`, children: [
|
|
6142
6145
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "material-symbols-outlined text-[24px]", children: tab.icon }),
|
|
6143
6146
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-[10px] font-bold uppercase tracking-wide", children: tab.label })
|
|
@@ -6387,10 +6390,16 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
6387
6390
|
!isRightCollapsed && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { onMouseDown: startRightResize, className: "w-1 shrink-0 cursor-col-resize hover:bg-white/20 active:bg-white/30 transition-colors", style: { background: "transparent" } }),
|
|
6388
6391
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col border-l border-white/5 bg-[#0e0e0e] shrink-0", style: { width: isRightCollapsed ? 60 : rightPanelWidth, transition: "none" }, children: [
|
|
6389
6392
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex border-b border-white/5 h-14 shrink-0 overflow-hidden", children: [
|
|
6390
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6393
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-1", children: [
|
|
6394
|
+
["history", "gallery", "inspect", "setup", "sync", "tags"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => {
|
|
6395
|
+
setActiveTab(tab);
|
|
6396
|
+
setIsRightCollapsed(false);
|
|
6397
|
+
}, className: `flex-1 flex items-center justify-center relative transition-colors ${activeTab === tab ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : tab === "inspect" ? "info" : tab === "setup" ? "settings" : tab === "sync" ? "cloud_sync" : "label" }) }, tab)),
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => {
|
|
6399
|
+
setActiveTab("server");
|
|
6400
|
+
setIsRightCollapsed(false);
|
|
6401
|
+
}, className: `w-10 flex items-center justify-center relative transition-colors ${activeTab === "server" ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "material-symbols-outlined text-[20px]", children: "storage" }) })
|
|
6402
|
+
] }),
|
|
6394
6403
|
hfToken && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => refreshHF(), disabled: isHfRefreshing, className: "w-10 flex items-center justify-center text-white/20 hover:text-white/60 transition-colors disabled:opacity-30", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: `material-symbols-outlined text-[18px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) }),
|
|
6395
6404
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setIsRightCollapsed(!isRightCollapsed), className: "w-10 flex items-center justify-center text-white/20 hover:text-white", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "material-symbols-outlined text-[18px]", children: isRightCollapsed ? "chevron_left" : "chevron_right" }) })
|
|
6396
6405
|
] }),
|
|
@@ -6451,7 +6460,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
6451
6460
|
onHfInitialSync: hfToken ? handleHfInitialSync : void 0
|
|
6452
6461
|
}
|
|
6453
6462
|
),
|
|
6454
|
-
activeTab === "server" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ServerTab, {})
|
|
6463
|
+
activeTab === "server" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ServerTab, { hfToken: hfToken || void 0 })
|
|
6455
6464
|
] })
|
|
6456
6465
|
] })
|
|
6457
6466
|
] });
|
|
@@ -6512,7 +6521,7 @@ function FaApp({
|
|
|
6512
6521
|
// src/index.ts
|
|
6513
6522
|
init_hfStateService();
|
|
6514
6523
|
init_hfStateService();
|
|
6515
|
-
var LIB_VERSION = "2.0.
|
|
6524
|
+
var LIB_VERSION = "2.0.28";
|
|
6516
6525
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6517
6526
|
0 && (module.exports = {
|
|
6518
6527
|
AvatarArchitectApp,
|
package/dist/index.mjs
CHANGED
|
@@ -3966,9 +3966,9 @@ function HFTestTab({ token, namespace, galleryItems, allEvents = [], confirmedEv
|
|
|
3966
3966
|
import { useState as useState17, useEffect as useEffect6 } from "react";
|
|
3967
3967
|
|
|
3968
3968
|
// src/lib/faHfServerService.ts
|
|
3969
|
-
var FA_APP_SPACE = "https://
|
|
3970
|
-
async function request(method, path, env = "prod", body) {
|
|
3971
|
-
const token = getHFToken();
|
|
3969
|
+
var FA_APP_SPACE = "https://rolandsch-fa-app.hf.space";
|
|
3970
|
+
async function request(method, path, env = "prod", body, tokenOverride) {
|
|
3971
|
+
const token = tokenOverride || getHFToken();
|
|
3972
3972
|
if (!token) throw new Error("fa-app gateway: kein HF Token gesetzt");
|
|
3973
3973
|
const res = await fetch(`${FA_APP_SPACE}/${path.replace(/^\//, "")}`, {
|
|
3974
3974
|
method,
|
|
@@ -3985,17 +3985,17 @@ async function request(method, path, env = "prod", body) {
|
|
|
3985
3985
|
}
|
|
3986
3986
|
return res.json();
|
|
3987
3987
|
}
|
|
3988
|
-
function faServerGet(path, env = "prod") {
|
|
3989
|
-
return request("GET", path, env);
|
|
3988
|
+
function faServerGet(path, env = "prod", token) {
|
|
3989
|
+
return request("GET", path, env, void 0, token);
|
|
3990
3990
|
}
|
|
3991
|
-
function faServerPost(path, body, env = "prod") {
|
|
3992
|
-
return request("POST", path, env, body);
|
|
3991
|
+
function faServerPost(path, body, env = "prod", token) {
|
|
3992
|
+
return request("POST", path, env, body, token);
|
|
3993
3993
|
}
|
|
3994
|
-
function faServerPut(path, body, env = "prod") {
|
|
3995
|
-
return request("PUT", path, env, body);
|
|
3994
|
+
function faServerPut(path, body, env = "prod", token) {
|
|
3995
|
+
return request("PUT", path, env, body, token);
|
|
3996
3996
|
}
|
|
3997
|
-
function faServerDelete(path, env = "prod") {
|
|
3998
|
-
return request("DELETE", path, env);
|
|
3997
|
+
function faServerDelete(path, env = "prod", token) {
|
|
3998
|
+
return request("DELETE", path, env, void 0, token);
|
|
3999
3999
|
}
|
|
4000
4000
|
|
|
4001
4001
|
// src/components/ServerTab.tsx
|
|
@@ -4003,8 +4003,9 @@ import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
|
4003
4003
|
function StarRating({ rating = 0 }) {
|
|
4004
4004
|
return /* @__PURE__ */ jsx22("div", { className: "flex gap-[2px]", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ jsx22("span", { className: `material-symbols-outlined text-[12px] ${i <= rating ? "text-yellow-400" : "text-white/15"}`, children: "star" }, i)) });
|
|
4005
4005
|
}
|
|
4006
|
-
function ServerTab() {
|
|
4007
|
-
const
|
|
4006
|
+
function ServerTab({ hfToken }) {
|
|
4007
|
+
const token = hfToken || getHFToken() || "";
|
|
4008
|
+
const hasToken = !!token;
|
|
4008
4009
|
const [env, setEnv] = useState17("prod");
|
|
4009
4010
|
const [step, setStep] = useState17("user");
|
|
4010
4011
|
const [users, setUsers] = useState17([]);
|
|
@@ -4024,13 +4025,13 @@ function ServerTab() {
|
|
|
4024
4025
|
if (!hasToken) return;
|
|
4025
4026
|
setUsersLoading(true);
|
|
4026
4027
|
setUsersError(null);
|
|
4027
|
-
faServerGet("/api/v2/users", env).then(setUsers).catch((e) => setUsersError(String(e))).finally(() => setUsersLoading(false));
|
|
4028
|
+
faServerGet("/api/v2/users", env, token).then(setUsers).catch((e) => setUsersError(String(e))).finally(() => setUsersLoading(false));
|
|
4028
4029
|
}, [env, hasToken]);
|
|
4029
4030
|
const selectUser = async (user) => {
|
|
4030
4031
|
setSelectedUser(user);
|
|
4031
4032
|
setContextsLoading(true);
|
|
4032
4033
|
try {
|
|
4033
|
-
const data = await faServerGet(`/api/v2/contexts?user_id=${user.id}`, env);
|
|
4034
|
+
const data = await faServerGet(`/api/v2/contexts?user_id=${user.id}`, env, token);
|
|
4034
4035
|
if (data.length === 1) {
|
|
4035
4036
|
await loadLibrary(user, data[0]);
|
|
4036
4037
|
} else {
|
|
@@ -4050,8 +4051,8 @@ function ServerTab() {
|
|
|
4050
4051
|
setLibError(null);
|
|
4051
4052
|
try {
|
|
4052
4053
|
const [tagsRes, libRes] = await Promise.all([
|
|
4053
|
-
faServerGet(`/api/v2/tags?user_id=${user.id}`, env),
|
|
4054
|
-
faServerGet(`/api/v2/library?user_id=${user.id}&context_id=${ctx.id}&limit=100`, env)
|
|
4054
|
+
faServerGet(`/api/v2/tags?user_id=${user.id}`, env, token),
|
|
4055
|
+
faServerGet(`/api/v2/library?user_id=${user.id}&context_id=${ctx.id}&limit=100`, env, token)
|
|
4055
4056
|
]);
|
|
4056
4057
|
setTags(Array.isArray(tagsRes) ? tagsRes : []);
|
|
4057
4058
|
const raw = Array.isArray(libRes) ? libRes : libRes.data ?? [];
|
|
@@ -5188,6 +5189,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5188
5189
|
setMobileTab("stage");
|
|
5189
5190
|
}
|
|
5190
5191
|
} }) }),
|
|
5192
|
+
mobileTab === "server" && /* @__PURE__ */ jsx23("div", { className: "flex flex-col flex-1 min-h-0 relative", children: /* @__PURE__ */ jsx23(ServerTab, { hfToken: hfToken || void 0 }) }),
|
|
5191
5193
|
mobileTab === "tags" && workspaceTags && /* @__PURE__ */ jsx23("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsx23(
|
|
5192
5194
|
TagManagerPanel,
|
|
5193
5195
|
{
|
|
@@ -5448,7 +5450,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5448
5450
|
imageUploadStatus
|
|
5449
5451
|
}
|
|
5450
5452
|
) }),
|
|
5451
|
-
activeTab === "server" && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsx23(ServerTab, {}) })
|
|
5453
|
+
activeTab === "server" && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsx23(ServerTab, { hfToken: hfToken || void 0 }) })
|
|
5452
5454
|
] })
|
|
5453
5455
|
] }),
|
|
5454
5456
|
/* @__PURE__ */ jsx23("div", { className: "flex border-t border-white/10 bg-black shrink-0", style: { height: 56, paddingBottom: "env(safe-area-inset-bottom, 0px)" }, children: [
|
|
@@ -5456,7 +5458,8 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5456
5458
|
{ id: "stage", icon: "palette", label: "Stage" },
|
|
5457
5459
|
{ id: "labs", icon: "science", label: "Labs" },
|
|
5458
5460
|
...workspaceTags ? [{ id: "tags", icon: "label", label: "Tags" }] : [],
|
|
5459
|
-
{ id: "browse", icon: "photo_library", label: "Galerie" }
|
|
5461
|
+
{ id: "browse", icon: "photo_library", label: "Galerie" },
|
|
5462
|
+
{ id: "server", icon: "storage", label: "Server" }
|
|
5460
5463
|
].map((tab) => /* @__PURE__ */ jsxs21("button", { onClick: () => setMobileTab(tab.id), className: `flex-1 flex flex-col items-center justify-center gap-0.5 transition-colors ${mobileTab === tab.id ? "text-white" : "text-white/30"}`, children: [
|
|
5461
5464
|
/* @__PURE__ */ jsx23("span", { className: "material-symbols-outlined text-[24px]", children: tab.icon }),
|
|
5462
5465
|
/* @__PURE__ */ jsx23("span", { className: "text-[10px] font-bold uppercase tracking-wide", children: tab.label })
|
|
@@ -5706,10 +5709,16 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5706
5709
|
!isRightCollapsed && /* @__PURE__ */ jsx23("div", { onMouseDown: startRightResize, className: "w-1 shrink-0 cursor-col-resize hover:bg-white/20 active:bg-white/30 transition-colors", style: { background: "transparent" } }),
|
|
5707
5710
|
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col border-l border-white/5 bg-[#0e0e0e] shrink-0", style: { width: isRightCollapsed ? 60 : rightPanelWidth, transition: "none" }, children: [
|
|
5708
5711
|
/* @__PURE__ */ jsxs21("div", { className: "flex border-b border-white/5 h-14 shrink-0 overflow-hidden", children: [
|
|
5709
|
-
/* @__PURE__ */
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5712
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-1", children: [
|
|
5713
|
+
["history", "gallery", "inspect", "setup", "sync", "tags"].map((tab) => /* @__PURE__ */ jsx23("button", { onClick: () => {
|
|
5714
|
+
setActiveTab(tab);
|
|
5715
|
+
setIsRightCollapsed(false);
|
|
5716
|
+
}, className: `flex-1 flex items-center justify-center relative transition-colors ${activeTab === tab ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ jsx23("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : tab === "inspect" ? "info" : tab === "setup" ? "settings" : tab === "sync" ? "cloud_sync" : "label" }) }, tab)),
|
|
5717
|
+
/* @__PURE__ */ jsx23("button", { onClick: () => {
|
|
5718
|
+
setActiveTab("server");
|
|
5719
|
+
setIsRightCollapsed(false);
|
|
5720
|
+
}, className: `w-10 flex items-center justify-center relative transition-colors ${activeTab === "server" ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ jsx23("span", { className: "material-symbols-outlined text-[20px]", children: "storage" }) })
|
|
5721
|
+
] }),
|
|
5713
5722
|
hfToken && /* @__PURE__ */ jsx23("button", { onClick: () => refreshHF(), disabled: isHfRefreshing, className: "w-10 flex items-center justify-center text-white/20 hover:text-white/60 transition-colors disabled:opacity-30", children: /* @__PURE__ */ jsx23("span", { className: `material-symbols-outlined text-[18px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) }),
|
|
5714
5723
|
/* @__PURE__ */ jsx23("button", { onClick: () => setIsRightCollapsed(!isRightCollapsed), className: "w-10 flex items-center justify-center text-white/20 hover:text-white", children: /* @__PURE__ */ jsx23("span", { className: "material-symbols-outlined text-[18px]", children: isRightCollapsed ? "chevron_left" : "chevron_right" }) })
|
|
5715
5724
|
] }),
|
|
@@ -5770,7 +5779,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
|
|
|
5770
5779
|
onHfInitialSync: hfToken ? handleHfInitialSync : void 0
|
|
5771
5780
|
}
|
|
5772
5781
|
),
|
|
5773
|
-
activeTab === "server" && /* @__PURE__ */ jsx23(ServerTab, {})
|
|
5782
|
+
activeTab === "server" && /* @__PURE__ */ jsx23(ServerTab, { hfToken: hfToken || void 0 })
|
|
5774
5783
|
] })
|
|
5775
5784
|
] })
|
|
5776
5785
|
] });
|
|
@@ -5829,7 +5838,7 @@ function FaApp({
|
|
|
5829
5838
|
}
|
|
5830
5839
|
|
|
5831
5840
|
// src/index.ts
|
|
5832
|
-
var LIB_VERSION = "2.0.
|
|
5841
|
+
var LIB_VERSION = "2.0.28";
|
|
5833
5842
|
export {
|
|
5834
5843
|
AvatarArchitectApp,
|
|
5835
5844
|
CollapsibleCard,
|