@burtson-labs/bandit-engine 2.0.44 → 2.0.50
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/README.md +7 -5
- package/dist/{aiProviderStore-UQI33C5E.mjs → aiProviderStore-3N3VE6D4.mjs} +2 -2
- package/dist/chat-CQWZOJH4.mjs +16 -0
- package/dist/chat-provider.js +45 -10
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +6 -6
- package/dist/{chunk-UXE67LR7.mjs → chunk-6WZUQHZT.mjs} +11 -7
- package/dist/chunk-6WZUQHZT.mjs.map +1 -0
- package/dist/{chunk-XUBYA5I7.mjs → chunk-7ZDS33S2.mjs} +34 -6
- package/dist/chunk-7ZDS33S2.mjs.map +1 -0
- package/dist/{chunk-SBNENBUQ.mjs → chunk-AXFX2HUK.mjs} +12 -12
- package/dist/{chunk-SBNENBUQ.mjs.map → chunk-AXFX2HUK.mjs.map} +1 -1
- package/dist/{chunk-54ZQ3FSN.mjs → chunk-BENL3EF2.mjs} +7 -4
- package/dist/chunk-BENL3EF2.mjs.map +1 -0
- package/dist/{chunk-RTQDQ6TC.mjs → chunk-EHNWQ4T3.mjs} +2 -2
- package/dist/{chunk-KBKWVG7X.mjs → chunk-HKJTRBWC.mjs} +5 -5
- package/dist/chunk-KHKWYHXD.mjs +482 -0
- package/dist/chunk-KHKWYHXD.mjs.map +1 -0
- package/dist/{chunk-QV4ELNLP.mjs → chunk-Q2N7CCZI.mjs} +881 -1289
- package/dist/chunk-Q2N7CCZI.mjs.map +1 -0
- package/dist/{chunk-ERV7GLY3.mjs → chunk-TVF45U7B.mjs} +5 -5
- package/dist/{chunk-H4PBQ5LJ.mjs → chunk-VL3CMSDO.mjs} +4 -4
- package/dist/{chunk-JRGCRBWE.mjs → chunk-ZTTGERUG.mjs} +2201 -615
- package/dist/chunk-ZTTGERUG.mjs.map +1 -0
- package/dist/cli.js +46 -46
- package/dist/cli.js.map +1 -1
- package/dist/{gateway-5yt_3QDP.d.mts → gateway-oScD5tvE.d.mts} +4 -3
- package/dist/{gateway-5yt_3QDP.d.ts → gateway-oScD5tvE.d.ts} +4 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2178 -507
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +3462 -1791
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +9 -8
- package/dist/modals/chat-modal/chat-modal.js +53 -18
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +5 -5
- package/dist/{modelStore-UMJBDSEF.mjs → modelStore-XWFHNTBT.mjs} +2 -2
- package/dist/public-types.d.mts +2 -1
- package/dist/public-types.d.ts +2 -1
- package/package.json +3 -3
- package/dist/chat-7U633EWN.mjs +0 -15
- package/dist/chunk-54ZQ3FSN.mjs.map +0 -1
- package/dist/chunk-JRGCRBWE.mjs.map +0 -1
- package/dist/chunk-QV4ELNLP.mjs.map +0 -1
- package/dist/chunk-UXE67LR7.mjs.map +0 -1
- package/dist/chunk-XUBYA5I7.mjs.map +0 -1
- /package/dist/{aiProviderStore-UQI33C5E.mjs.map → aiProviderStore-3N3VE6D4.mjs.map} +0 -0
- /package/dist/{chat-7U633EWN.mjs.map → chat-CQWZOJH4.mjs.map} +0 -0
- /package/dist/{chunk-RTQDQ6TC.mjs.map → chunk-EHNWQ4T3.mjs.map} +0 -0
- /package/dist/{chunk-KBKWVG7X.mjs.map → chunk-HKJTRBWC.mjs.map} +0 -0
- /package/dist/{chunk-ERV7GLY3.mjs.map → chunk-TVF45U7B.mjs.map} +0 -0
- /package/dist/{chunk-H4PBQ5LJ.mjs.map → chunk-VL3CMSDO.mjs.map} +0 -0
- /package/dist/{modelStore-UMJBDSEF.mjs.map → modelStore-XWFHNTBT.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -859,6 +859,27 @@ var init_modelStore = __esm({
|
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
+
(async () => {
|
|
863
|
+
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
864
|
+
try {
|
|
865
|
+
const existing = await indexedDBService_default.get("banditConfig", 1, "config", "main", storeConfigs6);
|
|
866
|
+
await indexedDBService_default.put(
|
|
867
|
+
"banditConfig",
|
|
868
|
+
1,
|
|
869
|
+
"config",
|
|
870
|
+
{
|
|
871
|
+
...existing,
|
|
872
|
+
id: "main",
|
|
873
|
+
model: { ...existing?.model ?? {}, selectedModel: modelName }
|
|
874
|
+
},
|
|
875
|
+
storeConfigs6
|
|
876
|
+
);
|
|
877
|
+
} catch (err) {
|
|
878
|
+
debugLogger.warn("setSelectedModel: failed to persist selected model", {
|
|
879
|
+
error: err instanceof Error ? err.message : String(err)
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
})();
|
|
862
883
|
},
|
|
863
884
|
saveModel: async () => {
|
|
864
885
|
const state = get();
|
|
@@ -868,7 +889,8 @@ var init_modelStore = __esm({
|
|
|
868
889
|
tagline: state.tagline,
|
|
869
890
|
systemPrompt: state.systemPrompt,
|
|
870
891
|
commands: state.commands,
|
|
871
|
-
|
|
892
|
+
// Ensure avatar changes are persisted even when cleared
|
|
893
|
+
avatarBase64: state.avatarBase64 ?? null
|
|
872
894
|
};
|
|
873
895
|
await indexedDBService_default.put("banditConfig", 1, "config", { id: newModel.name, model: newModel }, storeConfigs6);
|
|
874
896
|
const exists = state.availableModels.find((m) => m.name === newModel.name);
|
|
@@ -895,7 +917,12 @@ var init_modelStore = __esm({
|
|
|
895
917
|
debugLogger.info("initModels: starting initialization");
|
|
896
918
|
set({ isLoading: true, isInitializing: true });
|
|
897
919
|
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
898
|
-
const entries = await indexedDBService_default.getAll(
|
|
920
|
+
const entries = await indexedDBService_default.getAll(
|
|
921
|
+
"banditConfig",
|
|
922
|
+
1,
|
|
923
|
+
"config",
|
|
924
|
+
storeConfigs6
|
|
925
|
+
);
|
|
899
926
|
const mainEntry = entries.find((entry) => entry.id === "main");
|
|
900
927
|
const modelEntries = entries.filter((entry) => entry.id !== "main" && entry.id !== "deletedModels");
|
|
901
928
|
const deletedEntry = await indexedDBService_default.get("banditConfig", 1, "config", "deletedModels", storeConfigs6);
|
|
@@ -905,13 +932,14 @@ var init_modelStore = __esm({
|
|
|
905
932
|
if (modelEntries.length > 0) {
|
|
906
933
|
debugLogger.info("Loading models from IndexedDB");
|
|
907
934
|
allModels = modelEntries.map((entry) => {
|
|
908
|
-
const modelData = entry.model
|
|
935
|
+
const modelData = entry.model ?? entry;
|
|
909
936
|
return {
|
|
910
937
|
name: modelData.name,
|
|
911
938
|
tagline: modelData.tagline || "",
|
|
912
939
|
systemPrompt: modelData.systemPrompt || "",
|
|
913
940
|
commands: modelData.commands ?? [],
|
|
914
|
-
|
|
941
|
+
// Fall back to legacy top-level avatar when the nested model config omitted it
|
|
942
|
+
avatarBase64: modelData.avatarBase64 ?? entry.avatarBase64 ?? null
|
|
915
943
|
};
|
|
916
944
|
}).filter((m) => m.name && !deletedModelNames.includes(m.name));
|
|
917
945
|
const preferences = usePreferencesStore.getState().preferences;
|
|
@@ -2140,6 +2168,9 @@ function ensureDeviceId() {
|
|
|
2140
2168
|
return (0, import_uuid3.v4)();
|
|
2141
2169
|
}
|
|
2142
2170
|
}
|
|
2171
|
+
function getPackageDefaultAdvancedKnowledgeSync() {
|
|
2172
|
+
return usePackageSettingsStore.getState().settings?.advancedKnowledgeSyncDefaultEnabled;
|
|
2173
|
+
}
|
|
2143
2174
|
function mapConversationToDTO(conversation) {
|
|
2144
2175
|
const updatedAtIso = (conversation.updatedAt ?? /* @__PURE__ */ new Date()).toISOString();
|
|
2145
2176
|
const createdAtIso = conversation.createdAt ? conversation.createdAt.toISOString() : null;
|
|
@@ -2486,7 +2517,8 @@ function applyPreference(preference, set, getState, options) {
|
|
|
2486
2517
|
const override = options?.override ?? {};
|
|
2487
2518
|
const preferenceVectorFlag = preference.isAdvancedVectorFeaturesEnabled;
|
|
2488
2519
|
const overrideVectorFlag = override.isAdvancedVectorFeaturesEnabled;
|
|
2489
|
-
const
|
|
2520
|
+
const packageDefaultVectorFlag = getPackageDefaultAdvancedKnowledgeSync();
|
|
2521
|
+
const resolvedVectorFlag = preferenceVectorFlag !== void 0 ? preferenceVectorFlag : overrideVectorFlag !== void 0 ? overrideVectorFlag : packageDefaultVectorFlag !== void 0 ? packageDefaultVectorFlag : current.isAdvancedVectorFeaturesEnabled ?? false;
|
|
2490
2522
|
set({
|
|
2491
2523
|
syncEnabled: preference.syncEnabled,
|
|
2492
2524
|
status: preference.syncEnabled ? "idle" : "disabled",
|
|
@@ -2590,7 +2622,7 @@ var init_conversationSyncStore = __esm({
|
|
|
2590
2622
|
cursor: null,
|
|
2591
2623
|
lastError: null,
|
|
2592
2624
|
keepLocalOnly: false,
|
|
2593
|
-
isAdvancedVectorFeaturesEnabled: false,
|
|
2625
|
+
isAdvancedVectorFeaturesEnabled: getPackageDefaultAdvancedKnowledgeSync() ?? false,
|
|
2594
2626
|
conflicts: null,
|
|
2595
2627
|
deviceId: ensureDeviceId(),
|
|
2596
2628
|
pendingConversationUpserts: /* @__PURE__ */ new Set(),
|
|
@@ -2714,7 +2746,7 @@ var init_conversationSyncStore = __esm({
|
|
|
2714
2746
|
await get().runSync({ force: true });
|
|
2715
2747
|
}
|
|
2716
2748
|
} catch (error) {
|
|
2717
|
-
const message = error instanceof Error ? error.message : "Failed to update advanced
|
|
2749
|
+
const message = error instanceof Error ? error.message : "Failed to update advanced knowledge setting";
|
|
2718
2750
|
debugLogger.error("conversationSyncStore: setAdvancedVectorFeaturesEnabled failed", { error: message });
|
|
2719
2751
|
set({ status: "error", lastError: message });
|
|
2720
2752
|
throw error;
|
|
@@ -4467,7 +4499,7 @@ var init_gateway_service = __esm({
|
|
|
4467
4499
|
* Chat completion using the gateway API
|
|
4468
4500
|
*/
|
|
4469
4501
|
chat(request) {
|
|
4470
|
-
const endpoint = request.provider === "ollama" ? `/api/${request.provider}/chat` : request.provider ? `/api/${request.provider}/chat/completions` : "/api/chat/completions";
|
|
4502
|
+
const endpoint = request.provider === "ollama" ? `/api/${request.provider}/chat` : request.provider === "playground" ? "/api/playground/chat/completions" : request.provider ? `/api/${request.provider}/chat/completions` : "/api/chat/completions";
|
|
4471
4503
|
const fallbackEndpoint = request.provider === "bandit" ? "/completions" : null;
|
|
4472
4504
|
const normalizedModel = request.provider === "bandit" ? (() => {
|
|
4473
4505
|
const trimmed = (request.model ?? "").replace(/^bandit:/, "").trim();
|
|
@@ -5438,6 +5470,9 @@ var init_gateway_provider = __esm({
|
|
|
5438
5470
|
case "ollama":
|
|
5439
5471
|
this.providerSpecificService = new OllamaGatewayService(gatewayUrl, tokenFactory);
|
|
5440
5472
|
break;
|
|
5473
|
+
case "playground":
|
|
5474
|
+
this.providerSpecificService = null;
|
|
5475
|
+
break;
|
|
5441
5476
|
default:
|
|
5442
5477
|
debugLogger.warn("Unknown provider for gateway, using generic gateway service", {
|
|
5443
5478
|
provider: this.config.provider
|
|
@@ -5468,7 +5503,7 @@ var init_gateway_provider = __esm({
|
|
|
5468
5503
|
images: request.images
|
|
5469
5504
|
};
|
|
5470
5505
|
}
|
|
5471
|
-
} else if (["openai", "azure-openai", "anthropic", "bandit"].includes(this.config.provider || "")) {
|
|
5506
|
+
} else if (["openai", "azure-openai", "anthropic", "bandit", "playground"].includes(this.config.provider || "")) {
|
|
5472
5507
|
if (lastUserMessageIndex !== -1) {
|
|
5473
5508
|
const currentMessage = messages[lastUserMessageIndex];
|
|
5474
5509
|
const contentArray = [
|
|
@@ -5515,7 +5550,7 @@ var init_gateway_provider = __esm({
|
|
|
5515
5550
|
stream: request.stream,
|
|
5516
5551
|
hasImages: !!(request.images && request.images.length > 0),
|
|
5517
5552
|
imageCount: request.images?.length || 0,
|
|
5518
|
-
imageStrategy: this.config.provider === "ollama" ? "message-level-array" : ["openai", "azure-openai", "anthropic"].includes(this.config.provider || "") ? "structured-content" : "top-level-fallback",
|
|
5553
|
+
imageStrategy: this.config.provider === "ollama" ? "message-level-array" : ["openai", "azure-openai", "anthropic", "playground"].includes(this.config.provider || "") ? "structured-content" : "top-level-fallback",
|
|
5519
5554
|
finalMessages: messages.map((m) => ({
|
|
5520
5555
|
role: m.role,
|
|
5521
5556
|
hasImages: Array.isArray(m.images) && m.images.length > 0,
|
|
@@ -10549,6 +10584,7 @@ var init_custom_logo = __esm({
|
|
|
10549
10584
|
init_chat();
|
|
10550
10585
|
init_brandingService();
|
|
10551
10586
|
init_debugLogger();
|
|
10587
|
+
init_util();
|
|
10552
10588
|
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
10553
10589
|
Logo = ({ visible, atTop = false }) => {
|
|
10554
10590
|
const theme = (0, import_styles.useTheme)();
|
|
@@ -10562,7 +10598,20 @@ var init_custom_logo = __esm({
|
|
|
10562
10598
|
const brandingData = await brandingService_default.getBranding();
|
|
10563
10599
|
if (brandingData) {
|
|
10564
10600
|
setLogoBase64(brandingData.logoBase64 || null);
|
|
10565
|
-
|
|
10601
|
+
if (brandingData.logoBase64) {
|
|
10602
|
+
try {
|
|
10603
|
+
const detected = await detectTransparency(brandingData.logoBase64);
|
|
10604
|
+
const isPng = brandingData.logoBase64.startsWith("data:image/png");
|
|
10605
|
+
const finalTransparent = detected || isPng || brandingData.hasTransparentLogo === true;
|
|
10606
|
+
setHasTransparentLogo(finalTransparent);
|
|
10607
|
+
} catch {
|
|
10608
|
+
const isPng = brandingData.logoBase64.startsWith("data:image/png");
|
|
10609
|
+
const finalTransparent = brandingData.hasTransparentLogo === true || isPng;
|
|
10610
|
+
setHasTransparentLogo(finalTransparent);
|
|
10611
|
+
}
|
|
10612
|
+
} else {
|
|
10613
|
+
setHasTransparentLogo(brandingData.hasTransparentLogo ?? true);
|
|
10614
|
+
}
|
|
10566
10615
|
}
|
|
10567
10616
|
} catch (e) {
|
|
10568
10617
|
debugLogger.error("Failed to load branding from service", { error: e });
|
|
@@ -10572,7 +10621,7 @@ var init_custom_logo = __esm({
|
|
|
10572
10621
|
};
|
|
10573
10622
|
loadBranding();
|
|
10574
10623
|
}, []);
|
|
10575
|
-
return logoBase64 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: loading ? null : hasTransparentLogo ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
10624
|
+
return logoBase64 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: loading ? null : hasTransparentLogo !== false ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
10576
10625
|
import_material2.Box,
|
|
10577
10626
|
{
|
|
10578
10627
|
component: "img",
|
|
@@ -10584,7 +10633,8 @@ var init_custom_logo = __esm({
|
|
|
10584
10633
|
maxWidth: 600,
|
|
10585
10634
|
aspectRatio: "1 / 1",
|
|
10586
10635
|
margin: "0 auto",
|
|
10587
|
-
mt: atTop ? 2 : 6
|
|
10636
|
+
mt: atTop ? 2 : 6,
|
|
10637
|
+
display: "block"
|
|
10588
10638
|
}
|
|
10589
10639
|
}
|
|
10590
10640
|
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -10626,8 +10676,8 @@ var init_chat_scroll_to_bottom_button = __esm({
|
|
|
10626
10676
|
drawerOpen = false,
|
|
10627
10677
|
isMobile = false
|
|
10628
10678
|
}) => {
|
|
10629
|
-
const verticalBuffer = isMobile ?
|
|
10630
|
-
const bottomOffset = Math.max(inputHeight + verticalBuffer, verticalBuffer +
|
|
10679
|
+
const verticalBuffer = isMobile ? 28 : 48;
|
|
10680
|
+
const bottomOffset = Math.max(inputHeight + verticalBuffer, verticalBuffer + 64);
|
|
10631
10681
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
10632
10682
|
import_material3.IconButton,
|
|
10633
10683
|
{
|
|
@@ -10643,9 +10693,12 @@ var init_chat_scroll_to_bottom_button = __esm({
|
|
|
10643
10693
|
borderColor: (theme) => theme.palette.divider,
|
|
10644
10694
|
zIndex: (theme) => Math.max(theme.zIndex.modal + 1, 1400),
|
|
10645
10695
|
boxShadow: 3,
|
|
10646
|
-
transition: "bottom 0.
|
|
10696
|
+
transition: "bottom 0.25s ease, left 0.3s ease-in-out, transform 0.2s ease",
|
|
10647
10697
|
"&:hover": {
|
|
10648
10698
|
bgcolor: (theme) => theme.palette.action.hover
|
|
10699
|
+
},
|
|
10700
|
+
"&:active": {
|
|
10701
|
+
transform: "translateX(-50%) translateY(1px)"
|
|
10649
10702
|
}
|
|
10650
10703
|
},
|
|
10651
10704
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ArrowDownward.default, { sx: { color: "inherit" } })
|
|
@@ -15660,7 +15713,7 @@ var init_memory_modal = __esm({
|
|
|
15660
15713
|
children: [
|
|
15661
15714
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material11.Box, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
|
|
15662
15715
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Memory" }),
|
|
15663
|
-
shouldUseVectorForMemories && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Tooltip, { title: "Memories
|
|
15716
|
+
shouldUseVectorForMemories && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Tooltip, { title: "Memories stay in your private knowledge space for faster, more accurate answers.", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
15664
15717
|
import_material11.Typography,
|
|
15665
15718
|
{
|
|
15666
15719
|
variant: "caption",
|
|
@@ -15675,7 +15728,7 @@ var init_memory_modal = __esm({
|
|
|
15675
15728
|
textTransform: "uppercase",
|
|
15676
15729
|
cursor: "help"
|
|
15677
15730
|
},
|
|
15678
|
-
children: "
|
|
15731
|
+
children: "Synced"
|
|
15679
15732
|
}
|
|
15680
15733
|
) })
|
|
15681
15734
|
] }),
|
|
@@ -15774,7 +15827,7 @@ var init_memory_modal = __esm({
|
|
|
15774
15827
|
onClick: () => setBulkImportOpen(true),
|
|
15775
15828
|
startIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_CloudSync.default, {}),
|
|
15776
15829
|
sx: { textTransform: "none", borderRadius: 2, fontSize: "0.75rem" },
|
|
15777
|
-
children: "Import to
|
|
15830
|
+
children: "Import to workspace"
|
|
15778
15831
|
}
|
|
15779
15832
|
),
|
|
15780
15833
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -16016,7 +16069,7 @@ var init_memory_modal = __esm({
|
|
|
16016
16069
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", sx: {
|
|
16017
16070
|
color: (0, import_styles6.alpha)(theme.palette.text.secondary, 0.7),
|
|
16018
16071
|
maxWidth: 280
|
|
16019
|
-
}, children: selectedTab === "user" ? shouldUseVectorForMemories ? "Start by adding something you'd like me to remember. Your memories will be
|
|
16072
|
+
}, children: selectedTab === "user" ? shouldUseVectorForMemories ? "Start by adding something you'd like me to remember. Your memories will be kept in a private workspace for quick recall." : "Start by adding something you'd like me to remember about you or your preferences." : shouldUseVectorForMemories ? "Auto memories are created automatically based on our conversations and kept in your private workspace for better answers." : "Auto memories are created automatically based on our conversations." })
|
|
16020
16073
|
] }) : filteredMemories.map((memory) => {
|
|
16021
16074
|
const isSelected = selectedIds.includes(memory.id);
|
|
16022
16075
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react17.default.Fragment, { children: [
|
|
@@ -16288,7 +16341,7 @@ var init_memory_modal = __esm({
|
|
|
16288
16341
|
size: "small",
|
|
16289
16342
|
value: newMemory,
|
|
16290
16343
|
onChange: (e) => setNewMemory(e.target.value),
|
|
16291
|
-
placeholder: shouldUseVectorForMemories ? `Add a new ${selectedTab} memory to
|
|
16344
|
+
placeholder: shouldUseVectorForMemories ? `Add a new ${selectedTab} memory to your workspace...` : `Add a new ${selectedTab} memory...`,
|
|
16292
16345
|
onKeyDown: (e) => {
|
|
16293
16346
|
if (e.key === "Enter" && !e.shiftKey && newMemory.trim()) {
|
|
16294
16347
|
e.preventDefault();
|
|
@@ -16528,15 +16581,15 @@ var init_memory_modal = __esm({
|
|
|
16528
16581
|
gap: 1
|
|
16529
16582
|
}, children: [
|
|
16530
16583
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_CloudSync.default, { color: "primary" }),
|
|
16531
|
-
"Import Memories to
|
|
16584
|
+
"Import Memories to Secure Workspace"
|
|
16532
16585
|
] }),
|
|
16533
16586
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.DialogContent, { sx: { py: 2 }, children: !importProgress.isImporting ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material11.Box, { children: [
|
|
16534
16587
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material11.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: [
|
|
16535
16588
|
"This will import all your local memories (",
|
|
16536
16589
|
entries.length,
|
|
16537
|
-
" memories) to
|
|
16590
|
+
" memories) to your secure workspace for faster, more reliable answers."
|
|
16538
16591
|
] }),
|
|
16539
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "\u2022 Memories will be added to your
|
|
16592
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "\u2022 Memories will be added to your synced workspace \u2022 Local memories will remain unchanged \u2022 You can switch between synced and local storage anytime" }),
|
|
16540
16593
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material11.Typography, { variant: "body2", color: "primary", sx: { fontWeight: 500 }, children: [
|
|
16541
16594
|
"Ready to import ",
|
|
16542
16595
|
entries.length,
|
|
@@ -24202,9 +24255,18 @@ var init_chat_app_bar = __esm({
|
|
|
24202
24255
|
const currentModel = useModelStore((s) => s.availableModels.find((m) => m.name === selectedModel));
|
|
24203
24256
|
const currentAvatar = currentModel?.avatarBase64 || modelAvatars2[selectedModel] || banditHead3;
|
|
24204
24257
|
const pendingModelAvatar = useModelStore.getState().availableModels.find((m) => m.name === pendingModel)?.avatarBase64 || modelAvatars2[pendingModel || ""] || banditHead3;
|
|
24258
|
+
const resolvedHomeUrl = preferences.homeUrl?.trim() || packageSettings?.homeUrl?.trim() || "";
|
|
24259
|
+
const homeTooltip = (() => {
|
|
24260
|
+
if (!resolvedHomeUrl) return "Home";
|
|
24261
|
+
try {
|
|
24262
|
+
return `Home (${new URL(resolvedHomeUrl).hostname})`;
|
|
24263
|
+
} catch {
|
|
24264
|
+
return "Home";
|
|
24265
|
+
}
|
|
24266
|
+
})();
|
|
24205
24267
|
function goToHome() {
|
|
24206
|
-
if (
|
|
24207
|
-
window.location.href =
|
|
24268
|
+
if (resolvedHomeUrl) {
|
|
24269
|
+
window.location.href = resolvedHomeUrl;
|
|
24208
24270
|
return;
|
|
24209
24271
|
}
|
|
24210
24272
|
if (typeof window !== "undefined") {
|
|
@@ -24267,7 +24329,7 @@ var init_chat_app_bar = __esm({
|
|
|
24267
24329
|
}
|
|
24268
24330
|
},
|
|
24269
24331
|
children: [
|
|
24270
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material22.Tooltip, { title:
|
|
24332
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material22.Tooltip, { title: homeTooltip, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
24271
24333
|
import_material22.IconButton,
|
|
24272
24334
|
{
|
|
24273
24335
|
onClick: goToHome,
|
|
@@ -24551,9 +24613,15 @@ var init_chat_app_bar = __esm({
|
|
|
24551
24613
|
(async () => {
|
|
24552
24614
|
try {
|
|
24553
24615
|
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
24554
|
-
const current = await indexedDBService_default.get(
|
|
24616
|
+
const current = await indexedDBService_default.get(
|
|
24617
|
+
"banditConfig",
|
|
24618
|
+
1,
|
|
24619
|
+
"config",
|
|
24620
|
+
"main",
|
|
24621
|
+
storeConfigs6
|
|
24622
|
+
);
|
|
24555
24623
|
const updated = {
|
|
24556
|
-
...current,
|
|
24624
|
+
...current ?? {},
|
|
24557
24625
|
id: "main",
|
|
24558
24626
|
model: {
|
|
24559
24627
|
...current?.model || {},
|
|
@@ -24745,9 +24813,15 @@ var init_chat_app_bar = __esm({
|
|
|
24745
24813
|
(async () => {
|
|
24746
24814
|
try {
|
|
24747
24815
|
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
24748
|
-
const current = await indexedDBService_default.get(
|
|
24816
|
+
const current = await indexedDBService_default.get(
|
|
24817
|
+
"banditConfig",
|
|
24818
|
+
1,
|
|
24819
|
+
"config",
|
|
24820
|
+
"main",
|
|
24821
|
+
storeConfigs6
|
|
24822
|
+
);
|
|
24749
24823
|
const updated = {
|
|
24750
|
-
...current,
|
|
24824
|
+
...current ?? {},
|
|
24751
24825
|
id: "main",
|
|
24752
24826
|
model: {
|
|
24753
24827
|
...current?.model || {},
|
|
@@ -27548,7 +27622,7 @@ var init_under_review = __esm({
|
|
|
27548
27622
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("br", {}),
|
|
27549
27623
|
"For more info, please contact ",
|
|
27550
27624
|
" ",
|
|
27551
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("a", { href: "mailto:team@
|
|
27625
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("a", { href: "mailto:team@banditai.ai", style: { color: theme.palette.primary.main, fontWeight: 600 }, children: "team@banditai.ai" })
|
|
27552
27626
|
] })
|
|
27553
27627
|
]
|
|
27554
27628
|
}
|
|
@@ -28084,7 +28158,7 @@ var chat_exports = {};
|
|
|
28084
28158
|
__export(chat_exports, {
|
|
28085
28159
|
default: () => chat_default
|
|
28086
28160
|
});
|
|
28087
|
-
var import_react35, import_material27, import_react_router_dom3, import_jsx_runtime28, ChatContent, Chat, chat_default;
|
|
28161
|
+
var import_react35, import_material27, import_styles29, import_react_router_dom3, import_jsx_runtime28, ChatContent, Chat, chat_default;
|
|
28088
28162
|
var init_chat2 = __esm({
|
|
28089
28163
|
"src/chat/chat.tsx"() {
|
|
28090
28164
|
"use strict";
|
|
@@ -28092,6 +28166,7 @@ var init_chat2 = __esm({
|
|
|
28092
28166
|
init_custom_logo();
|
|
28093
28167
|
init_indexedDBService();
|
|
28094
28168
|
import_material27 = require("@mui/material");
|
|
28169
|
+
import_styles29 = require("@mui/material/styles");
|
|
28095
28170
|
init_aiQueryStore();
|
|
28096
28171
|
init_modelStore();
|
|
28097
28172
|
import_react_router_dom3 = require("react-router-dom");
|
|
@@ -28137,7 +28212,33 @@ var init_chat2 = __esm({
|
|
|
28137
28212
|
const [themeLoading, setThemeLoading] = (0, import_react35.useState)(true);
|
|
28138
28213
|
const token = authenticationService.getToken();
|
|
28139
28214
|
const claims = token ? authenticationService.parseJwtClaims(token) : null;
|
|
28140
|
-
const
|
|
28215
|
+
const baseTheme = themeMap_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
|
|
28216
|
+
const banditTheme = (0, import_react35.useMemo)(() => {
|
|
28217
|
+
return (0, import_styles29.createTheme)(baseTheme, {
|
|
28218
|
+
components: {
|
|
28219
|
+
MuiInputBase: {
|
|
28220
|
+
styleOverrides: {
|
|
28221
|
+
input: {
|
|
28222
|
+
outline: "none",
|
|
28223
|
+
boxShadow: "none",
|
|
28224
|
+
"&:focus, &:focus-visible": {
|
|
28225
|
+
outline: "none",
|
|
28226
|
+
boxShadow: "none"
|
|
28227
|
+
}
|
|
28228
|
+
},
|
|
28229
|
+
inputMultiline: {
|
|
28230
|
+
outline: "none",
|
|
28231
|
+
boxShadow: "none",
|
|
28232
|
+
"&:focus, &:focus-visible": {
|
|
28233
|
+
outline: "none",
|
|
28234
|
+
boxShadow: "none"
|
|
28235
|
+
}
|
|
28236
|
+
}
|
|
28237
|
+
}
|
|
28238
|
+
}
|
|
28239
|
+
}
|
|
28240
|
+
});
|
|
28241
|
+
}, [baseTheme]);
|
|
28141
28242
|
const {
|
|
28142
28243
|
inputValue,
|
|
28143
28244
|
setInputValue,
|
|
@@ -29698,12 +29799,12 @@ var chat_provider_default = ChatProvider;
|
|
|
29698
29799
|
init_chat2();
|
|
29699
29800
|
|
|
29700
29801
|
// src/management/management.tsx
|
|
29701
|
-
var
|
|
29802
|
+
var import_react57 = require("react");
|
|
29702
29803
|
var import_useMediaQuery2 = __toESM(require("@mui/material/useMediaQuery"));
|
|
29703
|
-
var
|
|
29804
|
+
var import_styles31 = require("@mui/material/styles");
|
|
29704
29805
|
init_useKnowledgeStore();
|
|
29705
29806
|
init_indexedDBService();
|
|
29706
|
-
var
|
|
29807
|
+
var import_material47 = require("@mui/material");
|
|
29707
29808
|
var import_FaceRetouchingNatural = __toESM(require("@mui/icons-material/FaceRetouchingNatural"));
|
|
29708
29809
|
var import_Brush = __toESM(require("@mui/icons-material/Brush"));
|
|
29709
29810
|
var import_MenuBook = __toESM(require("@mui/icons-material/MenuBook"));
|
|
@@ -32482,7 +32583,7 @@ var chat_modal_default = ChatModal;
|
|
|
32482
32583
|
var import_react44 = require("react");
|
|
32483
32584
|
var import_material36 = require("@mui/material");
|
|
32484
32585
|
var import_useMediaQuery = __toESM(require("@mui/material/useMediaQuery"));
|
|
32485
|
-
var
|
|
32586
|
+
var import_styles30 = require("@mui/material/styles");
|
|
32486
32587
|
var import_AutoAwesome = __toESM(require("@mui/icons-material/AutoAwesome"));
|
|
32487
32588
|
var import_RocketLaunchOutlined = __toESM(require("@mui/icons-material/RocketLaunchOutlined"));
|
|
32488
32589
|
var import_ViewModuleOutlined = __toESM(require("@mui/icons-material/ViewModuleOutlined"));
|
|
@@ -32868,7 +32969,7 @@ var PersonalitiesTab = ({
|
|
|
32868
32969
|
restoreBanditModels,
|
|
32869
32970
|
showSnackbar
|
|
32870
32971
|
}) => {
|
|
32871
|
-
const theme = (0,
|
|
32972
|
+
const theme = (0, import_styles30.useTheme)();
|
|
32872
32973
|
const isMobile = (0, import_useMediaQuery.default)(theme.breakpoints.down("sm"));
|
|
32873
32974
|
const [personalityTabIndex, setPersonalityTabIndex] = (0, import_react44.useState)(0);
|
|
32874
32975
|
const sectionGap = isMobile ? 2 : 3;
|
|
@@ -34676,7 +34777,7 @@ var PreferencesTab = ({
|
|
|
34676
34777
|
await setAdvancedVectorFeaturesEnabled(enabled);
|
|
34677
34778
|
if (showSnackbar) {
|
|
34678
34779
|
showSnackbar(
|
|
34679
|
-
enabled ? "Advanced
|
|
34780
|
+
enabled ? "Advanced knowledge sync enabled for this account." : "Advanced knowledge sync disabled.",
|
|
34680
34781
|
"success"
|
|
34681
34782
|
);
|
|
34682
34783
|
}
|
|
@@ -34961,8 +35062,8 @@ var PreferencesTab = ({
|
|
|
34961
35062
|
}
|
|
34962
35063
|
),
|
|
34963
35064
|
label: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material37.Box, { textAlign: "left", children: [
|
|
34964
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material37.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Advanced
|
|
34965
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material37.Typography, { variant: "body2", color: "text.secondary", children: "Keep
|
|
35065
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material37.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Advanced knowledge sync" }),
|
|
35066
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material37.Typography, { variant: "body2", color: "text.secondary", children: "Keep richer search, saved memories, and context in sync across devices" })
|
|
34966
35067
|
] }),
|
|
34967
35068
|
sx: { alignSelf: { xs: "flex-start", sm: "center" } }
|
|
34968
35069
|
}
|
|
@@ -35532,6 +35633,7 @@ var LogoCropper = ({
|
|
|
35532
35633
|
canvas.width = outputWidth;
|
|
35533
35634
|
canvas.height = outputHeight;
|
|
35534
35635
|
ctx.save();
|
|
35636
|
+
ctx.clearRect(0, 0, outputWidth, outputHeight);
|
|
35535
35637
|
const scaleX = outputWidth / cropDims.width;
|
|
35536
35638
|
const scaleY = outputHeight / cropDims.height;
|
|
35537
35639
|
ctx.translate(outputWidth / 2, outputHeight / 2);
|
|
@@ -36503,6 +36605,12 @@ var BrandingTab = ({
|
|
|
36503
36605
|
};
|
|
36504
36606
|
var BrandingTab_default = BrandingTab;
|
|
36505
36607
|
|
|
36608
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
36609
|
+
var import_react53 = require("react");
|
|
36610
|
+
var import_material43 = require("@mui/material");
|
|
36611
|
+
var import_Description5 = __toESM(require("@mui/icons-material/Description"));
|
|
36612
|
+
var import_AutoStories = __toESM(require("@mui/icons-material/AutoStories"));
|
|
36613
|
+
|
|
36506
36614
|
// src/management/components/KnowledgeTab.tsx
|
|
36507
36615
|
var import_react51 = require("react");
|
|
36508
36616
|
var import_uuid6 = require("uuid");
|
|
@@ -36572,30 +36680,29 @@ var defaultSteps = [
|
|
|
36572
36680
|
},
|
|
36573
36681
|
{
|
|
36574
36682
|
id: "embed",
|
|
36575
|
-
title: "
|
|
36576
|
-
description: "
|
|
36683
|
+
title: "Making It Searchable",
|
|
36684
|
+
description: "We turn the content into a private, searchable index...",
|
|
36577
36685
|
icon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_material12.Memory, {}),
|
|
36578
36686
|
duration: 10
|
|
36579
36687
|
},
|
|
36580
36688
|
{
|
|
36581
36689
|
id: "optimize",
|
|
36582
36690
|
title: "Optimizing Search",
|
|
36583
|
-
description: "
|
|
36691
|
+
description: "Organizing everything for quick, reliable answers...",
|
|
36584
36692
|
icon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons_material12.AutoAwesome, {}),
|
|
36585
36693
|
duration: 8
|
|
36586
36694
|
}
|
|
36587
36695
|
];
|
|
36588
36696
|
var cleverMessages = [
|
|
36589
|
-
"\u{1F977}
|
|
36590
|
-
"\u{1F916}
|
|
36591
|
-
"\u26A1
|
|
36592
|
-
"\u{1F9E0}
|
|
36593
|
-
"\u{
|
|
36594
|
-
"\
|
|
36595
|
-
"\u{
|
|
36596
|
-
"\u{
|
|
36597
|
-
"\u{
|
|
36598
|
-
"\u{1F31F} Transforming text into searchable stardust..."
|
|
36697
|
+
"\u{1F977} Keeping your content safe while we set things up...",
|
|
36698
|
+
"\u{1F916} Getting everything ready for fast answers...",
|
|
36699
|
+
"\u26A1 Tidying the data so responses stay consistent...",
|
|
36700
|
+
"\u{1F9E0} Remembering the important parts for you...",
|
|
36701
|
+
"\u{1F512} Locking in privacy before we share results...",
|
|
36702
|
+
"\u{1F680} Optimizing for quick, reliable lookups...",
|
|
36703
|
+
"\u{1F4AB} Turning this into searchable knowledge...",
|
|
36704
|
+
"\u{1F3AF} Focusing on the details that matter to you...",
|
|
36705
|
+
"\u{1F31F} Making sure it stays available when you need it..."
|
|
36599
36706
|
];
|
|
36600
36707
|
var ProcessingOverlay = ({
|
|
36601
36708
|
open,
|
|
@@ -37184,16 +37291,16 @@ var KnowledgeTab = ({
|
|
|
37184
37291
|
const handleDocumentUpload = async (files) => {
|
|
37185
37292
|
if (shouldUseVector) {
|
|
37186
37293
|
showProcessing(
|
|
37187
|
-
"Uploading to
|
|
37294
|
+
"Uploading to Secure Workspace",
|
|
37188
37295
|
[
|
|
37189
|
-
"\u{1F977}
|
|
37190
|
-
"\u{1F916}
|
|
37191
|
-
"\u26A1
|
|
37192
|
-
"\u{1F9E0}
|
|
37193
|
-
"\u{1F52E}
|
|
37194
|
-
"\u{1F680}
|
|
37195
|
-
"\u{1F4AB} Transforming documents into
|
|
37196
|
-
"\u{1F3AF}
|
|
37296
|
+
"\u{1F977} Keeping your documents private while we prepare them...",
|
|
37297
|
+
"\u{1F916} Reading the content so answers stay accurate...",
|
|
37298
|
+
"\u26A1 Turning pages into a searchable index...",
|
|
37299
|
+
"\u{1F9E0} Remembering highlights for quick recall...",
|
|
37300
|
+
"\u{1F52E} Organizing everything so search feels instant...",
|
|
37301
|
+
"\u{1F680} Optimizing for fast, consistent responses...",
|
|
37302
|
+
"\u{1F4AB} Transforming documents into trusted knowledge...",
|
|
37303
|
+
"\u{1F3AF} Focusing on the details that matter most..."
|
|
37197
37304
|
]
|
|
37198
37305
|
);
|
|
37199
37306
|
try {
|
|
@@ -37267,7 +37374,7 @@ var KnowledgeTab = ({
|
|
|
37267
37374
|
progress: 100,
|
|
37268
37375
|
status: "success"
|
|
37269
37376
|
})));
|
|
37270
|
-
const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to
|
|
37377
|
+
const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to your secure workspace` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
|
|
37271
37378
|
setSnackbarMessage(message);
|
|
37272
37379
|
setSnackbarSeverity(result.error ? "warning" : "success");
|
|
37273
37380
|
setShowSnackbar(true);
|
|
@@ -37328,7 +37435,7 @@ var KnowledgeTab = ({
|
|
|
37328
37435
|
progress: 100,
|
|
37329
37436
|
status: "success"
|
|
37330
37437
|
})));
|
|
37331
|
-
const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to
|
|
37438
|
+
const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to your secure workspace` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
|
|
37332
37439
|
setSnackbarMessage(message);
|
|
37333
37440
|
setSnackbarSeverity(result.error ? "warning" : "success");
|
|
37334
37441
|
setShowSnackbar(true);
|
|
@@ -37506,7 +37613,7 @@ var KnowledgeTab = ({
|
|
|
37506
37613
|
shouldUseVector && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
37507
37614
|
import_material41.Chip,
|
|
37508
37615
|
{
|
|
37509
|
-
label: "
|
|
37616
|
+
label: "Synced",
|
|
37510
37617
|
color: "primary",
|
|
37511
37618
|
size: "small",
|
|
37512
37619
|
sx: { ml: 1 }
|
|
@@ -37523,7 +37630,7 @@ var KnowledgeTab = ({
|
|
|
37523
37630
|
sx: { fontSize: { xs: "0.95rem", sm: "1rem" }, lineHeight: 1.5 },
|
|
37524
37631
|
children: [
|
|
37525
37632
|
"Add documents to your private knowledge base. Files are securely stored ",
|
|
37526
|
-
shouldUseVector ? "in
|
|
37633
|
+
shouldUseVector ? "in your private workspace" : "locally in your browser",
|
|
37527
37634
|
"."
|
|
37528
37635
|
]
|
|
37529
37636
|
}
|
|
@@ -37859,7 +37966,7 @@ var KnowledgeTab = ({
|
|
|
37859
37966
|
filteredAndSortedDocuments.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material41.Card, { sx: { textAlign: "center", py: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_material41.CardContent, { children: [
|
|
37860
37967
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_Folder.default, { sx: { fontSize: 64, color: "text.secondary", mb: 2 } }),
|
|
37861
37968
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material41.Typography, { variant: "h6", color: "text.secondary", gutterBottom: true, children: "No Documents Yet" }),
|
|
37862
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material41.Typography, { variant: "body2", color: "text.secondary", children: shouldUseVector ? "Upload and embed your first document to get started with advanced
|
|
37969
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material41.Typography, { variant: "body2", color: "text.secondary", children: shouldUseVector ? "Upload and embed your first document to get started with advanced search" : "Upload your first document to get started" })
|
|
37863
37970
|
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_material41.Box, { children: [
|
|
37864
37971
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_material41.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: [
|
|
37865
37972
|
"Showing ",
|
|
@@ -37868,7 +37975,7 @@ var KnowledgeTab = ({
|
|
|
37868
37975
|
shouldUseVector ? vectorDocuments.length : documents.length,
|
|
37869
37976
|
" documents",
|
|
37870
37977
|
searchQuery && ` for "${searchQuery}"`,
|
|
37871
|
-
shouldUseVector && ` (
|
|
37978
|
+
shouldUseVector && ` (Synced workspace)`
|
|
37872
37979
|
] }),
|
|
37873
37980
|
viewMode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
37874
37981
|
import_material41.Box,
|
|
@@ -38226,17 +38333,1482 @@ var KnowledgeTab = ({
|
|
|
38226
38333
|
};
|
|
38227
38334
|
var KnowledgeTab_default = KnowledgeTab;
|
|
38228
38335
|
|
|
38229
|
-
// src/management/components/
|
|
38336
|
+
// src/management/components/SeedPacksTab.tsx
|
|
38230
38337
|
var import_react52 = require("react");
|
|
38231
38338
|
var import_material42 = require("@mui/material");
|
|
38232
|
-
var
|
|
38339
|
+
var import_Add2 = __toESM(require("@mui/icons-material/Add"));
|
|
38340
|
+
var import_Archive = __toESM(require("@mui/icons-material/Archive"));
|
|
38233
38341
|
var import_Delete6 = __toESM(require("@mui/icons-material/Delete"));
|
|
38342
|
+
var import_Description4 = __toESM(require("@mui/icons-material/Description"));
|
|
38343
|
+
var import_Group2 = __toESM(require("@mui/icons-material/Group"));
|
|
38344
|
+
var import_Person3 = __toESM(require("@mui/icons-material/Person"));
|
|
38345
|
+
var import_Publish = __toESM(require("@mui/icons-material/Publish"));
|
|
38234
38346
|
var import_Refresh3 = __toESM(require("@mui/icons-material/Refresh"));
|
|
38347
|
+
var import_Save2 = __toESM(require("@mui/icons-material/Save"));
|
|
38348
|
+
var import_Search4 = __toESM(require("@mui/icons-material/Search"));
|
|
38349
|
+
var import_UploadFile2 = __toESM(require("@mui/icons-material/UploadFile"));
|
|
38350
|
+
init_packageSettingsStore();
|
|
38351
|
+
init_authenticationStore();
|
|
38352
|
+
init_StreamingMarkdown();
|
|
38353
|
+
init_debugLogger();
|
|
38354
|
+
|
|
38355
|
+
// src/services/seedPacks/seedPackService.ts
|
|
38356
|
+
init_authenticationService();
|
|
38357
|
+
init_packageSettingsStore();
|
|
38358
|
+
init_debugLogger();
|
|
38359
|
+
var HttpResponseError2 = class extends Error {
|
|
38360
|
+
constructor(message, status, payload, code) {
|
|
38361
|
+
super(message);
|
|
38362
|
+
this.status = status;
|
|
38363
|
+
this.payload = payload;
|
|
38364
|
+
this.code = code;
|
|
38365
|
+
this.name = "HttpResponseError";
|
|
38366
|
+
}
|
|
38367
|
+
};
|
|
38368
|
+
var isRecord5 = (value) => typeof value === "object" && value !== null;
|
|
38369
|
+
var getString2 = (record, key) => {
|
|
38370
|
+
const value = record[key];
|
|
38371
|
+
return typeof value === "string" ? value : void 0;
|
|
38372
|
+
};
|
|
38373
|
+
var getNumber = (record, key) => {
|
|
38374
|
+
const value = record[key];
|
|
38375
|
+
if (typeof value === "number") {
|
|
38376
|
+
return value;
|
|
38377
|
+
}
|
|
38378
|
+
if (typeof value === "string") {
|
|
38379
|
+
const parsed = Number(value);
|
|
38380
|
+
if (!Number.isNaN(parsed)) {
|
|
38381
|
+
return parsed;
|
|
38382
|
+
}
|
|
38383
|
+
}
|
|
38384
|
+
return void 0;
|
|
38385
|
+
};
|
|
38386
|
+
var getStringArray = (record, key) => {
|
|
38387
|
+
const value = record[key];
|
|
38388
|
+
if (Array.isArray(value)) {
|
|
38389
|
+
return value.filter((item) => typeof item === "string");
|
|
38390
|
+
}
|
|
38391
|
+
if (typeof value === "string") {
|
|
38392
|
+
return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
38393
|
+
}
|
|
38394
|
+
return void 0;
|
|
38395
|
+
};
|
|
38396
|
+
var toSeedPackStatus = (value) => {
|
|
38397
|
+
if (value === "draft" || value === "published" || value === "archived") {
|
|
38398
|
+
return value;
|
|
38399
|
+
}
|
|
38400
|
+
return "draft";
|
|
38401
|
+
};
|
|
38402
|
+
var toSeedPackScope = (value) => {
|
|
38403
|
+
if (value === "team" || value === "user") {
|
|
38404
|
+
return value;
|
|
38405
|
+
}
|
|
38406
|
+
return void 0;
|
|
38407
|
+
};
|
|
38408
|
+
var normalizeSeedPack = (record) => {
|
|
38409
|
+
const sid = getString2(record, "sid") ?? getString2(record, "id") ?? "";
|
|
38410
|
+
return {
|
|
38411
|
+
sid,
|
|
38412
|
+
name: getString2(record, "name") ?? "Untitled Seed Pack",
|
|
38413
|
+
description: getString2(record, "description"),
|
|
38414
|
+
status: toSeedPackStatus(getString2(record, "status")),
|
|
38415
|
+
version: getNumber(record, "version"),
|
|
38416
|
+
contentType: getString2(record, "contentType") ?? "markdown",
|
|
38417
|
+
content: getString2(record, "content"),
|
|
38418
|
+
summary: getString2(record, "summary"),
|
|
38419
|
+
tags: getStringArray(record, "tags"),
|
|
38420
|
+
scopeType: toSeedPackScope(getString2(record, "scopeType")),
|
|
38421
|
+
scopeSid: getString2(record, "scopeSid"),
|
|
38422
|
+
createdBySid: getString2(record, "createdBySid"),
|
|
38423
|
+
updatedBySid: getString2(record, "updatedBySid"),
|
|
38424
|
+
publishedBySid: getString2(record, "publishedBySid"),
|
|
38425
|
+
createdAt: getString2(record, "createdAt"),
|
|
38426
|
+
updatedAt: getString2(record, "updatedAt"),
|
|
38427
|
+
publishedAt: getString2(record, "publishedAt")
|
|
38428
|
+
};
|
|
38429
|
+
};
|
|
38430
|
+
var extractSeedPack = (payload) => {
|
|
38431
|
+
if (!isRecord5(payload)) {
|
|
38432
|
+
return null;
|
|
38433
|
+
}
|
|
38434
|
+
const candidate = isRecord5(payload.seedPack) && payload.seedPack || isRecord5(payload.data) && payload.data || payload;
|
|
38435
|
+
if (!isRecord5(candidate)) {
|
|
38436
|
+
return null;
|
|
38437
|
+
}
|
|
38438
|
+
const pack = normalizeSeedPack(candidate);
|
|
38439
|
+
if (!pack.sid) {
|
|
38440
|
+
return null;
|
|
38441
|
+
}
|
|
38442
|
+
return pack;
|
|
38443
|
+
};
|
|
38444
|
+
var extractSeedPackList = (payload) => {
|
|
38445
|
+
if (Array.isArray(payload)) {
|
|
38446
|
+
return payload.map((item) => isRecord5(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
38447
|
+
}
|
|
38448
|
+
if (!isRecord5(payload)) {
|
|
38449
|
+
return [];
|
|
38450
|
+
}
|
|
38451
|
+
const candidates = [
|
|
38452
|
+
payload.seedPacks,
|
|
38453
|
+
payload.items,
|
|
38454
|
+
payload.results,
|
|
38455
|
+
payload.data
|
|
38456
|
+
];
|
|
38457
|
+
const list = candidates.find(Array.isArray);
|
|
38458
|
+
if (!Array.isArray(list)) {
|
|
38459
|
+
return [];
|
|
38460
|
+
}
|
|
38461
|
+
return list.map((item) => isRecord5(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
38462
|
+
};
|
|
38463
|
+
var buildUrl2 = (path) => {
|
|
38464
|
+
const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "");
|
|
38465
|
+
if (!base) {
|
|
38466
|
+
throw new Error("Gateway API is not configured");
|
|
38467
|
+
}
|
|
38468
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
38469
|
+
return `${base}${normalized}`;
|
|
38470
|
+
};
|
|
38471
|
+
var buildHeaders2 = () => {
|
|
38472
|
+
const headers = {
|
|
38473
|
+
"Content-Type": "application/json"
|
|
38474
|
+
};
|
|
38475
|
+
const token = authenticationService.getToken();
|
|
38476
|
+
if (token) {
|
|
38477
|
+
headers.Authorization = `Bearer ${token}`;
|
|
38478
|
+
}
|
|
38479
|
+
return headers;
|
|
38480
|
+
};
|
|
38481
|
+
var handleJsonResponse2 = async (response, fallbackMessage) => {
|
|
38482
|
+
let data = null;
|
|
38483
|
+
try {
|
|
38484
|
+
data = await response.json();
|
|
38485
|
+
} catch (error) {
|
|
38486
|
+
debugLogger.warn("seedPackService: failed to parse JSON response", { error });
|
|
38487
|
+
}
|
|
38488
|
+
if (!response.ok) {
|
|
38489
|
+
const record = isRecord5(data) ? data : {};
|
|
38490
|
+
const message = getString2(record, "error") || getString2(record, "message") || getString2(record, "detail") || fallbackMessage;
|
|
38491
|
+
const code = getString2(record, "code") || getString2(record, "error_code");
|
|
38492
|
+
throw new HttpResponseError2(message, response.status, data, code);
|
|
38493
|
+
}
|
|
38494
|
+
return data;
|
|
38495
|
+
};
|
|
38496
|
+
var buildDraftPayload = (draft) => {
|
|
38497
|
+
const payload = {
|
|
38498
|
+
name: draft.name,
|
|
38499
|
+
contentType: draft.contentType ?? "markdown"
|
|
38500
|
+
};
|
|
38501
|
+
if (draft.description !== void 0) {
|
|
38502
|
+
payload.description = draft.description;
|
|
38503
|
+
}
|
|
38504
|
+
if (draft.content !== void 0) {
|
|
38505
|
+
payload.content = draft.content;
|
|
38506
|
+
}
|
|
38507
|
+
if (draft.tags) {
|
|
38508
|
+
payload.tags = draft.tags;
|
|
38509
|
+
}
|
|
38510
|
+
return payload;
|
|
38511
|
+
};
|
|
38512
|
+
var listSeedPacks = async () => {
|
|
38513
|
+
const url = buildUrl2("/seed-packs");
|
|
38514
|
+
try {
|
|
38515
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders2() });
|
|
38516
|
+
const payload = await handleJsonResponse2(response, "Failed to load seed packs");
|
|
38517
|
+
return extractSeedPackList(payload);
|
|
38518
|
+
} catch (error) {
|
|
38519
|
+
debugLogger.error("seedPackService: failed to list seed packs", {
|
|
38520
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38521
|
+
});
|
|
38522
|
+
throw error;
|
|
38523
|
+
}
|
|
38524
|
+
};
|
|
38525
|
+
var getSeedPack = async (sid) => {
|
|
38526
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
38527
|
+
try {
|
|
38528
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders2() });
|
|
38529
|
+
const payload = await handleJsonResponse2(response, "Failed to load seed pack");
|
|
38530
|
+
const pack = extractSeedPack(payload);
|
|
38531
|
+
if (!pack) {
|
|
38532
|
+
throw new Error("Seed pack response was empty");
|
|
38533
|
+
}
|
|
38534
|
+
return pack;
|
|
38535
|
+
} catch (error) {
|
|
38536
|
+
debugLogger.error("seedPackService: failed to load seed pack", {
|
|
38537
|
+
sid,
|
|
38538
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38539
|
+
});
|
|
38540
|
+
throw error;
|
|
38541
|
+
}
|
|
38542
|
+
};
|
|
38543
|
+
var createSeedPack = async (draft) => {
|
|
38544
|
+
const url = buildUrl2("/seed-packs");
|
|
38545
|
+
try {
|
|
38546
|
+
const response = await fetch(url, {
|
|
38547
|
+
method: "POST",
|
|
38548
|
+
headers: buildHeaders2(),
|
|
38549
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
38550
|
+
});
|
|
38551
|
+
const payload = await handleJsonResponse2(response, "Failed to create seed pack");
|
|
38552
|
+
const pack = extractSeedPack(payload);
|
|
38553
|
+
if (!pack) {
|
|
38554
|
+
throw new Error("Seed pack response was empty");
|
|
38555
|
+
}
|
|
38556
|
+
return pack;
|
|
38557
|
+
} catch (error) {
|
|
38558
|
+
debugLogger.error("seedPackService: failed to create seed pack", {
|
|
38559
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38560
|
+
});
|
|
38561
|
+
throw error;
|
|
38562
|
+
}
|
|
38563
|
+
};
|
|
38564
|
+
var updateSeedPack = async (sid, draft) => {
|
|
38565
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
38566
|
+
try {
|
|
38567
|
+
const response = await fetch(url, {
|
|
38568
|
+
method: "PUT",
|
|
38569
|
+
headers: buildHeaders2(),
|
|
38570
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
38571
|
+
});
|
|
38572
|
+
const payload = await handleJsonResponse2(response, "Failed to update seed pack");
|
|
38573
|
+
const pack = extractSeedPack(payload);
|
|
38574
|
+
if (!pack) {
|
|
38575
|
+
throw new Error("Seed pack response was empty");
|
|
38576
|
+
}
|
|
38577
|
+
return pack;
|
|
38578
|
+
} catch (error) {
|
|
38579
|
+
debugLogger.error("seedPackService: failed to update seed pack", {
|
|
38580
|
+
sid,
|
|
38581
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38582
|
+
});
|
|
38583
|
+
throw error;
|
|
38584
|
+
}
|
|
38585
|
+
};
|
|
38586
|
+
var publishSeedPack = async (sid) => {
|
|
38587
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}/publish`);
|
|
38588
|
+
try {
|
|
38589
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders2() });
|
|
38590
|
+
const payload = await handleJsonResponse2(response, "Failed to publish seed pack");
|
|
38591
|
+
const pack = extractSeedPack(payload);
|
|
38592
|
+
if (!pack) {
|
|
38593
|
+
throw new Error("Seed pack response was empty");
|
|
38594
|
+
}
|
|
38595
|
+
return pack;
|
|
38596
|
+
} catch (error) {
|
|
38597
|
+
debugLogger.error("seedPackService: failed to publish seed pack", {
|
|
38598
|
+
sid,
|
|
38599
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38600
|
+
});
|
|
38601
|
+
throw error;
|
|
38602
|
+
}
|
|
38603
|
+
};
|
|
38604
|
+
var archiveSeedPack = async (sid) => {
|
|
38605
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}/archive`);
|
|
38606
|
+
try {
|
|
38607
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders2() });
|
|
38608
|
+
const payload = await handleJsonResponse2(response, "Failed to archive seed pack");
|
|
38609
|
+
const pack = extractSeedPack(payload);
|
|
38610
|
+
if (!pack) {
|
|
38611
|
+
throw new Error("Seed pack response was empty");
|
|
38612
|
+
}
|
|
38613
|
+
return pack;
|
|
38614
|
+
} catch (error) {
|
|
38615
|
+
debugLogger.error("seedPackService: failed to archive seed pack", {
|
|
38616
|
+
sid,
|
|
38617
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38618
|
+
});
|
|
38619
|
+
throw error;
|
|
38620
|
+
}
|
|
38621
|
+
};
|
|
38622
|
+
|
|
38623
|
+
// src/management/components/SeedPacksTab.tsx
|
|
38624
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
38625
|
+
var parseTags = (value) => value.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
38626
|
+
var normalizeTags = (tags) => (tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
38627
|
+
var areArraysEqual = (a, b) => {
|
|
38628
|
+
if (a.length !== b.length) {
|
|
38629
|
+
return false;
|
|
38630
|
+
}
|
|
38631
|
+
return a.every((value, index) => value === b[index]);
|
|
38632
|
+
};
|
|
38633
|
+
var formatTimestamp = (value) => {
|
|
38634
|
+
if (!value) {
|
|
38635
|
+
return "Not set";
|
|
38636
|
+
}
|
|
38637
|
+
const parsed = Date.parse(value);
|
|
38638
|
+
if (Number.isNaN(parsed)) {
|
|
38639
|
+
return value;
|
|
38640
|
+
}
|
|
38641
|
+
return new Date(parsed).toLocaleString();
|
|
38642
|
+
};
|
|
38643
|
+
var formatFileSize3 = (bytes) => {
|
|
38644
|
+
if (bytes === 0) return "0 B";
|
|
38645
|
+
const k = 1024;
|
|
38646
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
38647
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
38648
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
38649
|
+
};
|
|
38650
|
+
var getPreviewSnippet = (content) => {
|
|
38651
|
+
const trimmed = content.trim();
|
|
38652
|
+
if (!trimmed) {
|
|
38653
|
+
return "No preview available";
|
|
38654
|
+
}
|
|
38655
|
+
return trimmed.length > 120 ? `${trimmed.slice(0, 120)}...` : trimmed;
|
|
38656
|
+
};
|
|
38657
|
+
var mergeMarkdownFiles = (existing, incoming) => {
|
|
38658
|
+
const next = [...existing];
|
|
38659
|
+
incoming.forEach((file) => {
|
|
38660
|
+
const index = next.findIndex((item) => item.name === file.name);
|
|
38661
|
+
if (index >= 0) {
|
|
38662
|
+
next[index] = file;
|
|
38663
|
+
} else {
|
|
38664
|
+
next.push(file);
|
|
38665
|
+
}
|
|
38666
|
+
});
|
|
38667
|
+
return next;
|
|
38668
|
+
};
|
|
38669
|
+
var buildMarkdownContent = (files) => {
|
|
38670
|
+
return files.map((file) => file.content.trim()).filter((content) => content.length > 0).join("\n\n---\n\n");
|
|
38671
|
+
};
|
|
38672
|
+
var readMarkdownFiles = async (files) => {
|
|
38673
|
+
const list = Array.from(files);
|
|
38674
|
+
const markdownFiles = list.filter((file) => file.name.toLowerCase().endsWith(".md"));
|
|
38675
|
+
const imported = await Promise.all(
|
|
38676
|
+
markdownFiles.map(async (file) => ({
|
|
38677
|
+
id: `${file.name}-${file.lastModified}`,
|
|
38678
|
+
name: file.name,
|
|
38679
|
+
size: file.size,
|
|
38680
|
+
content: await file.text(),
|
|
38681
|
+
lastModified: file.lastModified
|
|
38682
|
+
}))
|
|
38683
|
+
);
|
|
38684
|
+
return { imported, skipped: list.length - markdownFiles.length };
|
|
38685
|
+
};
|
|
38686
|
+
var getStatusChip = (status) => {
|
|
38687
|
+
switch (status) {
|
|
38688
|
+
case "published":
|
|
38689
|
+
return { label: "Published", color: "success" };
|
|
38690
|
+
case "archived":
|
|
38691
|
+
return { label: "Archived", color: "default" };
|
|
38692
|
+
case "draft":
|
|
38693
|
+
default:
|
|
38694
|
+
return { label: "Draft", color: "warning" };
|
|
38695
|
+
}
|
|
38696
|
+
};
|
|
38697
|
+
var getSeedPackTimestamp = (pack) => {
|
|
38698
|
+
const candidate = pack.updatedAt ?? pack.publishedAt ?? pack.createdAt;
|
|
38699
|
+
if (!candidate) {
|
|
38700
|
+
return 0;
|
|
38701
|
+
}
|
|
38702
|
+
const parsed = Date.parse(candidate);
|
|
38703
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
38704
|
+
};
|
|
38705
|
+
var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38706
|
+
import_material42.Card,
|
|
38707
|
+
{
|
|
38708
|
+
sx: {
|
|
38709
|
+
position: "relative",
|
|
38710
|
+
height: { xs: 240, sm: 260, md: 280 },
|
|
38711
|
+
cursor: "pointer",
|
|
38712
|
+
transition: "all 0.3s ease-in-out",
|
|
38713
|
+
border: "1px solid",
|
|
38714
|
+
borderColor: "divider",
|
|
38715
|
+
bgcolor: "background.paper",
|
|
38716
|
+
display: "flex",
|
|
38717
|
+
flexDirection: "column",
|
|
38718
|
+
"&:hover": {
|
|
38719
|
+
boxShadow: 6,
|
|
38720
|
+
transform: "translateY(-2px)"
|
|
38721
|
+
}
|
|
38722
|
+
},
|
|
38723
|
+
onClick: onPreview,
|
|
38724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38725
|
+
import_material42.CardContent,
|
|
38726
|
+
{
|
|
38727
|
+
sx: {
|
|
38728
|
+
p: { xs: 1.5, sm: 2 },
|
|
38729
|
+
height: "100%",
|
|
38730
|
+
display: "flex",
|
|
38731
|
+
flexDirection: "column",
|
|
38732
|
+
overflow: "hidden"
|
|
38733
|
+
},
|
|
38734
|
+
children: [
|
|
38735
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38736
|
+
import_material42.Box,
|
|
38737
|
+
{
|
|
38738
|
+
sx: {
|
|
38739
|
+
display: "flex",
|
|
38740
|
+
justifyContent: "space-between",
|
|
38741
|
+
alignItems: "flex-start",
|
|
38742
|
+
mb: 1,
|
|
38743
|
+
height: 32
|
|
38744
|
+
},
|
|
38745
|
+
children: [
|
|
38746
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Description4.default, { sx: { fontSize: 32, color: "#388e3c", flexShrink: 0 } }),
|
|
38747
|
+
!isReadOnly && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38748
|
+
import_material42.IconButton,
|
|
38749
|
+
{
|
|
38750
|
+
size: "small",
|
|
38751
|
+
color: "error",
|
|
38752
|
+
onClick: (event) => {
|
|
38753
|
+
event.stopPropagation();
|
|
38754
|
+
onRemove();
|
|
38755
|
+
},
|
|
38756
|
+
sx: { width: 24, height: 24 },
|
|
38757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Delete6.default, { fontSize: "small" })
|
|
38758
|
+
}
|
|
38759
|
+
)
|
|
38760
|
+
]
|
|
38761
|
+
}
|
|
38762
|
+
),
|
|
38763
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38764
|
+
import_material42.Box,
|
|
38765
|
+
{
|
|
38766
|
+
sx: {
|
|
38767
|
+
mb: 1.5,
|
|
38768
|
+
p: { xs: 1, sm: 1.5 },
|
|
38769
|
+
borderRadius: 1.5,
|
|
38770
|
+
bgcolor: "background.paper",
|
|
38771
|
+
border: "1px solid",
|
|
38772
|
+
borderColor: "divider",
|
|
38773
|
+
overflow: "hidden",
|
|
38774
|
+
position: "relative",
|
|
38775
|
+
height: { xs: 60, sm: 70, md: 80 },
|
|
38776
|
+
display: "flex",
|
|
38777
|
+
alignItems: "center"
|
|
38778
|
+
},
|
|
38779
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38780
|
+
import_material42.Typography,
|
|
38781
|
+
{
|
|
38782
|
+
variant: "body2",
|
|
38783
|
+
sx: {
|
|
38784
|
+
display: "-webkit-box",
|
|
38785
|
+
WebkitLineClamp: 3,
|
|
38786
|
+
WebkitBoxOrient: "vertical",
|
|
38787
|
+
overflow: "hidden",
|
|
38788
|
+
textOverflow: "ellipsis",
|
|
38789
|
+
color: "text.secondary",
|
|
38790
|
+
lineHeight: 1.3,
|
|
38791
|
+
fontSize: "0.8rem"
|
|
38792
|
+
},
|
|
38793
|
+
children: getPreviewSnippet(file.content)
|
|
38794
|
+
}
|
|
38795
|
+
)
|
|
38796
|
+
}
|
|
38797
|
+
),
|
|
38798
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Tooltip, { title: file.name, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38799
|
+
import_material42.Typography,
|
|
38800
|
+
{
|
|
38801
|
+
variant: "body2",
|
|
38802
|
+
sx: {
|
|
38803
|
+
fontWeight: 600,
|
|
38804
|
+
whiteSpace: "nowrap",
|
|
38805
|
+
overflow: "hidden",
|
|
38806
|
+
textOverflow: "ellipsis",
|
|
38807
|
+
mb: 1,
|
|
38808
|
+
color: "text.primary",
|
|
38809
|
+
fontSize: { xs: "0.8rem", sm: "0.875rem" },
|
|
38810
|
+
height: { xs: "1.2rem", sm: "1.3rem" }
|
|
38811
|
+
},
|
|
38812
|
+
children: file.name
|
|
38813
|
+
}
|
|
38814
|
+
) }),
|
|
38815
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38816
|
+
import_material42.Box,
|
|
38817
|
+
{
|
|
38818
|
+
sx: {
|
|
38819
|
+
display: "flex",
|
|
38820
|
+
justifyContent: "space-between",
|
|
38821
|
+
alignItems: "flex-start",
|
|
38822
|
+
mb: 1,
|
|
38823
|
+
minHeight: 40
|
|
38824
|
+
},
|
|
38825
|
+
children: [
|
|
38826
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", flex: 1, mr: 1 }, children: [
|
|
38827
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38828
|
+
import_material42.Chip,
|
|
38829
|
+
{
|
|
38830
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, { sx: { fontSize: "0.9rem !important" } }),
|
|
38831
|
+
label: "Local",
|
|
38832
|
+
size: "small",
|
|
38833
|
+
sx: {
|
|
38834
|
+
bgcolor: "#388e3c20",
|
|
38835
|
+
color: "#388e3c",
|
|
38836
|
+
fontWeight: 700,
|
|
38837
|
+
fontSize: "0.75rem",
|
|
38838
|
+
border: "2px solid #388e3c60",
|
|
38839
|
+
"& .MuiChip-icon": {
|
|
38840
|
+
color: "#388e3c !important"
|
|
38841
|
+
},
|
|
38842
|
+
boxShadow: "0 2px 4px #388e3c20"
|
|
38843
|
+
}
|
|
38844
|
+
}
|
|
38845
|
+
),
|
|
38846
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38847
|
+
import_material42.Chip,
|
|
38848
|
+
{
|
|
38849
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Description4.default, { sx: { fontSize: "0.85rem !important" } }),
|
|
38850
|
+
label: "Markdown",
|
|
38851
|
+
size: "small",
|
|
38852
|
+
sx: {
|
|
38853
|
+
bgcolor: "#388e3c15",
|
|
38854
|
+
color: "#388e3c",
|
|
38855
|
+
fontWeight: 500,
|
|
38856
|
+
fontSize: "0.65rem"
|
|
38857
|
+
}
|
|
38858
|
+
}
|
|
38859
|
+
)
|
|
38860
|
+
] }),
|
|
38861
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", sx: { flexShrink: 0 }, children: formatFileSize3(file.size) })
|
|
38862
|
+
]
|
|
38863
|
+
}
|
|
38864
|
+
),
|
|
38865
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Box, { sx: { mt: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38866
|
+
import_material42.Button,
|
|
38867
|
+
{
|
|
38868
|
+
variant: "outlined",
|
|
38869
|
+
size: "small",
|
|
38870
|
+
fullWidth: true,
|
|
38871
|
+
sx: {
|
|
38872
|
+
textTransform: "none",
|
|
38873
|
+
height: { xs: 32, sm: 36, md: 40 },
|
|
38874
|
+
flexShrink: 0,
|
|
38875
|
+
borderWidth: 2,
|
|
38876
|
+
fontSize: { xs: "0.75rem", sm: "0.8rem", md: "0.875rem" },
|
|
38877
|
+
fontWeight: 600,
|
|
38878
|
+
"&:hover": {
|
|
38879
|
+
borderWidth: 2,
|
|
38880
|
+
bgcolor: "primary.main",
|
|
38881
|
+
color: "primary.contrastText",
|
|
38882
|
+
transform: "translateY(-1px)",
|
|
38883
|
+
boxShadow: 2
|
|
38884
|
+
}
|
|
38885
|
+
},
|
|
38886
|
+
onClick: (event) => {
|
|
38887
|
+
event.stopPropagation();
|
|
38888
|
+
onPreview();
|
|
38889
|
+
},
|
|
38890
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Search4.default, { sx: { fontSize: { xs: "1rem", sm: "1.1rem" } } }),
|
|
38891
|
+
children: "Preview"
|
|
38892
|
+
}
|
|
38893
|
+
) })
|
|
38894
|
+
]
|
|
38895
|
+
}
|
|
38896
|
+
)
|
|
38897
|
+
}
|
|
38898
|
+
);
|
|
38899
|
+
var SeedPacksTab = () => {
|
|
38900
|
+
const { settings } = usePackageSettingsStore();
|
|
38901
|
+
const authStore = useAuthenticationStore();
|
|
38902
|
+
const gatewayConfigured = Boolean(settings?.gatewayApiUrl);
|
|
38903
|
+
const isTeamScope = Boolean(authStore.user?.teamSid);
|
|
38904
|
+
const seedPackAdminRoles = /* @__PURE__ */ new Set(["admin", "super-user", "team_admin", "team_owner"]);
|
|
38905
|
+
const userRoles = authStore.user?.roles ?? [];
|
|
38906
|
+
const canManage = userRoles.some((role) => seedPackAdminRoles.has(role));
|
|
38907
|
+
const [seedPacks, setSeedPacks] = (0, import_react52.useState)([]);
|
|
38908
|
+
const [selectedSid, setSelectedSid] = (0, import_react52.useState)(null);
|
|
38909
|
+
const [selectedSeedPack, setSelectedSeedPack] = (0, import_react52.useState)(null);
|
|
38910
|
+
const [draft, setDraft] = (0, import_react52.useState)({
|
|
38911
|
+
name: "",
|
|
38912
|
+
description: "",
|
|
38913
|
+
content: ""
|
|
38914
|
+
});
|
|
38915
|
+
const [tagsInput, setTagsInput] = (0, import_react52.useState)("");
|
|
38916
|
+
const [importedFiles, setImportedFiles] = (0, import_react52.useState)([]);
|
|
38917
|
+
const [createImportedFiles, setCreateImportedFiles] = (0, import_react52.useState)([]);
|
|
38918
|
+
const [previewFile, setPreviewFile] = (0, import_react52.useState)(null);
|
|
38919
|
+
const fileInputRef = (0, import_react52.useRef)(null);
|
|
38920
|
+
const createFileInputRef = (0, import_react52.useRef)(null);
|
|
38921
|
+
const [isLoadingList, setIsLoadingList] = (0, import_react52.useState)(false);
|
|
38922
|
+
const [isLoadingDetail, setIsLoadingDetail] = (0, import_react52.useState)(false);
|
|
38923
|
+
const [isSaving, setIsSaving] = (0, import_react52.useState)(false);
|
|
38924
|
+
const [isPublishing, setIsPublishing] = (0, import_react52.useState)(false);
|
|
38925
|
+
const [isArchiving, setIsArchiving] = (0, import_react52.useState)(false);
|
|
38926
|
+
const [isCreating, setIsCreating] = (0, import_react52.useState)(false);
|
|
38927
|
+
const [createDialogOpen, setCreateDialogOpen] = (0, import_react52.useState)(false);
|
|
38928
|
+
const [publishDialogOpen, setPublishDialogOpen] = (0, import_react52.useState)(false);
|
|
38929
|
+
const [archiveDialogOpen, setArchiveDialogOpen] = (0, import_react52.useState)(false);
|
|
38930
|
+
const [newPackName, setNewPackName] = (0, import_react52.useState)("");
|
|
38931
|
+
const [newPackDescription, setNewPackDescription] = (0, import_react52.useState)("");
|
|
38932
|
+
const [newPackTags, setNewPackTags] = (0, import_react52.useState)("");
|
|
38933
|
+
const [snackbarOpen, setSnackbarOpen] = (0, import_react52.useState)(false);
|
|
38934
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react52.useState)("");
|
|
38935
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react52.useState)("success");
|
|
38936
|
+
const parsedTags = (0, import_react52.useMemo)(() => parseTags(tagsInput), [tagsInput]);
|
|
38937
|
+
const normalizedSelectedTags = (0, import_react52.useMemo)(
|
|
38938
|
+
() => normalizeTags(selectedSeedPack?.tags),
|
|
38939
|
+
[selectedSeedPack?.tags]
|
|
38940
|
+
);
|
|
38941
|
+
const isDirty = (0, import_react52.useMemo)(() => {
|
|
38942
|
+
if (!selectedSeedPack) {
|
|
38943
|
+
return false;
|
|
38944
|
+
}
|
|
38945
|
+
const nameChanged = draft.name.trim() !== (selectedSeedPack.name ?? "").trim();
|
|
38946
|
+
const descriptionChanged = draft.description.trim() !== (selectedSeedPack.description ?? "").trim();
|
|
38947
|
+
const contentChanged = draft.content !== (selectedSeedPack.content ?? "");
|
|
38948
|
+
const tagsChanged = !areArraysEqual(parsedTags, normalizedSelectedTags);
|
|
38949
|
+
return nameChanged || descriptionChanged || contentChanged || tagsChanged;
|
|
38950
|
+
}, [draft, parsedTags, normalizedSelectedTags, selectedSeedPack]);
|
|
38951
|
+
const isReadOnly = !canManage || selectedSeedPack?.status === "archived";
|
|
38952
|
+
const sortedSeedPacks = (0, import_react52.useMemo)(() => {
|
|
38953
|
+
return [...seedPacks].sort((a, b) => getSeedPackTimestamp(b) - getSeedPackTimestamp(a));
|
|
38954
|
+
}, [seedPacks]);
|
|
38955
|
+
const scopeLabel = isTeamScope ? "Team scope" : "Personal scope";
|
|
38956
|
+
const scopeDescription = isTeamScope ? "Applies to all members of your team." : "Applies only to your account.";
|
|
38957
|
+
const showSnackbar = (0, import_react52.useCallback)((message, severity) => {
|
|
38958
|
+
setSnackbarMessage(message);
|
|
38959
|
+
setSnackbarSeverity(severity);
|
|
38960
|
+
setSnackbarOpen(true);
|
|
38961
|
+
}, []);
|
|
38962
|
+
const hydrateDraft = (0, import_react52.useCallback)((pack) => {
|
|
38963
|
+
setDraft({
|
|
38964
|
+
name: pack.name ?? "",
|
|
38965
|
+
description: pack.description ?? "",
|
|
38966
|
+
content: pack.content ?? ""
|
|
38967
|
+
});
|
|
38968
|
+
setTagsInput((pack.tags ?? []).join(", "));
|
|
38969
|
+
setImportedFiles([]);
|
|
38970
|
+
setPreviewFile(null);
|
|
38971
|
+
}, []);
|
|
38972
|
+
const resetCreateDialog = (0, import_react52.useCallback)(() => {
|
|
38973
|
+
setCreateDialogOpen(false);
|
|
38974
|
+
setNewPackName("");
|
|
38975
|
+
setNewPackDescription("");
|
|
38976
|
+
setNewPackTags("");
|
|
38977
|
+
setCreateImportedFiles([]);
|
|
38978
|
+
}, []);
|
|
38979
|
+
const refreshSeedPacks = (0, import_react52.useCallback)(
|
|
38980
|
+
async (nextSelectedSid) => {
|
|
38981
|
+
if (!gatewayConfigured) {
|
|
38982
|
+
return;
|
|
38983
|
+
}
|
|
38984
|
+
setIsLoadingList(true);
|
|
38985
|
+
try {
|
|
38986
|
+
const packs = await listSeedPacks();
|
|
38987
|
+
setSeedPacks(packs);
|
|
38988
|
+
const activeSid = nextSelectedSid ?? selectedSid;
|
|
38989
|
+
if (activeSid && !packs.some((pack) => pack.sid === activeSid)) {
|
|
38990
|
+
setSelectedSid(null);
|
|
38991
|
+
setSelectedSeedPack(null);
|
|
38992
|
+
}
|
|
38993
|
+
} catch (error) {
|
|
38994
|
+
showSnackbar("Failed to load seed packs.", "error");
|
|
38995
|
+
debugLogger.error("SeedPacksTab: failed to load seed packs", {
|
|
38996
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38997
|
+
});
|
|
38998
|
+
} finally {
|
|
38999
|
+
setIsLoadingList(false);
|
|
39000
|
+
}
|
|
39001
|
+
},
|
|
39002
|
+
[gatewayConfigured, selectedSid, showSnackbar]
|
|
39003
|
+
);
|
|
39004
|
+
const loadSeedPackDetail = (0, import_react52.useCallback)(
|
|
39005
|
+
async (sid) => {
|
|
39006
|
+
if (!gatewayConfigured) {
|
|
39007
|
+
return;
|
|
39008
|
+
}
|
|
39009
|
+
setIsLoadingDetail(true);
|
|
39010
|
+
try {
|
|
39011
|
+
const pack = await getSeedPack(sid);
|
|
39012
|
+
setSelectedSeedPack(pack);
|
|
39013
|
+
hydrateDraft(pack);
|
|
39014
|
+
} catch (error) {
|
|
39015
|
+
showSnackbar("Failed to load seed pack details.", "error");
|
|
39016
|
+
debugLogger.error("SeedPacksTab: failed to load seed pack details", {
|
|
39017
|
+
sid,
|
|
39018
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39019
|
+
});
|
|
39020
|
+
} finally {
|
|
39021
|
+
setIsLoadingDetail(false);
|
|
39022
|
+
}
|
|
39023
|
+
},
|
|
39024
|
+
[gatewayConfigured, hydrateDraft, showSnackbar]
|
|
39025
|
+
);
|
|
39026
|
+
(0, import_react52.useEffect)(() => {
|
|
39027
|
+
void refreshSeedPacks();
|
|
39028
|
+
}, [refreshSeedPacks, authStore.token]);
|
|
39029
|
+
(0, import_react52.useEffect)(() => {
|
|
39030
|
+
if (selectedSid) {
|
|
39031
|
+
void loadSeedPackDetail(selectedSid);
|
|
39032
|
+
}
|
|
39033
|
+
}, [selectedSid, loadSeedPackDetail]);
|
|
39034
|
+
const handleSelectPack = (pack) => {
|
|
39035
|
+
setSelectedSid(pack.sid);
|
|
39036
|
+
setSelectedSeedPack(pack);
|
|
39037
|
+
hydrateDraft(pack);
|
|
39038
|
+
};
|
|
39039
|
+
const handleImportFiles = (0, import_react52.useCallback)(
|
|
39040
|
+
async (files) => {
|
|
39041
|
+
if (!files || files.length === 0) {
|
|
39042
|
+
return;
|
|
39043
|
+
}
|
|
39044
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
39045
|
+
if (skipped > 0) {
|
|
39046
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
39047
|
+
}
|
|
39048
|
+
if (imported.length === 0) {
|
|
39049
|
+
return;
|
|
39050
|
+
}
|
|
39051
|
+
try {
|
|
39052
|
+
const newlyAdded = imported.filter(
|
|
39053
|
+
(file) => !importedFiles.some((existing) => existing.name === file.name)
|
|
39054
|
+
);
|
|
39055
|
+
setImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
39056
|
+
const combined = buildMarkdownContent(newlyAdded);
|
|
39057
|
+
if (combined.length > 0) {
|
|
39058
|
+
setDraft((prev) => {
|
|
39059
|
+
const current = prev.content.trim();
|
|
39060
|
+
const nextContent = current ? `${current}
|
|
39061
|
+
|
|
39062
|
+
---
|
|
39063
|
+
|
|
39064
|
+
${combined}` : combined;
|
|
39065
|
+
return { ...prev, content: nextContent };
|
|
39066
|
+
});
|
|
39067
|
+
}
|
|
39068
|
+
showSnackbar(
|
|
39069
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} into the editor.`,
|
|
39070
|
+
"success"
|
|
39071
|
+
);
|
|
39072
|
+
} catch (error) {
|
|
39073
|
+
showSnackbar("Failed to import markdown files.", "error");
|
|
39074
|
+
debugLogger.error("SeedPacksTab: failed to import markdown files", {
|
|
39075
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39076
|
+
});
|
|
39077
|
+
}
|
|
39078
|
+
},
|
|
39079
|
+
[importedFiles, showSnackbar]
|
|
39080
|
+
);
|
|
39081
|
+
const handleFileInputChange = (0, import_react52.useCallback)(
|
|
39082
|
+
async (event) => {
|
|
39083
|
+
await handleImportFiles(event.target.files);
|
|
39084
|
+
event.target.value = "";
|
|
39085
|
+
},
|
|
39086
|
+
[handleImportFiles]
|
|
39087
|
+
);
|
|
39088
|
+
const handleRemoveImportedFile = (0, import_react52.useCallback)((id) => {
|
|
39089
|
+
setImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
39090
|
+
}, []);
|
|
39091
|
+
const handleCreateImportFiles = (0, import_react52.useCallback)(
|
|
39092
|
+
async (files) => {
|
|
39093
|
+
if (!files || files.length === 0) {
|
|
39094
|
+
return;
|
|
39095
|
+
}
|
|
39096
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
39097
|
+
if (skipped > 0) {
|
|
39098
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
39099
|
+
}
|
|
39100
|
+
if (imported.length === 0) {
|
|
39101
|
+
return;
|
|
39102
|
+
}
|
|
39103
|
+
setCreateImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
39104
|
+
showSnackbar(
|
|
39105
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} for this seed pack.`,
|
|
39106
|
+
"success"
|
|
39107
|
+
);
|
|
39108
|
+
},
|
|
39109
|
+
[showSnackbar]
|
|
39110
|
+
);
|
|
39111
|
+
const handleCreateFileInputChange = (0, import_react52.useCallback)(
|
|
39112
|
+
async (event) => {
|
|
39113
|
+
await handleCreateImportFiles(event.target.files);
|
|
39114
|
+
event.target.value = "";
|
|
39115
|
+
},
|
|
39116
|
+
[handleCreateImportFiles]
|
|
39117
|
+
);
|
|
39118
|
+
const handleRemoveCreateImportedFile = (0, import_react52.useCallback)((id) => {
|
|
39119
|
+
setCreateImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
39120
|
+
}, []);
|
|
39121
|
+
const buildDraftPayload2 = (0, import_react52.useCallback)(() => {
|
|
39122
|
+
const name = draft.name.trim();
|
|
39123
|
+
if (!name) {
|
|
39124
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
39125
|
+
return null;
|
|
39126
|
+
}
|
|
39127
|
+
return {
|
|
39128
|
+
name,
|
|
39129
|
+
description: draft.description.trim(),
|
|
39130
|
+
content: draft.content,
|
|
39131
|
+
tags: parsedTags,
|
|
39132
|
+
contentType: "markdown"
|
|
39133
|
+
};
|
|
39134
|
+
}, [draft, parsedTags, showSnackbar]);
|
|
39135
|
+
const saveDraft = (0, import_react52.useCallback)(async () => {
|
|
39136
|
+
if (!selectedSeedPack) {
|
|
39137
|
+
return null;
|
|
39138
|
+
}
|
|
39139
|
+
const payload = buildDraftPayload2();
|
|
39140
|
+
if (!payload) {
|
|
39141
|
+
return null;
|
|
39142
|
+
}
|
|
39143
|
+
setIsSaving(true);
|
|
39144
|
+
try {
|
|
39145
|
+
const updated = await updateSeedPack(selectedSeedPack.sid, payload);
|
|
39146
|
+
setSelectedSeedPack(updated);
|
|
39147
|
+
hydrateDraft(updated);
|
|
39148
|
+
await refreshSeedPacks(updated.sid);
|
|
39149
|
+
return updated;
|
|
39150
|
+
} catch (error) {
|
|
39151
|
+
showSnackbar("Failed to save seed pack.", "error");
|
|
39152
|
+
debugLogger.error("SeedPacksTab: failed to save seed pack", {
|
|
39153
|
+
sid: selectedSeedPack.sid,
|
|
39154
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39155
|
+
});
|
|
39156
|
+
return null;
|
|
39157
|
+
} finally {
|
|
39158
|
+
setIsSaving(false);
|
|
39159
|
+
}
|
|
39160
|
+
}, [selectedSeedPack, buildDraftPayload2, hydrateDraft, refreshSeedPacks, showSnackbar]);
|
|
39161
|
+
const handleSaveDraft = async () => {
|
|
39162
|
+
const updated = await saveDraft();
|
|
39163
|
+
if (updated) {
|
|
39164
|
+
showSnackbar("Seed pack saved.", "success");
|
|
39165
|
+
}
|
|
39166
|
+
};
|
|
39167
|
+
const handleResetDraft = () => {
|
|
39168
|
+
if (selectedSeedPack) {
|
|
39169
|
+
hydrateDraft(selectedSeedPack);
|
|
39170
|
+
}
|
|
39171
|
+
};
|
|
39172
|
+
const handleCreateSeedPack = async () => {
|
|
39173
|
+
const name = newPackName.trim();
|
|
39174
|
+
if (!name) {
|
|
39175
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
39176
|
+
return;
|
|
39177
|
+
}
|
|
39178
|
+
const importedContent = buildMarkdownContent(createImportedFiles);
|
|
39179
|
+
const payload = {
|
|
39180
|
+
name,
|
|
39181
|
+
description: newPackDescription.trim(),
|
|
39182
|
+
tags: parseTags(newPackTags),
|
|
39183
|
+
content: importedContent,
|
|
39184
|
+
contentType: "markdown"
|
|
39185
|
+
};
|
|
39186
|
+
setIsCreating(true);
|
|
39187
|
+
try {
|
|
39188
|
+
const created = await createSeedPack(payload);
|
|
39189
|
+
resetCreateDialog();
|
|
39190
|
+
await refreshSeedPacks(created.sid);
|
|
39191
|
+
setSelectedSid(created.sid);
|
|
39192
|
+
setSelectedSeedPack(created);
|
|
39193
|
+
hydrateDraft(created);
|
|
39194
|
+
if (createImportedFiles.length > 0) {
|
|
39195
|
+
setImportedFiles(createImportedFiles);
|
|
39196
|
+
}
|
|
39197
|
+
setCreateImportedFiles([]);
|
|
39198
|
+
showSnackbar("Seed pack created.", "success");
|
|
39199
|
+
} catch (error) {
|
|
39200
|
+
showSnackbar("Failed to create seed pack.", "error");
|
|
39201
|
+
debugLogger.error("SeedPacksTab: failed to create seed pack", {
|
|
39202
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39203
|
+
});
|
|
39204
|
+
} finally {
|
|
39205
|
+
setIsCreating(false);
|
|
39206
|
+
}
|
|
39207
|
+
};
|
|
39208
|
+
const handlePublish = async () => {
|
|
39209
|
+
if (!selectedSeedPack) {
|
|
39210
|
+
return;
|
|
39211
|
+
}
|
|
39212
|
+
setPublishDialogOpen(false);
|
|
39213
|
+
setIsPublishing(true);
|
|
39214
|
+
try {
|
|
39215
|
+
if (isDirty) {
|
|
39216
|
+
const saved = await saveDraft();
|
|
39217
|
+
if (!saved) {
|
|
39218
|
+
return;
|
|
39219
|
+
}
|
|
39220
|
+
}
|
|
39221
|
+
const published = await publishSeedPack(selectedSeedPack.sid);
|
|
39222
|
+
setSelectedSeedPack(published);
|
|
39223
|
+
hydrateDraft(published);
|
|
39224
|
+
await refreshSeedPacks(published.sid);
|
|
39225
|
+
showSnackbar("Seed pack published.", "success");
|
|
39226
|
+
} catch (error) {
|
|
39227
|
+
showSnackbar("Failed to publish seed pack.", "error");
|
|
39228
|
+
debugLogger.error("SeedPacksTab: failed to publish seed pack", {
|
|
39229
|
+
sid: selectedSeedPack.sid,
|
|
39230
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39231
|
+
});
|
|
39232
|
+
} finally {
|
|
39233
|
+
setIsPublishing(false);
|
|
39234
|
+
}
|
|
39235
|
+
};
|
|
39236
|
+
const handleArchive = async () => {
|
|
39237
|
+
if (!selectedSeedPack) {
|
|
39238
|
+
return;
|
|
39239
|
+
}
|
|
39240
|
+
setArchiveDialogOpen(false);
|
|
39241
|
+
setIsArchiving(true);
|
|
39242
|
+
try {
|
|
39243
|
+
const archived = await archiveSeedPack(selectedSeedPack.sid);
|
|
39244
|
+
setSelectedSeedPack(archived);
|
|
39245
|
+
hydrateDraft(archived);
|
|
39246
|
+
await refreshSeedPacks(archived.sid);
|
|
39247
|
+
showSnackbar("Seed pack archived.", "success");
|
|
39248
|
+
} catch (error) {
|
|
39249
|
+
showSnackbar("Failed to archive seed pack.", "error");
|
|
39250
|
+
debugLogger.error("SeedPacksTab: failed to archive seed pack", {
|
|
39251
|
+
sid: selectedSeedPack.sid,
|
|
39252
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39253
|
+
});
|
|
39254
|
+
} finally {
|
|
39255
|
+
setIsArchiving(false);
|
|
39256
|
+
}
|
|
39257
|
+
};
|
|
39258
|
+
const previewContent = draft.content.trim().length > 0 ? draft.content : "Preview will appear here as you type.";
|
|
39259
|
+
const selectedStatus = selectedSeedPack?.status ?? "draft";
|
|
39260
|
+
const statusChip = getStatusChip(selectedStatus);
|
|
39261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
39262
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
39263
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39264
|
+
import_material42.Stack,
|
|
39265
|
+
{
|
|
39266
|
+
direction: { xs: "column", md: "row" },
|
|
39267
|
+
spacing: { xs: 1.5, md: 2 },
|
|
39268
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
39269
|
+
justifyContent: "space-between",
|
|
39270
|
+
children: [
|
|
39271
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39272
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39273
|
+
import_material42.Typography,
|
|
39274
|
+
{
|
|
39275
|
+
variant: "h5",
|
|
39276
|
+
color: "text.primary",
|
|
39277
|
+
sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.55rem", md: "1.8rem" } },
|
|
39278
|
+
children: "Seed Packs"
|
|
39279
|
+
}
|
|
39280
|
+
),
|
|
39281
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body1", color: "text.secondary", children: "Curated internal knowledge that is always available to assistants, without showing up as visible sources." })
|
|
39282
|
+
] }),
|
|
39283
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39284
|
+
import_material42.Chip,
|
|
39285
|
+
{
|
|
39286
|
+
icon: isTeamScope ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Group2.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, {}),
|
|
39287
|
+
label: scopeLabel,
|
|
39288
|
+
color: "info",
|
|
39289
|
+
variant: "outlined"
|
|
39290
|
+
}
|
|
39291
|
+
) })
|
|
39292
|
+
]
|
|
39293
|
+
}
|
|
39294
|
+
),
|
|
39295
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: scopeDescription })
|
|
39296
|
+
] }),
|
|
39297
|
+
!gatewayConfigured && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { severity: "warning", sx: { mb: 2 }, children: "Gateway API is not configured. Seed packs require a gateway URL in package settings." }),
|
|
39298
|
+
gatewayConfigured && !canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { severity: "info", sx: { mb: 2 }, children: "You have view-only access. Admin rights are required to create, publish, or archive team seed packs." }),
|
|
39299
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39300
|
+
import_material42.Box,
|
|
39301
|
+
{
|
|
39302
|
+
sx: {
|
|
39303
|
+
display: "grid",
|
|
39304
|
+
gridTemplateColumns: { xs: "1fr", md: "320px 1fr" },
|
|
39305
|
+
gap: { xs: 2, md: 3 }
|
|
39306
|
+
},
|
|
39307
|
+
children: [
|
|
39308
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Card, { sx: { height: "fit-content" }, children: [
|
|
39309
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.CardContent, { sx: { pb: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
39310
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Packs" }),
|
|
39311
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, children: [
|
|
39312
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39313
|
+
import_material42.Button,
|
|
39314
|
+
{
|
|
39315
|
+
size: "small",
|
|
39316
|
+
variant: "outlined",
|
|
39317
|
+
onClick: () => refreshSeedPacks(),
|
|
39318
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Refresh3.default, {}),
|
|
39319
|
+
disabled: !gatewayConfigured || isLoadingList,
|
|
39320
|
+
children: "Refresh"
|
|
39321
|
+
}
|
|
39322
|
+
),
|
|
39323
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39324
|
+
import_material42.Button,
|
|
39325
|
+
{
|
|
39326
|
+
size: "small",
|
|
39327
|
+
variant: "contained",
|
|
39328
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Add2.default, {}),
|
|
39329
|
+
onClick: () => setCreateDialogOpen(true),
|
|
39330
|
+
disabled: !gatewayConfigured,
|
|
39331
|
+
children: "New"
|
|
39332
|
+
}
|
|
39333
|
+
)
|
|
39334
|
+
] })
|
|
39335
|
+
] }) }),
|
|
39336
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, {}),
|
|
39337
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { px: 2, pb: 2 }, children: [
|
|
39338
|
+
isLoadingList && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.LinearProgress, { sx: { mb: 2 } }),
|
|
39339
|
+
sortedSeedPacks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body2", color: "text.secondary", children: "No seed packs yet. Create one to start sharing internal knowledge." }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.List, { sx: { px: 0 }, children: sortedSeedPacks.map((pack) => {
|
|
39340
|
+
const status = getStatusChip(pack.status);
|
|
39341
|
+
const tags = normalizeTags(pack.tags);
|
|
39342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39343
|
+
import_material42.ListItemButton,
|
|
39344
|
+
{
|
|
39345
|
+
selected: pack.sid === selectedSid,
|
|
39346
|
+
onClick: () => handleSelectPack(pack),
|
|
39347
|
+
sx: {
|
|
39348
|
+
mb: 1,
|
|
39349
|
+
borderRadius: 2,
|
|
39350
|
+
alignItems: "flex-start",
|
|
39351
|
+
border: pack.sid === selectedSid ? "1px solid" : "1px solid transparent",
|
|
39352
|
+
borderColor: pack.sid === selectedSid ? "primary.main" : "transparent"
|
|
39353
|
+
},
|
|
39354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { flex: 1 }, children: [
|
|
39355
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, alignItems: "center", sx: { mb: 0.5 }, children: [
|
|
39356
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: pack.name }),
|
|
39357
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: status.label, color: status.color })
|
|
39358
|
+
] }),
|
|
39359
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: [
|
|
39360
|
+
pack.version ? `v${pack.version}` : "v0",
|
|
39361
|
+
" | Last published:",
|
|
39362
|
+
" ",
|
|
39363
|
+
formatTimestamp(pack.publishedAt)
|
|
39364
|
+
] }),
|
|
39365
|
+
tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Stack, { direction: "row", spacing: 0.5, flexWrap: "wrap", sx: { mt: 1 }, children: tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: tag, variant: "outlined" }, tag)) })
|
|
39366
|
+
] })
|
|
39367
|
+
},
|
|
39368
|
+
pack.sid
|
|
39369
|
+
);
|
|
39370
|
+
}) })
|
|
39371
|
+
] })
|
|
39372
|
+
] }),
|
|
39373
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.CardContent, { children: [
|
|
39374
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
39375
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39376
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: selectedSeedPack ? "Seed Pack Editor" : "Seed Pack Details" }),
|
|
39377
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body2", color: "text.secondary", children: "Draft content stays internal and is never shown as user-facing sources." })
|
|
39378
|
+
] }),
|
|
39379
|
+
selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
39380
|
+
isDirty && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: "Unsaved changes", color: "warning" }),
|
|
39381
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: statusChip.label, color: statusChip.color })
|
|
39382
|
+
] })
|
|
39383
|
+
] }),
|
|
39384
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, { sx: { my: 2 } }),
|
|
39385
|
+
!selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39386
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Select a seed pack from the list or create a new one to begin editing." }),
|
|
39387
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39388
|
+
import_material42.Button,
|
|
39389
|
+
{
|
|
39390
|
+
variant: "contained",
|
|
39391
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Add2.default, {}),
|
|
39392
|
+
onClick: () => setCreateDialogOpen(true),
|
|
39393
|
+
disabled: !gatewayConfigured,
|
|
39394
|
+
children: "Create seed pack"
|
|
39395
|
+
}
|
|
39396
|
+
)
|
|
39397
|
+
] }),
|
|
39398
|
+
selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { spacing: 2, children: [
|
|
39399
|
+
isLoadingDetail && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.LinearProgress, {}),
|
|
39400
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39401
|
+
import_material42.TextField,
|
|
39402
|
+
{
|
|
39403
|
+
label: "Name",
|
|
39404
|
+
value: draft.name,
|
|
39405
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, name: event.target.value })),
|
|
39406
|
+
fullWidth: true,
|
|
39407
|
+
disabled: isReadOnly
|
|
39408
|
+
}
|
|
39409
|
+
),
|
|
39410
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39411
|
+
import_material42.TextField,
|
|
39412
|
+
{
|
|
39413
|
+
label: "Description",
|
|
39414
|
+
value: draft.description,
|
|
39415
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, description: event.target.value })),
|
|
39416
|
+
fullWidth: true,
|
|
39417
|
+
multiline: true,
|
|
39418
|
+
minRows: 2,
|
|
39419
|
+
disabled: isReadOnly
|
|
39420
|
+
}
|
|
39421
|
+
),
|
|
39422
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39423
|
+
import_material42.TextField,
|
|
39424
|
+
{
|
|
39425
|
+
label: "Tags (comma separated)",
|
|
39426
|
+
value: tagsInput,
|
|
39427
|
+
onChange: (event) => setTagsInput(event.target.value),
|
|
39428
|
+
fullWidth: true,
|
|
39429
|
+
disabled: isReadOnly
|
|
39430
|
+
}
|
|
39431
|
+
),
|
|
39432
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
39433
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: scopeLabel, icon: isTeamScope ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Group2.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, {}) }),
|
|
39434
|
+
selectedSeedPack.version && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: `Version ${selectedSeedPack.version}`, variant: "outlined" }),
|
|
39435
|
+
selectedSeedPack.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: `Updated ${formatTimestamp(selectedSeedPack.updatedAt)}`, variant: "outlined" })
|
|
39436
|
+
] }),
|
|
39437
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { severity: "info", children: "Treat seed pack content as internal knowledge. Do not include instructions that override system or developer messages." }),
|
|
39438
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39439
|
+
import_material42.Box,
|
|
39440
|
+
{
|
|
39441
|
+
sx: {
|
|
39442
|
+
display: "grid",
|
|
39443
|
+
gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" },
|
|
39444
|
+
gap: 2,
|
|
39445
|
+
alignItems: "start"
|
|
39446
|
+
},
|
|
39447
|
+
children: [
|
|
39448
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39449
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39450
|
+
import_material42.Stack,
|
|
39451
|
+
{
|
|
39452
|
+
direction: { xs: "column", sm: "row" },
|
|
39453
|
+
spacing: 1,
|
|
39454
|
+
alignItems: { xs: "flex-start", sm: "center" },
|
|
39455
|
+
justifyContent: "space-between",
|
|
39456
|
+
sx: { mb: 1 },
|
|
39457
|
+
children: [
|
|
39458
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", children: "Markdown content" }),
|
|
39459
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39460
|
+
import_material42.Button,
|
|
39461
|
+
{
|
|
39462
|
+
size: "small",
|
|
39463
|
+
variant: "outlined",
|
|
39464
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
|
|
39465
|
+
onClick: () => fileInputRef.current?.click(),
|
|
39466
|
+
disabled: isReadOnly,
|
|
39467
|
+
children: "Import .md"
|
|
39468
|
+
}
|
|
39469
|
+
),
|
|
39470
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39471
|
+
"input",
|
|
39472
|
+
{
|
|
39473
|
+
ref: fileInputRef,
|
|
39474
|
+
type: "file",
|
|
39475
|
+
accept: ".md",
|
|
39476
|
+
multiple: true,
|
|
39477
|
+
onChange: handleFileInputChange,
|
|
39478
|
+
style: { display: "none" }
|
|
39479
|
+
}
|
|
39480
|
+
)
|
|
39481
|
+
]
|
|
39482
|
+
}
|
|
39483
|
+
),
|
|
39484
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1, display: "block" }, children: "Paste or import markdown files. Imports copy content into the editor." }),
|
|
39485
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39486
|
+
import_material42.TextField,
|
|
39487
|
+
{
|
|
39488
|
+
label: "Content",
|
|
39489
|
+
value: draft.content,
|
|
39490
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, content: event.target.value })),
|
|
39491
|
+
fullWidth: true,
|
|
39492
|
+
multiline: true,
|
|
39493
|
+
minRows: 12,
|
|
39494
|
+
disabled: isReadOnly
|
|
39495
|
+
}
|
|
39496
|
+
),
|
|
39497
|
+
importedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { mt: 2 }, children: [
|
|
39498
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
39499
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39500
|
+
import_material42.Box,
|
|
39501
|
+
{
|
|
39502
|
+
sx: {
|
|
39503
|
+
display: "grid",
|
|
39504
|
+
gridTemplateColumns: {
|
|
39505
|
+
xs: "1fr",
|
|
39506
|
+
sm: "repeat(2, minmax(0, 1fr))",
|
|
39507
|
+
md: "repeat(3, minmax(0, 1fr))"
|
|
39508
|
+
},
|
|
39509
|
+
gap: 2
|
|
39510
|
+
},
|
|
39511
|
+
children: importedFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39512
|
+
SeedPackFileCard,
|
|
39513
|
+
{
|
|
39514
|
+
file,
|
|
39515
|
+
isReadOnly,
|
|
39516
|
+
onPreview: () => setPreviewFile(file),
|
|
39517
|
+
onRemove: () => handleRemoveImportedFile(file.id)
|
|
39518
|
+
},
|
|
39519
|
+
file.id
|
|
39520
|
+
))
|
|
39521
|
+
}
|
|
39522
|
+
)
|
|
39523
|
+
] })
|
|
39524
|
+
] }),
|
|
39525
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Card, { variant: "outlined", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.CardContent, { children: [
|
|
39526
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Preview" }),
|
|
39527
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StreamingMarkdown_default, { content: previewContent })
|
|
39528
|
+
] }) })
|
|
39529
|
+
]
|
|
39530
|
+
}
|
|
39531
|
+
),
|
|
39532
|
+
selectedSeedPack.summary && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39533
|
+
import_material42.TextField,
|
|
39534
|
+
{
|
|
39535
|
+
label: "Summary (auto-generated)",
|
|
39536
|
+
value: selectedSeedPack.summary,
|
|
39537
|
+
fullWidth: true,
|
|
39538
|
+
multiline: true,
|
|
39539
|
+
minRows: 3,
|
|
39540
|
+
InputProps: { readOnly: true }
|
|
39541
|
+
}
|
|
39542
|
+
),
|
|
39543
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, flexWrap: "wrap", children: [
|
|
39544
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39545
|
+
import_material42.Button,
|
|
39546
|
+
{
|
|
39547
|
+
variant: "outlined",
|
|
39548
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Save2.default, {}),
|
|
39549
|
+
onClick: handleSaveDraft,
|
|
39550
|
+
disabled: isReadOnly || !isDirty || isSaving,
|
|
39551
|
+
children: isSaving ? "Saving..." : "Save draft"
|
|
39552
|
+
}
|
|
39553
|
+
),
|
|
39554
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39555
|
+
import_material42.Button,
|
|
39556
|
+
{
|
|
39557
|
+
variant: "outlined",
|
|
39558
|
+
onClick: handleResetDraft,
|
|
39559
|
+
disabled: !isDirty || isReadOnly,
|
|
39560
|
+
children: "Reset changes"
|
|
39561
|
+
}
|
|
39562
|
+
),
|
|
39563
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39564
|
+
import_material42.Button,
|
|
39565
|
+
{
|
|
39566
|
+
variant: "contained",
|
|
39567
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Publish.default, {}),
|
|
39568
|
+
onClick: () => setPublishDialogOpen(true),
|
|
39569
|
+
disabled: isReadOnly || isPublishing,
|
|
39570
|
+
children: isPublishing ? "Publishing..." : "Publish"
|
|
39571
|
+
}
|
|
39572
|
+
),
|
|
39573
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39574
|
+
import_material42.Button,
|
|
39575
|
+
{
|
|
39576
|
+
variant: "text",
|
|
39577
|
+
color: "error",
|
|
39578
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Archive.default, {}),
|
|
39579
|
+
onClick: () => setArchiveDialogOpen(true),
|
|
39580
|
+
disabled: isReadOnly || isArchiving,
|
|
39581
|
+
children: isArchiving ? "Archiving..." : "Archive"
|
|
39582
|
+
}
|
|
39583
|
+
)
|
|
39584
|
+
] })
|
|
39585
|
+
] })
|
|
39586
|
+
] }) })
|
|
39587
|
+
]
|
|
39588
|
+
}
|
|
39589
|
+
),
|
|
39590
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: createDialogOpen, onClose: resetCreateDialog, maxWidth: "sm", fullWidth: true, children: [
|
|
39591
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Create seed pack" }),
|
|
39592
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContent, { children: [
|
|
39593
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContentText, { sx: { mb: 2 }, children: [
|
|
39594
|
+
"Seed packs are scoped automatically based on your sign-in. ",
|
|
39595
|
+
scopeLabel,
|
|
39596
|
+
" - ",
|
|
39597
|
+
scopeDescription
|
|
39598
|
+
] }),
|
|
39599
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { spacing: 2, children: [
|
|
39600
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39601
|
+
import_material42.TextField,
|
|
39602
|
+
{
|
|
39603
|
+
label: "Name",
|
|
39604
|
+
value: newPackName,
|
|
39605
|
+
onChange: (event) => setNewPackName(event.target.value),
|
|
39606
|
+
fullWidth: true,
|
|
39607
|
+
autoFocus: true
|
|
39608
|
+
}
|
|
39609
|
+
),
|
|
39610
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39611
|
+
import_material42.TextField,
|
|
39612
|
+
{
|
|
39613
|
+
label: "Description",
|
|
39614
|
+
value: newPackDescription,
|
|
39615
|
+
onChange: (event) => setNewPackDescription(event.target.value),
|
|
39616
|
+
fullWidth: true,
|
|
39617
|
+
multiline: true,
|
|
39618
|
+
minRows: 2
|
|
39619
|
+
}
|
|
39620
|
+
),
|
|
39621
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39622
|
+
import_material42.TextField,
|
|
39623
|
+
{
|
|
39624
|
+
label: "Tags (comma separated)",
|
|
39625
|
+
value: newPackTags,
|
|
39626
|
+
onChange: (event) => setNewPackTags(event.target.value),
|
|
39627
|
+
fullWidth: true
|
|
39628
|
+
}
|
|
39629
|
+
),
|
|
39630
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, {}),
|
|
39631
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, alignItems: "center", children: [
|
|
39632
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39633
|
+
import_material42.Button,
|
|
39634
|
+
{
|
|
39635
|
+
size: "small",
|
|
39636
|
+
variant: "outlined",
|
|
39637
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
|
|
39638
|
+
onClick: () => createFileInputRef.current?.click(),
|
|
39639
|
+
disabled: !canManage,
|
|
39640
|
+
children: "Import .md files"
|
|
39641
|
+
}
|
|
39642
|
+
),
|
|
39643
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: "Optional. Files are merged into the draft content." }),
|
|
39644
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39645
|
+
"input",
|
|
39646
|
+
{
|
|
39647
|
+
ref: createFileInputRef,
|
|
39648
|
+
type: "file",
|
|
39649
|
+
accept: ".md",
|
|
39650
|
+
multiple: true,
|
|
39651
|
+
onChange: handleCreateFileInputChange,
|
|
39652
|
+
style: { display: "none" }
|
|
39653
|
+
}
|
|
39654
|
+
)
|
|
39655
|
+
] }),
|
|
39656
|
+
createImportedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39657
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
39658
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39659
|
+
import_material42.Box,
|
|
39660
|
+
{
|
|
39661
|
+
sx: {
|
|
39662
|
+
display: "grid",
|
|
39663
|
+
gridTemplateColumns: {
|
|
39664
|
+
xs: "1fr",
|
|
39665
|
+
sm: "repeat(2, minmax(0, 1fr))"
|
|
39666
|
+
},
|
|
39667
|
+
gap: 2
|
|
39668
|
+
},
|
|
39669
|
+
children: createImportedFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39670
|
+
SeedPackFileCard,
|
|
39671
|
+
{
|
|
39672
|
+
file,
|
|
39673
|
+
isReadOnly: !canManage,
|
|
39674
|
+
onPreview: () => setPreviewFile(file),
|
|
39675
|
+
onRemove: () => handleRemoveCreateImportedFile(file.id)
|
|
39676
|
+
},
|
|
39677
|
+
file.id
|
|
39678
|
+
))
|
|
39679
|
+
}
|
|
39680
|
+
)
|
|
39681
|
+
] })
|
|
39682
|
+
] })
|
|
39683
|
+
] }),
|
|
39684
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39685
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: resetCreateDialog, children: "Cancel" }),
|
|
39686
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39687
|
+
import_material42.Button,
|
|
39688
|
+
{
|
|
39689
|
+
variant: "contained",
|
|
39690
|
+
onClick: handleCreateSeedPack,
|
|
39691
|
+
disabled: !gatewayConfigured || isCreating,
|
|
39692
|
+
children: isCreating ? "Creating..." : "Create"
|
|
39693
|
+
}
|
|
39694
|
+
)
|
|
39695
|
+
] })
|
|
39696
|
+
] }),
|
|
39697
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: publishDialogOpen, onClose: () => setPublishDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
39698
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Publish seed pack" }),
|
|
39699
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContent, { children: [
|
|
39700
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogContentText, { children: "Publishing locks a new version and makes it available for internal retrieval. This content is never shown as a user-facing source." }),
|
|
39701
|
+
isDirty && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { severity: "info", sx: { mt: 2 }, children: "You have unsaved changes. They will be included in the published version." })
|
|
39702
|
+
] }),
|
|
39703
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39704
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setPublishDialogOpen(false), children: "Cancel" }),
|
|
39705
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", onClick: handlePublish, disabled: isPublishing, children: isPublishing ? "Publishing..." : "Publish" })
|
|
39706
|
+
] })
|
|
39707
|
+
] }),
|
|
39708
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: archiveDialogOpen, onClose: () => setArchiveDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
39709
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Archive seed pack" }),
|
|
39710
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogContentText, { children: "Archiving stops this seed pack from being used in new conversations. You can keep it for reference or audit history." }) }),
|
|
39711
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39712
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setArchiveDialogOpen(false), children: "Cancel" }),
|
|
39713
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", color: "error", onClick: handleArchive, disabled: isArchiving, children: isArchiving ? "Archiving..." : "Archive" })
|
|
39714
|
+
] })
|
|
39715
|
+
] }),
|
|
39716
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39717
|
+
import_material42.Dialog,
|
|
39718
|
+
{
|
|
39719
|
+
open: Boolean(previewFile),
|
|
39720
|
+
onClose: () => setPreviewFile(null),
|
|
39721
|
+
maxWidth: "md",
|
|
39722
|
+
fullWidth: true,
|
|
39723
|
+
children: [
|
|
39724
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: previewFile?.name ?? "Markdown preview" }),
|
|
39725
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StreamingMarkdown_default, { content: previewFile?.content ?? "" }) }),
|
|
39726
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setPreviewFile(null), children: "Close" }) })
|
|
39727
|
+
]
|
|
39728
|
+
}
|
|
39729
|
+
),
|
|
39730
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39731
|
+
import_material42.Snackbar,
|
|
39732
|
+
{
|
|
39733
|
+
open: snackbarOpen,
|
|
39734
|
+
autoHideDuration: 4e3,
|
|
39735
|
+
onClose: () => setSnackbarOpen(false),
|
|
39736
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
39737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { onClose: () => setSnackbarOpen(false), severity: snackbarSeverity, sx: { width: "100%" }, children: snackbarMessage })
|
|
39738
|
+
}
|
|
39739
|
+
)
|
|
39740
|
+
] });
|
|
39741
|
+
};
|
|
39742
|
+
var SeedPacksTab_default = SeedPacksTab;
|
|
39743
|
+
|
|
39744
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
39745
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
39746
|
+
var KnowledgeHubTab = (props) => {
|
|
39747
|
+
const theme = (0, import_material43.useTheme)();
|
|
39748
|
+
const isMobile = (0, import_material43.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
39749
|
+
const { seedPacksEnabled = false } = props;
|
|
39750
|
+
const [tabIndex, setTabIndex] = (0, import_react53.useState)(0);
|
|
39751
|
+
const effectiveTabIndex = seedPacksEnabled ? tabIndex : 0;
|
|
39752
|
+
(0, import_react53.useEffect)(() => {
|
|
39753
|
+
if (!seedPacksEnabled && tabIndex !== 0) {
|
|
39754
|
+
setTabIndex(0);
|
|
39755
|
+
}
|
|
39756
|
+
}, [seedPacksEnabled, tabIndex]);
|
|
39757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_material43.Box, { children: [
|
|
39758
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.Box, { sx: { px: { xs: 1.5, sm: 3, md: 4 }, pt: { xs: 1.5, md: 2 } }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
39759
|
+
import_material43.Tabs,
|
|
39760
|
+
{
|
|
39761
|
+
value: effectiveTabIndex,
|
|
39762
|
+
onChange: (_, newValue) => setTabIndex(newValue),
|
|
39763
|
+
variant: isMobile ? "fullWidth" : "standard",
|
|
39764
|
+
sx: {
|
|
39765
|
+
borderBottom: 1,
|
|
39766
|
+
borderColor: "divider",
|
|
39767
|
+
"& .MuiTab-root": {
|
|
39768
|
+
textTransform: "none",
|
|
39769
|
+
fontWeight: 600,
|
|
39770
|
+
fontSize: { xs: "0.95rem", sm: "1rem" },
|
|
39771
|
+
minWidth: { xs: "auto", md: 160 },
|
|
39772
|
+
px: { xs: 1.2, sm: 1.5 }
|
|
39773
|
+
}
|
|
39774
|
+
},
|
|
39775
|
+
children: [
|
|
39776
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39777
|
+
import_material43.Tab,
|
|
39778
|
+
{
|
|
39779
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_Description5.default, { fontSize: isMobile ? "small" : "medium" }),
|
|
39780
|
+
iconPosition: isMobile ? "top" : "start",
|
|
39781
|
+
label: "Documents"
|
|
39782
|
+
}
|
|
39783
|
+
),
|
|
39784
|
+
seedPacksEnabled && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39785
|
+
import_material43.Tab,
|
|
39786
|
+
{
|
|
39787
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_AutoStories.default, { fontSize: isMobile ? "small" : "medium" }),
|
|
39788
|
+
iconPosition: isMobile ? "top" : "start",
|
|
39789
|
+
label: "Seed Packs"
|
|
39790
|
+
}
|
|
39791
|
+
)
|
|
39792
|
+
]
|
|
39793
|
+
}
|
|
39794
|
+
) }),
|
|
39795
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.Box, { sx: { display: effectiveTabIndex === 0 ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KnowledgeTab_default, { ...props }) }),
|
|
39796
|
+
seedPacksEnabled && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.Box, { sx: { display: effectiveTabIndex === 1 ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SeedPacksTab_default, {}) })
|
|
39797
|
+
] });
|
|
39798
|
+
};
|
|
39799
|
+
var KnowledgeHubTab_default = KnowledgeHubTab;
|
|
39800
|
+
|
|
39801
|
+
// src/management/components/StorageTab.tsx
|
|
39802
|
+
var import_react54 = require("react");
|
|
39803
|
+
var import_material44 = require("@mui/material");
|
|
39804
|
+
var import_Storage = __toESM(require("@mui/icons-material/Storage"));
|
|
39805
|
+
var import_Delete7 = __toESM(require("@mui/icons-material/Delete"));
|
|
39806
|
+
var import_Refresh4 = __toESM(require("@mui/icons-material/Refresh"));
|
|
38235
39807
|
var import_Warning = __toESM(require("@mui/icons-material/Warning"));
|
|
38236
39808
|
var import_Info2 = __toESM(require("@mui/icons-material/Info"));
|
|
38237
39809
|
var import_CleaningServices = __toESM(require("@mui/icons-material/CleaningServices"));
|
|
38238
|
-
var
|
|
38239
|
-
var
|
|
39810
|
+
var import_Description6 = __toESM(require("@mui/icons-material/Description"));
|
|
39811
|
+
var import_Person4 = __toESM(require("@mui/icons-material/Person"));
|
|
38240
39812
|
var import_Chat = __toESM(require("@mui/icons-material/Chat"));
|
|
38241
39813
|
var import_Settings2 = __toESM(require("@mui/icons-material/Settings"));
|
|
38242
39814
|
var import_ExpandMore3 = __toESM(require("@mui/icons-material/ExpandMore"));
|
|
@@ -38245,7 +39817,7 @@ var import_Error3 = __toESM(require("@mui/icons-material/Error"));
|
|
|
38245
39817
|
init_debugLogger();
|
|
38246
39818
|
init_indexedDBService();
|
|
38247
39819
|
init_conversationSyncStore();
|
|
38248
|
-
var
|
|
39820
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
38249
39821
|
var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
|
|
38250
39822
|
var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
|
|
38251
39823
|
var formatBytes = (bytes) => {
|
|
@@ -38340,7 +39912,7 @@ var getIndexedDBSize = async () => {
|
|
|
38340
39912
|
}
|
|
38341
39913
|
categories.push({
|
|
38342
39914
|
name: "Knowledge Documents",
|
|
38343
|
-
icon:
|
|
39915
|
+
icon: import_Description6.default,
|
|
38344
39916
|
color: "#2196f3",
|
|
38345
39917
|
size: knowledgeSize.size,
|
|
38346
39918
|
itemCount: knowledgeSize.count,
|
|
@@ -38374,7 +39946,7 @@ var getIndexedDBSize = async () => {
|
|
|
38374
39946
|
}
|
|
38375
39947
|
categories.push({
|
|
38376
39948
|
name: "AI Memories",
|
|
38377
|
-
icon:
|
|
39949
|
+
icon: import_Person4.default,
|
|
38378
39950
|
color: "#ff9800",
|
|
38379
39951
|
size: memorySize.size,
|
|
38380
39952
|
itemCount: memorySize.count,
|
|
@@ -38429,7 +40001,7 @@ var getIndexedDBSize = async () => {
|
|
|
38429
40001
|
if (querySize.count > 0) {
|
|
38430
40002
|
categories.push({
|
|
38431
40003
|
name: "AI Query Cache",
|
|
38432
|
-
icon:
|
|
40004
|
+
icon: import_Person4.default,
|
|
38433
40005
|
color: "#ff5722",
|
|
38434
40006
|
size: querySize.size,
|
|
38435
40007
|
itemCount: querySize.count,
|
|
@@ -38541,21 +40113,21 @@ var clearEntireDatabase = async (dbName) => {
|
|
|
38541
40113
|
});
|
|
38542
40114
|
};
|
|
38543
40115
|
var StorageTab = ({ currentTheme }) => {
|
|
38544
|
-
const theme = (0,
|
|
38545
|
-
const [storageQuota, setStorageQuota] = (0,
|
|
40116
|
+
const theme = (0, import_material44.useTheme)();
|
|
40117
|
+
const [storageQuota, setStorageQuota] = (0, import_react54.useState)({
|
|
38546
40118
|
used: 0,
|
|
38547
40119
|
quota: 0,
|
|
38548
40120
|
available: 0,
|
|
38549
40121
|
browserQuotaEstimate: 0
|
|
38550
40122
|
});
|
|
38551
|
-
const [storageCategories, setStorageCategories] = (0,
|
|
38552
|
-
const [loading, setLoading] = (0,
|
|
38553
|
-
const [clearAllDialogOpen, setClearAllDialogOpen] = (0,
|
|
38554
|
-
const [clearCategoryDialog, setClearCategoryDialog] = (0,
|
|
38555
|
-
const [clearing, setClearing] = (0,
|
|
38556
|
-
const [snackbarMessage, setSnackbarMessage] = (0,
|
|
38557
|
-
const [showSnackbar, setShowSnackbar] = (0,
|
|
38558
|
-
const [snackbarSeverity, setSnackbarSeverity] = (0,
|
|
40123
|
+
const [storageCategories, setStorageCategories] = (0, import_react54.useState)([]);
|
|
40124
|
+
const [loading, setLoading] = (0, import_react54.useState)(true);
|
|
40125
|
+
const [clearAllDialogOpen, setClearAllDialogOpen] = (0, import_react54.useState)(false);
|
|
40126
|
+
const [clearCategoryDialog, setClearCategoryDialog] = (0, import_react54.useState)(null);
|
|
40127
|
+
const [clearing, setClearing] = (0, import_react54.useState)(false);
|
|
40128
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react54.useState)("");
|
|
40129
|
+
const [showSnackbar, setShowSnackbar] = (0, import_react54.useState)(false);
|
|
40130
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react54.useState)("success");
|
|
38559
40131
|
const { syncEnabled, isAdvancedVectorFeaturesEnabled } = useConversationSyncStore((state) => ({
|
|
38560
40132
|
syncEnabled: state.syncEnabled,
|
|
38561
40133
|
isAdvancedVectorFeaturesEnabled: state.isAdvancedVectorFeaturesEnabled
|
|
@@ -38607,18 +40179,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38607
40179
|
setLoading(false);
|
|
38608
40180
|
}
|
|
38609
40181
|
};
|
|
38610
|
-
(0,
|
|
40182
|
+
(0, import_react54.useEffect)(() => {
|
|
38611
40183
|
loadStorageData();
|
|
38612
40184
|
}, []);
|
|
38613
|
-
const totalUsed = (0,
|
|
40185
|
+
const totalUsed = (0, import_react54.useMemo)(() => {
|
|
38614
40186
|
return storageCategories.reduce((sum, cat) => sum + cat.size, 0);
|
|
38615
40187
|
}, [storageCategories]);
|
|
38616
|
-
const usagePercentage = (0,
|
|
40188
|
+
const usagePercentage = (0, import_react54.useMemo)(() => {
|
|
38617
40189
|
if (storageQuota.quota === 0) return 0;
|
|
38618
40190
|
const percentage = Math.min(storageQuota.used / storageQuota.quota * 100, 100);
|
|
38619
40191
|
return percentage > 0 && percentage < 0.1 ? 0.1 : percentage;
|
|
38620
40192
|
}, [storageQuota]);
|
|
38621
|
-
const clearableCategories = (0,
|
|
40193
|
+
const clearableCategories = (0, import_react54.useMemo)(() => {
|
|
38622
40194
|
return storageCategories.filter((cat) => cat.canClear);
|
|
38623
40195
|
}, [storageCategories]);
|
|
38624
40196
|
const handleClearCategory = async (category) => {
|
|
@@ -38703,13 +40275,13 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38703
40275
|
}
|
|
38704
40276
|
};
|
|
38705
40277
|
if (loading) {
|
|
38706
|
-
return /* @__PURE__ */ (0,
|
|
38707
|
-
/* @__PURE__ */ (0,
|
|
38708
|
-
/* @__PURE__ */ (0,
|
|
40278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 8 }, children: [
|
|
40279
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, {}),
|
|
40280
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body1", color: "text.secondary", sx: { ml: 2 }, children: "Analyzing storage usage..." })
|
|
38709
40281
|
] });
|
|
38710
40282
|
}
|
|
38711
|
-
return /* @__PURE__ */ (0,
|
|
38712
|
-
/* @__PURE__ */ (0,
|
|
40283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { px: { xs: 2, sm: 4, md: 6 }, pt: 3, pb: 5 }, children: [
|
|
40284
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: {
|
|
38713
40285
|
display: "flex",
|
|
38714
40286
|
flexDirection: { xs: "column", sm: "row" },
|
|
38715
40287
|
justifyContent: "space-between",
|
|
@@ -38717,19 +40289,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38717
40289
|
gap: { xs: 2, sm: 0 },
|
|
38718
40290
|
mb: 2
|
|
38719
40291
|
}, children: [
|
|
38720
|
-
/* @__PURE__ */ (0,
|
|
38721
|
-
/* @__PURE__ */ (0,
|
|
38722
|
-
/* @__PURE__ */ (0,
|
|
40292
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { flex: 1 }, children: [
|
|
40293
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h5", color: "text.primary", sx: { mb: 1, fontWeight: 600 }, children: "Storage Management" }),
|
|
40294
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body1", color: "text.secondary", children: "Monitor and manage your local browser storage usage" })
|
|
38723
40295
|
] }),
|
|
38724
|
-
/* @__PURE__ */ (0,
|
|
40296
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: {
|
|
38725
40297
|
display: "flex",
|
|
38726
40298
|
gap: 1,
|
|
38727
40299
|
flexWrap: { xs: "wrap", sm: "nowrap" },
|
|
38728
40300
|
justifyContent: { xs: "stretch", sm: "flex-end" },
|
|
38729
40301
|
width: { xs: "100%", sm: "auto" }
|
|
38730
40302
|
}, children: [
|
|
38731
|
-
/* @__PURE__ */ (0,
|
|
38732
|
-
|
|
40303
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40304
|
+
import_material44.Button,
|
|
38733
40305
|
{
|
|
38734
40306
|
variant: "outlined",
|
|
38735
40307
|
size: "small",
|
|
@@ -38741,22 +40313,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38741
40313
|
minHeight: 36
|
|
38742
40314
|
},
|
|
38743
40315
|
children: [
|
|
38744
|
-
/* @__PURE__ */ (0,
|
|
38745
|
-
/* @__PURE__ */ (0,
|
|
40316
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: { xs: "none", sm: "flex" }, alignItems: "center", gap: 1 }, children: [
|
|
40317
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Refresh4.default, { fontSize: "medium" }),
|
|
38746
40318
|
"Refresh"
|
|
38747
40319
|
] }),
|
|
38748
|
-
/* @__PURE__ */ (0,
|
|
40320
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "flex", sm: "none" }, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Refresh4.default, { fontSize: "medium" }) })
|
|
38749
40321
|
]
|
|
38750
40322
|
}
|
|
38751
40323
|
),
|
|
38752
|
-
clearableCategories.length > 0 && /* @__PURE__ */ (0,
|
|
38753
|
-
/* @__PURE__ */ (0,
|
|
38754
|
-
|
|
40324
|
+
clearableCategories.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
40325
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40326
|
+
import_material44.Button,
|
|
38755
40327
|
{
|
|
38756
40328
|
variant: "outlined",
|
|
38757
40329
|
color: "error",
|
|
38758
40330
|
size: "small",
|
|
38759
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40331
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
38760
40332
|
onClick: () => setClearAllDialogOpen(true),
|
|
38761
40333
|
sx: {
|
|
38762
40334
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -38764,18 +40336,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38764
40336
|
px: { xs: 1, sm: 2 }
|
|
38765
40337
|
},
|
|
38766
40338
|
children: [
|
|
38767
|
-
/* @__PURE__ */ (0,
|
|
38768
|
-
/* @__PURE__ */ (0,
|
|
40339
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "none", sm: "inline" } }, children: "Clear All Data" }),
|
|
40340
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "inline", sm: "none" } }, children: "Clear All" })
|
|
38769
40341
|
]
|
|
38770
40342
|
}
|
|
38771
40343
|
),
|
|
38772
|
-
/* @__PURE__ */ (0,
|
|
38773
|
-
|
|
40344
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40345
|
+
import_material44.Button,
|
|
38774
40346
|
{
|
|
38775
40347
|
variant: "outlined",
|
|
38776
40348
|
color: "error",
|
|
38777
40349
|
size: "small",
|
|
38778
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40350
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
38779
40351
|
onClick: () => handleNuclearClear(),
|
|
38780
40352
|
sx: {
|
|
38781
40353
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -38783,28 +40355,28 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38783
40355
|
px: { xs: 1, sm: 2 }
|
|
38784
40356
|
},
|
|
38785
40357
|
children: [
|
|
38786
|
-
/* @__PURE__ */ (0,
|
|
38787
|
-
/* @__PURE__ */ (0,
|
|
40358
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "none", sm: "inline" } }, children: "Nuclear Clear" }),
|
|
40359
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "inline", sm: "none" } }, children: "Nuclear" })
|
|
38788
40360
|
]
|
|
38789
40361
|
}
|
|
38790
40362
|
)
|
|
38791
40363
|
] })
|
|
38792
40364
|
] })
|
|
38793
40365
|
] }) }),
|
|
38794
|
-
/* @__PURE__ */ (0,
|
|
38795
|
-
/* @__PURE__ */ (0,
|
|
40366
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mb: 4 }, children: [
|
|
40367
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { sx: { mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { sx: {
|
|
38796
40368
|
display: "flex",
|
|
38797
40369
|
flexDirection: "column",
|
|
38798
40370
|
minHeight: 180
|
|
38799
40371
|
}, children: [
|
|
38800
|
-
/* @__PURE__ */ (0,
|
|
38801
|
-
/* @__PURE__ */ (0,
|
|
40372
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
40373
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Storage.default, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
38802
40374
|
"Storage Quota"
|
|
38803
40375
|
] }),
|
|
38804
|
-
/* @__PURE__ */ (0,
|
|
38805
|
-
/* @__PURE__ */ (0,
|
|
38806
|
-
/* @__PURE__ */ (0,
|
|
38807
|
-
|
|
40376
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mb: 2, flex: 1 }, children: [
|
|
40377
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
40378
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40379
|
+
import_material44.Chip,
|
|
38808
40380
|
{
|
|
38809
40381
|
label: `${formatBytes(storageQuota.used)} Used`,
|
|
38810
40382
|
color: "warning",
|
|
@@ -38812,8 +40384,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38812
40384
|
variant: "outlined"
|
|
38813
40385
|
}
|
|
38814
40386
|
),
|
|
38815
|
-
/* @__PURE__ */ (0,
|
|
38816
|
-
|
|
40387
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40388
|
+
import_material44.Chip,
|
|
38817
40389
|
{
|
|
38818
40390
|
label: `${formatBytes(storageQuota.available)} Available`,
|
|
38819
40391
|
color: "success",
|
|
@@ -38821,8 +40393,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38821
40393
|
variant: "outlined"
|
|
38822
40394
|
}
|
|
38823
40395
|
),
|
|
38824
|
-
/* @__PURE__ */ (0,
|
|
38825
|
-
|
|
40396
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40397
|
+
import_material44.Chip,
|
|
38826
40398
|
{
|
|
38827
40399
|
label: `${formatBytes(storageQuota.quota)} Total`,
|
|
38828
40400
|
color: "info",
|
|
@@ -38830,8 +40402,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38830
40402
|
variant: "outlined"
|
|
38831
40403
|
}
|
|
38832
40404
|
),
|
|
38833
|
-
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ (0,
|
|
38834
|
-
|
|
40405
|
+
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40406
|
+
import_material44.Chip,
|
|
38835
40407
|
{
|
|
38836
40408
|
label: `\u2248${formatBytes(storageQuota.browserQuotaEstimate)} Browser Estimate`,
|
|
38837
40409
|
color: "default",
|
|
@@ -38840,8 +40412,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38840
40412
|
}
|
|
38841
40413
|
)
|
|
38842
40414
|
] }),
|
|
38843
|
-
/* @__PURE__ */ (0,
|
|
38844
|
-
|
|
40415
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40416
|
+
import_material44.LinearProgress,
|
|
38845
40417
|
{
|
|
38846
40418
|
variant: "determinate",
|
|
38847
40419
|
value: usagePercentage,
|
|
@@ -38856,38 +40428,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38856
40428
|
}
|
|
38857
40429
|
}
|
|
38858
40430
|
),
|
|
38859
|
-
/* @__PURE__ */ (0,
|
|
40431
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "caption", color: "text.secondary", sx: { mt: 0.5, display: "block" }, children: [
|
|
38860
40432
|
usagePercentage.toFixed(1),
|
|
38861
40433
|
"% used"
|
|
38862
40434
|
] })
|
|
38863
40435
|
] }),
|
|
38864
|
-
usagePercentage > 80 && /* @__PURE__ */ (0,
|
|
40436
|
+
usagePercentage > 80 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "warning", sx: { mt: "auto" }, children: "Storage usage is high. Consider clearing unused data." })
|
|
38865
40437
|
] }) }),
|
|
38866
|
-
/* @__PURE__ */ (0,
|
|
40438
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { sx: {
|
|
38867
40439
|
display: "flex",
|
|
38868
40440
|
flexDirection: "column",
|
|
38869
40441
|
minHeight: 140
|
|
38870
40442
|
}, children: [
|
|
38871
|
-
/* @__PURE__ */ (0,
|
|
38872
|
-
/* @__PURE__ */ (0,
|
|
38873
|
-
/* @__PURE__ */ (0,
|
|
38874
|
-
|
|
40443
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: "Usage Summary" }),
|
|
40444
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
40445
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40446
|
+
import_material44.Chip,
|
|
38875
40447
|
{
|
|
38876
40448
|
label: `${storageCategories.length} Categories`,
|
|
38877
40449
|
color: "primary",
|
|
38878
40450
|
size: "small"
|
|
38879
40451
|
}
|
|
38880
40452
|
),
|
|
38881
|
-
/* @__PURE__ */ (0,
|
|
38882
|
-
|
|
40453
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40454
|
+
import_material44.Chip,
|
|
38883
40455
|
{
|
|
38884
40456
|
label: `${storageCategories.reduce((sum, cat) => sum + cat.itemCount, 0)} Items`,
|
|
38885
40457
|
color: "secondary",
|
|
38886
40458
|
size: "small"
|
|
38887
40459
|
}
|
|
38888
40460
|
),
|
|
38889
|
-
/* @__PURE__ */ (0,
|
|
38890
|
-
|
|
40461
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40462
|
+
import_material44.Chip,
|
|
38891
40463
|
{
|
|
38892
40464
|
label: `${formatBytes(totalUsed)} Used`,
|
|
38893
40465
|
color: "info",
|
|
@@ -38895,11 +40467,11 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38895
40467
|
}
|
|
38896
40468
|
)
|
|
38897
40469
|
] }),
|
|
38898
|
-
/* @__PURE__ */ (0,
|
|
40470
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
|
|
38899
40471
|
] }) })
|
|
38900
40472
|
] }),
|
|
38901
|
-
/* @__PURE__ */ (0,
|
|
38902
|
-
/* @__PURE__ */ (0,
|
|
40473
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
|
|
40474
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: {
|
|
38903
40475
|
maxHeight: "60vh",
|
|
38904
40476
|
overflow: "auto",
|
|
38905
40477
|
"&::-webkit-scrollbar": {
|
|
@@ -38907,15 +40479,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38907
40479
|
},
|
|
38908
40480
|
msOverflowStyle: "none",
|
|
38909
40481
|
scrollbarWidth: "none"
|
|
38910
|
-
}, children: storageCategories.length === 0 ? /* @__PURE__ */ (0,
|
|
38911
|
-
/* @__PURE__ */ (0,
|
|
38912
|
-
/* @__PURE__ */ (0,
|
|
38913
|
-
/* @__PURE__ */ (0,
|
|
38914
|
-
/* @__PURE__ */ (0,
|
|
38915
|
-
/* @__PURE__ */ (0,
|
|
40482
|
+
}, children: storageCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Alert, { severity: "info", sx: { mt: 2 }, children: [
|
|
40483
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", children: "No storage data found. This could mean:" }),
|
|
40484
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
|
|
40485
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "All databases are empty" }),
|
|
40486
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "Data is stored under different names" }),
|
|
40487
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "There was an error accessing the databases" })
|
|
38916
40488
|
] }),
|
|
38917
|
-
/* @__PURE__ */ (0,
|
|
38918
|
-
] }) : /* @__PURE__ */ (0,
|
|
40489
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", sx: { mt: 1 }, children: 'Try clicking "Refresh" or check the browser console for more details.' })
|
|
40490
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Stack, { spacing: 2, children: storageCategories.map((category) => {
|
|
38919
40491
|
const IconComponent = category.icon;
|
|
38920
40492
|
const categoryPercentage = storageQuota.quota > 0 ? category.size / storageQuota.quota * 100 : 0;
|
|
38921
40493
|
const categoryRelativePercentage = totalUsed > 0 ? category.size / totalUsed * 100 : 0;
|
|
@@ -38926,18 +40498,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38926
40498
|
categoryPercentage: categoryPercentage.toFixed(2),
|
|
38927
40499
|
categoryRelativePercentage: categoryRelativePercentage.toFixed(2)
|
|
38928
40500
|
});
|
|
38929
|
-
return /* @__PURE__ */ (0,
|
|
38930
|
-
/* @__PURE__ */ (0,
|
|
38931
|
-
|
|
40501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Accordion, { sx: { bgcolor: "background.paper" }, children: [
|
|
40502
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40503
|
+
import_material44.AccordionSummary,
|
|
38932
40504
|
{
|
|
38933
|
-
expandIcon: /* @__PURE__ */ (0,
|
|
40505
|
+
expandIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_ExpandMore3.default, {}),
|
|
38934
40506
|
"aria-controls": `${category.name}-content`,
|
|
38935
40507
|
id: `${category.name}-header`,
|
|
38936
|
-
children: /* @__PURE__ */ (0,
|
|
38937
|
-
/* @__PURE__ */ (0,
|
|
38938
|
-
/* @__PURE__ */ (0,
|
|
38939
|
-
/* @__PURE__ */ (0,
|
|
38940
|
-
|
|
40508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", width: "100%", pr: 2 }, children: [
|
|
40509
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(IconComponent, { sx: { color: category.color, mr: 2 } }),
|
|
40510
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { flex: 1 }, children: [
|
|
40511
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40512
|
+
import_material44.Typography,
|
|
38941
40513
|
{
|
|
38942
40514
|
variant: "body1",
|
|
38943
40515
|
style: {
|
|
@@ -38947,18 +40519,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38947
40519
|
children: category.name
|
|
38948
40520
|
}
|
|
38949
40521
|
),
|
|
38950
|
-
/* @__PURE__ */ (0,
|
|
38951
|
-
/* @__PURE__ */ (0,
|
|
38952
|
-
/* @__PURE__ */ (0,
|
|
38953
|
-
|
|
40522
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", gap: 2, mt: 0.5 }, children: [
|
|
40523
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", children: formatBytes(category.size) }),
|
|
40524
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40525
|
+
import_material44.Chip,
|
|
38954
40526
|
{
|
|
38955
40527
|
label: `${category.itemCount} items`,
|
|
38956
40528
|
size: "small",
|
|
38957
40529
|
variant: "outlined"
|
|
38958
40530
|
}
|
|
38959
40531
|
),
|
|
38960
|
-
/* @__PURE__ */ (0,
|
|
38961
|
-
|
|
40532
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { flex: 1, mx: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40533
|
+
import_material44.LinearProgress,
|
|
38962
40534
|
{
|
|
38963
40535
|
variant: "determinate",
|
|
38964
40536
|
value: Math.min(categoryRelativePercentage, 100),
|
|
@@ -38973,7 +40545,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38973
40545
|
}
|
|
38974
40546
|
}
|
|
38975
40547
|
) }),
|
|
38976
|
-
/* @__PURE__ */ (0,
|
|
40548
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "caption", color: "text.secondary", children: [
|
|
38977
40549
|
categoryRelativePercentage.toFixed(1),
|
|
38978
40550
|
"%"
|
|
38979
40551
|
] })
|
|
@@ -38982,27 +40554,27 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38982
40554
|
] })
|
|
38983
40555
|
}
|
|
38984
40556
|
),
|
|
38985
|
-
/* @__PURE__ */ (0,
|
|
38986
|
-
/* @__PURE__ */ (0,
|
|
38987
|
-
/* @__PURE__ */ (0,
|
|
38988
|
-
/* @__PURE__ */ (0,
|
|
38989
|
-
/* @__PURE__ */ (0,
|
|
38990
|
-
/* @__PURE__ */ (0,
|
|
38991
|
-
|
|
40557
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.AccordionDetails, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { pl: 5 }, children: [
|
|
40558
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", paragraph: true, children: category.description }),
|
|
40559
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "subtitle2", gutterBottom: true, children: "Storage Locations:" }),
|
|
40560
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.List, { dense: true, children: category.stores.map((store) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { sx: { py: 0.5 }, children: [
|
|
40561
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Storage.default, { fontSize: "small" }) }),
|
|
40562
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40563
|
+
import_material44.ListItemText,
|
|
38992
40564
|
{
|
|
38993
40565
|
primary: store,
|
|
38994
40566
|
primaryTypographyProps: { variant: "body2", fontFamily: "monospace" }
|
|
38995
40567
|
}
|
|
38996
40568
|
)
|
|
38997
40569
|
] }, store)) }),
|
|
38998
|
-
category.canClear ? /* @__PURE__ */ (0,
|
|
38999
|
-
/* @__PURE__ */ (0,
|
|
39000
|
-
|
|
40570
|
+
category.canClear ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mt: 2, pt: 2, borderTop: 1, borderColor: "divider" }, children: [
|
|
40571
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40572
|
+
import_material44.Button,
|
|
39001
40573
|
{
|
|
39002
40574
|
variant: "outlined",
|
|
39003
40575
|
color: "error",
|
|
39004
40576
|
size: "small",
|
|
39005
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40577
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, {}),
|
|
39006
40578
|
onClick: () => setClearCategoryDialog(category),
|
|
39007
40579
|
disabled: clearing,
|
|
39008
40580
|
children: [
|
|
@@ -39011,19 +40583,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39011
40583
|
]
|
|
39012
40584
|
}
|
|
39013
40585
|
),
|
|
39014
|
-
category.clearWarning && /* @__PURE__ */ (0,
|
|
39015
|
-
] }) : /* @__PURE__ */ (0,
|
|
40586
|
+
category.clearWarning && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "warning", sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "caption", children: category.clearWarning }) })
|
|
40587
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "info", sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "caption", children: category.itemCount === 0 ? "This category is empty." : "This category cannot be cleared automatically." }) })
|
|
39016
40588
|
] }) })
|
|
39017
40589
|
] }, category.name);
|
|
39018
40590
|
}) }) }),
|
|
39019
|
-
/* @__PURE__ */ (0,
|
|
39020
|
-
/* @__PURE__ */ (0,
|
|
39021
|
-
/* @__PURE__ */ (0,
|
|
40591
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { sx: { mt: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { children: [
|
|
40592
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
40593
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Info2.default, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
39022
40594
|
"Storage Tips & Clear Options"
|
|
39023
40595
|
] }),
|
|
39024
|
-
/* @__PURE__ */ (0,
|
|
39025
|
-
/* @__PURE__ */ (0,
|
|
39026
|
-
/* @__PURE__ */ (0,
|
|
40596
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.List, { children: [
|
|
40597
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40598
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
39027
40599
|
import_CheckCircle3.default,
|
|
39028
40600
|
{
|
|
39029
40601
|
sx: {
|
|
@@ -39031,38 +40603,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39031
40603
|
}
|
|
39032
40604
|
}
|
|
39033
40605
|
) }),
|
|
39034
|
-
/* @__PURE__ */ (0,
|
|
39035
|
-
|
|
40606
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40607
|
+
import_material44.ListItemText,
|
|
39036
40608
|
{
|
|
39037
40609
|
primary: storageStatusPrimary,
|
|
39038
40610
|
secondary: syncFeaturesActive ? "Some features (conversation sync or advanced vector storage) can sync items to your configured gateway storage." : "With conversation sync and advanced vector storage turned off, everything stays in this browser."
|
|
39039
40611
|
}
|
|
39040
40612
|
)
|
|
39041
40613
|
] }),
|
|
39042
|
-
/* @__PURE__ */ (0,
|
|
39043
|
-
/* @__PURE__ */ (0,
|
|
39044
|
-
/* @__PURE__ */ (0,
|
|
39045
|
-
|
|
40614
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40615
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, { color: "info" }) }),
|
|
40616
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40617
|
+
import_material44.ListItemText,
|
|
39046
40618
|
{
|
|
39047
40619
|
primary: "Clear All Data (Safe)",
|
|
39048
40620
|
secondary: "Deletes all items but keeps database structure intact. App continues working normally."
|
|
39049
40621
|
}
|
|
39050
40622
|
)
|
|
39051
40623
|
] }),
|
|
39052
|
-
/* @__PURE__ */ (0,
|
|
39053
|
-
/* @__PURE__ */ (0,
|
|
39054
|
-
/* @__PURE__ */ (0,
|
|
39055
|
-
|
|
40624
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40625
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, { color: "error" }) }),
|
|
40626
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40627
|
+
import_material44.ListItemText,
|
|
39056
40628
|
{
|
|
39057
40629
|
primary: "Nuclear Clear (Complete Reset)",
|
|
39058
40630
|
secondary: "Completely destroys all databases and forces app reload. Use only for complete reset."
|
|
39059
40631
|
}
|
|
39060
40632
|
)
|
|
39061
40633
|
] }),
|
|
39062
|
-
/* @__PURE__ */ (0,
|
|
39063
|
-
/* @__PURE__ */ (0,
|
|
39064
|
-
/* @__PURE__ */ (0,
|
|
39065
|
-
|
|
40634
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40635
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Warning.default, { color: "warning" }) }),
|
|
40636
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40637
|
+
import_material44.ListItemText,
|
|
39066
40638
|
{
|
|
39067
40639
|
primary: "Backup important data",
|
|
39068
40640
|
secondary: "Export custom models and important documents before clearing storage"
|
|
@@ -39071,38 +40643,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39071
40643
|
] })
|
|
39072
40644
|
] })
|
|
39073
40645
|
] }) }),
|
|
39074
|
-
/* @__PURE__ */ (0,
|
|
39075
|
-
|
|
40646
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40647
|
+
import_material44.Dialog,
|
|
39076
40648
|
{
|
|
39077
40649
|
open: !!clearCategoryDialog,
|
|
39078
40650
|
onClose: () => setClearCategoryDialog(null),
|
|
39079
40651
|
maxWidth: "sm",
|
|
39080
40652
|
fullWidth: true,
|
|
39081
40653
|
children: [
|
|
39082
|
-
/* @__PURE__ */ (0,
|
|
39083
|
-
/* @__PURE__ */ (0,
|
|
40654
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.DialogTitle, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
40655
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Warning.default, { color: "warning" }),
|
|
39084
40656
|
"Clear ",
|
|
39085
40657
|
clearCategoryDialog?.name,
|
|
39086
40658
|
"?"
|
|
39087
40659
|
] }) }),
|
|
39088
|
-
/* @__PURE__ */ (0,
|
|
39089
|
-
/* @__PURE__ */ (0,
|
|
40660
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContent, { children: [
|
|
40661
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContentText, { children: [
|
|
39090
40662
|
'This will permanently delete all data in the "',
|
|
39091
40663
|
clearCategoryDialog?.name,
|
|
39092
40664
|
'" category.'
|
|
39093
40665
|
] }),
|
|
39094
|
-
clearCategoryDialog?.clearWarning && /* @__PURE__ */ (0,
|
|
39095
|
-
clearCategoryDialog && /* @__PURE__ */ (0,
|
|
39096
|
-
/* @__PURE__ */ (0,
|
|
39097
|
-
/* @__PURE__ */ (0,
|
|
40666
|
+
clearCategoryDialog?.clearWarning && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "warning", sx: { mt: 2 }, children: clearCategoryDialog.clearWarning }),
|
|
40667
|
+
clearCategoryDialog && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mt: 2, p: 2, bgcolor: "action.hover", borderRadius: 1 }, children: [
|
|
40668
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: "Will clear:" }) }),
|
|
40669
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", sx: { fontFamily: "monospace", mt: 1 }, children: [
|
|
39098
40670
|
"\u2022 ",
|
|
39099
40671
|
clearCategoryDialog.itemCount,
|
|
39100
40672
|
" items",
|
|
39101
|
-
/* @__PURE__ */ (0,
|
|
40673
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("br", {}),
|
|
39102
40674
|
"\u2022 ",
|
|
39103
40675
|
formatBytes(clearCategoryDialog.size),
|
|
39104
40676
|
" of data",
|
|
39105
|
-
/* @__PURE__ */ (0,
|
|
40677
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("br", {}),
|
|
39106
40678
|
"\u2022 ",
|
|
39107
40679
|
clearCategoryDialog.stores.length,
|
|
39108
40680
|
" storage location",
|
|
@@ -39110,22 +40682,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39110
40682
|
] })
|
|
39111
40683
|
] })
|
|
39112
40684
|
] }),
|
|
39113
|
-
/* @__PURE__ */ (0,
|
|
39114
|
-
/* @__PURE__ */ (0,
|
|
39115
|
-
|
|
40685
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogActions, { children: [
|
|
40686
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40687
|
+
import_material44.Button,
|
|
39116
40688
|
{
|
|
39117
40689
|
onClick: () => setClearCategoryDialog(null),
|
|
39118
40690
|
disabled: clearing,
|
|
39119
40691
|
children: "Cancel"
|
|
39120
40692
|
}
|
|
39121
40693
|
),
|
|
39122
|
-
/* @__PURE__ */ (0,
|
|
39123
|
-
|
|
40694
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40695
|
+
import_material44.Button,
|
|
39124
40696
|
{
|
|
39125
40697
|
onClick: () => clearCategoryDialog && handleClearCategory(clearCategoryDialog),
|
|
39126
40698
|
color: "error",
|
|
39127
40699
|
variant: "contained",
|
|
39128
|
-
startIcon: clearing ? /* @__PURE__ */ (0,
|
|
40700
|
+
startIcon: clearing ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, {}),
|
|
39129
40701
|
disabled: clearing,
|
|
39130
40702
|
children: clearing ? "Clearing..." : "Clear Data"
|
|
39131
40703
|
}
|
|
@@ -39134,51 +40706,51 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39134
40706
|
]
|
|
39135
40707
|
}
|
|
39136
40708
|
),
|
|
39137
|
-
/* @__PURE__ */ (0,
|
|
39138
|
-
|
|
40709
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40710
|
+
import_material44.Dialog,
|
|
39139
40711
|
{
|
|
39140
40712
|
open: clearAllDialogOpen,
|
|
39141
40713
|
onClose: () => setClearAllDialogOpen(false),
|
|
39142
40714
|
maxWidth: "sm",
|
|
39143
40715
|
fullWidth: true,
|
|
39144
40716
|
children: [
|
|
39145
|
-
/* @__PURE__ */ (0,
|
|
39146
|
-
/* @__PURE__ */ (0,
|
|
40717
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.DialogTitle, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
40718
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Error3.default, { color: "error" }),
|
|
39147
40719
|
"Clear All Storage Data?"
|
|
39148
40720
|
] }) }),
|
|
39149
|
-
/* @__PURE__ */ (0,
|
|
39150
|
-
/* @__PURE__ */ (0,
|
|
39151
|
-
/* @__PURE__ */ (0,
|
|
39152
|
-
/* @__PURE__ */ (0,
|
|
39153
|
-
/* @__PURE__ */ (0,
|
|
39154
|
-
|
|
40721
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContent, { children: [
|
|
40722
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.DialogContentText, { children: "This will permanently delete ALL your local data including:" }),
|
|
40723
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.List, { dense: true, sx: { mt: 1 }, children: clearableCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40724
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(category.icon, { fontSize: "small", sx: { color: category.color } }) }),
|
|
40725
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40726
|
+
import_material44.ListItemText,
|
|
39155
40727
|
{
|
|
39156
40728
|
primary: category.name,
|
|
39157
40729
|
secondary: `${category.itemCount} items \u2022 ${formatBytes(category.size)}`
|
|
39158
40730
|
}
|
|
39159
40731
|
)
|
|
39160
40732
|
] }, category.name)) }),
|
|
39161
|
-
/* @__PURE__ */ (0,
|
|
39162
|
-
/* @__PURE__ */ (0,
|
|
40733
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "error", sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", children: [
|
|
40734
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: "This action cannot be undone!" }),
|
|
39163
40735
|
" Make sure to export any important data before proceeding."
|
|
39164
40736
|
] }) })
|
|
39165
40737
|
] }),
|
|
39166
|
-
/* @__PURE__ */ (0,
|
|
39167
|
-
/* @__PURE__ */ (0,
|
|
39168
|
-
|
|
40738
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogActions, { children: [
|
|
40739
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40740
|
+
import_material44.Button,
|
|
39169
40741
|
{
|
|
39170
40742
|
onClick: () => setClearAllDialogOpen(false),
|
|
39171
40743
|
disabled: clearing,
|
|
39172
40744
|
children: "Cancel"
|
|
39173
40745
|
}
|
|
39174
40746
|
),
|
|
39175
|
-
/* @__PURE__ */ (0,
|
|
39176
|
-
|
|
40747
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40748
|
+
import_material44.Button,
|
|
39177
40749
|
{
|
|
39178
40750
|
onClick: handleClearAll,
|
|
39179
40751
|
color: "error",
|
|
39180
40752
|
variant: "contained",
|
|
39181
|
-
startIcon: clearing ? /* @__PURE__ */ (0,
|
|
40753
|
+
startIcon: clearing ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, {}),
|
|
39182
40754
|
disabled: clearing,
|
|
39183
40755
|
children: clearing ? "Clearing All..." : "Clear All Data"
|
|
39184
40756
|
}
|
|
@@ -39187,15 +40759,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39187
40759
|
]
|
|
39188
40760
|
}
|
|
39189
40761
|
),
|
|
39190
|
-
/* @__PURE__ */ (0,
|
|
39191
|
-
|
|
40762
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40763
|
+
import_material44.Snackbar,
|
|
39192
40764
|
{
|
|
39193
40765
|
open: showSnackbar,
|
|
39194
40766
|
autoHideDuration: 4e3,
|
|
39195
40767
|
onClose: () => setShowSnackbar(false),
|
|
39196
40768
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
39197
|
-
children: /* @__PURE__ */ (0,
|
|
39198
|
-
|
|
40769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40770
|
+
import_material44.Alert,
|
|
39199
40771
|
{
|
|
39200
40772
|
onClose: () => setShowSnackbar(false),
|
|
39201
40773
|
severity: snackbarSeverity,
|
|
@@ -39211,21 +40783,21 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39211
40783
|
var StorageTab_default = StorageTab;
|
|
39212
40784
|
|
|
39213
40785
|
// src/management/components/ProviderTab.tsx
|
|
39214
|
-
var
|
|
39215
|
-
var
|
|
40786
|
+
var import_react55 = require("react");
|
|
40787
|
+
var import_material45 = require("@mui/material");
|
|
39216
40788
|
init_aiProviderStore();
|
|
39217
40789
|
init_packageSettingsStore();
|
|
39218
40790
|
init_common_types();
|
|
39219
40791
|
init_ai_provider_factory();
|
|
39220
40792
|
init_debugLogger();
|
|
39221
40793
|
init_indexedDBService();
|
|
39222
|
-
var
|
|
40794
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
39223
40795
|
var ProviderTab = () => {
|
|
39224
40796
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
39225
40797
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
39226
|
-
const theme = (0,
|
|
39227
|
-
const isMobile = (0,
|
|
39228
|
-
const getSuggestedModel = (0,
|
|
40798
|
+
const theme = (0, import_material45.useTheme)();
|
|
40799
|
+
const isMobile = (0, import_material45.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
40800
|
+
const getSuggestedModel = (0, import_react55.useCallback)((type) => {
|
|
39229
40801
|
const configuredDefault = packageSettings?.defaultModel?.trim();
|
|
39230
40802
|
if (configuredDefault) {
|
|
39231
40803
|
return configuredDefault;
|
|
@@ -39241,7 +40813,7 @@ var ProviderTab = () => {
|
|
|
39241
40813
|
return "";
|
|
39242
40814
|
}
|
|
39243
40815
|
}, [packageSettings?.defaultModel]);
|
|
39244
|
-
const applyDefaultModel = (0,
|
|
40816
|
+
const applyDefaultModel = (0, import_react55.useCallback)((config) => {
|
|
39245
40817
|
const normalized = { ...config };
|
|
39246
40818
|
const trimmed = typeof normalized.defaultModel === "string" ? normalized.defaultModel.trim() : void 0;
|
|
39247
40819
|
const requiresModel = normalized.type === "openai" /* OPENAI */ || normalized.type === "xai" /* XAI */ || normalized.type === "bandit" /* BANDIT */;
|
|
@@ -39261,7 +40833,7 @@ var ProviderTab = () => {
|
|
|
39261
40833
|
}
|
|
39262
40834
|
return normalized;
|
|
39263
40835
|
}, [getSuggestedModel]);
|
|
39264
|
-
const sanitizeConfigForSave = (0,
|
|
40836
|
+
const sanitizeConfigForSave = (0, import_react55.useCallback)((config) => {
|
|
39265
40837
|
const sanitized = { ...config };
|
|
39266
40838
|
if (typeof sanitized.defaultModel === "string") {
|
|
39267
40839
|
const trimmed = sanitized.defaultModel.trim();
|
|
@@ -39273,15 +40845,15 @@ var ProviderTab = () => {
|
|
|
39273
40845
|
}
|
|
39274
40846
|
return sanitized;
|
|
39275
40847
|
}, []);
|
|
39276
|
-
const [providerConfig, setProviderConfig] = (0,
|
|
40848
|
+
const [providerConfig, setProviderConfig] = (0, import_react55.useState)({
|
|
39277
40849
|
type: "gateway",
|
|
39278
40850
|
gatewayUrl: packageSettings?.gatewayApiUrl || "",
|
|
39279
40851
|
provider: "bandit"
|
|
39280
40852
|
});
|
|
39281
|
-
const [isProviderConfigOpen, setIsProviderConfigOpen] = (0,
|
|
39282
|
-
const [snackbarMessage, setSnackbarMessage] = (0,
|
|
39283
|
-
const [showSnackbar, setShowSnackbar] = (0,
|
|
39284
|
-
const [snackbarSeverity, setSnackbarSeverity] = (0,
|
|
40853
|
+
const [isProviderConfigOpen, setIsProviderConfigOpen] = (0, import_react55.useState)(false);
|
|
40854
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react55.useState)("");
|
|
40855
|
+
const [showSnackbar, setShowSnackbar] = (0, import_react55.useState)(false);
|
|
40856
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react55.useState)("success");
|
|
39285
40857
|
const saveProviderConfigToDB = async (config) => {
|
|
39286
40858
|
try {
|
|
39287
40859
|
const { tokenFactory: _tokenFactory, ...persistableConfig } = config;
|
|
@@ -39322,7 +40894,7 @@ var ProviderTab = () => {
|
|
|
39322
40894
|
}
|
|
39323
40895
|
return null;
|
|
39324
40896
|
};
|
|
39325
|
-
const convertAnthropicConfig = (0,
|
|
40897
|
+
const convertAnthropicConfig = (0, import_react55.useCallback)((config) => {
|
|
39326
40898
|
if (!config) return null;
|
|
39327
40899
|
if (config.type !== "anthropic" /* ANTHROPIC */) {
|
|
39328
40900
|
return config;
|
|
@@ -39338,7 +40910,7 @@ var ProviderTab = () => {
|
|
|
39338
40910
|
};
|
|
39339
40911
|
return converted;
|
|
39340
40912
|
}, [packageSettings?.gatewayApiUrl]);
|
|
39341
|
-
(0,
|
|
40913
|
+
(0, import_react55.useEffect)(() => {
|
|
39342
40914
|
const initializeProviderConfig = async () => {
|
|
39343
40915
|
const savedConfig = await loadProviderConfigFromDB();
|
|
39344
40916
|
if (savedConfig) {
|
|
@@ -39473,18 +41045,18 @@ var ProviderTab = () => {
|
|
|
39473
41045
|
showMessage("Connection test failed. Please check your configuration.", "error");
|
|
39474
41046
|
}
|
|
39475
41047
|
};
|
|
39476
|
-
return /* @__PURE__ */ (0,
|
|
39477
|
-
/* @__PURE__ */ (0,
|
|
39478
|
-
/* @__PURE__ */ (0,
|
|
39479
|
-
|
|
41048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
41049
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
41050
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41051
|
+
import_material45.Typography,
|
|
39480
41052
|
{
|
|
39481
41053
|
variant: "h5",
|
|
39482
41054
|
sx: { fontWeight: 600, mb: 1, color: "primary.main", fontSize: { xs: "1.6rem", md: "1.8rem" } },
|
|
39483
41055
|
children: "AI Provider Configuration"
|
|
39484
41056
|
}
|
|
39485
41057
|
),
|
|
39486
|
-
/* @__PURE__ */ (0,
|
|
39487
|
-
|
|
41058
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41059
|
+
import_material45.Typography,
|
|
39488
41060
|
{
|
|
39489
41061
|
variant: "body1",
|
|
39490
41062
|
color: "text.secondary",
|
|
@@ -39493,23 +41065,23 @@ var ProviderTab = () => {
|
|
|
39493
41065
|
children: "Configure your AI provider for chat, generation, and model services. This determines which backend service powers your AI interactions."
|
|
39494
41066
|
}
|
|
39495
41067
|
),
|
|
39496
|
-
/* @__PURE__ */ (0,
|
|
39497
|
-
/* @__PURE__ */ (0,
|
|
39498
|
-
currentProvider ? /* @__PURE__ */ (0,
|
|
39499
|
-
/* @__PURE__ */ (0,
|
|
39500
|
-
|
|
41068
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
|
|
41069
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "h6", sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Current Provider" }),
|
|
41070
|
+
currentProvider ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
41071
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41072
|
+
import_material45.Chip,
|
|
39501
41073
|
{
|
|
39502
41074
|
label: currentProvider.getProviderType().toUpperCase(),
|
|
39503
41075
|
color: "primary",
|
|
39504
41076
|
variant: "filled"
|
|
39505
41077
|
}
|
|
39506
41078
|
),
|
|
39507
|
-
/* @__PURE__ */ (0,
|
|
39508
|
-
] }) : /* @__PURE__ */ (0,
|
|
41079
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "body2", color: "text.secondary", children: currentProviderConfig?.baseUrl || currentProviderConfig?.gatewayUrl || "No URL configured" })
|
|
41080
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Chip, { label: "No Provider Configured", color: "warning" })
|
|
39509
41081
|
] }),
|
|
39510
|
-
/* @__PURE__ */ (0,
|
|
39511
|
-
/* @__PURE__ */ (0,
|
|
39512
|
-
|
|
41082
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
|
|
41083
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41084
|
+
import_material45.Box,
|
|
39513
41085
|
{
|
|
39514
41086
|
sx: {
|
|
39515
41087
|
display: "flex",
|
|
@@ -39520,9 +41092,9 @@ var ProviderTab = () => {
|
|
|
39520
41092
|
mb: 3
|
|
39521
41093
|
},
|
|
39522
41094
|
children: [
|
|
39523
|
-
/* @__PURE__ */ (0,
|
|
39524
|
-
/* @__PURE__ */ (0,
|
|
39525
|
-
|
|
41095
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
|
|
41096
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41097
|
+
import_material45.Button,
|
|
39526
41098
|
{
|
|
39527
41099
|
variant: "outlined",
|
|
39528
41100
|
onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
|
|
@@ -39536,9 +41108,9 @@ var ProviderTab = () => {
|
|
|
39536
41108
|
]
|
|
39537
41109
|
}
|
|
39538
41110
|
),
|
|
39539
|
-
isProviderConfigOpen && /* @__PURE__ */ (0,
|
|
39540
|
-
/* @__PURE__ */ (0,
|
|
39541
|
-
|
|
41111
|
+
isProviderConfigOpen && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { mt: 3 }, children: [
|
|
41112
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41113
|
+
import_material45.TextField,
|
|
39542
41114
|
{
|
|
39543
41115
|
label: "Provider Type",
|
|
39544
41116
|
select: true,
|
|
@@ -39547,19 +41119,19 @@ var ProviderTab = () => {
|
|
|
39547
41119
|
fullWidth: true,
|
|
39548
41120
|
sx: { mb: 3 },
|
|
39549
41121
|
children: [
|
|
39550
|
-
/* @__PURE__ */ (0,
|
|
39551
|
-
/* @__PURE__ */ (0,
|
|
39552
|
-
/* @__PURE__ */ (0,
|
|
39553
|
-
/* @__PURE__ */ (0,
|
|
39554
|
-
/* @__PURE__ */ (0,
|
|
39555
|
-
/* @__PURE__ */ (0,
|
|
39556
|
-
/* @__PURE__ */ (0,
|
|
41122
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "gateway", children: "Gateway (Recommended)" }),
|
|
41123
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
41124
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
41125
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
41126
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "bandit", children: "Bandit AI" }),
|
|
41127
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "xai", children: "xAI" }),
|
|
41128
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "playground", children: "Playground (Mock Demo)" })
|
|
39557
41129
|
]
|
|
39558
41130
|
}
|
|
39559
41131
|
),
|
|
39560
|
-
providerConfig.type === "gateway" && /* @__PURE__ */ (0,
|
|
39561
|
-
/* @__PURE__ */ (0,
|
|
39562
|
-
|
|
41132
|
+
providerConfig.type === "gateway" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41133
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41134
|
+
import_material45.TextField,
|
|
39563
41135
|
{
|
|
39564
41136
|
label: "Gateway URL",
|
|
39565
41137
|
value: providerConfig.gatewayUrl || "",
|
|
@@ -39569,8 +41141,8 @@ var ProviderTab = () => {
|
|
|
39569
41141
|
placeholder: "https://your-gateway-api.com"
|
|
39570
41142
|
}
|
|
39571
41143
|
),
|
|
39572
|
-
/* @__PURE__ */ (0,
|
|
39573
|
-
|
|
41144
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41145
|
+
import_material45.TextField,
|
|
39574
41146
|
{
|
|
39575
41147
|
label: "Backend Provider",
|
|
39576
41148
|
select: true,
|
|
@@ -39582,18 +41154,18 @@ var ProviderTab = () => {
|
|
|
39582
41154
|
fullWidth: true,
|
|
39583
41155
|
sx: { mb: 2 },
|
|
39584
41156
|
children: [
|
|
39585
|
-
/* @__PURE__ */ (0,
|
|
39586
|
-
/* @__PURE__ */ (0,
|
|
39587
|
-
/* @__PURE__ */ (0,
|
|
39588
|
-
/* @__PURE__ */ (0,
|
|
39589
|
-
/* @__PURE__ */ (0,
|
|
39590
|
-
/* @__PURE__ */ (0,
|
|
41157
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
41158
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
41159
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
41160
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
41161
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "bandit", children: "Bandit AI" }),
|
|
41162
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "xai", children: "xAI" })
|
|
39591
41163
|
]
|
|
39592
41164
|
}
|
|
39593
41165
|
)
|
|
39594
41166
|
] }),
|
|
39595
|
-
providerConfig.type === "ollama" && /* @__PURE__ */ (0,
|
|
39596
|
-
|
|
41167
|
+
providerConfig.type === "ollama" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41168
|
+
import_material45.TextField,
|
|
39597
41169
|
{
|
|
39598
41170
|
label: "Ollama URL",
|
|
39599
41171
|
value: providerConfig.baseUrl || "",
|
|
@@ -39602,9 +41174,9 @@ var ProviderTab = () => {
|
|
|
39602
41174
|
placeholder: "http://localhost:11434"
|
|
39603
41175
|
}
|
|
39604
41176
|
),
|
|
39605
|
-
providerConfig.type === "bandit" && /* @__PURE__ */ (0,
|
|
39606
|
-
/* @__PURE__ */ (0,
|
|
39607
|
-
|
|
41177
|
+
providerConfig.type === "bandit" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41178
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41179
|
+
import_material45.TextField,
|
|
39608
41180
|
{
|
|
39609
41181
|
label: "API Base URL",
|
|
39610
41182
|
value: providerConfig.baseUrl || "",
|
|
@@ -39618,8 +41190,8 @@ var ProviderTab = () => {
|
|
|
39618
41190
|
helperText: "Defaults to https://api.burtson.ai"
|
|
39619
41191
|
}
|
|
39620
41192
|
),
|
|
39621
|
-
/* @__PURE__ */ (0,
|
|
39622
|
-
|
|
41193
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41194
|
+
import_material45.TextField,
|
|
39623
41195
|
{
|
|
39624
41196
|
label: "API Key",
|
|
39625
41197
|
type: "password",
|
|
@@ -39633,8 +41205,8 @@ var ProviderTab = () => {
|
|
|
39633
41205
|
placeholder: "bai_..."
|
|
39634
41206
|
}
|
|
39635
41207
|
),
|
|
39636
|
-
/* @__PURE__ */ (0,
|
|
39637
|
-
|
|
41208
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41209
|
+
import_material45.TextField,
|
|
39638
41210
|
{
|
|
39639
41211
|
label: "Default Model ID",
|
|
39640
41212
|
value: providerConfig.defaultModel || "",
|
|
@@ -39648,9 +41220,9 @@ var ProviderTab = () => {
|
|
|
39648
41220
|
}
|
|
39649
41221
|
)
|
|
39650
41222
|
] }),
|
|
39651
|
-
providerConfig.type === "openai" && /* @__PURE__ */ (0,
|
|
39652
|
-
/* @__PURE__ */ (0,
|
|
39653
|
-
|
|
41223
|
+
providerConfig.type === "openai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41224
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41225
|
+
import_material45.TextField,
|
|
39654
41226
|
{
|
|
39655
41227
|
label: "API Base URL",
|
|
39656
41228
|
value: providerConfig.baseUrl || "",
|
|
@@ -39663,8 +41235,8 @@ var ProviderTab = () => {
|
|
|
39663
41235
|
placeholder: "https://api.openai.com/v1"
|
|
39664
41236
|
}
|
|
39665
41237
|
),
|
|
39666
|
-
/* @__PURE__ */ (0,
|
|
39667
|
-
|
|
41238
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41239
|
+
import_material45.TextField,
|
|
39668
41240
|
{
|
|
39669
41241
|
label: "API Key",
|
|
39670
41242
|
type: "password",
|
|
@@ -39678,8 +41250,8 @@ var ProviderTab = () => {
|
|
|
39678
41250
|
placeholder: "sk-..."
|
|
39679
41251
|
}
|
|
39680
41252
|
),
|
|
39681
|
-
/* @__PURE__ */ (0,
|
|
39682
|
-
|
|
41253
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41254
|
+
import_material45.TextField,
|
|
39683
41255
|
{
|
|
39684
41256
|
label: "Default Model ID",
|
|
39685
41257
|
value: providerConfig.defaultModel || "",
|
|
@@ -39693,9 +41265,9 @@ var ProviderTab = () => {
|
|
|
39693
41265
|
}
|
|
39694
41266
|
)
|
|
39695
41267
|
] }),
|
|
39696
|
-
providerConfig.type === "azure-openai" && /* @__PURE__ */ (0,
|
|
39697
|
-
/* @__PURE__ */ (0,
|
|
39698
|
-
|
|
41268
|
+
providerConfig.type === "azure-openai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41269
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41270
|
+
import_material45.TextField,
|
|
39699
41271
|
{
|
|
39700
41272
|
label: "Azure Endpoint",
|
|
39701
41273
|
value: providerConfig.baseUrl || "",
|
|
@@ -39705,8 +41277,8 @@ var ProviderTab = () => {
|
|
|
39705
41277
|
placeholder: "https://your-resource.openai.azure.com"
|
|
39706
41278
|
}
|
|
39707
41279
|
),
|
|
39708
|
-
/* @__PURE__ */ (0,
|
|
39709
|
-
|
|
41280
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41281
|
+
import_material45.TextField,
|
|
39710
41282
|
{
|
|
39711
41283
|
label: "API Key",
|
|
39712
41284
|
type: "password",
|
|
@@ -39716,8 +41288,8 @@ var ProviderTab = () => {
|
|
|
39716
41288
|
sx: { mb: 2 }
|
|
39717
41289
|
}
|
|
39718
41290
|
),
|
|
39719
|
-
/* @__PURE__ */ (0,
|
|
39720
|
-
|
|
41291
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41292
|
+
import_material45.TextField,
|
|
39721
41293
|
{
|
|
39722
41294
|
label: "API Version",
|
|
39723
41295
|
value: providerConfig.apiVersion || "",
|
|
@@ -39727,8 +41299,8 @@ var ProviderTab = () => {
|
|
|
39727
41299
|
placeholder: "2024-02-01"
|
|
39728
41300
|
}
|
|
39729
41301
|
),
|
|
39730
|
-
/* @__PURE__ */ (0,
|
|
39731
|
-
|
|
41302
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41303
|
+
import_material45.TextField,
|
|
39732
41304
|
{
|
|
39733
41305
|
label: "Deployment Name",
|
|
39734
41306
|
value: providerConfig.deploymentName || "",
|
|
@@ -39738,9 +41310,9 @@ var ProviderTab = () => {
|
|
|
39738
41310
|
}
|
|
39739
41311
|
)
|
|
39740
41312
|
] }),
|
|
39741
|
-
providerConfig.type === "xai" && /* @__PURE__ */ (0,
|
|
39742
|
-
/* @__PURE__ */ (0,
|
|
39743
|
-
|
|
41313
|
+
providerConfig.type === "xai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41314
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41315
|
+
import_material45.TextField,
|
|
39744
41316
|
{
|
|
39745
41317
|
label: "API Base URL",
|
|
39746
41318
|
value: providerConfig.baseUrl || "",
|
|
@@ -39753,8 +41325,8 @@ var ProviderTab = () => {
|
|
|
39753
41325
|
placeholder: "https://api.x.ai/v1"
|
|
39754
41326
|
}
|
|
39755
41327
|
),
|
|
39756
|
-
/* @__PURE__ */ (0,
|
|
39757
|
-
|
|
41328
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41329
|
+
import_material45.TextField,
|
|
39758
41330
|
{
|
|
39759
41331
|
label: "API Key",
|
|
39760
41332
|
type: "password",
|
|
@@ -39768,8 +41340,8 @@ var ProviderTab = () => {
|
|
|
39768
41340
|
placeholder: "xai-..."
|
|
39769
41341
|
}
|
|
39770
41342
|
),
|
|
39771
|
-
/* @__PURE__ */ (0,
|
|
39772
|
-
|
|
41343
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41344
|
+
import_material45.TextField,
|
|
39773
41345
|
{
|
|
39774
41346
|
label: "Default Model ID",
|
|
39775
41347
|
value: providerConfig.defaultModel || "",
|
|
@@ -39783,10 +41355,10 @@ var ProviderTab = () => {
|
|
|
39783
41355
|
}
|
|
39784
41356
|
)
|
|
39785
41357
|
] }),
|
|
39786
|
-
providerConfig.type === "anthropic" && /* @__PURE__ */ (0,
|
|
39787
|
-
/* @__PURE__ */ (0,
|
|
39788
|
-
/* @__PURE__ */ (0,
|
|
39789
|
-
|
|
41358
|
+
providerConfig.type === "anthropic" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Alert, { severity: "warning", sx: { mt: 2 }, children: "Anthropic is only supported through the Bandit Gateway provider. Please switch to Gateway and select Anthropic as the backend service." }),
|
|
41359
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { display: "flex", gap: 2, mt: 3 }, children: [
|
|
41360
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41361
|
+
import_material45.Button,
|
|
39790
41362
|
{
|
|
39791
41363
|
variant: "outlined",
|
|
39792
41364
|
onClick: handleTestProviderConnection,
|
|
@@ -39794,8 +41366,8 @@ var ProviderTab = () => {
|
|
|
39794
41366
|
children: "Test Connection"
|
|
39795
41367
|
}
|
|
39796
41368
|
),
|
|
39797
|
-
/* @__PURE__ */ (0,
|
|
39798
|
-
|
|
41369
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41370
|
+
import_material45.Button,
|
|
39799
41371
|
{
|
|
39800
41372
|
variant: "contained",
|
|
39801
41373
|
onClick: handleSaveProviderConfig,
|
|
@@ -39806,20 +41378,20 @@ var ProviderTab = () => {
|
|
|
39806
41378
|
] })
|
|
39807
41379
|
] })
|
|
39808
41380
|
] }),
|
|
39809
|
-
/* @__PURE__ */ (0,
|
|
39810
|
-
/* @__PURE__ */ (0,
|
|
39811
|
-
/* @__PURE__ */ (0,
|
|
41381
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Paper, { sx: { p: 3, bgcolor: "info.main", color: "info.contrastText", borderRadius: 2 }, children: [
|
|
41382
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "h6", sx: { mb: 1, fontWeight: 600, color: "text.primary" }, children: "\u{1F680} Gateway Provider Recommended" }),
|
|
41383
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "body2", children: "For production deployments, we recommend using the Gateway provider which routes requests through your secure backend API. This approach keeps API keys secure, enables rate limiting, and provides better monitoring capabilities." })
|
|
39812
41384
|
] })
|
|
39813
41385
|
] }),
|
|
39814
|
-
/* @__PURE__ */ (0,
|
|
39815
|
-
|
|
41386
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41387
|
+
import_material45.Snackbar,
|
|
39816
41388
|
{
|
|
39817
41389
|
open: showSnackbar,
|
|
39818
41390
|
autoHideDuration: 6e3,
|
|
39819
41391
|
onClose: () => setShowSnackbar(false),
|
|
39820
41392
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
39821
|
-
children: /* @__PURE__ */ (0,
|
|
39822
|
-
|
|
41393
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41394
|
+
import_material45.Alert,
|
|
39823
41395
|
{
|
|
39824
41396
|
onClose: () => setShowSnackbar(false),
|
|
39825
41397
|
severity: snackbarSeverity,
|
|
@@ -39834,9 +41406,9 @@ var ProviderTab = () => {
|
|
|
39834
41406
|
};
|
|
39835
41407
|
|
|
39836
41408
|
// src/management/components/MCPToolsTabV2.tsx
|
|
39837
|
-
var
|
|
39838
|
-
var
|
|
39839
|
-
var
|
|
41409
|
+
var import_react56 = require("react");
|
|
41410
|
+
var import_material46 = require("@mui/material");
|
|
41411
|
+
var import_Refresh5 = __toESM(require("@mui/icons-material/Refresh"));
|
|
39840
41412
|
var import_HealthAndSafety = __toESM(require("@mui/icons-material/HealthAndSafety"));
|
|
39841
41413
|
var import_ErrorOutline3 = __toESM(require("@mui/icons-material/ErrorOutline"));
|
|
39842
41414
|
var import_Settings3 = __toESM(require("@mui/icons-material/Settings"));
|
|
@@ -39853,7 +41425,7 @@ var isPlaygroundMode2 = () => {
|
|
|
39853
41425
|
const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
|
|
39854
41426
|
return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
|
|
39855
41427
|
};
|
|
39856
|
-
function
|
|
41428
|
+
function buildUrl3(path) {
|
|
39857
41429
|
if (isPlaygroundMode2()) {
|
|
39858
41430
|
debugLogger.info("MCP controller URL build skipped in playground mode", { path });
|
|
39859
41431
|
return path.startsWith("/") ? path : `/${path}`;
|
|
@@ -39876,7 +41448,7 @@ async function fetchAvailableMcpTools() {
|
|
|
39876
41448
|
debugLogger.info("Skipping remote MCP tool fetch \u2014 playground mode active");
|
|
39877
41449
|
return [];
|
|
39878
41450
|
}
|
|
39879
|
-
const url =
|
|
41451
|
+
const url = buildUrl3("/mcp/tools");
|
|
39880
41452
|
try {
|
|
39881
41453
|
const res = await fetch(url, { headers: authHeaders() });
|
|
39882
41454
|
const data = await res.json();
|
|
@@ -39900,7 +41472,7 @@ async function fetchMcpHealth() {
|
|
|
39900
41472
|
availableTools: []
|
|
39901
41473
|
};
|
|
39902
41474
|
}
|
|
39903
|
-
const url =
|
|
41475
|
+
const url = buildUrl3("/mcp/health");
|
|
39904
41476
|
try {
|
|
39905
41477
|
const res = await fetch(url, { headers: authHeaders() });
|
|
39906
41478
|
const data = await res.json();
|
|
@@ -39917,14 +41489,14 @@ async function fetchMcpHealth() {
|
|
|
39917
41489
|
// src/management/components/MCPToolsTabV2.tsx
|
|
39918
41490
|
init_mcpToolsStore();
|
|
39919
41491
|
init_packageSettingsStore();
|
|
39920
|
-
var
|
|
41492
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
39921
41493
|
var MCPToolsTabV2 = () => {
|
|
39922
41494
|
const { settings } = usePackageSettingsStore();
|
|
39923
41495
|
const { tools: localTools, loadTools, toggleTool, addTool, updateTool, isLoaded } = useMCPToolsStore();
|
|
39924
|
-
const [loading, setLoading] = (0,
|
|
39925
|
-
const [error, setError] = (0,
|
|
39926
|
-
const [tools, setTools] = (0,
|
|
39927
|
-
const [health, setHealth] = (0,
|
|
41496
|
+
const [loading, setLoading] = (0, import_react56.useState)(true);
|
|
41497
|
+
const [error, setError] = (0, import_react56.useState)(null);
|
|
41498
|
+
const [tools, setTools] = (0, import_react56.useState)([]);
|
|
41499
|
+
const [health, setHealth] = (0, import_react56.useState)(null);
|
|
39928
41500
|
const gatewayConfigured = !!settings?.gatewayApiUrl;
|
|
39929
41501
|
const refresh = async () => {
|
|
39930
41502
|
setLoading(true);
|
|
@@ -39978,7 +41550,7 @@ var MCPToolsTabV2 = () => {
|
|
|
39978
41550
|
setLoading(false);
|
|
39979
41551
|
}
|
|
39980
41552
|
};
|
|
39981
|
-
(0,
|
|
41553
|
+
(0, import_react56.useEffect)(() => {
|
|
39982
41554
|
if (isLoaded) {
|
|
39983
41555
|
refresh();
|
|
39984
41556
|
} else {
|
|
@@ -39987,7 +41559,7 @@ var MCPToolsTabV2 = () => {
|
|
|
39987
41559
|
});
|
|
39988
41560
|
}
|
|
39989
41561
|
}, [isLoaded]);
|
|
39990
|
-
const localEnabledMap = (0,
|
|
41562
|
+
const localEnabledMap = (0, import_react56.useMemo)(() => {
|
|
39991
41563
|
const map23 = /* @__PURE__ */ new Map();
|
|
39992
41564
|
const sortedTools = [...localTools].sort((a, b) => {
|
|
39993
41565
|
if (a.isBuiltIn && !b.isBuiltIn) return -1;
|
|
@@ -40003,17 +41575,17 @@ var MCPToolsTabV2 = () => {
|
|
|
40003
41575
|
});
|
|
40004
41576
|
return map23;
|
|
40005
41577
|
}, [localTools]);
|
|
40006
|
-
return /* @__PURE__ */ (0,
|
|
40007
|
-
/* @__PURE__ */ (0,
|
|
40008
|
-
/* @__PURE__ */ (0,
|
|
40009
|
-
/* @__PURE__ */ (0,
|
|
41578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { children: [
|
|
41579
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
41580
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "h5", sx: { fontWeight: 600, color: "primary.main" }, children: "Available Tools" }),
|
|
41581
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Tooltip, { title: "Refresh", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.IconButton, { onClick: refresh, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_Refresh5.default, {}) }) }) })
|
|
40010
41582
|
] }),
|
|
40011
|
-
!gatewayConfigured && /* @__PURE__ */ (0,
|
|
40012
|
-
/* @__PURE__ */ (0,
|
|
40013
|
-
health?.status === "healthy" ? /* @__PURE__ */ (0,
|
|
40014
|
-
/* @__PURE__ */ (0,
|
|
40015
|
-
/* @__PURE__ */ (0,
|
|
40016
|
-
|
|
41583
|
+
!gatewayConfigured && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Paper, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "body2", color: "text.secondary", children: "Gateway API URL isn\u2019t configured. The controller endpoints will be fetched relative to this origin." }) }),
|
|
41584
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Paper, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
41585
|
+
health?.status === "healthy" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_HealthAndSafety.default, { color: "success" }) : health?.status === "unhealthy" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_ErrorOutline3.default, { color: "error" }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_ErrorOutline3.default, { color: "disabled" }),
|
|
41586
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "Controller Health" }),
|
|
41587
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
41588
|
+
import_material46.Chip,
|
|
40017
41589
|
{
|
|
40018
41590
|
size: "small",
|
|
40019
41591
|
label: (health?.status || "unknown").toString(),
|
|
@@ -40021,11 +41593,11 @@ var MCPToolsTabV2 = () => {
|
|
|
40021
41593
|
sx: { ml: 1 }
|
|
40022
41594
|
}
|
|
40023
41595
|
),
|
|
40024
|
-
health?.timestamp && /* @__PURE__ */ (0,
|
|
41596
|
+
health?.timestamp && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "caption", color: "text.secondary", sx: { ml: 1 }, children: new Date(health.timestamp).toLocaleString() })
|
|
40025
41597
|
] }) }),
|
|
40026
|
-
loading && /* @__PURE__ */ (0,
|
|
40027
|
-
error && /* @__PURE__ */ (0,
|
|
40028
|
-
/* @__PURE__ */ (0,
|
|
41598
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Box, { sx: { mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.LinearProgress, {}) }),
|
|
41599
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Paper, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { color: "error", children: error }) }),
|
|
41600
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Stack, { spacing: 2, children: tools.map((tool) => {
|
|
40029
41601
|
let locallyEnabled = localEnabledMap.get(tool.id);
|
|
40030
41602
|
if (locallyEnabled === void 0) {
|
|
40031
41603
|
locallyEnabled = localEnabledMap.get(tool.name);
|
|
@@ -40036,17 +41608,17 @@ var MCPToolsTabV2 = () => {
|
|
|
40036
41608
|
);
|
|
40037
41609
|
locallyEnabled = directLookup?.enabled ?? tool.isEnabled;
|
|
40038
41610
|
}
|
|
40039
|
-
return /* @__PURE__ */ (0,
|
|
40040
|
-
/* @__PURE__ */ (0,
|
|
40041
|
-
/* @__PURE__ */ (0,
|
|
40042
|
-
/* @__PURE__ */ (0,
|
|
40043
|
-
/* @__PURE__ */ (0,
|
|
41611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Paper, { sx: { p: 2 }, children: [
|
|
41612
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
41613
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { children: [
|
|
41614
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "h6", sx: { fontWeight: 700 }, children: tool.name }),
|
|
41615
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: tool.description })
|
|
40044
41616
|
] }),
|
|
40045
|
-
/* @__PURE__ */ (0,
|
|
40046
|
-
/* @__PURE__ */ (0,
|
|
40047
|
-
|
|
41617
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
41618
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
41619
|
+
import_material46.FormControlLabel,
|
|
40048
41620
|
{
|
|
40049
|
-
control: /* @__PURE__ */ (0,
|
|
41621
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Switch, { checked: !!locallyEnabled, onChange: () => {
|
|
40050
41622
|
let local = localTools.find((t) => t.function.name === tool.id);
|
|
40051
41623
|
if (!local) {
|
|
40052
41624
|
local = localTools.find((t) => t.function.name === tool.name);
|
|
@@ -40066,12 +41638,12 @@ var MCPToolsTabV2 = () => {
|
|
|
40066
41638
|
label: locallyEnabled ? "Enabled" : "Disabled"
|
|
40067
41639
|
}
|
|
40068
41640
|
),
|
|
40069
|
-
/* @__PURE__ */ (0,
|
|
41641
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Tooltip, { title: "Controller-driven tools (read-only schema)", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_Settings3.default, { color: "disabled" }) })
|
|
40070
41642
|
] })
|
|
40071
41643
|
] }),
|
|
40072
|
-
!!tool.supportedParameters?.length && /* @__PURE__ */ (0,
|
|
40073
|
-
/* @__PURE__ */ (0,
|
|
40074
|
-
/* @__PURE__ */ (0,
|
|
41644
|
+
!!tool.supportedParameters?.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { mt: 1.5 }, children: [
|
|
41645
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "caption", color: "text.secondary", children: "Supported parameters" }),
|
|
41646
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Box, { sx: { mt: 0.5, display: "flex", flexWrap: "wrap", gap: 1 }, children: tool.supportedParameters.map((p) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Chip, { size: "small", label: p }, p)) })
|
|
40075
41647
|
] })
|
|
40076
41648
|
] }, tool.id);
|
|
40077
41649
|
}) })
|
|
@@ -40085,19 +41657,28 @@ init_banditTheme();
|
|
|
40085
41657
|
init_themeMap();
|
|
40086
41658
|
init_util();
|
|
40087
41659
|
init_brandingService();
|
|
41660
|
+
init_authenticationService();
|
|
40088
41661
|
init_debugLogger();
|
|
40089
41662
|
init_packageSettingsStore();
|
|
40090
41663
|
init_preferencesStore();
|
|
40091
41664
|
init_aiProviderStore();
|
|
41665
|
+
init_authenticationStore();
|
|
40092
41666
|
init_useNotificationService();
|
|
40093
41667
|
init_useFeatures();
|
|
40094
|
-
var
|
|
41668
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
40095
41669
|
var preloadChatPage = () => Promise.resolve().then(() => (init_chat2(), chat_exports));
|
|
41670
|
+
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
41671
|
+
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
41672
|
+
if (trimmed.endsWith("/api")) {
|
|
41673
|
+
return `${trimmed}/capabilities`;
|
|
41674
|
+
}
|
|
41675
|
+
return `${trimmed}/api/capabilities`;
|
|
41676
|
+
};
|
|
40096
41677
|
var Management = () => {
|
|
40097
41678
|
const navigate = (0, import_react_router_dom5.useNavigate)();
|
|
40098
41679
|
const notificationService2 = useNotificationService();
|
|
40099
41680
|
const isMobile = (0, import_useMediaQuery2.default)("(max-width:900px)");
|
|
40100
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
41681
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react57.useState)(false);
|
|
40101
41682
|
const getOptimalFabLogo = async () => {
|
|
40102
41683
|
const banditHead7 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
40103
41684
|
try {
|
|
@@ -40137,16 +41718,16 @@ var Management = () => {
|
|
|
40137
41718
|
hasTransparentLogo,
|
|
40138
41719
|
setHasTransparentLogo
|
|
40139
41720
|
} = useModelStore();
|
|
40140
|
-
const [modalOpen, setModalOpen] = (0,
|
|
41721
|
+
const [modalOpen, setModalOpen] = (0, import_react57.useState)(false);
|
|
40141
41722
|
const banditHead6 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
40142
|
-
const [fabLogo, setFabLogo] = (0,
|
|
40143
|
-
const [tabIndex, setTabIndex] = (0,
|
|
40144
|
-
const [logoFile, setLogoFile] = (0,
|
|
40145
|
-
const [logoBase64, setLogoBase64] = (0,
|
|
40146
|
-
const [brandingText, setBrandingText] = (0,
|
|
40147
|
-
const [theme, setTheme] = (0,
|
|
40148
|
-
const [customAvatarBase64, setCustomAvatarBase64] = (0,
|
|
40149
|
-
const [presetAvatar, setPresetAvatar] = (0,
|
|
41723
|
+
const [fabLogo, setFabLogo] = (0, import_react57.useState)(banditHead6);
|
|
41724
|
+
const [tabIndex, setTabIndex] = (0, import_react57.useState)(0);
|
|
41725
|
+
const [logoFile, setLogoFile] = (0, import_react57.useState)(null);
|
|
41726
|
+
const [logoBase64, setLogoBase64] = (0, import_react57.useState)(null);
|
|
41727
|
+
const [brandingText, setBrandingText] = (0, import_react57.useState)("");
|
|
41728
|
+
const [theme, setTheme] = (0, import_react57.useState)("bandit-dark");
|
|
41729
|
+
const [customAvatarBase64, setCustomAvatarBase64] = (0, import_react57.useState)(null);
|
|
41730
|
+
const [presetAvatar, setPresetAvatar] = (0, import_react57.useState)(null);
|
|
40150
41731
|
const showSnackbarMessage = (message, severity = "success") => {
|
|
40151
41732
|
if (severity === "success") {
|
|
40152
41733
|
notificationService2?.showSuccess(message);
|
|
@@ -40154,16 +41735,18 @@ var Management = () => {
|
|
|
40154
41735
|
notificationService2?.showError(message);
|
|
40155
41736
|
}
|
|
40156
41737
|
};
|
|
40157
|
-
const [restoreDialogOpen, setRestoreDialogOpen] = (0,
|
|
40158
|
-
const [brandingLoaded, setBrandingLoaded] = (0,
|
|
40159
|
-
const [isLoadingBranding, setIsLoadingBranding] = (0,
|
|
41738
|
+
const [restoreDialogOpen, setRestoreDialogOpen] = (0, import_react57.useState)(false);
|
|
41739
|
+
const [brandingLoaded, setBrandingLoaded] = (0, import_react57.useState)(false);
|
|
41740
|
+
const [isLoadingBranding, setIsLoadingBranding] = (0, import_react57.useState)(false);
|
|
40160
41741
|
const { initModels } = useModelStore();
|
|
40161
41742
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
41743
|
+
const authToken = useAuthenticationStore((state) => state.token);
|
|
40162
41744
|
const { preferences, updatePreference } = usePreferencesStore();
|
|
40163
41745
|
const { hasAdminDashboard, hasLimitedAdminDashboard, getCurrentTier, hasAdvancedSearch } = useFeatures();
|
|
40164
41746
|
const { showAdminPanel, showLimitedAdminPanel } = useFeatureVisibility();
|
|
40165
41747
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
40166
|
-
const [
|
|
41748
|
+
const [seedPacksEnabled, setSeedPacksEnabled] = (0, import_react57.useState)(false);
|
|
41749
|
+
const [localSelectedModel, setLocalSelectedModel] = (0, import_react57.useState)({
|
|
40167
41750
|
name: "",
|
|
40168
41751
|
tagline: "",
|
|
40169
41752
|
systemPrompt: "",
|
|
@@ -40176,7 +41759,7 @@ var Management = () => {
|
|
|
40176
41759
|
loadDocuments,
|
|
40177
41760
|
clearAllDocuments
|
|
40178
41761
|
} = useKnowledgeStore2();
|
|
40179
|
-
(0,
|
|
41762
|
+
(0, import_react57.useEffect)(() => {
|
|
40180
41763
|
if (selectedModel) {
|
|
40181
41764
|
const selected = availableModels.find((m) => m.name === selectedModel);
|
|
40182
41765
|
if (selected) {
|
|
@@ -40200,7 +41783,7 @@ var Management = () => {
|
|
|
40200
41783
|
}
|
|
40201
41784
|
}
|
|
40202
41785
|
}, [selectedModel, availableModels]);
|
|
40203
|
-
const loadBrandingConfig = (0,
|
|
41786
|
+
const loadBrandingConfig = (0, import_react57.useCallback)(async () => {
|
|
40204
41787
|
if (isLoadingBranding || brandingLoaded) {
|
|
40205
41788
|
debugLogger.warn("Branding loading already in progress or completed, skipping");
|
|
40206
41789
|
return;
|
|
@@ -40315,15 +41898,15 @@ var Management = () => {
|
|
|
40315
41898
|
setTagline,
|
|
40316
41899
|
setTheme
|
|
40317
41900
|
]);
|
|
40318
|
-
(0,
|
|
41901
|
+
(0, import_react57.useEffect)(() => {
|
|
40319
41902
|
void loadBrandingConfig();
|
|
40320
41903
|
}, [loadBrandingConfig]);
|
|
40321
41904
|
const handleOpenModal = () => setModalOpen(true);
|
|
40322
41905
|
const handleCloseModal = () => setModalOpen(false);
|
|
40323
|
-
(0,
|
|
41906
|
+
(0, import_react57.useEffect)(() => {
|
|
40324
41907
|
getOptimalFabLogo().then(setFabLogo);
|
|
40325
41908
|
}, []);
|
|
40326
|
-
(0,
|
|
41909
|
+
(0, import_react57.useEffect)(() => {
|
|
40327
41910
|
if (logoBase64) {
|
|
40328
41911
|
setFabLogo(logoBase64);
|
|
40329
41912
|
} else {
|
|
@@ -40378,6 +41961,7 @@ var Management = () => {
|
|
|
40378
41961
|
name: modelToSave.name,
|
|
40379
41962
|
tagline: modelToSave.tagline,
|
|
40380
41963
|
systemPrompt: modelToSave.systemPrompt,
|
|
41964
|
+
avatarBase64: modelToSave.avatarBase64 || void 0,
|
|
40381
41965
|
selectedModel: modelToSave.name
|
|
40382
41966
|
}
|
|
40383
41967
|
};
|
|
@@ -40430,6 +42014,19 @@ var Management = () => {
|
|
|
40430
42014
|
try {
|
|
40431
42015
|
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
40432
42016
|
debugLogger.info("Saving branding data to IndexedDB");
|
|
42017
|
+
let finalHasTransparentLogo = hasTransparentLogo;
|
|
42018
|
+
if (logoBase64) {
|
|
42019
|
+
try {
|
|
42020
|
+
const detected = await detectTransparency(logoBase64);
|
|
42021
|
+
const isPng = logoBase64.startsWith("data:image/png");
|
|
42022
|
+
finalHasTransparentLogo = detected || isPng;
|
|
42023
|
+
debugLogger.debug("SaveBranding transparency check", { detected, isPng, finalHasTransparentLogo });
|
|
42024
|
+
} catch (err) {
|
|
42025
|
+
const isPng = logoBase64.startsWith("data:image/png");
|
|
42026
|
+
finalHasTransparentLogo = finalHasTransparentLogo ?? isPng ?? true;
|
|
42027
|
+
debugLogger.warn("SaveBranding transparency check failed, using fallback", { error: err, finalHasTransparentLogo });
|
|
42028
|
+
}
|
|
42029
|
+
}
|
|
40433
42030
|
const current = await indexedDBService_default.get(
|
|
40434
42031
|
"banditConfig",
|
|
40435
42032
|
1,
|
|
@@ -40445,7 +42042,7 @@ var Management = () => {
|
|
|
40445
42042
|
logoBase64,
|
|
40446
42043
|
brandingText,
|
|
40447
42044
|
theme,
|
|
40448
|
-
hasTransparentLogo,
|
|
42045
|
+
hasTransparentLogo: finalHasTransparentLogo,
|
|
40449
42046
|
userSaved: true
|
|
40450
42047
|
// Mark as user-saved to protect from CDN overrides
|
|
40451
42048
|
}
|
|
@@ -40484,9 +42081,11 @@ var Management = () => {
|
|
|
40484
42081
|
setLogoBase64(base64);
|
|
40485
42082
|
debugLogger.debug("Starting transparency detection for uploaded image");
|
|
40486
42083
|
try {
|
|
42084
|
+
const isPng = base64.startsWith("data:image/png");
|
|
40487
42085
|
const isTransparent = await detectTransparency(base64);
|
|
40488
|
-
|
|
40489
|
-
|
|
42086
|
+
const finalTransparent = isTransparent || isPng;
|
|
42087
|
+
setHasTransparentLogo(finalTransparent);
|
|
42088
|
+
debugLogger.debug("Transparency detection result saved", { isTransparent, finalTransparent });
|
|
40490
42089
|
} catch (err) {
|
|
40491
42090
|
debugLogger.error("Failed to detect transparency", { error: err });
|
|
40492
42091
|
}
|
|
@@ -40699,7 +42298,8 @@ var Management = () => {
|
|
|
40699
42298
|
name: modelName2,
|
|
40700
42299
|
tagline: typeof parsedModel.tagline === "string" ? parsedModel.tagline : void 0,
|
|
40701
42300
|
systemPrompt: typeof parsedModel.systemPrompt === "string" ? parsedModel.systemPrompt : void 0,
|
|
40702
|
-
selectedModel: typeof parsedModel.selectedModel === "string" ? parsedModel.selectedModel : void 0
|
|
42301
|
+
selectedModel: typeof parsedModel.selectedModel === "string" ? parsedModel.selectedModel : void 0,
|
|
42302
|
+
avatarBase64: typeof parsedModel.avatarBase64 === "string" ? parsedModel.avatarBase64 : parsedModel.avatarBase64 === null ? void 0 : void 0
|
|
40703
42303
|
};
|
|
40704
42304
|
const entry = {
|
|
40705
42305
|
id: modelName2,
|
|
@@ -40707,7 +42307,8 @@ var Management = () => {
|
|
|
40707
42307
|
name: modelName2,
|
|
40708
42308
|
tagline: sanitizedModel.tagline,
|
|
40709
42309
|
systemPrompt: sanitizedModel.systemPrompt,
|
|
40710
|
-
|
|
42310
|
+
// Normalize to match StoredBanditConfigRecord (string | undefined)
|
|
42311
|
+
avatarBase64: sanitizedModel.avatarBase64 ?? void 0
|
|
40711
42312
|
};
|
|
40712
42313
|
await indexedDBService_default.put("banditConfig", 1, "config", entry, storeConfigs6);
|
|
40713
42314
|
}
|
|
@@ -40752,7 +42353,7 @@ var Management = () => {
|
|
|
40752
42353
|
reader.readAsText(file);
|
|
40753
42354
|
}
|
|
40754
42355
|
};
|
|
40755
|
-
(0,
|
|
42356
|
+
(0, import_react57.useEffect)(() => {
|
|
40756
42357
|
if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
|
|
40757
42358
|
setLocalSelectedModel((prev) => ({
|
|
40758
42359
|
...prev,
|
|
@@ -40760,51 +42361,120 @@ var Management = () => {
|
|
|
40760
42361
|
}));
|
|
40761
42362
|
}
|
|
40762
42363
|
}, [availableModels, localSelectedModel.selectedModel]);
|
|
40763
|
-
(0,
|
|
42364
|
+
(0, import_react57.useEffect)(() => {
|
|
40764
42365
|
loadDocuments();
|
|
40765
42366
|
}, [loadDocuments]);
|
|
40766
|
-
|
|
42367
|
+
(0, import_react57.useEffect)(() => {
|
|
42368
|
+
const gatewayApiUrl = packageSettings?.gatewayApiUrl;
|
|
42369
|
+
if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
|
|
42370
|
+
setSeedPacksEnabled(false);
|
|
42371
|
+
return;
|
|
42372
|
+
}
|
|
42373
|
+
let isActive = true;
|
|
42374
|
+
const loadCapabilities = async () => {
|
|
42375
|
+
try {
|
|
42376
|
+
const token = authToken ?? authenticationService.getToken();
|
|
42377
|
+
const headers = {
|
|
42378
|
+
"Content-Type": "application/json"
|
|
42379
|
+
};
|
|
42380
|
+
if (token) {
|
|
42381
|
+
headers.Authorization = `Bearer ${token}`;
|
|
42382
|
+
}
|
|
42383
|
+
const response = await fetch(buildCapabilitiesUrl(gatewayApiUrl), {
|
|
42384
|
+
method: "GET",
|
|
42385
|
+
headers
|
|
42386
|
+
});
|
|
42387
|
+
if (!response.ok) {
|
|
42388
|
+
throw new Error(`Capabilities request failed: ${response.status}`);
|
|
42389
|
+
}
|
|
42390
|
+
const payload = await response.json();
|
|
42391
|
+
if (!isActive) {
|
|
42392
|
+
return;
|
|
42393
|
+
}
|
|
42394
|
+
setSeedPacksEnabled(Boolean(payload?.seedPacksEnabled));
|
|
42395
|
+
} catch (error) {
|
|
42396
|
+
if (!isActive) {
|
|
42397
|
+
return;
|
|
42398
|
+
}
|
|
42399
|
+
setSeedPacksEnabled(false);
|
|
42400
|
+
debugLogger.warn("Management: failed to load capabilities", {
|
|
42401
|
+
error: error instanceof Error ? error.message : String(error)
|
|
42402
|
+
});
|
|
42403
|
+
}
|
|
42404
|
+
};
|
|
42405
|
+
loadCapabilities();
|
|
42406
|
+
return () => {
|
|
42407
|
+
isActive = false;
|
|
42408
|
+
};
|
|
42409
|
+
}, [packageSettings?.gatewayApiUrl, authToken]);
|
|
42410
|
+
const currentTheme = (0, import_react57.useMemo)(() => {
|
|
42411
|
+
const baseTheme = predefinedThemes[theme] || banditDarkTheme;
|
|
42412
|
+
return (0, import_styles31.createTheme)(baseTheme, {
|
|
42413
|
+
components: {
|
|
42414
|
+
MuiInputBase: {
|
|
42415
|
+
styleOverrides: {
|
|
42416
|
+
input: {
|
|
42417
|
+
outline: "none",
|
|
42418
|
+
boxShadow: "none",
|
|
42419
|
+
"&:focus, &:focus-visible": {
|
|
42420
|
+
outline: "none",
|
|
42421
|
+
boxShadow: "none"
|
|
42422
|
+
}
|
|
42423
|
+
},
|
|
42424
|
+
inputMultiline: {
|
|
42425
|
+
outline: "none",
|
|
42426
|
+
boxShadow: "none",
|
|
42427
|
+
"&:focus, &:focus-visible": {
|
|
42428
|
+
outline: "none",
|
|
42429
|
+
boxShadow: "none"
|
|
42430
|
+
}
|
|
42431
|
+
}
|
|
42432
|
+
}
|
|
42433
|
+
}
|
|
42434
|
+
}
|
|
42435
|
+
});
|
|
42436
|
+
}, [theme]);
|
|
40767
42437
|
if (!brandingLoaded) return null;
|
|
40768
42438
|
const allNavTabs = [
|
|
40769
42439
|
{
|
|
40770
42440
|
label: "Personalities",
|
|
40771
|
-
icon: /* @__PURE__ */ (0,
|
|
42441
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_FaceRetouchingNatural.default, {}),
|
|
40772
42442
|
requiresFeature: "limitedAdminDashboard"
|
|
40773
42443
|
// Available to premium+
|
|
40774
42444
|
},
|
|
40775
42445
|
{
|
|
40776
42446
|
label: "Branding",
|
|
40777
|
-
icon: /* @__PURE__ */ (0,
|
|
42447
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Brush.default, {}),
|
|
40778
42448
|
requiresFeature: "limitedAdminDashboard"
|
|
40779
42449
|
// Available to premium+
|
|
40780
42450
|
},
|
|
40781
42451
|
{
|
|
40782
42452
|
label: "Knowledge",
|
|
40783
|
-
icon: /* @__PURE__ */ (0,
|
|
42453
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_MenuBook.default, {}),
|
|
40784
42454
|
requiresFeature: "limitedAdminDashboard"
|
|
40785
42455
|
// Available to premium+
|
|
40786
42456
|
},
|
|
40787
42457
|
{
|
|
40788
42458
|
label: "Storage",
|
|
40789
|
-
icon: /* @__PURE__ */ (0,
|
|
42459
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Storage2.default, {}),
|
|
40790
42460
|
requiresFeature: "limitedAdminDashboard"
|
|
40791
42461
|
// Available to premium+ (changed from adminDashboardEnabled)
|
|
40792
42462
|
},
|
|
40793
42463
|
{
|
|
40794
42464
|
label: "Preferences",
|
|
40795
|
-
icon: /* @__PURE__ */ (0,
|
|
42465
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Tune.default, {}),
|
|
40796
42466
|
requiresFeature: "limitedAdminDashboard"
|
|
40797
42467
|
// Available to premium+
|
|
40798
42468
|
},
|
|
40799
42469
|
{
|
|
40800
42470
|
label: "Provider",
|
|
40801
|
-
icon: /* @__PURE__ */ (0,
|
|
42471
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Cloud2.default, {}),
|
|
40802
42472
|
requiresFeature: "advancedSearch"
|
|
40803
42473
|
// Pro/Team users with advanced features
|
|
40804
42474
|
},
|
|
40805
42475
|
{
|
|
40806
42476
|
label: "MCP Tools",
|
|
40807
|
-
icon: /* @__PURE__ */ (0,
|
|
42477
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Build.default, {}),
|
|
40808
42478
|
requiresFeature: "advancedSearch"
|
|
40809
42479
|
// Pro/Team users with advanced features
|
|
40810
42480
|
}
|
|
@@ -40821,8 +42491,8 @@ var Management = () => {
|
|
|
40821
42491
|
}
|
|
40822
42492
|
return true;
|
|
40823
42493
|
});
|
|
40824
|
-
const navigationContent = /* @__PURE__ */ (0,
|
|
40825
|
-
|
|
42494
|
+
const navigationContent = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42495
|
+
import_material47.Box,
|
|
40826
42496
|
{
|
|
40827
42497
|
sx: {
|
|
40828
42498
|
display: "flex",
|
|
@@ -40832,29 +42502,29 @@ var Management = () => {
|
|
|
40832
42502
|
bgcolor: "inherit"
|
|
40833
42503
|
},
|
|
40834
42504
|
children: [
|
|
40835
|
-
isMobile && /* @__PURE__ */ (0,
|
|
40836
|
-
|
|
42505
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42506
|
+
import_material47.Box,
|
|
40837
42507
|
{
|
|
40838
42508
|
sx: {
|
|
40839
42509
|
height: 6,
|
|
40840
42510
|
width: 56,
|
|
40841
42511
|
borderRadius: 999,
|
|
40842
|
-
bgcolor: (theme2) => (0,
|
|
42512
|
+
bgcolor: (theme2) => (0, import_styles31.alpha)(theme2.palette.text.primary, 0.18),
|
|
40843
42513
|
alignSelf: "center",
|
|
40844
42514
|
mt: 1.25,
|
|
40845
42515
|
mb: 0.75
|
|
40846
42516
|
}
|
|
40847
42517
|
}
|
|
40848
42518
|
),
|
|
40849
|
-
/* @__PURE__ */ (0,
|
|
40850
|
-
|
|
42519
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Box, { sx: { p: isMobile ? 2.5 : 3, pb: isMobile ? 1.5 : 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42520
|
+
import_material47.Button,
|
|
40851
42521
|
{
|
|
40852
42522
|
onClick: () => {
|
|
40853
42523
|
if (isMobile) setSidebarOpen(false);
|
|
40854
42524
|
navigate("/chat");
|
|
40855
42525
|
},
|
|
40856
42526
|
onMouseEnter: preloadChatPage,
|
|
40857
|
-
startIcon: /* @__PURE__ */ (0,
|
|
42527
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_ChevronLeft.default, { sx: { fontSize: 20 } }),
|
|
40858
42528
|
fullWidth: true,
|
|
40859
42529
|
variant: "outlined",
|
|
40860
42530
|
sx: {
|
|
@@ -40881,9 +42551,9 @@ var Management = () => {
|
|
|
40881
42551
|
children: "Back to Chat"
|
|
40882
42552
|
}
|
|
40883
42553
|
) }),
|
|
40884
|
-
/* @__PURE__ */ (0,
|
|
40885
|
-
/* @__PURE__ */ (0,
|
|
40886
|
-
|
|
42554
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Divider, { sx: { mx: isMobile ? 2 : 3, mb: 2, opacity: 0.6 } }),
|
|
42555
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Box, { sx: { flex: 1, px: isMobile ? 1.5 : 2, pb: 3, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.List, { sx: { px: 0, py: 0 }, children: navTabs.map((tab, idx) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42556
|
+
import_material47.ListItemButton,
|
|
40887
42557
|
{
|
|
40888
42558
|
selected: tabIndex === idx,
|
|
40889
42559
|
onClick: () => {
|
|
@@ -40932,8 +42602,8 @@ var Management = () => {
|
|
|
40932
42602
|
}
|
|
40933
42603
|
},
|
|
40934
42604
|
children: [
|
|
40935
|
-
/* @__PURE__ */ (0,
|
|
40936
|
-
|
|
42605
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42606
|
+
import_material47.ListItemIcon,
|
|
40937
42607
|
{
|
|
40938
42608
|
sx: {
|
|
40939
42609
|
color: tabIndex === idx ? "primary.main" : "text.secondary",
|
|
@@ -40943,8 +42613,8 @@ var Management = () => {
|
|
|
40943
42613
|
children: tab.icon
|
|
40944
42614
|
}
|
|
40945
42615
|
),
|
|
40946
|
-
/* @__PURE__ */ (0,
|
|
40947
|
-
|
|
42616
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42617
|
+
import_material47.ListItemText,
|
|
40948
42618
|
{
|
|
40949
42619
|
primary: tab.label,
|
|
40950
42620
|
primaryTypographyProps: {
|
|
@@ -40954,8 +42624,8 @@ var Management = () => {
|
|
|
40954
42624
|
}
|
|
40955
42625
|
}
|
|
40956
42626
|
),
|
|
40957
|
-
tabIndex === idx && /* @__PURE__ */ (0,
|
|
40958
|
-
|
|
42627
|
+
tabIndex === idx && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42628
|
+
import_material47.Box,
|
|
40959
42629
|
{
|
|
40960
42630
|
sx: {
|
|
40961
42631
|
position: "absolute",
|
|
@@ -40977,10 +42647,10 @@ var Management = () => {
|
|
|
40977
42647
|
]
|
|
40978
42648
|
}
|
|
40979
42649
|
);
|
|
40980
|
-
return /* @__PURE__ */ (0,
|
|
40981
|
-
/* @__PURE__ */ (0,
|
|
40982
|
-
/* @__PURE__ */ (0,
|
|
40983
|
-
|
|
42650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_material47.ThemeProvider, { theme: currentTheme, children: [
|
|
42651
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.CssBaseline, {}),
|
|
42652
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42653
|
+
import_material47.Box,
|
|
40984
42654
|
{
|
|
40985
42655
|
display: "flex",
|
|
40986
42656
|
height: "100vh",
|
|
@@ -40992,8 +42662,8 @@ var Management = () => {
|
|
|
40992
42662
|
position: "relative"
|
|
40993
42663
|
},
|
|
40994
42664
|
children: [
|
|
40995
|
-
isMobile && /* @__PURE__ */ (0,
|
|
40996
|
-
|
|
42665
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42666
|
+
import_material47.Box,
|
|
40997
42667
|
{
|
|
40998
42668
|
sx: {
|
|
40999
42669
|
width: "100%",
|
|
@@ -41012,8 +42682,8 @@ var Management = () => {
|
|
|
41012
42682
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
41013
42683
|
},
|
|
41014
42684
|
children: [
|
|
41015
|
-
/* @__PURE__ */ (0,
|
|
41016
|
-
|
|
42685
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42686
|
+
import_material47.Button,
|
|
41017
42687
|
{
|
|
41018
42688
|
onClick: () => setSidebarOpen((o) => !o),
|
|
41019
42689
|
sx: {
|
|
@@ -41034,7 +42704,7 @@ var Management = () => {
|
|
|
41034
42704
|
transform: sidebarOpen ? "rotate(90deg) scale(0.95)" : "scale(0.95)"
|
|
41035
42705
|
}
|
|
41036
42706
|
},
|
|
41037
|
-
children: /* @__PURE__ */ (0,
|
|
42707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41038
42708
|
"path",
|
|
41039
42709
|
{
|
|
41040
42710
|
d: sidebarOpen ? "M18 6L6 18M6 6L18 18" : "M3 12H21M3 6H21M3 18H21",
|
|
@@ -41046,8 +42716,8 @@ var Management = () => {
|
|
|
41046
42716
|
) })
|
|
41047
42717
|
}
|
|
41048
42718
|
),
|
|
41049
|
-
/* @__PURE__ */ (0,
|
|
41050
|
-
|
|
42719
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42720
|
+
import_material47.Typography,
|
|
41051
42721
|
{
|
|
41052
42722
|
variant: "h6",
|
|
41053
42723
|
sx: {
|
|
@@ -41059,14 +42729,14 @@ var Management = () => {
|
|
|
41059
42729
|
children: "Management"
|
|
41060
42730
|
}
|
|
41061
42731
|
),
|
|
41062
|
-
/* @__PURE__ */ (0,
|
|
42732
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Box, { sx: {
|
|
41063
42733
|
px: 2,
|
|
41064
42734
|
py: 0.5,
|
|
41065
42735
|
borderRadius: 2,
|
|
41066
42736
|
bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.12)" : "rgba(25,118,210,0.08)",
|
|
41067
42737
|
border: (theme2) => `1px solid ${theme2.palette.primary.main}20`
|
|
41068
|
-
}, children: /* @__PURE__ */ (0,
|
|
41069
|
-
|
|
42738
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42739
|
+
import_material47.Typography,
|
|
41070
42740
|
{
|
|
41071
42741
|
variant: "caption",
|
|
41072
42742
|
sx: {
|
|
@@ -41080,8 +42750,8 @@ var Management = () => {
|
|
|
41080
42750
|
]
|
|
41081
42751
|
}
|
|
41082
42752
|
),
|
|
41083
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
41084
|
-
|
|
42753
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42754
|
+
import_material47.SwipeableDrawer,
|
|
41085
42755
|
{
|
|
41086
42756
|
anchor: "bottom",
|
|
41087
42757
|
open: sidebarOpen,
|
|
@@ -41101,8 +42771,8 @@ var Management = () => {
|
|
|
41101
42771
|
},
|
|
41102
42772
|
children: navigationContent
|
|
41103
42773
|
}
|
|
41104
|
-
) : /* @__PURE__ */ (0,
|
|
41105
|
-
|
|
42774
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42775
|
+
import_material47.Box,
|
|
41106
42776
|
{
|
|
41107
42777
|
sx: {
|
|
41108
42778
|
width: 280,
|
|
@@ -41125,8 +42795,8 @@ var Management = () => {
|
|
|
41125
42795
|
children: navigationContent
|
|
41126
42796
|
}
|
|
41127
42797
|
),
|
|
41128
|
-
/* @__PURE__ */ (0,
|
|
41129
|
-
|
|
42798
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42799
|
+
import_material47.Box,
|
|
41130
42800
|
{
|
|
41131
42801
|
sx: {
|
|
41132
42802
|
flex: 1,
|
|
@@ -41154,7 +42824,7 @@ var Management = () => {
|
|
|
41154
42824
|
// IE and Edge
|
|
41155
42825
|
},
|
|
41156
42826
|
children: [
|
|
41157
|
-
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ (0,
|
|
42827
|
+
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41158
42828
|
PersonalitiesTab_default,
|
|
41159
42829
|
{
|
|
41160
42830
|
availableModels,
|
|
@@ -41173,7 +42843,7 @@ var Management = () => {
|
|
|
41173
42843
|
showSnackbar: showSnackbarMessage
|
|
41174
42844
|
}
|
|
41175
42845
|
),
|
|
41176
|
-
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ (0,
|
|
42846
|
+
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41177
42847
|
BrandingTab_default,
|
|
41178
42848
|
{
|
|
41179
42849
|
logoFile,
|
|
@@ -41192,8 +42862,8 @@ var Management = () => {
|
|
|
41192
42862
|
setLogoBase64
|
|
41193
42863
|
}
|
|
41194
42864
|
),
|
|
41195
|
-
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ (0,
|
|
41196
|
-
|
|
42865
|
+
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42866
|
+
KnowledgeHubTab_default,
|
|
41197
42867
|
{
|
|
41198
42868
|
documents,
|
|
41199
42869
|
addDocuments,
|
|
@@ -41201,11 +42871,12 @@ var Management = () => {
|
|
|
41201
42871
|
loadDocuments,
|
|
41202
42872
|
clearAllDocuments,
|
|
41203
42873
|
currentTheme,
|
|
41204
|
-
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard()
|
|
42874
|
+
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard(),
|
|
42875
|
+
seedPacksEnabled
|
|
41205
42876
|
}
|
|
41206
42877
|
),
|
|
41207
|
-
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ (0,
|
|
41208
|
-
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ (0,
|
|
42878
|
+
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(StorageTab_default, { currentTheme }),
|
|
42879
|
+
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41209
42880
|
PreferencesTab_default,
|
|
41210
42881
|
{
|
|
41211
42882
|
preferences,
|
|
@@ -41215,13 +42886,13 @@ var Management = () => {
|
|
|
41215
42886
|
showSnackbar: showSnackbarMessage
|
|
41216
42887
|
}
|
|
41217
42888
|
),
|
|
41218
|
-
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ (0,
|
|
41219
|
-
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ (0,
|
|
42889
|
+
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ProviderTab, {}),
|
|
42890
|
+
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MCPToolsTabV2_default, {})
|
|
41220
42891
|
]
|
|
41221
42892
|
}
|
|
41222
42893
|
),
|
|
41223
|
-
/* @__PURE__ */ (0,
|
|
41224
|
-
|
|
42894
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42895
|
+
import_material47.Fab,
|
|
41225
42896
|
{
|
|
41226
42897
|
"aria-label": "AI",
|
|
41227
42898
|
onClick: handleOpenModal,
|
|
@@ -41242,7 +42913,7 @@ var Management = () => {
|
|
|
41242
42913
|
boxShadow: theme2.shadows[6],
|
|
41243
42914
|
zIndex: 2e3
|
|
41244
42915
|
}),
|
|
41245
|
-
children: /* @__PURE__ */ (0,
|
|
42916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41246
42917
|
"img",
|
|
41247
42918
|
{
|
|
41248
42919
|
src: fabLogo,
|
|
@@ -41256,7 +42927,7 @@ var Management = () => {
|
|
|
41256
42927
|
)
|
|
41257
42928
|
}
|
|
41258
42929
|
),
|
|
41259
|
-
/* @__PURE__ */ (0,
|
|
42930
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(chat_modal_default, { open: modalOpen, onClose: handleCloseModal })
|
|
41260
42931
|
]
|
|
41261
42932
|
}
|
|
41262
42933
|
)
|
|
@@ -41265,7 +42936,7 @@ var Management = () => {
|
|
|
41265
42936
|
var management_default = Management;
|
|
41266
42937
|
|
|
41267
42938
|
// src/shared/custom-element.ts
|
|
41268
|
-
var
|
|
42939
|
+
var import_react58 = __toESM(require("react"));
|
|
41269
42940
|
var import_client = __toESM(require("react-dom/client"));
|
|
41270
42941
|
function defineCustomElement(name, Component) {
|
|
41271
42942
|
if (customElements.get(name)) return;
|
|
@@ -41293,7 +42964,7 @@ function defineCustomElement(name, Component) {
|
|
|
41293
42964
|
if (!this.root) {
|
|
41294
42965
|
this.root = import_client.default.createRoot(this.mountPoint);
|
|
41295
42966
|
}
|
|
41296
|
-
this.root.render(
|
|
42967
|
+
this.root.render(import_react58.default.createElement(Component, props));
|
|
41297
42968
|
}
|
|
41298
42969
|
}
|
|
41299
42970
|
customElements.define(name, ReactElement);
|
|
@@ -41502,7 +43173,7 @@ var getFeatureMatrix = () => featureFlagService.generateFeatureMatrix();
|
|
|
41502
43173
|
init_featureFlags();
|
|
41503
43174
|
|
|
41504
43175
|
// src/hooks/useVoices.ts
|
|
41505
|
-
var
|
|
43176
|
+
var import_react59 = require("react");
|
|
41506
43177
|
init_voiceStore();
|
|
41507
43178
|
init_packageSettingsStore();
|
|
41508
43179
|
init_authenticationStore();
|
|
@@ -41522,7 +43193,7 @@ var useVoices = () => {
|
|
|
41522
43193
|
} = useVoiceStore();
|
|
41523
43194
|
const gatewayApiUrl = usePackageSettingsStore((state) => state.settings?.gatewayApiUrl);
|
|
41524
43195
|
const { token } = useAuthenticationStore();
|
|
41525
|
-
(0,
|
|
43196
|
+
(0, import_react59.useEffect)(() => {
|
|
41526
43197
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
41527
43198
|
if (gatewayApiUrl && token && isAuthenticated && !isServiceAvailable) {
|
|
41528
43199
|
debugLogger.debug("Gateway API URL and JWT token available, loading voice models...");
|
|
@@ -41557,9 +43228,9 @@ init_useTTS();
|
|
|
41557
43228
|
init_streaming_tts();
|
|
41558
43229
|
|
|
41559
43230
|
// src/modals/SubscriptionExpiredModal.tsx
|
|
41560
|
-
var
|
|
43231
|
+
var import_material48 = require("@mui/material");
|
|
41561
43232
|
var import_icons_material13 = require("@mui/icons-material");
|
|
41562
|
-
var
|
|
43233
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
41563
43234
|
var SubscriptionExpiredModal = ({
|
|
41564
43235
|
open,
|
|
41565
43236
|
onNavigateHome,
|
|
@@ -41581,8 +43252,8 @@ var SubscriptionExpiredModal = ({
|
|
|
41581
43252
|
window.location.href = "/manage-subscription";
|
|
41582
43253
|
}
|
|
41583
43254
|
};
|
|
41584
|
-
return /* @__PURE__ */ (0,
|
|
41585
|
-
|
|
43255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
43256
|
+
import_material48.Dialog,
|
|
41586
43257
|
{
|
|
41587
43258
|
open,
|
|
41588
43259
|
onClose,
|
|
@@ -41596,47 +43267,47 @@ var SubscriptionExpiredModal = ({
|
|
|
41596
43267
|
}
|
|
41597
43268
|
},
|
|
41598
43269
|
children: [
|
|
41599
|
-
/* @__PURE__ */ (0,
|
|
41600
|
-
/* @__PURE__ */ (0,
|
|
41601
|
-
/* @__PURE__ */ (0,
|
|
43270
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.DialogTitle, { sx: { textAlign: "center", pb: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", gap: 1, mb: 1 }, children: [
|
|
43271
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.Warning, { color: "warning", sx: { fontSize: 32 } }),
|
|
43272
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Typography, { variant: "h5", component: "span", fontWeight: "bold", children: "Subscription Expired" })
|
|
41602
43273
|
] }) }),
|
|
41603
|
-
/* @__PURE__ */ (0,
|
|
41604
|
-
/* @__PURE__ */ (0,
|
|
41605
|
-
userEmail && /* @__PURE__ */ (0,
|
|
43274
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.DialogContent, { sx: { pt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Stack, { spacing: 2, children: [
|
|
43275
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Alert, { severity: "warning", sx: { mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Typography, { variant: "body2", children: "Your subscription has expired and access to features has been restricted." }) }),
|
|
43276
|
+
userEmail && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Typography, { variant: "body2", color: "text.secondary", sx: { textAlign: "center" }, children: [
|
|
41606
43277
|
"Account: ",
|
|
41607
|
-
/* @__PURE__ */ (0,
|
|
43278
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: userEmail })
|
|
41608
43279
|
] }),
|
|
41609
|
-
/* @__PURE__ */ (0,
|
|
41610
|
-
/* @__PURE__ */ (0,
|
|
43280
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Typography, { variant: "body1", sx: { textAlign: "center", color: "text.secondary" }, children: "To continue using all features, please renew your subscription or return to the main application." }),
|
|
43281
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Box, { sx: {
|
|
41611
43282
|
bgcolor: "background.paper",
|
|
41612
43283
|
border: 1,
|
|
41613
43284
|
borderColor: "divider",
|
|
41614
43285
|
borderRadius: 1,
|
|
41615
43286
|
p: 2,
|
|
41616
43287
|
mt: 2
|
|
41617
|
-
}, children: /* @__PURE__ */ (0,
|
|
41618
|
-
/* @__PURE__ */ (0,
|
|
43288
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Typography, { variant: "caption", color: "text.secondary", sx: { fontStyle: "italic" }, children: [
|
|
43289
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "What's affected:" }),
|
|
41619
43290
|
" All premium features including document upload, voice controls, advanced search, and admin dashboard access have been disabled until your subscription is renewed."
|
|
41620
43291
|
] }) })
|
|
41621
43292
|
] }) }),
|
|
41622
|
-
/* @__PURE__ */ (0,
|
|
41623
|
-
/* @__PURE__ */ (0,
|
|
41624
|
-
|
|
43293
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.DialogActions, { sx: { px: 3, pb: 3, gap: 1, justifyContent: "center" }, children: [
|
|
43294
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
43295
|
+
import_material48.Button,
|
|
41625
43296
|
{
|
|
41626
43297
|
onClick: handleNavigateHome,
|
|
41627
43298
|
variant: "outlined",
|
|
41628
|
-
startIcon: /* @__PURE__ */ (0,
|
|
43299
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.Home, {}),
|
|
41629
43300
|
size: "large",
|
|
41630
43301
|
sx: { minWidth: 140 },
|
|
41631
43302
|
children: "Go Home"
|
|
41632
43303
|
}
|
|
41633
43304
|
),
|
|
41634
|
-
/* @__PURE__ */ (0,
|
|
41635
|
-
|
|
43305
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
43306
|
+
import_material48.Button,
|
|
41636
43307
|
{
|
|
41637
43308
|
onClick: handleManageSubscription,
|
|
41638
43309
|
variant: "contained",
|
|
41639
|
-
startIcon: /* @__PURE__ */ (0,
|
|
43310
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.CreditCard, {}),
|
|
41640
43311
|
size: "large",
|
|
41641
43312
|
color: "primary",
|
|
41642
43313
|
sx: { minWidth: 140 },
|
|
@@ -41650,9 +43321,9 @@ var SubscriptionExpiredModal = ({
|
|
|
41650
43321
|
};
|
|
41651
43322
|
|
|
41652
43323
|
// src/guards/SubscriptionExpiredGuard.tsx
|
|
41653
|
-
var
|
|
43324
|
+
var import_react60 = require("react");
|
|
41654
43325
|
init_useFeatures();
|
|
41655
|
-
var
|
|
43326
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
41656
43327
|
var SubscriptionExpiredGuard = ({
|
|
41657
43328
|
children,
|
|
41658
43329
|
onNavigateHome,
|
|
@@ -41661,9 +43332,9 @@ var SubscriptionExpiredGuard = ({
|
|
|
41661
43332
|
allowContinue = false
|
|
41662
43333
|
}) => {
|
|
41663
43334
|
const { isExpiredTier, getFullEvaluation } = useFeatures();
|
|
41664
|
-
const [showModal, setShowModal] = (0,
|
|
41665
|
-
const [userDismissed, setUserDismissed] = (0,
|
|
41666
|
-
(0,
|
|
43335
|
+
const [showModal, setShowModal] = (0, import_react60.useState)(false);
|
|
43336
|
+
const [userDismissed, setUserDismissed] = (0, import_react60.useState)(false);
|
|
43337
|
+
(0, import_react60.useEffect)(() => {
|
|
41667
43338
|
if (isExpiredTier() && !userDismissed) {
|
|
41668
43339
|
setShowModal(true);
|
|
41669
43340
|
} else {
|
|
@@ -41689,9 +43360,9 @@ var SubscriptionExpiredGuard = ({
|
|
|
41689
43360
|
}
|
|
41690
43361
|
return void 0;
|
|
41691
43362
|
})() : void 0;
|
|
41692
|
-
return /* @__PURE__ */ (0,
|
|
43363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
41693
43364
|
children,
|
|
41694
|
-
/* @__PURE__ */ (0,
|
|
43365
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
41695
43366
|
SubscriptionExpiredModal,
|
|
41696
43367
|
{
|
|
41697
43368
|
open: showModal,
|
|
@@ -41718,8 +43389,8 @@ init_useNotificationService();
|
|
|
41718
43389
|
// src/services/http/httpErrorHandler.ts
|
|
41719
43390
|
init_notificationService();
|
|
41720
43391
|
init_debugLogger();
|
|
41721
|
-
var
|
|
41722
|
-
var isHttpErrorLike = (error) =>
|
|
43392
|
+
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
43393
|
+
var isHttpErrorLike = (error) => isRecord6(error);
|
|
41723
43394
|
var extractString = (record, key) => {
|
|
41724
43395
|
const value = record[key];
|
|
41725
43396
|
return typeof value === "string" ? value : void 0;
|
|
@@ -41734,7 +43405,7 @@ var normalizeMessages = (value) => {
|
|
|
41734
43405
|
if (Array.isArray(value)) {
|
|
41735
43406
|
return value.flatMap(normalizeMessages);
|
|
41736
43407
|
}
|
|
41737
|
-
if (
|
|
43408
|
+
if (isRecord6(value) && typeof value.message === "string") {
|
|
41738
43409
|
return [value.message];
|
|
41739
43410
|
}
|
|
41740
43411
|
return [];
|
|
@@ -41744,7 +43415,7 @@ var handleHttpError = (error, context) => {
|
|
|
41744
43415
|
if (isHttpErrorLike(error) && error.response) {
|
|
41745
43416
|
const status = error.response.status;
|
|
41746
43417
|
const data = error.response.data;
|
|
41747
|
-
const dataRecord =
|
|
43418
|
+
const dataRecord = isRecord6(data) ? data : {};
|
|
41748
43419
|
const errorMessage = extractString(dataRecord, "message") || extractString(dataRecord, "error") || extractString(dataRecord, "detail");
|
|
41749
43420
|
const errorCode = extractString(dataRecord, "code") || extractString(dataRecord, "error_code");
|
|
41750
43421
|
debugLogger.error(`${contextPrefix}HTTP Error ${status}:`, {
|
|
@@ -41792,7 +43463,7 @@ var handleValidationError = (errors, context) => {
|
|
|
41792
43463
|
notificationService.handleValidationError(messages, `${contextPrefix}Please check your input`);
|
|
41793
43464
|
return;
|
|
41794
43465
|
}
|
|
41795
|
-
} else if (
|
|
43466
|
+
} else if (isRecord6(errors)) {
|
|
41796
43467
|
const collected = [];
|
|
41797
43468
|
Object.values(errors).forEach((value) => {
|
|
41798
43469
|
collected.push(...normalizeMessages(value));
|