@burtson-labs/bandit-engine 2.0.49 → 2.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chat-647M6BRG.mjs → chat-W5IFNEUC.mjs} +5 -4
- package/dist/chat-provider.js +29 -14
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +3 -3
- package/dist/{chunk-VL3CMSDO.mjs → chunk-EWUUF4GE.mjs} +2 -2
- package/dist/{chunk-AXFX2HUK.mjs → chunk-HETIHZ42.mjs} +2 -2
- package/dist/{chunk-6WZUQHZT.mjs → chunk-IDH2YOW3.mjs} +30 -15
- package/dist/chunk-IDH2YOW3.mjs.map +1 -0
- package/dist/{chunk-JCLL7AGP.mjs → chunk-JBXNXSAH.mjs} +2144 -576
- package/dist/chunk-JBXNXSAH.mjs.map +1 -0
- package/dist/{chunk-TVF45U7B.mjs → chunk-LXD3IV6Z.mjs} +3 -3
- package/dist/chunk-N7RMUOFB.mjs +482 -0
- package/dist/chunk-N7RMUOFB.mjs.map +1 -0
- package/dist/{chunk-HKJTRBWC.mjs → chunk-QFSEZAG6.mjs} +3 -3
- package/dist/{chunk-7HXARU5R.mjs → chunk-STMXPFAQ.mjs} +867 -1275
- package/dist/chunk-STMXPFAQ.mjs.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2088 -455
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +3397 -1764
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +6 -5
- package/dist/modals/chat-modal/chat-modal.js +29 -14
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +3 -3
- package/package.json +3 -3
- package/dist/chunk-6WZUQHZT.mjs.map +0 -1
- package/dist/chunk-7HXARU5R.mjs.map +0 -1
- package/dist/chunk-JCLL7AGP.mjs.map +0 -1
- /package/dist/{chat-647M6BRG.mjs.map → chat-W5IFNEUC.mjs.map} +0 -0
- /package/dist/{chunk-VL3CMSDO.mjs.map → chunk-EWUUF4GE.mjs.map} +0 -0
- /package/dist/{chunk-AXFX2HUK.mjs.map → chunk-HETIHZ42.mjs.map} +0 -0
- /package/dist/{chunk-TVF45U7B.mjs.map → chunk-LXD3IV6Z.mjs.map} +0 -0
- /package/dist/{chunk-HKJTRBWC.mjs.map → chunk-QFSEZAG6.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -467,7 +467,18 @@ async function saveStateToDB(state) {
|
|
|
467
467
|
await indexedDBService_default.put(DB_NAME, DB_VERSION, STORE_NAME, state, storeConfigs, STORAGE_KEY);
|
|
468
468
|
}
|
|
469
469
|
async function loadStateFromDB() {
|
|
470
|
-
|
|
470
|
+
let timeoutId;
|
|
471
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
472
|
+
timeoutId = window.setTimeout(() => resolve(void 0), 1200);
|
|
473
|
+
});
|
|
474
|
+
try {
|
|
475
|
+
const getPromise = indexedDBService_default.get(DB_NAME, DB_VERSION, STORE_NAME, STORAGE_KEY, storeConfigs).catch(() => void 0);
|
|
476
|
+
return await Promise.race([getPromise, timeoutPromise]);
|
|
477
|
+
} finally {
|
|
478
|
+
if (timeoutId !== void 0) {
|
|
479
|
+
window.clearTimeout(timeoutId);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
471
482
|
}
|
|
472
483
|
var import_zustand3, DB_NAME, STORE_NAME, DB_VERSION, STORAGE_KEY, storeConfigs, useAIQueryStore;
|
|
473
484
|
var init_aiQueryStore = __esm({
|
|
@@ -534,19 +545,23 @@ var init_aiQueryStore = __esm({
|
|
|
534
545
|
saveStateToDB(resetState);
|
|
535
546
|
},
|
|
536
547
|
hydrate: async () => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
try {
|
|
549
|
+
const storedState = await loadStateFromDB();
|
|
550
|
+
if (storedState) {
|
|
551
|
+
set({
|
|
552
|
+
inputValue: storedState.inputValue ?? "",
|
|
553
|
+
response: storedState.response ?? "",
|
|
554
|
+
previousQuestion: storedState.previousQuestion ?? "",
|
|
555
|
+
position: storedState.position ?? { x: window.innerWidth / 2 - 300, y: window.innerHeight - 350 },
|
|
556
|
+
componentStatus: "Idle",
|
|
557
|
+
history: storedState.history ?? [],
|
|
558
|
+
apiKey: storedState.apiKey ?? "",
|
|
559
|
+
hydrated: true
|
|
560
|
+
});
|
|
561
|
+
} else {
|
|
562
|
+
set({ hydrated: true });
|
|
563
|
+
}
|
|
564
|
+
} catch {
|
|
550
565
|
set({ hydrated: true });
|
|
551
566
|
}
|
|
552
567
|
}
|
|
@@ -27622,7 +27637,7 @@ var init_under_review = __esm({
|
|
|
27622
27637
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("br", {}),
|
|
27623
27638
|
"For more info, please contact ",
|
|
27624
27639
|
" ",
|
|
27625
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("a", { href: "mailto:team@
|
|
27640
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("a", { href: "mailto:team@banditai.ai", style: { color: theme.palette.primary.main, fontWeight: 600 }, children: "team@banditai.ai" })
|
|
27626
27641
|
] })
|
|
27627
27642
|
]
|
|
27628
27643
|
}
|
|
@@ -28158,7 +28173,7 @@ var chat_exports = {};
|
|
|
28158
28173
|
__export(chat_exports, {
|
|
28159
28174
|
default: () => chat_default
|
|
28160
28175
|
});
|
|
28161
|
-
var import_react35, import_material27, import_react_router_dom3, import_jsx_runtime28, ChatContent, Chat, chat_default;
|
|
28176
|
+
var import_react35, import_material27, import_styles29, import_react_router_dom3, import_jsx_runtime28, ChatContent, Chat, chat_default;
|
|
28162
28177
|
var init_chat2 = __esm({
|
|
28163
28178
|
"src/chat/chat.tsx"() {
|
|
28164
28179
|
"use strict";
|
|
@@ -28166,6 +28181,7 @@ var init_chat2 = __esm({
|
|
|
28166
28181
|
init_custom_logo();
|
|
28167
28182
|
init_indexedDBService();
|
|
28168
28183
|
import_material27 = require("@mui/material");
|
|
28184
|
+
import_styles29 = require("@mui/material/styles");
|
|
28169
28185
|
init_aiQueryStore();
|
|
28170
28186
|
init_modelStore();
|
|
28171
28187
|
import_react_router_dom3 = require("react-router-dom");
|
|
@@ -28211,7 +28227,33 @@ var init_chat2 = __esm({
|
|
|
28211
28227
|
const [themeLoading, setThemeLoading] = (0, import_react35.useState)(true);
|
|
28212
28228
|
const token = authenticationService.getToken();
|
|
28213
28229
|
const claims = token ? authenticationService.parseJwtClaims(token) : null;
|
|
28214
|
-
const
|
|
28230
|
+
const baseTheme = themeMap_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
|
|
28231
|
+
const banditTheme = (0, import_react35.useMemo)(() => {
|
|
28232
|
+
return (0, import_styles29.createTheme)(baseTheme, {
|
|
28233
|
+
components: {
|
|
28234
|
+
MuiInputBase: {
|
|
28235
|
+
styleOverrides: {
|
|
28236
|
+
input: {
|
|
28237
|
+
outline: "none",
|
|
28238
|
+
boxShadow: "none",
|
|
28239
|
+
"&:focus, &:focus-visible": {
|
|
28240
|
+
outline: "none",
|
|
28241
|
+
boxShadow: "none"
|
|
28242
|
+
}
|
|
28243
|
+
},
|
|
28244
|
+
inputMultiline: {
|
|
28245
|
+
outline: "none",
|
|
28246
|
+
boxShadow: "none",
|
|
28247
|
+
"&:focus, &:focus-visible": {
|
|
28248
|
+
outline: "none",
|
|
28249
|
+
boxShadow: "none"
|
|
28250
|
+
}
|
|
28251
|
+
}
|
|
28252
|
+
}
|
|
28253
|
+
}
|
|
28254
|
+
}
|
|
28255
|
+
});
|
|
28256
|
+
}, [baseTheme]);
|
|
28215
28257
|
const {
|
|
28216
28258
|
inputValue,
|
|
28217
28259
|
setInputValue,
|
|
@@ -28338,6 +28380,22 @@ var init_chat2 = __esm({
|
|
|
28338
28380
|
}, 500);
|
|
28339
28381
|
}
|
|
28340
28382
|
}, [history, pendingMessage]);
|
|
28383
|
+
(0, import_react35.useEffect)(() => {
|
|
28384
|
+
if (!brandingLoading && !themeLoading) {
|
|
28385
|
+
return;
|
|
28386
|
+
}
|
|
28387
|
+
const timeoutId = window.setTimeout(() => {
|
|
28388
|
+
if (brandingLoading || themeLoading) {
|
|
28389
|
+
debugLogger.warn("Chat: branding/theme load timed out, falling back to defaults");
|
|
28390
|
+
setBrandingLoading(false);
|
|
28391
|
+
setThemeLoading(false);
|
|
28392
|
+
if (!selectedTheme) {
|
|
28393
|
+
setSelectedTheme("bandit-dark");
|
|
28394
|
+
}
|
|
28395
|
+
}
|
|
28396
|
+
}, 2500);
|
|
28397
|
+
return () => window.clearTimeout(timeoutId);
|
|
28398
|
+
}, [brandingLoading, themeLoading, selectedTheme]);
|
|
28341
28399
|
(0, import_react35.useEffect)(() => () => {
|
|
28342
28400
|
if (logoFadeTimeoutRef.current) {
|
|
28343
28401
|
window.clearTimeout(logoFadeTimeoutRef.current);
|
|
@@ -29055,7 +29113,30 @@ var init_chat2 = __esm({
|
|
|
29055
29113
|
requestAnimationFrame(pump);
|
|
29056
29114
|
}
|
|
29057
29115
|
};
|
|
29058
|
-
if (!hydrated || brandingLoading || themeLoading)
|
|
29116
|
+
if (!hydrated || brandingLoading || themeLoading) {
|
|
29117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material27.ThemeProvider, { theme: banditTheme, children: [
|
|
29118
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.CssBaseline, {}),
|
|
29119
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
29120
|
+
import_material27.Box,
|
|
29121
|
+
{
|
|
29122
|
+
sx: (theme) => ({
|
|
29123
|
+
minHeight: "100dvh",
|
|
29124
|
+
display: "flex",
|
|
29125
|
+
alignItems: "center",
|
|
29126
|
+
justifyContent: "center",
|
|
29127
|
+
flexDirection: "column",
|
|
29128
|
+
gap: 1.5,
|
|
29129
|
+
bgcolor: theme.palette.chat.shell,
|
|
29130
|
+
color: theme.palette.text.primary
|
|
29131
|
+
}),
|
|
29132
|
+
children: [
|
|
29133
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.CircularProgress, { size: 32, thickness: 4 }),
|
|
29134
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.Typography, { variant: "body2", color: "text.secondary", children: "Preparing your workspace..." })
|
|
29135
|
+
]
|
|
29136
|
+
}
|
|
29137
|
+
)
|
|
29138
|
+
] });
|
|
29139
|
+
}
|
|
29059
29140
|
const userHasAccess = playgroundBypassAccess || ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
|
|
29060
29141
|
if (!userHasAccess) {
|
|
29061
29142
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material27.ThemeProvider, { theme: banditTheme, children: [
|
|
@@ -29772,12 +29853,12 @@ var chat_provider_default = ChatProvider;
|
|
|
29772
29853
|
init_chat2();
|
|
29773
29854
|
|
|
29774
29855
|
// src/management/management.tsx
|
|
29775
|
-
var
|
|
29856
|
+
var import_react57 = require("react");
|
|
29776
29857
|
var import_useMediaQuery2 = __toESM(require("@mui/material/useMediaQuery"));
|
|
29777
|
-
var
|
|
29858
|
+
var import_styles31 = require("@mui/material/styles");
|
|
29778
29859
|
init_useKnowledgeStore();
|
|
29779
29860
|
init_indexedDBService();
|
|
29780
|
-
var
|
|
29861
|
+
var import_material47 = require("@mui/material");
|
|
29781
29862
|
var import_FaceRetouchingNatural = __toESM(require("@mui/icons-material/FaceRetouchingNatural"));
|
|
29782
29863
|
var import_Brush = __toESM(require("@mui/icons-material/Brush"));
|
|
29783
29864
|
var import_MenuBook = __toESM(require("@mui/icons-material/MenuBook"));
|
|
@@ -32556,7 +32637,7 @@ var chat_modal_default = ChatModal;
|
|
|
32556
32637
|
var import_react44 = require("react");
|
|
32557
32638
|
var import_material36 = require("@mui/material");
|
|
32558
32639
|
var import_useMediaQuery = __toESM(require("@mui/material/useMediaQuery"));
|
|
32559
|
-
var
|
|
32640
|
+
var import_styles30 = require("@mui/material/styles");
|
|
32560
32641
|
var import_AutoAwesome = __toESM(require("@mui/icons-material/AutoAwesome"));
|
|
32561
32642
|
var import_RocketLaunchOutlined = __toESM(require("@mui/icons-material/RocketLaunchOutlined"));
|
|
32562
32643
|
var import_ViewModuleOutlined = __toESM(require("@mui/icons-material/ViewModuleOutlined"));
|
|
@@ -32942,7 +33023,7 @@ var PersonalitiesTab = ({
|
|
|
32942
33023
|
restoreBanditModels,
|
|
32943
33024
|
showSnackbar
|
|
32944
33025
|
}) => {
|
|
32945
|
-
const theme = (0,
|
|
33026
|
+
const theme = (0, import_styles30.useTheme)();
|
|
32946
33027
|
const isMobile = (0, import_useMediaQuery.default)(theme.breakpoints.down("sm"));
|
|
32947
33028
|
const [personalityTabIndex, setPersonalityTabIndex] = (0, import_react44.useState)(0);
|
|
32948
33029
|
const sectionGap = isMobile ? 2 : 3;
|
|
@@ -36578,6 +36659,12 @@ var BrandingTab = ({
|
|
|
36578
36659
|
};
|
|
36579
36660
|
var BrandingTab_default = BrandingTab;
|
|
36580
36661
|
|
|
36662
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
36663
|
+
var import_react53 = require("react");
|
|
36664
|
+
var import_material43 = require("@mui/material");
|
|
36665
|
+
var import_Description5 = __toESM(require("@mui/icons-material/Description"));
|
|
36666
|
+
var import_AutoStories = __toESM(require("@mui/icons-material/AutoStories"));
|
|
36667
|
+
|
|
36581
36668
|
// src/management/components/KnowledgeTab.tsx
|
|
36582
36669
|
var import_react51 = require("react");
|
|
36583
36670
|
var import_uuid6 = require("uuid");
|
|
@@ -38300,17 +38387,1482 @@ var KnowledgeTab = ({
|
|
|
38300
38387
|
};
|
|
38301
38388
|
var KnowledgeTab_default = KnowledgeTab;
|
|
38302
38389
|
|
|
38303
|
-
// src/management/components/
|
|
38390
|
+
// src/management/components/SeedPacksTab.tsx
|
|
38304
38391
|
var import_react52 = require("react");
|
|
38305
38392
|
var import_material42 = require("@mui/material");
|
|
38306
|
-
var
|
|
38393
|
+
var import_Add2 = __toESM(require("@mui/icons-material/Add"));
|
|
38394
|
+
var import_Archive = __toESM(require("@mui/icons-material/Archive"));
|
|
38307
38395
|
var import_Delete6 = __toESM(require("@mui/icons-material/Delete"));
|
|
38396
|
+
var import_Description4 = __toESM(require("@mui/icons-material/Description"));
|
|
38397
|
+
var import_Group2 = __toESM(require("@mui/icons-material/Group"));
|
|
38398
|
+
var import_Person3 = __toESM(require("@mui/icons-material/Person"));
|
|
38399
|
+
var import_Publish = __toESM(require("@mui/icons-material/Publish"));
|
|
38308
38400
|
var import_Refresh3 = __toESM(require("@mui/icons-material/Refresh"));
|
|
38401
|
+
var import_Save2 = __toESM(require("@mui/icons-material/Save"));
|
|
38402
|
+
var import_Search4 = __toESM(require("@mui/icons-material/Search"));
|
|
38403
|
+
var import_UploadFile2 = __toESM(require("@mui/icons-material/UploadFile"));
|
|
38404
|
+
init_packageSettingsStore();
|
|
38405
|
+
init_authenticationStore();
|
|
38406
|
+
init_StreamingMarkdown();
|
|
38407
|
+
init_debugLogger();
|
|
38408
|
+
|
|
38409
|
+
// src/services/seedPacks/seedPackService.ts
|
|
38410
|
+
init_authenticationService();
|
|
38411
|
+
init_packageSettingsStore();
|
|
38412
|
+
init_debugLogger();
|
|
38413
|
+
var HttpResponseError2 = class extends Error {
|
|
38414
|
+
constructor(message, status, payload, code) {
|
|
38415
|
+
super(message);
|
|
38416
|
+
this.status = status;
|
|
38417
|
+
this.payload = payload;
|
|
38418
|
+
this.code = code;
|
|
38419
|
+
this.name = "HttpResponseError";
|
|
38420
|
+
}
|
|
38421
|
+
};
|
|
38422
|
+
var isRecord5 = (value) => typeof value === "object" && value !== null;
|
|
38423
|
+
var getString2 = (record, key) => {
|
|
38424
|
+
const value = record[key];
|
|
38425
|
+
return typeof value === "string" ? value : void 0;
|
|
38426
|
+
};
|
|
38427
|
+
var getNumber = (record, key) => {
|
|
38428
|
+
const value = record[key];
|
|
38429
|
+
if (typeof value === "number") {
|
|
38430
|
+
return value;
|
|
38431
|
+
}
|
|
38432
|
+
if (typeof value === "string") {
|
|
38433
|
+
const parsed = Number(value);
|
|
38434
|
+
if (!Number.isNaN(parsed)) {
|
|
38435
|
+
return parsed;
|
|
38436
|
+
}
|
|
38437
|
+
}
|
|
38438
|
+
return void 0;
|
|
38439
|
+
};
|
|
38440
|
+
var getStringArray = (record, key) => {
|
|
38441
|
+
const value = record[key];
|
|
38442
|
+
if (Array.isArray(value)) {
|
|
38443
|
+
return value.filter((item) => typeof item === "string");
|
|
38444
|
+
}
|
|
38445
|
+
if (typeof value === "string") {
|
|
38446
|
+
return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
38447
|
+
}
|
|
38448
|
+
return void 0;
|
|
38449
|
+
};
|
|
38450
|
+
var toSeedPackStatus = (value) => {
|
|
38451
|
+
if (value === "draft" || value === "published" || value === "archived") {
|
|
38452
|
+
return value;
|
|
38453
|
+
}
|
|
38454
|
+
return "draft";
|
|
38455
|
+
};
|
|
38456
|
+
var toSeedPackScope = (value) => {
|
|
38457
|
+
if (value === "team" || value === "user") {
|
|
38458
|
+
return value;
|
|
38459
|
+
}
|
|
38460
|
+
return void 0;
|
|
38461
|
+
};
|
|
38462
|
+
var normalizeSeedPack = (record) => {
|
|
38463
|
+
const sid = getString2(record, "sid") ?? getString2(record, "id") ?? "";
|
|
38464
|
+
return {
|
|
38465
|
+
sid,
|
|
38466
|
+
name: getString2(record, "name") ?? "Untitled Seed Pack",
|
|
38467
|
+
description: getString2(record, "description"),
|
|
38468
|
+
status: toSeedPackStatus(getString2(record, "status")),
|
|
38469
|
+
version: getNumber(record, "version"),
|
|
38470
|
+
contentType: getString2(record, "contentType") ?? "markdown",
|
|
38471
|
+
content: getString2(record, "content"),
|
|
38472
|
+
summary: getString2(record, "summary"),
|
|
38473
|
+
tags: getStringArray(record, "tags"),
|
|
38474
|
+
scopeType: toSeedPackScope(getString2(record, "scopeType")),
|
|
38475
|
+
scopeSid: getString2(record, "scopeSid"),
|
|
38476
|
+
createdBySid: getString2(record, "createdBySid"),
|
|
38477
|
+
updatedBySid: getString2(record, "updatedBySid"),
|
|
38478
|
+
publishedBySid: getString2(record, "publishedBySid"),
|
|
38479
|
+
createdAt: getString2(record, "createdAt"),
|
|
38480
|
+
updatedAt: getString2(record, "updatedAt"),
|
|
38481
|
+
publishedAt: getString2(record, "publishedAt")
|
|
38482
|
+
};
|
|
38483
|
+
};
|
|
38484
|
+
var extractSeedPack = (payload) => {
|
|
38485
|
+
if (!isRecord5(payload)) {
|
|
38486
|
+
return null;
|
|
38487
|
+
}
|
|
38488
|
+
const candidate = isRecord5(payload.seedPack) && payload.seedPack || isRecord5(payload.data) && payload.data || payload;
|
|
38489
|
+
if (!isRecord5(candidate)) {
|
|
38490
|
+
return null;
|
|
38491
|
+
}
|
|
38492
|
+
const pack = normalizeSeedPack(candidate);
|
|
38493
|
+
if (!pack.sid) {
|
|
38494
|
+
return null;
|
|
38495
|
+
}
|
|
38496
|
+
return pack;
|
|
38497
|
+
};
|
|
38498
|
+
var extractSeedPackList = (payload) => {
|
|
38499
|
+
if (Array.isArray(payload)) {
|
|
38500
|
+
return payload.map((item) => isRecord5(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
38501
|
+
}
|
|
38502
|
+
if (!isRecord5(payload)) {
|
|
38503
|
+
return [];
|
|
38504
|
+
}
|
|
38505
|
+
const candidates = [
|
|
38506
|
+
payload.seedPacks,
|
|
38507
|
+
payload.items,
|
|
38508
|
+
payload.results,
|
|
38509
|
+
payload.data
|
|
38510
|
+
];
|
|
38511
|
+
const list = candidates.find(Array.isArray);
|
|
38512
|
+
if (!Array.isArray(list)) {
|
|
38513
|
+
return [];
|
|
38514
|
+
}
|
|
38515
|
+
return list.map((item) => isRecord5(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
38516
|
+
};
|
|
38517
|
+
var buildUrl2 = (path) => {
|
|
38518
|
+
const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "");
|
|
38519
|
+
if (!base) {
|
|
38520
|
+
throw new Error("Gateway API is not configured");
|
|
38521
|
+
}
|
|
38522
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
38523
|
+
return `${base}${normalized}`;
|
|
38524
|
+
};
|
|
38525
|
+
var buildHeaders2 = () => {
|
|
38526
|
+
const headers = {
|
|
38527
|
+
"Content-Type": "application/json"
|
|
38528
|
+
};
|
|
38529
|
+
const token = authenticationService.getToken();
|
|
38530
|
+
if (token) {
|
|
38531
|
+
headers.Authorization = `Bearer ${token}`;
|
|
38532
|
+
}
|
|
38533
|
+
return headers;
|
|
38534
|
+
};
|
|
38535
|
+
var handleJsonResponse2 = async (response, fallbackMessage) => {
|
|
38536
|
+
let data = null;
|
|
38537
|
+
try {
|
|
38538
|
+
data = await response.json();
|
|
38539
|
+
} catch (error) {
|
|
38540
|
+
debugLogger.warn("seedPackService: failed to parse JSON response", { error });
|
|
38541
|
+
}
|
|
38542
|
+
if (!response.ok) {
|
|
38543
|
+
const record = isRecord5(data) ? data : {};
|
|
38544
|
+
const message = getString2(record, "error") || getString2(record, "message") || getString2(record, "detail") || fallbackMessage;
|
|
38545
|
+
const code = getString2(record, "code") || getString2(record, "error_code");
|
|
38546
|
+
throw new HttpResponseError2(message, response.status, data, code);
|
|
38547
|
+
}
|
|
38548
|
+
return data;
|
|
38549
|
+
};
|
|
38550
|
+
var buildDraftPayload = (draft) => {
|
|
38551
|
+
const payload = {
|
|
38552
|
+
name: draft.name,
|
|
38553
|
+
contentType: draft.contentType ?? "markdown"
|
|
38554
|
+
};
|
|
38555
|
+
if (draft.description !== void 0) {
|
|
38556
|
+
payload.description = draft.description;
|
|
38557
|
+
}
|
|
38558
|
+
if (draft.content !== void 0) {
|
|
38559
|
+
payload.content = draft.content;
|
|
38560
|
+
}
|
|
38561
|
+
if (draft.tags) {
|
|
38562
|
+
payload.tags = draft.tags;
|
|
38563
|
+
}
|
|
38564
|
+
return payload;
|
|
38565
|
+
};
|
|
38566
|
+
var listSeedPacks = async () => {
|
|
38567
|
+
const url = buildUrl2("/seed-packs");
|
|
38568
|
+
try {
|
|
38569
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders2() });
|
|
38570
|
+
const payload = await handleJsonResponse2(response, "Failed to load seed packs");
|
|
38571
|
+
return extractSeedPackList(payload);
|
|
38572
|
+
} catch (error) {
|
|
38573
|
+
debugLogger.error("seedPackService: failed to list seed packs", {
|
|
38574
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38575
|
+
});
|
|
38576
|
+
throw error;
|
|
38577
|
+
}
|
|
38578
|
+
};
|
|
38579
|
+
var getSeedPack = async (sid) => {
|
|
38580
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
38581
|
+
try {
|
|
38582
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders2() });
|
|
38583
|
+
const payload = await handleJsonResponse2(response, "Failed to load seed pack");
|
|
38584
|
+
const pack = extractSeedPack(payload);
|
|
38585
|
+
if (!pack) {
|
|
38586
|
+
throw new Error("Seed pack response was empty");
|
|
38587
|
+
}
|
|
38588
|
+
return pack;
|
|
38589
|
+
} catch (error) {
|
|
38590
|
+
debugLogger.error("seedPackService: failed to load seed pack", {
|
|
38591
|
+
sid,
|
|
38592
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38593
|
+
});
|
|
38594
|
+
throw error;
|
|
38595
|
+
}
|
|
38596
|
+
};
|
|
38597
|
+
var createSeedPack = async (draft) => {
|
|
38598
|
+
const url = buildUrl2("/seed-packs");
|
|
38599
|
+
try {
|
|
38600
|
+
const response = await fetch(url, {
|
|
38601
|
+
method: "POST",
|
|
38602
|
+
headers: buildHeaders2(),
|
|
38603
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
38604
|
+
});
|
|
38605
|
+
const payload = await handleJsonResponse2(response, "Failed to create seed pack");
|
|
38606
|
+
const pack = extractSeedPack(payload);
|
|
38607
|
+
if (!pack) {
|
|
38608
|
+
throw new Error("Seed pack response was empty");
|
|
38609
|
+
}
|
|
38610
|
+
return pack;
|
|
38611
|
+
} catch (error) {
|
|
38612
|
+
debugLogger.error("seedPackService: failed to create seed pack", {
|
|
38613
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38614
|
+
});
|
|
38615
|
+
throw error;
|
|
38616
|
+
}
|
|
38617
|
+
};
|
|
38618
|
+
var updateSeedPack = async (sid, draft) => {
|
|
38619
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
38620
|
+
try {
|
|
38621
|
+
const response = await fetch(url, {
|
|
38622
|
+
method: "PUT",
|
|
38623
|
+
headers: buildHeaders2(),
|
|
38624
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
38625
|
+
});
|
|
38626
|
+
const payload = await handleJsonResponse2(response, "Failed to update seed pack");
|
|
38627
|
+
const pack = extractSeedPack(payload);
|
|
38628
|
+
if (!pack) {
|
|
38629
|
+
throw new Error("Seed pack response was empty");
|
|
38630
|
+
}
|
|
38631
|
+
return pack;
|
|
38632
|
+
} catch (error) {
|
|
38633
|
+
debugLogger.error("seedPackService: failed to update seed pack", {
|
|
38634
|
+
sid,
|
|
38635
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38636
|
+
});
|
|
38637
|
+
throw error;
|
|
38638
|
+
}
|
|
38639
|
+
};
|
|
38640
|
+
var publishSeedPack = async (sid) => {
|
|
38641
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}/publish`);
|
|
38642
|
+
try {
|
|
38643
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders2() });
|
|
38644
|
+
const payload = await handleJsonResponse2(response, "Failed to publish seed pack");
|
|
38645
|
+
const pack = extractSeedPack(payload);
|
|
38646
|
+
if (!pack) {
|
|
38647
|
+
throw new Error("Seed pack response was empty");
|
|
38648
|
+
}
|
|
38649
|
+
return pack;
|
|
38650
|
+
} catch (error) {
|
|
38651
|
+
debugLogger.error("seedPackService: failed to publish seed pack", {
|
|
38652
|
+
sid,
|
|
38653
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38654
|
+
});
|
|
38655
|
+
throw error;
|
|
38656
|
+
}
|
|
38657
|
+
};
|
|
38658
|
+
var archiveSeedPack = async (sid) => {
|
|
38659
|
+
const url = buildUrl2(`/seed-packs/${encodeURIComponent(sid)}/archive`);
|
|
38660
|
+
try {
|
|
38661
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders2() });
|
|
38662
|
+
const payload = await handleJsonResponse2(response, "Failed to archive seed pack");
|
|
38663
|
+
const pack = extractSeedPack(payload);
|
|
38664
|
+
if (!pack) {
|
|
38665
|
+
throw new Error("Seed pack response was empty");
|
|
38666
|
+
}
|
|
38667
|
+
return pack;
|
|
38668
|
+
} catch (error) {
|
|
38669
|
+
debugLogger.error("seedPackService: failed to archive seed pack", {
|
|
38670
|
+
sid,
|
|
38671
|
+
error: error instanceof Error ? error.message : String(error)
|
|
38672
|
+
});
|
|
38673
|
+
throw error;
|
|
38674
|
+
}
|
|
38675
|
+
};
|
|
38676
|
+
|
|
38677
|
+
// src/management/components/SeedPacksTab.tsx
|
|
38678
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
38679
|
+
var parseTags = (value) => value.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
38680
|
+
var normalizeTags = (tags) => (tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
38681
|
+
var areArraysEqual = (a, b) => {
|
|
38682
|
+
if (a.length !== b.length) {
|
|
38683
|
+
return false;
|
|
38684
|
+
}
|
|
38685
|
+
return a.every((value, index) => value === b[index]);
|
|
38686
|
+
};
|
|
38687
|
+
var formatTimestamp = (value) => {
|
|
38688
|
+
if (!value) {
|
|
38689
|
+
return "Not set";
|
|
38690
|
+
}
|
|
38691
|
+
const parsed = Date.parse(value);
|
|
38692
|
+
if (Number.isNaN(parsed)) {
|
|
38693
|
+
return value;
|
|
38694
|
+
}
|
|
38695
|
+
return new Date(parsed).toLocaleString();
|
|
38696
|
+
};
|
|
38697
|
+
var formatFileSize3 = (bytes) => {
|
|
38698
|
+
if (bytes === 0) return "0 B";
|
|
38699
|
+
const k = 1024;
|
|
38700
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
38701
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
38702
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
38703
|
+
};
|
|
38704
|
+
var getPreviewSnippet = (content) => {
|
|
38705
|
+
const trimmed = content.trim();
|
|
38706
|
+
if (!trimmed) {
|
|
38707
|
+
return "No preview available";
|
|
38708
|
+
}
|
|
38709
|
+
return trimmed.length > 120 ? `${trimmed.slice(0, 120)}...` : trimmed;
|
|
38710
|
+
};
|
|
38711
|
+
var mergeMarkdownFiles = (existing, incoming) => {
|
|
38712
|
+
const next = [...existing];
|
|
38713
|
+
incoming.forEach((file) => {
|
|
38714
|
+
const index = next.findIndex((item) => item.name === file.name);
|
|
38715
|
+
if (index >= 0) {
|
|
38716
|
+
next[index] = file;
|
|
38717
|
+
} else {
|
|
38718
|
+
next.push(file);
|
|
38719
|
+
}
|
|
38720
|
+
});
|
|
38721
|
+
return next;
|
|
38722
|
+
};
|
|
38723
|
+
var buildMarkdownContent = (files) => {
|
|
38724
|
+
return files.map((file) => file.content.trim()).filter((content) => content.length > 0).join("\n\n---\n\n");
|
|
38725
|
+
};
|
|
38726
|
+
var readMarkdownFiles = async (files) => {
|
|
38727
|
+
const list = Array.from(files);
|
|
38728
|
+
const markdownFiles = list.filter((file) => file.name.toLowerCase().endsWith(".md"));
|
|
38729
|
+
const imported = await Promise.all(
|
|
38730
|
+
markdownFiles.map(async (file) => ({
|
|
38731
|
+
id: `${file.name}-${file.lastModified}`,
|
|
38732
|
+
name: file.name,
|
|
38733
|
+
size: file.size,
|
|
38734
|
+
content: await file.text(),
|
|
38735
|
+
lastModified: file.lastModified
|
|
38736
|
+
}))
|
|
38737
|
+
);
|
|
38738
|
+
return { imported, skipped: list.length - markdownFiles.length };
|
|
38739
|
+
};
|
|
38740
|
+
var getStatusChip = (status) => {
|
|
38741
|
+
switch (status) {
|
|
38742
|
+
case "published":
|
|
38743
|
+
return { label: "Published", color: "success" };
|
|
38744
|
+
case "archived":
|
|
38745
|
+
return { label: "Archived", color: "default" };
|
|
38746
|
+
case "draft":
|
|
38747
|
+
default:
|
|
38748
|
+
return { label: "Draft", color: "warning" };
|
|
38749
|
+
}
|
|
38750
|
+
};
|
|
38751
|
+
var getSeedPackTimestamp = (pack) => {
|
|
38752
|
+
const candidate = pack.updatedAt ?? pack.publishedAt ?? pack.createdAt;
|
|
38753
|
+
if (!candidate) {
|
|
38754
|
+
return 0;
|
|
38755
|
+
}
|
|
38756
|
+
const parsed = Date.parse(candidate);
|
|
38757
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
38758
|
+
};
|
|
38759
|
+
var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38760
|
+
import_material42.Card,
|
|
38761
|
+
{
|
|
38762
|
+
sx: {
|
|
38763
|
+
position: "relative",
|
|
38764
|
+
height: { xs: 240, sm: 260, md: 280 },
|
|
38765
|
+
cursor: "pointer",
|
|
38766
|
+
transition: "all 0.3s ease-in-out",
|
|
38767
|
+
border: "1px solid",
|
|
38768
|
+
borderColor: "divider",
|
|
38769
|
+
bgcolor: "background.paper",
|
|
38770
|
+
display: "flex",
|
|
38771
|
+
flexDirection: "column",
|
|
38772
|
+
"&:hover": {
|
|
38773
|
+
boxShadow: 6,
|
|
38774
|
+
transform: "translateY(-2px)"
|
|
38775
|
+
}
|
|
38776
|
+
},
|
|
38777
|
+
onClick: onPreview,
|
|
38778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38779
|
+
import_material42.CardContent,
|
|
38780
|
+
{
|
|
38781
|
+
sx: {
|
|
38782
|
+
p: { xs: 1.5, sm: 2 },
|
|
38783
|
+
height: "100%",
|
|
38784
|
+
display: "flex",
|
|
38785
|
+
flexDirection: "column",
|
|
38786
|
+
overflow: "hidden"
|
|
38787
|
+
},
|
|
38788
|
+
children: [
|
|
38789
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38790
|
+
import_material42.Box,
|
|
38791
|
+
{
|
|
38792
|
+
sx: {
|
|
38793
|
+
display: "flex",
|
|
38794
|
+
justifyContent: "space-between",
|
|
38795
|
+
alignItems: "flex-start",
|
|
38796
|
+
mb: 1,
|
|
38797
|
+
height: 32
|
|
38798
|
+
},
|
|
38799
|
+
children: [
|
|
38800
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Description4.default, { sx: { fontSize: 32, color: "#388e3c", flexShrink: 0 } }),
|
|
38801
|
+
!isReadOnly && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38802
|
+
import_material42.IconButton,
|
|
38803
|
+
{
|
|
38804
|
+
size: "small",
|
|
38805
|
+
color: "error",
|
|
38806
|
+
onClick: (event) => {
|
|
38807
|
+
event.stopPropagation();
|
|
38808
|
+
onRemove();
|
|
38809
|
+
},
|
|
38810
|
+
sx: { width: 24, height: 24 },
|
|
38811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Delete6.default, { fontSize: "small" })
|
|
38812
|
+
}
|
|
38813
|
+
)
|
|
38814
|
+
]
|
|
38815
|
+
}
|
|
38816
|
+
),
|
|
38817
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38818
|
+
import_material42.Box,
|
|
38819
|
+
{
|
|
38820
|
+
sx: {
|
|
38821
|
+
mb: 1.5,
|
|
38822
|
+
p: { xs: 1, sm: 1.5 },
|
|
38823
|
+
borderRadius: 1.5,
|
|
38824
|
+
bgcolor: "background.paper",
|
|
38825
|
+
border: "1px solid",
|
|
38826
|
+
borderColor: "divider",
|
|
38827
|
+
overflow: "hidden",
|
|
38828
|
+
position: "relative",
|
|
38829
|
+
height: { xs: 60, sm: 70, md: 80 },
|
|
38830
|
+
display: "flex",
|
|
38831
|
+
alignItems: "center"
|
|
38832
|
+
},
|
|
38833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38834
|
+
import_material42.Typography,
|
|
38835
|
+
{
|
|
38836
|
+
variant: "body2",
|
|
38837
|
+
sx: {
|
|
38838
|
+
display: "-webkit-box",
|
|
38839
|
+
WebkitLineClamp: 3,
|
|
38840
|
+
WebkitBoxOrient: "vertical",
|
|
38841
|
+
overflow: "hidden",
|
|
38842
|
+
textOverflow: "ellipsis",
|
|
38843
|
+
color: "text.secondary",
|
|
38844
|
+
lineHeight: 1.3,
|
|
38845
|
+
fontSize: "0.8rem"
|
|
38846
|
+
},
|
|
38847
|
+
children: getPreviewSnippet(file.content)
|
|
38848
|
+
}
|
|
38849
|
+
)
|
|
38850
|
+
}
|
|
38851
|
+
),
|
|
38852
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Tooltip, { title: file.name, arrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38853
|
+
import_material42.Typography,
|
|
38854
|
+
{
|
|
38855
|
+
variant: "body2",
|
|
38856
|
+
sx: {
|
|
38857
|
+
fontWeight: 600,
|
|
38858
|
+
whiteSpace: "nowrap",
|
|
38859
|
+
overflow: "hidden",
|
|
38860
|
+
textOverflow: "ellipsis",
|
|
38861
|
+
mb: 1,
|
|
38862
|
+
color: "text.primary",
|
|
38863
|
+
fontSize: { xs: "0.8rem", sm: "0.875rem" },
|
|
38864
|
+
height: { xs: "1.2rem", sm: "1.3rem" }
|
|
38865
|
+
},
|
|
38866
|
+
children: file.name
|
|
38867
|
+
}
|
|
38868
|
+
) }),
|
|
38869
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
38870
|
+
import_material42.Box,
|
|
38871
|
+
{
|
|
38872
|
+
sx: {
|
|
38873
|
+
display: "flex",
|
|
38874
|
+
justifyContent: "space-between",
|
|
38875
|
+
alignItems: "flex-start",
|
|
38876
|
+
mb: 1,
|
|
38877
|
+
minHeight: 40
|
|
38878
|
+
},
|
|
38879
|
+
children: [
|
|
38880
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", flex: 1, mr: 1 }, children: [
|
|
38881
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38882
|
+
import_material42.Chip,
|
|
38883
|
+
{
|
|
38884
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, { sx: { fontSize: "0.9rem !important" } }),
|
|
38885
|
+
label: "Local",
|
|
38886
|
+
size: "small",
|
|
38887
|
+
sx: {
|
|
38888
|
+
bgcolor: "#388e3c20",
|
|
38889
|
+
color: "#388e3c",
|
|
38890
|
+
fontWeight: 700,
|
|
38891
|
+
fontSize: "0.75rem",
|
|
38892
|
+
border: "2px solid #388e3c60",
|
|
38893
|
+
"& .MuiChip-icon": {
|
|
38894
|
+
color: "#388e3c !important"
|
|
38895
|
+
},
|
|
38896
|
+
boxShadow: "0 2px 4px #388e3c20"
|
|
38897
|
+
}
|
|
38898
|
+
}
|
|
38899
|
+
),
|
|
38900
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38901
|
+
import_material42.Chip,
|
|
38902
|
+
{
|
|
38903
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Description4.default, { sx: { fontSize: "0.85rem !important" } }),
|
|
38904
|
+
label: "Markdown",
|
|
38905
|
+
size: "small",
|
|
38906
|
+
sx: {
|
|
38907
|
+
bgcolor: "#388e3c15",
|
|
38908
|
+
color: "#388e3c",
|
|
38909
|
+
fontWeight: 500,
|
|
38910
|
+
fontSize: "0.65rem"
|
|
38911
|
+
}
|
|
38912
|
+
}
|
|
38913
|
+
)
|
|
38914
|
+
] }),
|
|
38915
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", sx: { flexShrink: 0 }, children: formatFileSize3(file.size) })
|
|
38916
|
+
]
|
|
38917
|
+
}
|
|
38918
|
+
),
|
|
38919
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Box, { sx: { mt: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
38920
|
+
import_material42.Button,
|
|
38921
|
+
{
|
|
38922
|
+
variant: "outlined",
|
|
38923
|
+
size: "small",
|
|
38924
|
+
fullWidth: true,
|
|
38925
|
+
sx: {
|
|
38926
|
+
textTransform: "none",
|
|
38927
|
+
height: { xs: 32, sm: 36, md: 40 },
|
|
38928
|
+
flexShrink: 0,
|
|
38929
|
+
borderWidth: 2,
|
|
38930
|
+
fontSize: { xs: "0.75rem", sm: "0.8rem", md: "0.875rem" },
|
|
38931
|
+
fontWeight: 600,
|
|
38932
|
+
"&:hover": {
|
|
38933
|
+
borderWidth: 2,
|
|
38934
|
+
bgcolor: "primary.main",
|
|
38935
|
+
color: "primary.contrastText",
|
|
38936
|
+
transform: "translateY(-1px)",
|
|
38937
|
+
boxShadow: 2
|
|
38938
|
+
}
|
|
38939
|
+
},
|
|
38940
|
+
onClick: (event) => {
|
|
38941
|
+
event.stopPropagation();
|
|
38942
|
+
onPreview();
|
|
38943
|
+
},
|
|
38944
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Search4.default, { sx: { fontSize: { xs: "1rem", sm: "1.1rem" } } }),
|
|
38945
|
+
children: "Preview"
|
|
38946
|
+
}
|
|
38947
|
+
) })
|
|
38948
|
+
]
|
|
38949
|
+
}
|
|
38950
|
+
)
|
|
38951
|
+
}
|
|
38952
|
+
);
|
|
38953
|
+
var SeedPacksTab = () => {
|
|
38954
|
+
const { settings } = usePackageSettingsStore();
|
|
38955
|
+
const authStore = useAuthenticationStore();
|
|
38956
|
+
const gatewayConfigured = Boolean(settings?.gatewayApiUrl);
|
|
38957
|
+
const isTeamScope = Boolean(authStore.user?.teamSid);
|
|
38958
|
+
const seedPackAdminRoles = /* @__PURE__ */ new Set(["admin", "super-user", "team_admin", "team_owner"]);
|
|
38959
|
+
const userRoles = authStore.user?.roles ?? [];
|
|
38960
|
+
const canManage = userRoles.some((role) => seedPackAdminRoles.has(role));
|
|
38961
|
+
const [seedPacks, setSeedPacks] = (0, import_react52.useState)([]);
|
|
38962
|
+
const [selectedSid, setSelectedSid] = (0, import_react52.useState)(null);
|
|
38963
|
+
const [selectedSeedPack, setSelectedSeedPack] = (0, import_react52.useState)(null);
|
|
38964
|
+
const [draft, setDraft] = (0, import_react52.useState)({
|
|
38965
|
+
name: "",
|
|
38966
|
+
description: "",
|
|
38967
|
+
content: ""
|
|
38968
|
+
});
|
|
38969
|
+
const [tagsInput, setTagsInput] = (0, import_react52.useState)("");
|
|
38970
|
+
const [importedFiles, setImportedFiles] = (0, import_react52.useState)([]);
|
|
38971
|
+
const [createImportedFiles, setCreateImportedFiles] = (0, import_react52.useState)([]);
|
|
38972
|
+
const [previewFile, setPreviewFile] = (0, import_react52.useState)(null);
|
|
38973
|
+
const fileInputRef = (0, import_react52.useRef)(null);
|
|
38974
|
+
const createFileInputRef = (0, import_react52.useRef)(null);
|
|
38975
|
+
const [isLoadingList, setIsLoadingList] = (0, import_react52.useState)(false);
|
|
38976
|
+
const [isLoadingDetail, setIsLoadingDetail] = (0, import_react52.useState)(false);
|
|
38977
|
+
const [isSaving, setIsSaving] = (0, import_react52.useState)(false);
|
|
38978
|
+
const [isPublishing, setIsPublishing] = (0, import_react52.useState)(false);
|
|
38979
|
+
const [isArchiving, setIsArchiving] = (0, import_react52.useState)(false);
|
|
38980
|
+
const [isCreating, setIsCreating] = (0, import_react52.useState)(false);
|
|
38981
|
+
const [createDialogOpen, setCreateDialogOpen] = (0, import_react52.useState)(false);
|
|
38982
|
+
const [publishDialogOpen, setPublishDialogOpen] = (0, import_react52.useState)(false);
|
|
38983
|
+
const [archiveDialogOpen, setArchiveDialogOpen] = (0, import_react52.useState)(false);
|
|
38984
|
+
const [newPackName, setNewPackName] = (0, import_react52.useState)("");
|
|
38985
|
+
const [newPackDescription, setNewPackDescription] = (0, import_react52.useState)("");
|
|
38986
|
+
const [newPackTags, setNewPackTags] = (0, import_react52.useState)("");
|
|
38987
|
+
const [snackbarOpen, setSnackbarOpen] = (0, import_react52.useState)(false);
|
|
38988
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react52.useState)("");
|
|
38989
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react52.useState)("success");
|
|
38990
|
+
const parsedTags = (0, import_react52.useMemo)(() => parseTags(tagsInput), [tagsInput]);
|
|
38991
|
+
const normalizedSelectedTags = (0, import_react52.useMemo)(
|
|
38992
|
+
() => normalizeTags(selectedSeedPack?.tags),
|
|
38993
|
+
[selectedSeedPack?.tags]
|
|
38994
|
+
);
|
|
38995
|
+
const isDirty = (0, import_react52.useMemo)(() => {
|
|
38996
|
+
if (!selectedSeedPack) {
|
|
38997
|
+
return false;
|
|
38998
|
+
}
|
|
38999
|
+
const nameChanged = draft.name.trim() !== (selectedSeedPack.name ?? "").trim();
|
|
39000
|
+
const descriptionChanged = draft.description.trim() !== (selectedSeedPack.description ?? "").trim();
|
|
39001
|
+
const contentChanged = draft.content !== (selectedSeedPack.content ?? "");
|
|
39002
|
+
const tagsChanged = !areArraysEqual(parsedTags, normalizedSelectedTags);
|
|
39003
|
+
return nameChanged || descriptionChanged || contentChanged || tagsChanged;
|
|
39004
|
+
}, [draft, parsedTags, normalizedSelectedTags, selectedSeedPack]);
|
|
39005
|
+
const isReadOnly = !canManage || selectedSeedPack?.status === "archived";
|
|
39006
|
+
const sortedSeedPacks = (0, import_react52.useMemo)(() => {
|
|
39007
|
+
return [...seedPacks].sort((a, b) => getSeedPackTimestamp(b) - getSeedPackTimestamp(a));
|
|
39008
|
+
}, [seedPacks]);
|
|
39009
|
+
const scopeLabel = isTeamScope ? "Team scope" : "Personal scope";
|
|
39010
|
+
const scopeDescription = isTeamScope ? "Applies to all members of your team." : "Applies only to your account.";
|
|
39011
|
+
const showSnackbar = (0, import_react52.useCallback)((message, severity) => {
|
|
39012
|
+
setSnackbarMessage(message);
|
|
39013
|
+
setSnackbarSeverity(severity);
|
|
39014
|
+
setSnackbarOpen(true);
|
|
39015
|
+
}, []);
|
|
39016
|
+
const hydrateDraft = (0, import_react52.useCallback)((pack) => {
|
|
39017
|
+
setDraft({
|
|
39018
|
+
name: pack.name ?? "",
|
|
39019
|
+
description: pack.description ?? "",
|
|
39020
|
+
content: pack.content ?? ""
|
|
39021
|
+
});
|
|
39022
|
+
setTagsInput((pack.tags ?? []).join(", "));
|
|
39023
|
+
setImportedFiles([]);
|
|
39024
|
+
setPreviewFile(null);
|
|
39025
|
+
}, []);
|
|
39026
|
+
const resetCreateDialog = (0, import_react52.useCallback)(() => {
|
|
39027
|
+
setCreateDialogOpen(false);
|
|
39028
|
+
setNewPackName("");
|
|
39029
|
+
setNewPackDescription("");
|
|
39030
|
+
setNewPackTags("");
|
|
39031
|
+
setCreateImportedFiles([]);
|
|
39032
|
+
}, []);
|
|
39033
|
+
const refreshSeedPacks = (0, import_react52.useCallback)(
|
|
39034
|
+
async (nextSelectedSid) => {
|
|
39035
|
+
if (!gatewayConfigured) {
|
|
39036
|
+
return;
|
|
39037
|
+
}
|
|
39038
|
+
setIsLoadingList(true);
|
|
39039
|
+
try {
|
|
39040
|
+
const packs = await listSeedPacks();
|
|
39041
|
+
setSeedPacks(packs);
|
|
39042
|
+
const activeSid = nextSelectedSid ?? selectedSid;
|
|
39043
|
+
if (activeSid && !packs.some((pack) => pack.sid === activeSid)) {
|
|
39044
|
+
setSelectedSid(null);
|
|
39045
|
+
setSelectedSeedPack(null);
|
|
39046
|
+
}
|
|
39047
|
+
} catch (error) {
|
|
39048
|
+
showSnackbar("Failed to load seed packs.", "error");
|
|
39049
|
+
debugLogger.error("SeedPacksTab: failed to load seed packs", {
|
|
39050
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39051
|
+
});
|
|
39052
|
+
} finally {
|
|
39053
|
+
setIsLoadingList(false);
|
|
39054
|
+
}
|
|
39055
|
+
},
|
|
39056
|
+
[gatewayConfigured, selectedSid, showSnackbar]
|
|
39057
|
+
);
|
|
39058
|
+
const loadSeedPackDetail = (0, import_react52.useCallback)(
|
|
39059
|
+
async (sid) => {
|
|
39060
|
+
if (!gatewayConfigured) {
|
|
39061
|
+
return;
|
|
39062
|
+
}
|
|
39063
|
+
setIsLoadingDetail(true);
|
|
39064
|
+
try {
|
|
39065
|
+
const pack = await getSeedPack(sid);
|
|
39066
|
+
setSelectedSeedPack(pack);
|
|
39067
|
+
hydrateDraft(pack);
|
|
39068
|
+
} catch (error) {
|
|
39069
|
+
showSnackbar("Failed to load seed pack details.", "error");
|
|
39070
|
+
debugLogger.error("SeedPacksTab: failed to load seed pack details", {
|
|
39071
|
+
sid,
|
|
39072
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39073
|
+
});
|
|
39074
|
+
} finally {
|
|
39075
|
+
setIsLoadingDetail(false);
|
|
39076
|
+
}
|
|
39077
|
+
},
|
|
39078
|
+
[gatewayConfigured, hydrateDraft, showSnackbar]
|
|
39079
|
+
);
|
|
39080
|
+
(0, import_react52.useEffect)(() => {
|
|
39081
|
+
void refreshSeedPacks();
|
|
39082
|
+
}, [refreshSeedPacks, authStore.token]);
|
|
39083
|
+
(0, import_react52.useEffect)(() => {
|
|
39084
|
+
if (selectedSid) {
|
|
39085
|
+
void loadSeedPackDetail(selectedSid);
|
|
39086
|
+
}
|
|
39087
|
+
}, [selectedSid, loadSeedPackDetail]);
|
|
39088
|
+
const handleSelectPack = (pack) => {
|
|
39089
|
+
setSelectedSid(pack.sid);
|
|
39090
|
+
setSelectedSeedPack(pack);
|
|
39091
|
+
hydrateDraft(pack);
|
|
39092
|
+
};
|
|
39093
|
+
const handleImportFiles = (0, import_react52.useCallback)(
|
|
39094
|
+
async (files) => {
|
|
39095
|
+
if (!files || files.length === 0) {
|
|
39096
|
+
return;
|
|
39097
|
+
}
|
|
39098
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
39099
|
+
if (skipped > 0) {
|
|
39100
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
39101
|
+
}
|
|
39102
|
+
if (imported.length === 0) {
|
|
39103
|
+
return;
|
|
39104
|
+
}
|
|
39105
|
+
try {
|
|
39106
|
+
const newlyAdded = imported.filter(
|
|
39107
|
+
(file) => !importedFiles.some((existing) => existing.name === file.name)
|
|
39108
|
+
);
|
|
39109
|
+
setImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
39110
|
+
const combined = buildMarkdownContent(newlyAdded);
|
|
39111
|
+
if (combined.length > 0) {
|
|
39112
|
+
setDraft((prev) => {
|
|
39113
|
+
const current = prev.content.trim();
|
|
39114
|
+
const nextContent = current ? `${current}
|
|
39115
|
+
|
|
39116
|
+
---
|
|
39117
|
+
|
|
39118
|
+
${combined}` : combined;
|
|
39119
|
+
return { ...prev, content: nextContent };
|
|
39120
|
+
});
|
|
39121
|
+
}
|
|
39122
|
+
showSnackbar(
|
|
39123
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} into the editor.`,
|
|
39124
|
+
"success"
|
|
39125
|
+
);
|
|
39126
|
+
} catch (error) {
|
|
39127
|
+
showSnackbar("Failed to import markdown files.", "error");
|
|
39128
|
+
debugLogger.error("SeedPacksTab: failed to import markdown files", {
|
|
39129
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39130
|
+
});
|
|
39131
|
+
}
|
|
39132
|
+
},
|
|
39133
|
+
[importedFiles, showSnackbar]
|
|
39134
|
+
);
|
|
39135
|
+
const handleFileInputChange = (0, import_react52.useCallback)(
|
|
39136
|
+
async (event) => {
|
|
39137
|
+
await handleImportFiles(event.target.files);
|
|
39138
|
+
event.target.value = "";
|
|
39139
|
+
},
|
|
39140
|
+
[handleImportFiles]
|
|
39141
|
+
);
|
|
39142
|
+
const handleRemoveImportedFile = (0, import_react52.useCallback)((id) => {
|
|
39143
|
+
setImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
39144
|
+
}, []);
|
|
39145
|
+
const handleCreateImportFiles = (0, import_react52.useCallback)(
|
|
39146
|
+
async (files) => {
|
|
39147
|
+
if (!files || files.length === 0) {
|
|
39148
|
+
return;
|
|
39149
|
+
}
|
|
39150
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
39151
|
+
if (skipped > 0) {
|
|
39152
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
39153
|
+
}
|
|
39154
|
+
if (imported.length === 0) {
|
|
39155
|
+
return;
|
|
39156
|
+
}
|
|
39157
|
+
setCreateImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
39158
|
+
showSnackbar(
|
|
39159
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} for this seed pack.`,
|
|
39160
|
+
"success"
|
|
39161
|
+
);
|
|
39162
|
+
},
|
|
39163
|
+
[showSnackbar]
|
|
39164
|
+
);
|
|
39165
|
+
const handleCreateFileInputChange = (0, import_react52.useCallback)(
|
|
39166
|
+
async (event) => {
|
|
39167
|
+
await handleCreateImportFiles(event.target.files);
|
|
39168
|
+
event.target.value = "";
|
|
39169
|
+
},
|
|
39170
|
+
[handleCreateImportFiles]
|
|
39171
|
+
);
|
|
39172
|
+
const handleRemoveCreateImportedFile = (0, import_react52.useCallback)((id) => {
|
|
39173
|
+
setCreateImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
39174
|
+
}, []);
|
|
39175
|
+
const buildDraftPayload2 = (0, import_react52.useCallback)(() => {
|
|
39176
|
+
const name = draft.name.trim();
|
|
39177
|
+
if (!name) {
|
|
39178
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
39179
|
+
return null;
|
|
39180
|
+
}
|
|
39181
|
+
return {
|
|
39182
|
+
name,
|
|
39183
|
+
description: draft.description.trim(),
|
|
39184
|
+
content: draft.content,
|
|
39185
|
+
tags: parsedTags,
|
|
39186
|
+
contentType: "markdown"
|
|
39187
|
+
};
|
|
39188
|
+
}, [draft, parsedTags, showSnackbar]);
|
|
39189
|
+
const saveDraft = (0, import_react52.useCallback)(async () => {
|
|
39190
|
+
if (!selectedSeedPack) {
|
|
39191
|
+
return null;
|
|
39192
|
+
}
|
|
39193
|
+
const payload = buildDraftPayload2();
|
|
39194
|
+
if (!payload) {
|
|
39195
|
+
return null;
|
|
39196
|
+
}
|
|
39197
|
+
setIsSaving(true);
|
|
39198
|
+
try {
|
|
39199
|
+
const updated = await updateSeedPack(selectedSeedPack.sid, payload);
|
|
39200
|
+
setSelectedSeedPack(updated);
|
|
39201
|
+
hydrateDraft(updated);
|
|
39202
|
+
await refreshSeedPacks(updated.sid);
|
|
39203
|
+
return updated;
|
|
39204
|
+
} catch (error) {
|
|
39205
|
+
showSnackbar("Failed to save seed pack.", "error");
|
|
39206
|
+
debugLogger.error("SeedPacksTab: failed to save seed pack", {
|
|
39207
|
+
sid: selectedSeedPack.sid,
|
|
39208
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39209
|
+
});
|
|
39210
|
+
return null;
|
|
39211
|
+
} finally {
|
|
39212
|
+
setIsSaving(false);
|
|
39213
|
+
}
|
|
39214
|
+
}, [selectedSeedPack, buildDraftPayload2, hydrateDraft, refreshSeedPacks, showSnackbar]);
|
|
39215
|
+
const handleSaveDraft = async () => {
|
|
39216
|
+
const updated = await saveDraft();
|
|
39217
|
+
if (updated) {
|
|
39218
|
+
showSnackbar("Seed pack saved.", "success");
|
|
39219
|
+
}
|
|
39220
|
+
};
|
|
39221
|
+
const handleResetDraft = () => {
|
|
39222
|
+
if (selectedSeedPack) {
|
|
39223
|
+
hydrateDraft(selectedSeedPack);
|
|
39224
|
+
}
|
|
39225
|
+
};
|
|
39226
|
+
const handleCreateSeedPack = async () => {
|
|
39227
|
+
const name = newPackName.trim();
|
|
39228
|
+
if (!name) {
|
|
39229
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
39230
|
+
return;
|
|
39231
|
+
}
|
|
39232
|
+
const importedContent = buildMarkdownContent(createImportedFiles);
|
|
39233
|
+
const payload = {
|
|
39234
|
+
name,
|
|
39235
|
+
description: newPackDescription.trim(),
|
|
39236
|
+
tags: parseTags(newPackTags),
|
|
39237
|
+
content: importedContent,
|
|
39238
|
+
contentType: "markdown"
|
|
39239
|
+
};
|
|
39240
|
+
setIsCreating(true);
|
|
39241
|
+
try {
|
|
39242
|
+
const created = await createSeedPack(payload);
|
|
39243
|
+
resetCreateDialog();
|
|
39244
|
+
await refreshSeedPacks(created.sid);
|
|
39245
|
+
setSelectedSid(created.sid);
|
|
39246
|
+
setSelectedSeedPack(created);
|
|
39247
|
+
hydrateDraft(created);
|
|
39248
|
+
if (createImportedFiles.length > 0) {
|
|
39249
|
+
setImportedFiles(createImportedFiles);
|
|
39250
|
+
}
|
|
39251
|
+
setCreateImportedFiles([]);
|
|
39252
|
+
showSnackbar("Seed pack created.", "success");
|
|
39253
|
+
} catch (error) {
|
|
39254
|
+
showSnackbar("Failed to create seed pack.", "error");
|
|
39255
|
+
debugLogger.error("SeedPacksTab: failed to create seed pack", {
|
|
39256
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39257
|
+
});
|
|
39258
|
+
} finally {
|
|
39259
|
+
setIsCreating(false);
|
|
39260
|
+
}
|
|
39261
|
+
};
|
|
39262
|
+
const handlePublish = async () => {
|
|
39263
|
+
if (!selectedSeedPack) {
|
|
39264
|
+
return;
|
|
39265
|
+
}
|
|
39266
|
+
setPublishDialogOpen(false);
|
|
39267
|
+
setIsPublishing(true);
|
|
39268
|
+
try {
|
|
39269
|
+
if (isDirty) {
|
|
39270
|
+
const saved = await saveDraft();
|
|
39271
|
+
if (!saved) {
|
|
39272
|
+
return;
|
|
39273
|
+
}
|
|
39274
|
+
}
|
|
39275
|
+
const published = await publishSeedPack(selectedSeedPack.sid);
|
|
39276
|
+
setSelectedSeedPack(published);
|
|
39277
|
+
hydrateDraft(published);
|
|
39278
|
+
await refreshSeedPacks(published.sid);
|
|
39279
|
+
showSnackbar("Seed pack published.", "success");
|
|
39280
|
+
} catch (error) {
|
|
39281
|
+
showSnackbar("Failed to publish seed pack.", "error");
|
|
39282
|
+
debugLogger.error("SeedPacksTab: failed to publish seed pack", {
|
|
39283
|
+
sid: selectedSeedPack.sid,
|
|
39284
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39285
|
+
});
|
|
39286
|
+
} finally {
|
|
39287
|
+
setIsPublishing(false);
|
|
39288
|
+
}
|
|
39289
|
+
};
|
|
39290
|
+
const handleArchive = async () => {
|
|
39291
|
+
if (!selectedSeedPack) {
|
|
39292
|
+
return;
|
|
39293
|
+
}
|
|
39294
|
+
setArchiveDialogOpen(false);
|
|
39295
|
+
setIsArchiving(true);
|
|
39296
|
+
try {
|
|
39297
|
+
const archived = await archiveSeedPack(selectedSeedPack.sid);
|
|
39298
|
+
setSelectedSeedPack(archived);
|
|
39299
|
+
hydrateDraft(archived);
|
|
39300
|
+
await refreshSeedPacks(archived.sid);
|
|
39301
|
+
showSnackbar("Seed pack archived.", "success");
|
|
39302
|
+
} catch (error) {
|
|
39303
|
+
showSnackbar("Failed to archive seed pack.", "error");
|
|
39304
|
+
debugLogger.error("SeedPacksTab: failed to archive seed pack", {
|
|
39305
|
+
sid: selectedSeedPack.sid,
|
|
39306
|
+
error: error instanceof Error ? error.message : String(error)
|
|
39307
|
+
});
|
|
39308
|
+
} finally {
|
|
39309
|
+
setIsArchiving(false);
|
|
39310
|
+
}
|
|
39311
|
+
};
|
|
39312
|
+
const previewContent = draft.content.trim().length > 0 ? draft.content : "Preview will appear here as you type.";
|
|
39313
|
+
const selectedStatus = selectedSeedPack?.status ?? "draft";
|
|
39314
|
+
const statusChip = getStatusChip(selectedStatus);
|
|
39315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
39316
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
39317
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39318
|
+
import_material42.Stack,
|
|
39319
|
+
{
|
|
39320
|
+
direction: { xs: "column", md: "row" },
|
|
39321
|
+
spacing: { xs: 1.5, md: 2 },
|
|
39322
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
39323
|
+
justifyContent: "space-between",
|
|
39324
|
+
children: [
|
|
39325
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39326
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39327
|
+
import_material42.Typography,
|
|
39328
|
+
{
|
|
39329
|
+
variant: "h5",
|
|
39330
|
+
color: "text.primary",
|
|
39331
|
+
sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.55rem", md: "1.8rem" } },
|
|
39332
|
+
children: "Seed Packs"
|
|
39333
|
+
}
|
|
39334
|
+
),
|
|
39335
|
+
/* @__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." })
|
|
39336
|
+
] }),
|
|
39337
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39338
|
+
import_material42.Chip,
|
|
39339
|
+
{
|
|
39340
|
+
icon: isTeamScope ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Group2.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Person3.default, {}),
|
|
39341
|
+
label: scopeLabel,
|
|
39342
|
+
color: "info",
|
|
39343
|
+
variant: "outlined"
|
|
39344
|
+
}
|
|
39345
|
+
) })
|
|
39346
|
+
]
|
|
39347
|
+
}
|
|
39348
|
+
),
|
|
39349
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: scopeDescription })
|
|
39350
|
+
] }),
|
|
39351
|
+
!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." }),
|
|
39352
|
+
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." }),
|
|
39353
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39354
|
+
import_material42.Box,
|
|
39355
|
+
{
|
|
39356
|
+
sx: {
|
|
39357
|
+
display: "grid",
|
|
39358
|
+
gridTemplateColumns: { xs: "1fr", md: "320px 1fr" },
|
|
39359
|
+
gap: { xs: 2, md: 3 }
|
|
39360
|
+
},
|
|
39361
|
+
children: [
|
|
39362
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Card, { sx: { height: "fit-content" }, children: [
|
|
39363
|
+
/* @__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: [
|
|
39364
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Packs" }),
|
|
39365
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, children: [
|
|
39366
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39367
|
+
import_material42.Button,
|
|
39368
|
+
{
|
|
39369
|
+
size: "small",
|
|
39370
|
+
variant: "outlined",
|
|
39371
|
+
onClick: () => refreshSeedPacks(),
|
|
39372
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Refresh3.default, {}),
|
|
39373
|
+
disabled: !gatewayConfigured || isLoadingList,
|
|
39374
|
+
children: "Refresh"
|
|
39375
|
+
}
|
|
39376
|
+
),
|
|
39377
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39378
|
+
import_material42.Button,
|
|
39379
|
+
{
|
|
39380
|
+
size: "small",
|
|
39381
|
+
variant: "contained",
|
|
39382
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Add2.default, {}),
|
|
39383
|
+
onClick: () => setCreateDialogOpen(true),
|
|
39384
|
+
disabled: !gatewayConfigured,
|
|
39385
|
+
children: "New"
|
|
39386
|
+
}
|
|
39387
|
+
)
|
|
39388
|
+
] })
|
|
39389
|
+
] }) }),
|
|
39390
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, {}),
|
|
39391
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { px: 2, pb: 2 }, children: [
|
|
39392
|
+
isLoadingList && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.LinearProgress, { sx: { mb: 2 } }),
|
|
39393
|
+
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) => {
|
|
39394
|
+
const status = getStatusChip(pack.status);
|
|
39395
|
+
const tags = normalizeTags(pack.tags);
|
|
39396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39397
|
+
import_material42.ListItemButton,
|
|
39398
|
+
{
|
|
39399
|
+
selected: pack.sid === selectedSid,
|
|
39400
|
+
onClick: () => handleSelectPack(pack),
|
|
39401
|
+
sx: {
|
|
39402
|
+
mb: 1,
|
|
39403
|
+
borderRadius: 2,
|
|
39404
|
+
alignItems: "flex-start",
|
|
39405
|
+
border: pack.sid === selectedSid ? "1px solid" : "1px solid transparent",
|
|
39406
|
+
borderColor: pack.sid === selectedSid ? "primary.main" : "transparent"
|
|
39407
|
+
},
|
|
39408
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { flex: 1 }, children: [
|
|
39409
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, alignItems: "center", sx: { mb: 0.5 }, children: [
|
|
39410
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: pack.name }),
|
|
39411
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: status.label, color: status.color })
|
|
39412
|
+
] }),
|
|
39413
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: [
|
|
39414
|
+
pack.version ? `v${pack.version}` : "v0",
|
|
39415
|
+
" | Last published:",
|
|
39416
|
+
" ",
|
|
39417
|
+
formatTimestamp(pack.publishedAt)
|
|
39418
|
+
] }),
|
|
39419
|
+
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)) })
|
|
39420
|
+
] })
|
|
39421
|
+
},
|
|
39422
|
+
pack.sid
|
|
39423
|
+
);
|
|
39424
|
+
}) })
|
|
39425
|
+
] })
|
|
39426
|
+
] }),
|
|
39427
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.CardContent, { children: [
|
|
39428
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
39429
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39430
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: selectedSeedPack ? "Seed Pack Editor" : "Seed Pack Details" }),
|
|
39431
|
+
/* @__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." })
|
|
39432
|
+
] }),
|
|
39433
|
+
selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
39434
|
+
isDirty && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: "Unsaved changes", color: "warning" }),
|
|
39435
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: statusChip.label, color: statusChip.color })
|
|
39436
|
+
] })
|
|
39437
|
+
] }),
|
|
39438
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, { sx: { my: 2 } }),
|
|
39439
|
+
!selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39440
|
+
/* @__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." }),
|
|
39441
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39442
|
+
import_material42.Button,
|
|
39443
|
+
{
|
|
39444
|
+
variant: "contained",
|
|
39445
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Add2.default, {}),
|
|
39446
|
+
onClick: () => setCreateDialogOpen(true),
|
|
39447
|
+
disabled: !gatewayConfigured,
|
|
39448
|
+
children: "Create seed pack"
|
|
39449
|
+
}
|
|
39450
|
+
)
|
|
39451
|
+
] }),
|
|
39452
|
+
selectedSeedPack && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { spacing: 2, children: [
|
|
39453
|
+
isLoadingDetail && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.LinearProgress, {}),
|
|
39454
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39455
|
+
import_material42.TextField,
|
|
39456
|
+
{
|
|
39457
|
+
label: "Name",
|
|
39458
|
+
value: draft.name,
|
|
39459
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, name: event.target.value })),
|
|
39460
|
+
fullWidth: true,
|
|
39461
|
+
disabled: isReadOnly
|
|
39462
|
+
}
|
|
39463
|
+
),
|
|
39464
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39465
|
+
import_material42.TextField,
|
|
39466
|
+
{
|
|
39467
|
+
label: "Description",
|
|
39468
|
+
value: draft.description,
|
|
39469
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, description: event.target.value })),
|
|
39470
|
+
fullWidth: true,
|
|
39471
|
+
multiline: true,
|
|
39472
|
+
minRows: 2,
|
|
39473
|
+
disabled: isReadOnly
|
|
39474
|
+
}
|
|
39475
|
+
),
|
|
39476
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39477
|
+
import_material42.TextField,
|
|
39478
|
+
{
|
|
39479
|
+
label: "Tags (comma separated)",
|
|
39480
|
+
value: tagsInput,
|
|
39481
|
+
onChange: (event) => setTagsInput(event.target.value),
|
|
39482
|
+
fullWidth: true,
|
|
39483
|
+
disabled: isReadOnly
|
|
39484
|
+
}
|
|
39485
|
+
),
|
|
39486
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
39487
|
+
/* @__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, {}) }),
|
|
39488
|
+
selectedSeedPack.version && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: `Version ${selectedSeedPack.version}`, variant: "outlined" }),
|
|
39489
|
+
selectedSeedPack.updatedAt && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Chip, { size: "small", label: `Updated ${formatTimestamp(selectedSeedPack.updatedAt)}`, variant: "outlined" })
|
|
39490
|
+
] }),
|
|
39491
|
+
/* @__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." }),
|
|
39492
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39493
|
+
import_material42.Box,
|
|
39494
|
+
{
|
|
39495
|
+
sx: {
|
|
39496
|
+
display: "grid",
|
|
39497
|
+
gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" },
|
|
39498
|
+
gap: 2,
|
|
39499
|
+
alignItems: "start"
|
|
39500
|
+
},
|
|
39501
|
+
children: [
|
|
39502
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39503
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39504
|
+
import_material42.Stack,
|
|
39505
|
+
{
|
|
39506
|
+
direction: { xs: "column", sm: "row" },
|
|
39507
|
+
spacing: 1,
|
|
39508
|
+
alignItems: { xs: "flex-start", sm: "center" },
|
|
39509
|
+
justifyContent: "space-between",
|
|
39510
|
+
sx: { mb: 1 },
|
|
39511
|
+
children: [
|
|
39512
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", children: "Markdown content" }),
|
|
39513
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39514
|
+
import_material42.Button,
|
|
39515
|
+
{
|
|
39516
|
+
size: "small",
|
|
39517
|
+
variant: "outlined",
|
|
39518
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
|
|
39519
|
+
onClick: () => fileInputRef.current?.click(),
|
|
39520
|
+
disabled: isReadOnly,
|
|
39521
|
+
children: "Import .md"
|
|
39522
|
+
}
|
|
39523
|
+
),
|
|
39524
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39525
|
+
"input",
|
|
39526
|
+
{
|
|
39527
|
+
ref: fileInputRef,
|
|
39528
|
+
type: "file",
|
|
39529
|
+
accept: ".md",
|
|
39530
|
+
multiple: true,
|
|
39531
|
+
onChange: handleFileInputChange,
|
|
39532
|
+
style: { display: "none" }
|
|
39533
|
+
}
|
|
39534
|
+
)
|
|
39535
|
+
]
|
|
39536
|
+
}
|
|
39537
|
+
),
|
|
39538
|
+
/* @__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." }),
|
|
39539
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39540
|
+
import_material42.TextField,
|
|
39541
|
+
{
|
|
39542
|
+
label: "Content",
|
|
39543
|
+
value: draft.content,
|
|
39544
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, content: event.target.value })),
|
|
39545
|
+
fullWidth: true,
|
|
39546
|
+
multiline: true,
|
|
39547
|
+
minRows: 12,
|
|
39548
|
+
disabled: isReadOnly
|
|
39549
|
+
}
|
|
39550
|
+
),
|
|
39551
|
+
importedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { sx: { mt: 2 }, children: [
|
|
39552
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
39553
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39554
|
+
import_material42.Box,
|
|
39555
|
+
{
|
|
39556
|
+
sx: {
|
|
39557
|
+
display: "grid",
|
|
39558
|
+
gridTemplateColumns: {
|
|
39559
|
+
xs: "1fr",
|
|
39560
|
+
sm: "repeat(2, minmax(0, 1fr))",
|
|
39561
|
+
md: "repeat(3, minmax(0, 1fr))"
|
|
39562
|
+
},
|
|
39563
|
+
gap: 2
|
|
39564
|
+
},
|
|
39565
|
+
children: importedFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39566
|
+
SeedPackFileCard,
|
|
39567
|
+
{
|
|
39568
|
+
file,
|
|
39569
|
+
isReadOnly,
|
|
39570
|
+
onPreview: () => setPreviewFile(file),
|
|
39571
|
+
onRemove: () => handleRemoveImportedFile(file.id)
|
|
39572
|
+
},
|
|
39573
|
+
file.id
|
|
39574
|
+
))
|
|
39575
|
+
}
|
|
39576
|
+
)
|
|
39577
|
+
] })
|
|
39578
|
+
] }),
|
|
39579
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Card, { variant: "outlined", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.CardContent, { children: [
|
|
39580
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Preview" }),
|
|
39581
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StreamingMarkdown_default, { content: previewContent })
|
|
39582
|
+
] }) })
|
|
39583
|
+
]
|
|
39584
|
+
}
|
|
39585
|
+
),
|
|
39586
|
+
selectedSeedPack.summary && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39587
|
+
import_material42.TextField,
|
|
39588
|
+
{
|
|
39589
|
+
label: "Summary (auto-generated)",
|
|
39590
|
+
value: selectedSeedPack.summary,
|
|
39591
|
+
fullWidth: true,
|
|
39592
|
+
multiline: true,
|
|
39593
|
+
minRows: 3,
|
|
39594
|
+
InputProps: { readOnly: true }
|
|
39595
|
+
}
|
|
39596
|
+
),
|
|
39597
|
+
canManage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, flexWrap: "wrap", children: [
|
|
39598
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39599
|
+
import_material42.Button,
|
|
39600
|
+
{
|
|
39601
|
+
variant: "outlined",
|
|
39602
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Save2.default, {}),
|
|
39603
|
+
onClick: handleSaveDraft,
|
|
39604
|
+
disabled: isReadOnly || !isDirty || isSaving,
|
|
39605
|
+
children: isSaving ? "Saving..." : "Save draft"
|
|
39606
|
+
}
|
|
39607
|
+
),
|
|
39608
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39609
|
+
import_material42.Button,
|
|
39610
|
+
{
|
|
39611
|
+
variant: "outlined",
|
|
39612
|
+
onClick: handleResetDraft,
|
|
39613
|
+
disabled: !isDirty || isReadOnly,
|
|
39614
|
+
children: "Reset changes"
|
|
39615
|
+
}
|
|
39616
|
+
),
|
|
39617
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39618
|
+
import_material42.Button,
|
|
39619
|
+
{
|
|
39620
|
+
variant: "contained",
|
|
39621
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Publish.default, {}),
|
|
39622
|
+
onClick: () => setPublishDialogOpen(true),
|
|
39623
|
+
disabled: isReadOnly || isPublishing,
|
|
39624
|
+
children: isPublishing ? "Publishing..." : "Publish"
|
|
39625
|
+
}
|
|
39626
|
+
),
|
|
39627
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39628
|
+
import_material42.Button,
|
|
39629
|
+
{
|
|
39630
|
+
variant: "text",
|
|
39631
|
+
color: "error",
|
|
39632
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_Archive.default, {}),
|
|
39633
|
+
onClick: () => setArchiveDialogOpen(true),
|
|
39634
|
+
disabled: isReadOnly || isArchiving,
|
|
39635
|
+
children: isArchiving ? "Archiving..." : "Archive"
|
|
39636
|
+
}
|
|
39637
|
+
)
|
|
39638
|
+
] })
|
|
39639
|
+
] })
|
|
39640
|
+
] }) })
|
|
39641
|
+
]
|
|
39642
|
+
}
|
|
39643
|
+
),
|
|
39644
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: createDialogOpen, onClose: resetCreateDialog, maxWidth: "sm", fullWidth: true, children: [
|
|
39645
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Create seed pack" }),
|
|
39646
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContent, { children: [
|
|
39647
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContentText, { sx: { mb: 2 }, children: [
|
|
39648
|
+
"Seed packs are scoped automatically based on your sign-in. ",
|
|
39649
|
+
scopeLabel,
|
|
39650
|
+
" - ",
|
|
39651
|
+
scopeDescription
|
|
39652
|
+
] }),
|
|
39653
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { spacing: 2, children: [
|
|
39654
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39655
|
+
import_material42.TextField,
|
|
39656
|
+
{
|
|
39657
|
+
label: "Name",
|
|
39658
|
+
value: newPackName,
|
|
39659
|
+
onChange: (event) => setNewPackName(event.target.value),
|
|
39660
|
+
fullWidth: true,
|
|
39661
|
+
autoFocus: true
|
|
39662
|
+
}
|
|
39663
|
+
),
|
|
39664
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39665
|
+
import_material42.TextField,
|
|
39666
|
+
{
|
|
39667
|
+
label: "Description",
|
|
39668
|
+
value: newPackDescription,
|
|
39669
|
+
onChange: (event) => setNewPackDescription(event.target.value),
|
|
39670
|
+
fullWidth: true,
|
|
39671
|
+
multiline: true,
|
|
39672
|
+
minRows: 2
|
|
39673
|
+
}
|
|
39674
|
+
),
|
|
39675
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39676
|
+
import_material42.TextField,
|
|
39677
|
+
{
|
|
39678
|
+
label: "Tags (comma separated)",
|
|
39679
|
+
value: newPackTags,
|
|
39680
|
+
onChange: (event) => setNewPackTags(event.target.value),
|
|
39681
|
+
fullWidth: true
|
|
39682
|
+
}
|
|
39683
|
+
),
|
|
39684
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Divider, {}),
|
|
39685
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Stack, { direction: { xs: "column", sm: "row" }, spacing: 1, alignItems: "center", children: [
|
|
39686
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39687
|
+
import_material42.Button,
|
|
39688
|
+
{
|
|
39689
|
+
size: "small",
|
|
39690
|
+
variant: "outlined",
|
|
39691
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_UploadFile2.default, {}),
|
|
39692
|
+
onClick: () => createFileInputRef.current?.click(),
|
|
39693
|
+
disabled: !canManage,
|
|
39694
|
+
children: "Import .md files"
|
|
39695
|
+
}
|
|
39696
|
+
),
|
|
39697
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "caption", color: "text.secondary", children: "Optional. Files are merged into the draft content." }),
|
|
39698
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39699
|
+
"input",
|
|
39700
|
+
{
|
|
39701
|
+
ref: createFileInputRef,
|
|
39702
|
+
type: "file",
|
|
39703
|
+
accept: ".md",
|
|
39704
|
+
multiple: true,
|
|
39705
|
+
onChange: handleCreateFileInputChange,
|
|
39706
|
+
style: { display: "none" }
|
|
39707
|
+
}
|
|
39708
|
+
)
|
|
39709
|
+
] }),
|
|
39710
|
+
createImportedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Box, { children: [
|
|
39711
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
39712
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39713
|
+
import_material42.Box,
|
|
39714
|
+
{
|
|
39715
|
+
sx: {
|
|
39716
|
+
display: "grid",
|
|
39717
|
+
gridTemplateColumns: {
|
|
39718
|
+
xs: "1fr",
|
|
39719
|
+
sm: "repeat(2, minmax(0, 1fr))"
|
|
39720
|
+
},
|
|
39721
|
+
gap: 2
|
|
39722
|
+
},
|
|
39723
|
+
children: createImportedFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39724
|
+
SeedPackFileCard,
|
|
39725
|
+
{
|
|
39726
|
+
file,
|
|
39727
|
+
isReadOnly: !canManage,
|
|
39728
|
+
onPreview: () => setPreviewFile(file),
|
|
39729
|
+
onRemove: () => handleRemoveCreateImportedFile(file.id)
|
|
39730
|
+
},
|
|
39731
|
+
file.id
|
|
39732
|
+
))
|
|
39733
|
+
}
|
|
39734
|
+
)
|
|
39735
|
+
] })
|
|
39736
|
+
] })
|
|
39737
|
+
] }),
|
|
39738
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39739
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: resetCreateDialog, children: "Cancel" }),
|
|
39740
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39741
|
+
import_material42.Button,
|
|
39742
|
+
{
|
|
39743
|
+
variant: "contained",
|
|
39744
|
+
onClick: handleCreateSeedPack,
|
|
39745
|
+
disabled: !gatewayConfigured || isCreating,
|
|
39746
|
+
children: isCreating ? "Creating..." : "Create"
|
|
39747
|
+
}
|
|
39748
|
+
)
|
|
39749
|
+
] })
|
|
39750
|
+
] }),
|
|
39751
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: publishDialogOpen, onClose: () => setPublishDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
39752
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Publish seed pack" }),
|
|
39753
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogContent, { children: [
|
|
39754
|
+
/* @__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." }),
|
|
39755
|
+
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." })
|
|
39756
|
+
] }),
|
|
39757
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39758
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setPublishDialogOpen(false), children: "Cancel" }),
|
|
39759
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", onClick: handlePublish, disabled: isPublishing, children: isPublishing ? "Publishing..." : "Publish" })
|
|
39760
|
+
] })
|
|
39761
|
+
] }),
|
|
39762
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.Dialog, { open: archiveDialogOpen, onClose: () => setArchiveDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
39763
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: "Archive seed pack" }),
|
|
39764
|
+
/* @__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." }) }),
|
|
39765
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_material42.DialogActions, { children: [
|
|
39766
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setArchiveDialogOpen(false), children: "Cancel" }),
|
|
39767
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { variant: "contained", color: "error", onClick: handleArchive, disabled: isArchiving, children: isArchiving ? "Archiving..." : "Archive" })
|
|
39768
|
+
] })
|
|
39769
|
+
] }),
|
|
39770
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
39771
|
+
import_material42.Dialog,
|
|
39772
|
+
{
|
|
39773
|
+
open: Boolean(previewFile),
|
|
39774
|
+
onClose: () => setPreviewFile(null),
|
|
39775
|
+
maxWidth: "md",
|
|
39776
|
+
fullWidth: true,
|
|
39777
|
+
children: [
|
|
39778
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogTitle, { children: previewFile?.name ?? "Markdown preview" }),
|
|
39779
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StreamingMarkdown_default, { content: previewFile?.content ?? "" }) }),
|
|
39780
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Button, { onClick: () => setPreviewFile(null), children: "Close" }) })
|
|
39781
|
+
]
|
|
39782
|
+
}
|
|
39783
|
+
),
|
|
39784
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
39785
|
+
import_material42.Snackbar,
|
|
39786
|
+
{
|
|
39787
|
+
open: snackbarOpen,
|
|
39788
|
+
autoHideDuration: 4e3,
|
|
39789
|
+
onClose: () => setSnackbarOpen(false),
|
|
39790
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
39791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_material42.Alert, { onClose: () => setSnackbarOpen(false), severity: snackbarSeverity, sx: { width: "100%" }, children: snackbarMessage })
|
|
39792
|
+
}
|
|
39793
|
+
)
|
|
39794
|
+
] });
|
|
39795
|
+
};
|
|
39796
|
+
var SeedPacksTab_default = SeedPacksTab;
|
|
39797
|
+
|
|
39798
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
39799
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
39800
|
+
var KnowledgeHubTab = (props) => {
|
|
39801
|
+
const theme = (0, import_material43.useTheme)();
|
|
39802
|
+
const isMobile = (0, import_material43.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
39803
|
+
const { seedPacksEnabled = false } = props;
|
|
39804
|
+
const [tabIndex, setTabIndex] = (0, import_react53.useState)(0);
|
|
39805
|
+
const effectiveTabIndex = seedPacksEnabled ? tabIndex : 0;
|
|
39806
|
+
(0, import_react53.useEffect)(() => {
|
|
39807
|
+
if (!seedPacksEnabled && tabIndex !== 0) {
|
|
39808
|
+
setTabIndex(0);
|
|
39809
|
+
}
|
|
39810
|
+
}, [seedPacksEnabled, tabIndex]);
|
|
39811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_material43.Box, { children: [
|
|
39812
|
+
/* @__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)(
|
|
39813
|
+
import_material43.Tabs,
|
|
39814
|
+
{
|
|
39815
|
+
value: effectiveTabIndex,
|
|
39816
|
+
onChange: (_, newValue) => setTabIndex(newValue),
|
|
39817
|
+
variant: isMobile ? "fullWidth" : "standard",
|
|
39818
|
+
sx: {
|
|
39819
|
+
borderBottom: 1,
|
|
39820
|
+
borderColor: "divider",
|
|
39821
|
+
"& .MuiTab-root": {
|
|
39822
|
+
textTransform: "none",
|
|
39823
|
+
fontWeight: 600,
|
|
39824
|
+
fontSize: { xs: "0.95rem", sm: "1rem" },
|
|
39825
|
+
minWidth: { xs: "auto", md: 160 },
|
|
39826
|
+
px: { xs: 1.2, sm: 1.5 }
|
|
39827
|
+
}
|
|
39828
|
+
},
|
|
39829
|
+
children: [
|
|
39830
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39831
|
+
import_material43.Tab,
|
|
39832
|
+
{
|
|
39833
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_Description5.default, { fontSize: isMobile ? "small" : "medium" }),
|
|
39834
|
+
iconPosition: isMobile ? "top" : "start",
|
|
39835
|
+
label: "Documents"
|
|
39836
|
+
}
|
|
39837
|
+
),
|
|
39838
|
+
seedPacksEnabled && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39839
|
+
import_material43.Tab,
|
|
39840
|
+
{
|
|
39841
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_AutoStories.default, { fontSize: isMobile ? "small" : "medium" }),
|
|
39842
|
+
iconPosition: isMobile ? "top" : "start",
|
|
39843
|
+
label: "Seed Packs"
|
|
39844
|
+
}
|
|
39845
|
+
)
|
|
39846
|
+
]
|
|
39847
|
+
}
|
|
39848
|
+
) }),
|
|
39849
|
+
/* @__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 }) }),
|
|
39850
|
+
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, {}) })
|
|
39851
|
+
] });
|
|
39852
|
+
};
|
|
39853
|
+
var KnowledgeHubTab_default = KnowledgeHubTab;
|
|
39854
|
+
|
|
39855
|
+
// src/management/components/StorageTab.tsx
|
|
39856
|
+
var import_react54 = require("react");
|
|
39857
|
+
var import_material44 = require("@mui/material");
|
|
39858
|
+
var import_Storage = __toESM(require("@mui/icons-material/Storage"));
|
|
39859
|
+
var import_Delete7 = __toESM(require("@mui/icons-material/Delete"));
|
|
39860
|
+
var import_Refresh4 = __toESM(require("@mui/icons-material/Refresh"));
|
|
38309
39861
|
var import_Warning = __toESM(require("@mui/icons-material/Warning"));
|
|
38310
39862
|
var import_Info2 = __toESM(require("@mui/icons-material/Info"));
|
|
38311
39863
|
var import_CleaningServices = __toESM(require("@mui/icons-material/CleaningServices"));
|
|
38312
|
-
var
|
|
38313
|
-
var
|
|
39864
|
+
var import_Description6 = __toESM(require("@mui/icons-material/Description"));
|
|
39865
|
+
var import_Person4 = __toESM(require("@mui/icons-material/Person"));
|
|
38314
39866
|
var import_Chat = __toESM(require("@mui/icons-material/Chat"));
|
|
38315
39867
|
var import_Settings2 = __toESM(require("@mui/icons-material/Settings"));
|
|
38316
39868
|
var import_ExpandMore3 = __toESM(require("@mui/icons-material/ExpandMore"));
|
|
@@ -38319,7 +39871,7 @@ var import_Error3 = __toESM(require("@mui/icons-material/Error"));
|
|
|
38319
39871
|
init_debugLogger();
|
|
38320
39872
|
init_indexedDBService();
|
|
38321
39873
|
init_conversationSyncStore();
|
|
38322
|
-
var
|
|
39874
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
38323
39875
|
var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
|
|
38324
39876
|
var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
|
|
38325
39877
|
var formatBytes = (bytes) => {
|
|
@@ -38414,7 +39966,7 @@ var getIndexedDBSize = async () => {
|
|
|
38414
39966
|
}
|
|
38415
39967
|
categories.push({
|
|
38416
39968
|
name: "Knowledge Documents",
|
|
38417
|
-
icon:
|
|
39969
|
+
icon: import_Description6.default,
|
|
38418
39970
|
color: "#2196f3",
|
|
38419
39971
|
size: knowledgeSize.size,
|
|
38420
39972
|
itemCount: knowledgeSize.count,
|
|
@@ -38448,7 +40000,7 @@ var getIndexedDBSize = async () => {
|
|
|
38448
40000
|
}
|
|
38449
40001
|
categories.push({
|
|
38450
40002
|
name: "AI Memories",
|
|
38451
|
-
icon:
|
|
40003
|
+
icon: import_Person4.default,
|
|
38452
40004
|
color: "#ff9800",
|
|
38453
40005
|
size: memorySize.size,
|
|
38454
40006
|
itemCount: memorySize.count,
|
|
@@ -38503,7 +40055,7 @@ var getIndexedDBSize = async () => {
|
|
|
38503
40055
|
if (querySize.count > 0) {
|
|
38504
40056
|
categories.push({
|
|
38505
40057
|
name: "AI Query Cache",
|
|
38506
|
-
icon:
|
|
40058
|
+
icon: import_Person4.default,
|
|
38507
40059
|
color: "#ff5722",
|
|
38508
40060
|
size: querySize.size,
|
|
38509
40061
|
itemCount: querySize.count,
|
|
@@ -38615,21 +40167,21 @@ var clearEntireDatabase = async (dbName) => {
|
|
|
38615
40167
|
});
|
|
38616
40168
|
};
|
|
38617
40169
|
var StorageTab = ({ currentTheme }) => {
|
|
38618
|
-
const theme = (0,
|
|
38619
|
-
const [storageQuota, setStorageQuota] = (0,
|
|
40170
|
+
const theme = (0, import_material44.useTheme)();
|
|
40171
|
+
const [storageQuota, setStorageQuota] = (0, import_react54.useState)({
|
|
38620
40172
|
used: 0,
|
|
38621
40173
|
quota: 0,
|
|
38622
40174
|
available: 0,
|
|
38623
40175
|
browserQuotaEstimate: 0
|
|
38624
40176
|
});
|
|
38625
|
-
const [storageCategories, setStorageCategories] = (0,
|
|
38626
|
-
const [loading, setLoading] = (0,
|
|
38627
|
-
const [clearAllDialogOpen, setClearAllDialogOpen] = (0,
|
|
38628
|
-
const [clearCategoryDialog, setClearCategoryDialog] = (0,
|
|
38629
|
-
const [clearing, setClearing] = (0,
|
|
38630
|
-
const [snackbarMessage, setSnackbarMessage] = (0,
|
|
38631
|
-
const [showSnackbar, setShowSnackbar] = (0,
|
|
38632
|
-
const [snackbarSeverity, setSnackbarSeverity] = (0,
|
|
40177
|
+
const [storageCategories, setStorageCategories] = (0, import_react54.useState)([]);
|
|
40178
|
+
const [loading, setLoading] = (0, import_react54.useState)(true);
|
|
40179
|
+
const [clearAllDialogOpen, setClearAllDialogOpen] = (0, import_react54.useState)(false);
|
|
40180
|
+
const [clearCategoryDialog, setClearCategoryDialog] = (0, import_react54.useState)(null);
|
|
40181
|
+
const [clearing, setClearing] = (0, import_react54.useState)(false);
|
|
40182
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react54.useState)("");
|
|
40183
|
+
const [showSnackbar, setShowSnackbar] = (0, import_react54.useState)(false);
|
|
40184
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react54.useState)("success");
|
|
38633
40185
|
const { syncEnabled, isAdvancedVectorFeaturesEnabled } = useConversationSyncStore((state) => ({
|
|
38634
40186
|
syncEnabled: state.syncEnabled,
|
|
38635
40187
|
isAdvancedVectorFeaturesEnabled: state.isAdvancedVectorFeaturesEnabled
|
|
@@ -38681,18 +40233,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38681
40233
|
setLoading(false);
|
|
38682
40234
|
}
|
|
38683
40235
|
};
|
|
38684
|
-
(0,
|
|
40236
|
+
(0, import_react54.useEffect)(() => {
|
|
38685
40237
|
loadStorageData();
|
|
38686
40238
|
}, []);
|
|
38687
|
-
const totalUsed = (0,
|
|
40239
|
+
const totalUsed = (0, import_react54.useMemo)(() => {
|
|
38688
40240
|
return storageCategories.reduce((sum, cat) => sum + cat.size, 0);
|
|
38689
40241
|
}, [storageCategories]);
|
|
38690
|
-
const usagePercentage = (0,
|
|
40242
|
+
const usagePercentage = (0, import_react54.useMemo)(() => {
|
|
38691
40243
|
if (storageQuota.quota === 0) return 0;
|
|
38692
40244
|
const percentage = Math.min(storageQuota.used / storageQuota.quota * 100, 100);
|
|
38693
40245
|
return percentage > 0 && percentage < 0.1 ? 0.1 : percentage;
|
|
38694
40246
|
}, [storageQuota]);
|
|
38695
|
-
const clearableCategories = (0,
|
|
40247
|
+
const clearableCategories = (0, import_react54.useMemo)(() => {
|
|
38696
40248
|
return storageCategories.filter((cat) => cat.canClear);
|
|
38697
40249
|
}, [storageCategories]);
|
|
38698
40250
|
const handleClearCategory = async (category) => {
|
|
@@ -38777,13 +40329,13 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38777
40329
|
}
|
|
38778
40330
|
};
|
|
38779
40331
|
if (loading) {
|
|
38780
|
-
return /* @__PURE__ */ (0,
|
|
38781
|
-
/* @__PURE__ */ (0,
|
|
38782
|
-
/* @__PURE__ */ (0,
|
|
40332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 8 }, children: [
|
|
40333
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, {}),
|
|
40334
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body1", color: "text.secondary", sx: { ml: 2 }, children: "Analyzing storage usage..." })
|
|
38783
40335
|
] });
|
|
38784
40336
|
}
|
|
38785
|
-
return /* @__PURE__ */ (0,
|
|
38786
|
-
/* @__PURE__ */ (0,
|
|
40337
|
+
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: [
|
|
40338
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: {
|
|
38787
40339
|
display: "flex",
|
|
38788
40340
|
flexDirection: { xs: "column", sm: "row" },
|
|
38789
40341
|
justifyContent: "space-between",
|
|
@@ -38791,19 +40343,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38791
40343
|
gap: { xs: 2, sm: 0 },
|
|
38792
40344
|
mb: 2
|
|
38793
40345
|
}, children: [
|
|
38794
|
-
/* @__PURE__ */ (0,
|
|
38795
|
-
/* @__PURE__ */ (0,
|
|
38796
|
-
/* @__PURE__ */ (0,
|
|
40346
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { flex: 1 }, children: [
|
|
40347
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h5", color: "text.primary", sx: { mb: 1, fontWeight: 600 }, children: "Storage Management" }),
|
|
40348
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body1", color: "text.secondary", children: "Monitor and manage your local browser storage usage" })
|
|
38797
40349
|
] }),
|
|
38798
|
-
/* @__PURE__ */ (0,
|
|
40350
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: {
|
|
38799
40351
|
display: "flex",
|
|
38800
40352
|
gap: 1,
|
|
38801
40353
|
flexWrap: { xs: "wrap", sm: "nowrap" },
|
|
38802
40354
|
justifyContent: { xs: "stretch", sm: "flex-end" },
|
|
38803
40355
|
width: { xs: "100%", sm: "auto" }
|
|
38804
40356
|
}, children: [
|
|
38805
|
-
/* @__PURE__ */ (0,
|
|
38806
|
-
|
|
40357
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40358
|
+
import_material44.Button,
|
|
38807
40359
|
{
|
|
38808
40360
|
variant: "outlined",
|
|
38809
40361
|
size: "small",
|
|
@@ -38815,22 +40367,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38815
40367
|
minHeight: 36
|
|
38816
40368
|
},
|
|
38817
40369
|
children: [
|
|
38818
|
-
/* @__PURE__ */ (0,
|
|
38819
|
-
/* @__PURE__ */ (0,
|
|
40370
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: { xs: "none", sm: "flex" }, alignItems: "center", gap: 1 }, children: [
|
|
40371
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Refresh4.default, { fontSize: "medium" }),
|
|
38820
40372
|
"Refresh"
|
|
38821
40373
|
] }),
|
|
38822
|
-
/* @__PURE__ */ (0,
|
|
40374
|
+
/* @__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" }) })
|
|
38823
40375
|
]
|
|
38824
40376
|
}
|
|
38825
40377
|
),
|
|
38826
|
-
clearableCategories.length > 0 && /* @__PURE__ */ (0,
|
|
38827
|
-
/* @__PURE__ */ (0,
|
|
38828
|
-
|
|
40378
|
+
clearableCategories.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
40379
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40380
|
+
import_material44.Button,
|
|
38829
40381
|
{
|
|
38830
40382
|
variant: "outlined",
|
|
38831
40383
|
color: "error",
|
|
38832
40384
|
size: "small",
|
|
38833
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40385
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
38834
40386
|
onClick: () => setClearAllDialogOpen(true),
|
|
38835
40387
|
sx: {
|
|
38836
40388
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -38838,18 +40390,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38838
40390
|
px: { xs: 1, sm: 2 }
|
|
38839
40391
|
},
|
|
38840
40392
|
children: [
|
|
38841
|
-
/* @__PURE__ */ (0,
|
|
38842
|
-
/* @__PURE__ */ (0,
|
|
40393
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "none", sm: "inline" } }, children: "Clear All Data" }),
|
|
40394
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "inline", sm: "none" } }, children: "Clear All" })
|
|
38843
40395
|
]
|
|
38844
40396
|
}
|
|
38845
40397
|
),
|
|
38846
|
-
/* @__PURE__ */ (0,
|
|
38847
|
-
|
|
40398
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40399
|
+
import_material44.Button,
|
|
38848
40400
|
{
|
|
38849
40401
|
variant: "outlined",
|
|
38850
40402
|
color: "error",
|
|
38851
40403
|
size: "small",
|
|
38852
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40404
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
38853
40405
|
onClick: () => handleNuclearClear(),
|
|
38854
40406
|
sx: {
|
|
38855
40407
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -38857,28 +40409,28 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38857
40409
|
px: { xs: 1, sm: 2 }
|
|
38858
40410
|
},
|
|
38859
40411
|
children: [
|
|
38860
|
-
/* @__PURE__ */ (0,
|
|
38861
|
-
/* @__PURE__ */ (0,
|
|
40412
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "none", sm: "inline" } }, children: "Nuclear Clear" }),
|
|
40413
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { display: { xs: "inline", sm: "none" } }, children: "Nuclear" })
|
|
38862
40414
|
]
|
|
38863
40415
|
}
|
|
38864
40416
|
)
|
|
38865
40417
|
] })
|
|
38866
40418
|
] })
|
|
38867
40419
|
] }) }),
|
|
38868
|
-
/* @__PURE__ */ (0,
|
|
38869
|
-
/* @__PURE__ */ (0,
|
|
40420
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mb: 4 }, children: [
|
|
40421
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { sx: { mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { sx: {
|
|
38870
40422
|
display: "flex",
|
|
38871
40423
|
flexDirection: "column",
|
|
38872
40424
|
minHeight: 180
|
|
38873
40425
|
}, children: [
|
|
38874
|
-
/* @__PURE__ */ (0,
|
|
38875
|
-
/* @__PURE__ */ (0,
|
|
40426
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
40427
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Storage.default, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
38876
40428
|
"Storage Quota"
|
|
38877
40429
|
] }),
|
|
38878
|
-
/* @__PURE__ */ (0,
|
|
38879
|
-
/* @__PURE__ */ (0,
|
|
38880
|
-
/* @__PURE__ */ (0,
|
|
38881
|
-
|
|
40430
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mb: 2, flex: 1 }, children: [
|
|
40431
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
40432
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40433
|
+
import_material44.Chip,
|
|
38882
40434
|
{
|
|
38883
40435
|
label: `${formatBytes(storageQuota.used)} Used`,
|
|
38884
40436
|
color: "warning",
|
|
@@ -38886,8 +40438,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38886
40438
|
variant: "outlined"
|
|
38887
40439
|
}
|
|
38888
40440
|
),
|
|
38889
|
-
/* @__PURE__ */ (0,
|
|
38890
|
-
|
|
40441
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40442
|
+
import_material44.Chip,
|
|
38891
40443
|
{
|
|
38892
40444
|
label: `${formatBytes(storageQuota.available)} Available`,
|
|
38893
40445
|
color: "success",
|
|
@@ -38895,8 +40447,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38895
40447
|
variant: "outlined"
|
|
38896
40448
|
}
|
|
38897
40449
|
),
|
|
38898
|
-
/* @__PURE__ */ (0,
|
|
38899
|
-
|
|
40450
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40451
|
+
import_material44.Chip,
|
|
38900
40452
|
{
|
|
38901
40453
|
label: `${formatBytes(storageQuota.quota)} Total`,
|
|
38902
40454
|
color: "info",
|
|
@@ -38904,8 +40456,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38904
40456
|
variant: "outlined"
|
|
38905
40457
|
}
|
|
38906
40458
|
),
|
|
38907
|
-
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ (0,
|
|
38908
|
-
|
|
40459
|
+
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40460
|
+
import_material44.Chip,
|
|
38909
40461
|
{
|
|
38910
40462
|
label: `\u2248${formatBytes(storageQuota.browserQuotaEstimate)} Browser Estimate`,
|
|
38911
40463
|
color: "default",
|
|
@@ -38914,8 +40466,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38914
40466
|
}
|
|
38915
40467
|
)
|
|
38916
40468
|
] }),
|
|
38917
|
-
/* @__PURE__ */ (0,
|
|
38918
|
-
|
|
40469
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40470
|
+
import_material44.LinearProgress,
|
|
38919
40471
|
{
|
|
38920
40472
|
variant: "determinate",
|
|
38921
40473
|
value: usagePercentage,
|
|
@@ -38930,38 +40482,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38930
40482
|
}
|
|
38931
40483
|
}
|
|
38932
40484
|
),
|
|
38933
|
-
/* @__PURE__ */ (0,
|
|
40485
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "caption", color: "text.secondary", sx: { mt: 0.5, display: "block" }, children: [
|
|
38934
40486
|
usagePercentage.toFixed(1),
|
|
38935
40487
|
"% used"
|
|
38936
40488
|
] })
|
|
38937
40489
|
] }),
|
|
38938
|
-
usagePercentage > 80 && /* @__PURE__ */ (0,
|
|
40490
|
+
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." })
|
|
38939
40491
|
] }) }),
|
|
38940
|
-
/* @__PURE__ */ (0,
|
|
40492
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { sx: {
|
|
38941
40493
|
display: "flex",
|
|
38942
40494
|
flexDirection: "column",
|
|
38943
40495
|
minHeight: 140
|
|
38944
40496
|
}, children: [
|
|
38945
|
-
/* @__PURE__ */ (0,
|
|
38946
|
-
/* @__PURE__ */ (0,
|
|
38947
|
-
/* @__PURE__ */ (0,
|
|
38948
|
-
|
|
40497
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: "Usage Summary" }),
|
|
40498
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
40499
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40500
|
+
import_material44.Chip,
|
|
38949
40501
|
{
|
|
38950
40502
|
label: `${storageCategories.length} Categories`,
|
|
38951
40503
|
color: "primary",
|
|
38952
40504
|
size: "small"
|
|
38953
40505
|
}
|
|
38954
40506
|
),
|
|
38955
|
-
/* @__PURE__ */ (0,
|
|
38956
|
-
|
|
40507
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40508
|
+
import_material44.Chip,
|
|
38957
40509
|
{
|
|
38958
40510
|
label: `${storageCategories.reduce((sum, cat) => sum + cat.itemCount, 0)} Items`,
|
|
38959
40511
|
color: "secondary",
|
|
38960
40512
|
size: "small"
|
|
38961
40513
|
}
|
|
38962
40514
|
),
|
|
38963
|
-
/* @__PURE__ */ (0,
|
|
38964
|
-
|
|
40515
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40516
|
+
import_material44.Chip,
|
|
38965
40517
|
{
|
|
38966
40518
|
label: `${formatBytes(totalUsed)} Used`,
|
|
38967
40519
|
color: "info",
|
|
@@ -38969,11 +40521,11 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38969
40521
|
}
|
|
38970
40522
|
)
|
|
38971
40523
|
] }),
|
|
38972
|
-
/* @__PURE__ */ (0,
|
|
40524
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
|
|
38973
40525
|
] }) })
|
|
38974
40526
|
] }),
|
|
38975
|
-
/* @__PURE__ */ (0,
|
|
38976
|
-
/* @__PURE__ */ (0,
|
|
40527
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
|
|
40528
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: {
|
|
38977
40529
|
maxHeight: "60vh",
|
|
38978
40530
|
overflow: "auto",
|
|
38979
40531
|
"&::-webkit-scrollbar": {
|
|
@@ -38981,15 +40533,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
38981
40533
|
},
|
|
38982
40534
|
msOverflowStyle: "none",
|
|
38983
40535
|
scrollbarWidth: "none"
|
|
38984
|
-
}, children: storageCategories.length === 0 ? /* @__PURE__ */ (0,
|
|
38985
|
-
/* @__PURE__ */ (0,
|
|
38986
|
-
/* @__PURE__ */ (0,
|
|
38987
|
-
/* @__PURE__ */ (0,
|
|
38988
|
-
/* @__PURE__ */ (0,
|
|
38989
|
-
/* @__PURE__ */ (0,
|
|
40536
|
+
}, children: storageCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Alert, { severity: "info", sx: { mt: 2 }, children: [
|
|
40537
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", children: "No storage data found. This could mean:" }),
|
|
40538
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
|
|
40539
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "All databases are empty" }),
|
|
40540
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "Data is stored under different names" }),
|
|
40541
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: "There was an error accessing the databases" })
|
|
38990
40542
|
] }),
|
|
38991
|
-
/* @__PURE__ */ (0,
|
|
38992
|
-
] }) : /* @__PURE__ */ (0,
|
|
40543
|
+
/* @__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.' })
|
|
40544
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Stack, { spacing: 2, children: storageCategories.map((category) => {
|
|
38993
40545
|
const IconComponent = category.icon;
|
|
38994
40546
|
const categoryPercentage = storageQuota.quota > 0 ? category.size / storageQuota.quota * 100 : 0;
|
|
38995
40547
|
const categoryRelativePercentage = totalUsed > 0 ? category.size / totalUsed * 100 : 0;
|
|
@@ -39000,18 +40552,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39000
40552
|
categoryPercentage: categoryPercentage.toFixed(2),
|
|
39001
40553
|
categoryRelativePercentage: categoryRelativePercentage.toFixed(2)
|
|
39002
40554
|
});
|
|
39003
|
-
return /* @__PURE__ */ (0,
|
|
39004
|
-
/* @__PURE__ */ (0,
|
|
39005
|
-
|
|
40555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Accordion, { sx: { bgcolor: "background.paper" }, children: [
|
|
40556
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40557
|
+
import_material44.AccordionSummary,
|
|
39006
40558
|
{
|
|
39007
|
-
expandIcon: /* @__PURE__ */ (0,
|
|
40559
|
+
expandIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_ExpandMore3.default, {}),
|
|
39008
40560
|
"aria-controls": `${category.name}-content`,
|
|
39009
40561
|
id: `${category.name}-header`,
|
|
39010
|
-
children: /* @__PURE__ */ (0,
|
|
39011
|
-
/* @__PURE__ */ (0,
|
|
39012
|
-
/* @__PURE__ */ (0,
|
|
39013
|
-
/* @__PURE__ */ (0,
|
|
39014
|
-
|
|
40562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", width: "100%", pr: 2 }, children: [
|
|
40563
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(IconComponent, { sx: { color: category.color, mr: 2 } }),
|
|
40564
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { flex: 1 }, children: [
|
|
40565
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40566
|
+
import_material44.Typography,
|
|
39015
40567
|
{
|
|
39016
40568
|
variant: "body1",
|
|
39017
40569
|
style: {
|
|
@@ -39021,18 +40573,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39021
40573
|
children: category.name
|
|
39022
40574
|
}
|
|
39023
40575
|
),
|
|
39024
|
-
/* @__PURE__ */ (0,
|
|
39025
|
-
/* @__PURE__ */ (0,
|
|
39026
|
-
/* @__PURE__ */ (0,
|
|
39027
|
-
|
|
40576
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", gap: 2, mt: 0.5 }, children: [
|
|
40577
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", children: formatBytes(category.size) }),
|
|
40578
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40579
|
+
import_material44.Chip,
|
|
39028
40580
|
{
|
|
39029
40581
|
label: `${category.itemCount} items`,
|
|
39030
40582
|
size: "small",
|
|
39031
40583
|
variant: "outlined"
|
|
39032
40584
|
}
|
|
39033
40585
|
),
|
|
39034
|
-
/* @__PURE__ */ (0,
|
|
39035
|
-
|
|
40586
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Box, { sx: { flex: 1, mx: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40587
|
+
import_material44.LinearProgress,
|
|
39036
40588
|
{
|
|
39037
40589
|
variant: "determinate",
|
|
39038
40590
|
value: Math.min(categoryRelativePercentage, 100),
|
|
@@ -39047,7 +40599,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39047
40599
|
}
|
|
39048
40600
|
}
|
|
39049
40601
|
) }),
|
|
39050
|
-
/* @__PURE__ */ (0,
|
|
40602
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "caption", color: "text.secondary", children: [
|
|
39051
40603
|
categoryRelativePercentage.toFixed(1),
|
|
39052
40604
|
"%"
|
|
39053
40605
|
] })
|
|
@@ -39056,27 +40608,27 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39056
40608
|
] })
|
|
39057
40609
|
}
|
|
39058
40610
|
),
|
|
39059
|
-
/* @__PURE__ */ (0,
|
|
39060
|
-
/* @__PURE__ */ (0,
|
|
39061
|
-
/* @__PURE__ */ (0,
|
|
39062
|
-
/* @__PURE__ */ (0,
|
|
39063
|
-
/* @__PURE__ */ (0,
|
|
39064
|
-
/* @__PURE__ */ (0,
|
|
39065
|
-
|
|
40611
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.AccordionDetails, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { pl: 5 }, children: [
|
|
40612
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "body2", color: "text.secondary", paragraph: true, children: category.description }),
|
|
40613
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Typography, { variant: "subtitle2", gutterBottom: true, children: "Storage Locations:" }),
|
|
40614
|
+
/* @__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: [
|
|
40615
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Storage.default, { fontSize: "small" }) }),
|
|
40616
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40617
|
+
import_material44.ListItemText,
|
|
39066
40618
|
{
|
|
39067
40619
|
primary: store,
|
|
39068
40620
|
primaryTypographyProps: { variant: "body2", fontFamily: "monospace" }
|
|
39069
40621
|
}
|
|
39070
40622
|
)
|
|
39071
40623
|
] }, store)) }),
|
|
39072
|
-
category.canClear ? /* @__PURE__ */ (0,
|
|
39073
|
-
/* @__PURE__ */ (0,
|
|
39074
|
-
|
|
40624
|
+
category.canClear ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mt: 2, pt: 2, borderTop: 1, borderColor: "divider" }, children: [
|
|
40625
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40626
|
+
import_material44.Button,
|
|
39075
40627
|
{
|
|
39076
40628
|
variant: "outlined",
|
|
39077
40629
|
color: "error",
|
|
39078
40630
|
size: "small",
|
|
39079
|
-
startIcon: /* @__PURE__ */ (0,
|
|
40631
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, {}),
|
|
39080
40632
|
onClick: () => setClearCategoryDialog(category),
|
|
39081
40633
|
disabled: clearing,
|
|
39082
40634
|
children: [
|
|
@@ -39085,19 +40637,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39085
40637
|
]
|
|
39086
40638
|
}
|
|
39087
40639
|
),
|
|
39088
|
-
category.clearWarning && /* @__PURE__ */ (0,
|
|
39089
|
-
] }) : /* @__PURE__ */ (0,
|
|
40640
|
+
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 }) })
|
|
40641
|
+
] }) : /* @__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." }) })
|
|
39090
40642
|
] }) })
|
|
39091
40643
|
] }, category.name);
|
|
39092
40644
|
}) }) }),
|
|
39093
|
-
/* @__PURE__ */ (0,
|
|
39094
|
-
/* @__PURE__ */ (0,
|
|
39095
|
-
/* @__PURE__ */ (0,
|
|
40645
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Card, { sx: { mt: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.CardContent, { children: [
|
|
40646
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
40647
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Info2.default, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
39096
40648
|
"Storage Tips & Clear Options"
|
|
39097
40649
|
] }),
|
|
39098
|
-
/* @__PURE__ */ (0,
|
|
39099
|
-
/* @__PURE__ */ (0,
|
|
39100
|
-
/* @__PURE__ */ (0,
|
|
40650
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.List, { children: [
|
|
40651
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40652
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
39101
40653
|
import_CheckCircle3.default,
|
|
39102
40654
|
{
|
|
39103
40655
|
sx: {
|
|
@@ -39105,38 +40657,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39105
40657
|
}
|
|
39106
40658
|
}
|
|
39107
40659
|
) }),
|
|
39108
|
-
/* @__PURE__ */ (0,
|
|
39109
|
-
|
|
40660
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40661
|
+
import_material44.ListItemText,
|
|
39110
40662
|
{
|
|
39111
40663
|
primary: storageStatusPrimary,
|
|
39112
40664
|
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."
|
|
39113
40665
|
}
|
|
39114
40666
|
)
|
|
39115
40667
|
] }),
|
|
39116
|
-
/* @__PURE__ */ (0,
|
|
39117
|
-
/* @__PURE__ */ (0,
|
|
39118
|
-
/* @__PURE__ */ (0,
|
|
39119
|
-
|
|
40668
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40669
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, { color: "info" }) }),
|
|
40670
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40671
|
+
import_material44.ListItemText,
|
|
39120
40672
|
{
|
|
39121
40673
|
primary: "Clear All Data (Safe)",
|
|
39122
40674
|
secondary: "Deletes all items but keeps database structure intact. App continues working normally."
|
|
39123
40675
|
}
|
|
39124
40676
|
)
|
|
39125
40677
|
] }),
|
|
39126
|
-
/* @__PURE__ */ (0,
|
|
39127
|
-
/* @__PURE__ */ (0,
|
|
39128
|
-
/* @__PURE__ */ (0,
|
|
39129
|
-
|
|
40678
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40679
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, { color: "error" }) }),
|
|
40680
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40681
|
+
import_material44.ListItemText,
|
|
39130
40682
|
{
|
|
39131
40683
|
primary: "Nuclear Clear (Complete Reset)",
|
|
39132
40684
|
secondary: "Completely destroys all databases and forces app reload. Use only for complete reset."
|
|
39133
40685
|
}
|
|
39134
40686
|
)
|
|
39135
40687
|
] }),
|
|
39136
|
-
/* @__PURE__ */ (0,
|
|
39137
|
-
/* @__PURE__ */ (0,
|
|
39138
|
-
/* @__PURE__ */ (0,
|
|
39139
|
-
|
|
40688
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.ListItem, { children: [
|
|
40689
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Warning.default, { color: "warning" }) }),
|
|
40690
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40691
|
+
import_material44.ListItemText,
|
|
39140
40692
|
{
|
|
39141
40693
|
primary: "Backup important data",
|
|
39142
40694
|
secondary: "Export custom models and important documents before clearing storage"
|
|
@@ -39145,38 +40697,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39145
40697
|
] })
|
|
39146
40698
|
] })
|
|
39147
40699
|
] }) }),
|
|
39148
|
-
/* @__PURE__ */ (0,
|
|
39149
|
-
|
|
40700
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40701
|
+
import_material44.Dialog,
|
|
39150
40702
|
{
|
|
39151
40703
|
open: !!clearCategoryDialog,
|
|
39152
40704
|
onClose: () => setClearCategoryDialog(null),
|
|
39153
40705
|
maxWidth: "sm",
|
|
39154
40706
|
fullWidth: true,
|
|
39155
40707
|
children: [
|
|
39156
|
-
/* @__PURE__ */ (0,
|
|
39157
|
-
/* @__PURE__ */ (0,
|
|
40708
|
+
/* @__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: [
|
|
40709
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Warning.default, { color: "warning" }),
|
|
39158
40710
|
"Clear ",
|
|
39159
40711
|
clearCategoryDialog?.name,
|
|
39160
40712
|
"?"
|
|
39161
40713
|
] }) }),
|
|
39162
|
-
/* @__PURE__ */ (0,
|
|
39163
|
-
/* @__PURE__ */ (0,
|
|
40714
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContent, { children: [
|
|
40715
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContentText, { children: [
|
|
39164
40716
|
'This will permanently delete all data in the "',
|
|
39165
40717
|
clearCategoryDialog?.name,
|
|
39166
40718
|
'" category.'
|
|
39167
40719
|
] }),
|
|
39168
|
-
clearCategoryDialog?.clearWarning && /* @__PURE__ */ (0,
|
|
39169
|
-
clearCategoryDialog && /* @__PURE__ */ (0,
|
|
39170
|
-
/* @__PURE__ */ (0,
|
|
39171
|
-
/* @__PURE__ */ (0,
|
|
40720
|
+
clearCategoryDialog?.clearWarning && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.Alert, { severity: "warning", sx: { mt: 2 }, children: clearCategoryDialog.clearWarning }),
|
|
40721
|
+
clearCategoryDialog && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { mt: 2, p: 2, bgcolor: "action.hover", borderRadius: 1 }, children: [
|
|
40722
|
+
/* @__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:" }) }),
|
|
40723
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Typography, { variant: "body2", sx: { fontFamily: "monospace", mt: 1 }, children: [
|
|
39172
40724
|
"\u2022 ",
|
|
39173
40725
|
clearCategoryDialog.itemCount,
|
|
39174
40726
|
" items",
|
|
39175
|
-
/* @__PURE__ */ (0,
|
|
40727
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("br", {}),
|
|
39176
40728
|
"\u2022 ",
|
|
39177
40729
|
formatBytes(clearCategoryDialog.size),
|
|
39178
40730
|
" of data",
|
|
39179
|
-
/* @__PURE__ */ (0,
|
|
40731
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("br", {}),
|
|
39180
40732
|
"\u2022 ",
|
|
39181
40733
|
clearCategoryDialog.stores.length,
|
|
39182
40734
|
" storage location",
|
|
@@ -39184,22 +40736,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39184
40736
|
] })
|
|
39185
40737
|
] })
|
|
39186
40738
|
] }),
|
|
39187
|
-
/* @__PURE__ */ (0,
|
|
39188
|
-
/* @__PURE__ */ (0,
|
|
39189
|
-
|
|
40739
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogActions, { children: [
|
|
40740
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40741
|
+
import_material44.Button,
|
|
39190
40742
|
{
|
|
39191
40743
|
onClick: () => setClearCategoryDialog(null),
|
|
39192
40744
|
disabled: clearing,
|
|
39193
40745
|
children: "Cancel"
|
|
39194
40746
|
}
|
|
39195
40747
|
),
|
|
39196
|
-
/* @__PURE__ */ (0,
|
|
39197
|
-
|
|
40748
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40749
|
+
import_material44.Button,
|
|
39198
40750
|
{
|
|
39199
40751
|
onClick: () => clearCategoryDialog && handleClearCategory(clearCategoryDialog),
|
|
39200
40752
|
color: "error",
|
|
39201
40753
|
variant: "contained",
|
|
39202
|
-
startIcon: clearing ? /* @__PURE__ */ (0,
|
|
40754
|
+
startIcon: clearing ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Delete7.default, {}),
|
|
39203
40755
|
disabled: clearing,
|
|
39204
40756
|
children: clearing ? "Clearing..." : "Clear Data"
|
|
39205
40757
|
}
|
|
@@ -39208,51 +40760,51 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39208
40760
|
]
|
|
39209
40761
|
}
|
|
39210
40762
|
),
|
|
39211
|
-
/* @__PURE__ */ (0,
|
|
39212
|
-
|
|
40763
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
40764
|
+
import_material44.Dialog,
|
|
39213
40765
|
{
|
|
39214
40766
|
open: clearAllDialogOpen,
|
|
39215
40767
|
onClose: () => setClearAllDialogOpen(false),
|
|
39216
40768
|
maxWidth: "sm",
|
|
39217
40769
|
fullWidth: true,
|
|
39218
40770
|
children: [
|
|
39219
|
-
/* @__PURE__ */ (0,
|
|
39220
|
-
/* @__PURE__ */ (0,
|
|
40771
|
+
/* @__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: [
|
|
40772
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Error3.default, { color: "error" }),
|
|
39221
40773
|
"Clear All Storage Data?"
|
|
39222
40774
|
] }) }),
|
|
39223
|
-
/* @__PURE__ */ (0,
|
|
39224
|
-
/* @__PURE__ */ (0,
|
|
39225
|
-
/* @__PURE__ */ (0,
|
|
39226
|
-
/* @__PURE__ */ (0,
|
|
39227
|
-
/* @__PURE__ */ (0,
|
|
39228
|
-
|
|
40775
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogContent, { children: [
|
|
40776
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.DialogContentText, { children: "This will permanently delete ALL your local data including:" }),
|
|
40777
|
+
/* @__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: [
|
|
40778
|
+
/* @__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 } }) }),
|
|
40779
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40780
|
+
import_material44.ListItemText,
|
|
39229
40781
|
{
|
|
39230
40782
|
primary: category.name,
|
|
39231
40783
|
secondary: `${category.itemCount} items \u2022 ${formatBytes(category.size)}`
|
|
39232
40784
|
}
|
|
39233
40785
|
)
|
|
39234
40786
|
] }, category.name)) }),
|
|
39235
|
-
/* @__PURE__ */ (0,
|
|
39236
|
-
/* @__PURE__ */ (0,
|
|
40787
|
+
/* @__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: [
|
|
40788
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: "This action cannot be undone!" }),
|
|
39237
40789
|
" Make sure to export any important data before proceeding."
|
|
39238
40790
|
] }) })
|
|
39239
40791
|
] }),
|
|
39240
|
-
/* @__PURE__ */ (0,
|
|
39241
|
-
/* @__PURE__ */ (0,
|
|
39242
|
-
|
|
40792
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.DialogActions, { children: [
|
|
40793
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40794
|
+
import_material44.Button,
|
|
39243
40795
|
{
|
|
39244
40796
|
onClick: () => setClearAllDialogOpen(false),
|
|
39245
40797
|
disabled: clearing,
|
|
39246
40798
|
children: "Cancel"
|
|
39247
40799
|
}
|
|
39248
40800
|
),
|
|
39249
|
-
/* @__PURE__ */ (0,
|
|
39250
|
-
|
|
40801
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40802
|
+
import_material44.Button,
|
|
39251
40803
|
{
|
|
39252
40804
|
onClick: handleClearAll,
|
|
39253
40805
|
color: "error",
|
|
39254
40806
|
variant: "contained",
|
|
39255
|
-
startIcon: clearing ? /* @__PURE__ */ (0,
|
|
40807
|
+
startIcon: clearing ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_material44.CircularProgress, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_CleaningServices.default, {}),
|
|
39256
40808
|
disabled: clearing,
|
|
39257
40809
|
children: clearing ? "Clearing All..." : "Clear All Data"
|
|
39258
40810
|
}
|
|
@@ -39261,15 +40813,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39261
40813
|
]
|
|
39262
40814
|
}
|
|
39263
40815
|
),
|
|
39264
|
-
/* @__PURE__ */ (0,
|
|
39265
|
-
|
|
40816
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40817
|
+
import_material44.Snackbar,
|
|
39266
40818
|
{
|
|
39267
40819
|
open: showSnackbar,
|
|
39268
40820
|
autoHideDuration: 4e3,
|
|
39269
40821
|
onClose: () => setShowSnackbar(false),
|
|
39270
40822
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
39271
|
-
children: /* @__PURE__ */ (0,
|
|
39272
|
-
|
|
40823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
40824
|
+
import_material44.Alert,
|
|
39273
40825
|
{
|
|
39274
40826
|
onClose: () => setShowSnackbar(false),
|
|
39275
40827
|
severity: snackbarSeverity,
|
|
@@ -39285,21 +40837,21 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
39285
40837
|
var StorageTab_default = StorageTab;
|
|
39286
40838
|
|
|
39287
40839
|
// src/management/components/ProviderTab.tsx
|
|
39288
|
-
var
|
|
39289
|
-
var
|
|
40840
|
+
var import_react55 = require("react");
|
|
40841
|
+
var import_material45 = require("@mui/material");
|
|
39290
40842
|
init_aiProviderStore();
|
|
39291
40843
|
init_packageSettingsStore();
|
|
39292
40844
|
init_common_types();
|
|
39293
40845
|
init_ai_provider_factory();
|
|
39294
40846
|
init_debugLogger();
|
|
39295
40847
|
init_indexedDBService();
|
|
39296
|
-
var
|
|
40848
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
39297
40849
|
var ProviderTab = () => {
|
|
39298
40850
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
39299
40851
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
39300
|
-
const theme = (0,
|
|
39301
|
-
const isMobile = (0,
|
|
39302
|
-
const getSuggestedModel = (0,
|
|
40852
|
+
const theme = (0, import_material45.useTheme)();
|
|
40853
|
+
const isMobile = (0, import_material45.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
40854
|
+
const getSuggestedModel = (0, import_react55.useCallback)((type) => {
|
|
39303
40855
|
const configuredDefault = packageSettings?.defaultModel?.trim();
|
|
39304
40856
|
if (configuredDefault) {
|
|
39305
40857
|
return configuredDefault;
|
|
@@ -39315,7 +40867,7 @@ var ProviderTab = () => {
|
|
|
39315
40867
|
return "";
|
|
39316
40868
|
}
|
|
39317
40869
|
}, [packageSettings?.defaultModel]);
|
|
39318
|
-
const applyDefaultModel = (0,
|
|
40870
|
+
const applyDefaultModel = (0, import_react55.useCallback)((config) => {
|
|
39319
40871
|
const normalized = { ...config };
|
|
39320
40872
|
const trimmed = typeof normalized.defaultModel === "string" ? normalized.defaultModel.trim() : void 0;
|
|
39321
40873
|
const requiresModel = normalized.type === "openai" /* OPENAI */ || normalized.type === "xai" /* XAI */ || normalized.type === "bandit" /* BANDIT */;
|
|
@@ -39335,7 +40887,7 @@ var ProviderTab = () => {
|
|
|
39335
40887
|
}
|
|
39336
40888
|
return normalized;
|
|
39337
40889
|
}, [getSuggestedModel]);
|
|
39338
|
-
const sanitizeConfigForSave = (0,
|
|
40890
|
+
const sanitizeConfigForSave = (0, import_react55.useCallback)((config) => {
|
|
39339
40891
|
const sanitized = { ...config };
|
|
39340
40892
|
if (typeof sanitized.defaultModel === "string") {
|
|
39341
40893
|
const trimmed = sanitized.defaultModel.trim();
|
|
@@ -39347,15 +40899,15 @@ var ProviderTab = () => {
|
|
|
39347
40899
|
}
|
|
39348
40900
|
return sanitized;
|
|
39349
40901
|
}, []);
|
|
39350
|
-
const [providerConfig, setProviderConfig] = (0,
|
|
40902
|
+
const [providerConfig, setProviderConfig] = (0, import_react55.useState)({
|
|
39351
40903
|
type: "gateway",
|
|
39352
40904
|
gatewayUrl: packageSettings?.gatewayApiUrl || "",
|
|
39353
40905
|
provider: "bandit"
|
|
39354
40906
|
});
|
|
39355
|
-
const [isProviderConfigOpen, setIsProviderConfigOpen] = (0,
|
|
39356
|
-
const [snackbarMessage, setSnackbarMessage] = (0,
|
|
39357
|
-
const [showSnackbar, setShowSnackbar] = (0,
|
|
39358
|
-
const [snackbarSeverity, setSnackbarSeverity] = (0,
|
|
40907
|
+
const [isProviderConfigOpen, setIsProviderConfigOpen] = (0, import_react55.useState)(false);
|
|
40908
|
+
const [snackbarMessage, setSnackbarMessage] = (0, import_react55.useState)("");
|
|
40909
|
+
const [showSnackbar, setShowSnackbar] = (0, import_react55.useState)(false);
|
|
40910
|
+
const [snackbarSeverity, setSnackbarSeverity] = (0, import_react55.useState)("success");
|
|
39359
40911
|
const saveProviderConfigToDB = async (config) => {
|
|
39360
40912
|
try {
|
|
39361
40913
|
const { tokenFactory: _tokenFactory, ...persistableConfig } = config;
|
|
@@ -39396,7 +40948,7 @@ var ProviderTab = () => {
|
|
|
39396
40948
|
}
|
|
39397
40949
|
return null;
|
|
39398
40950
|
};
|
|
39399
|
-
const convertAnthropicConfig = (0,
|
|
40951
|
+
const convertAnthropicConfig = (0, import_react55.useCallback)((config) => {
|
|
39400
40952
|
if (!config) return null;
|
|
39401
40953
|
if (config.type !== "anthropic" /* ANTHROPIC */) {
|
|
39402
40954
|
return config;
|
|
@@ -39412,7 +40964,7 @@ var ProviderTab = () => {
|
|
|
39412
40964
|
};
|
|
39413
40965
|
return converted;
|
|
39414
40966
|
}, [packageSettings?.gatewayApiUrl]);
|
|
39415
|
-
(0,
|
|
40967
|
+
(0, import_react55.useEffect)(() => {
|
|
39416
40968
|
const initializeProviderConfig = async () => {
|
|
39417
40969
|
const savedConfig = await loadProviderConfigFromDB();
|
|
39418
40970
|
if (savedConfig) {
|
|
@@ -39547,18 +41099,18 @@ var ProviderTab = () => {
|
|
|
39547
41099
|
showMessage("Connection test failed. Please check your configuration.", "error");
|
|
39548
41100
|
}
|
|
39549
41101
|
};
|
|
39550
|
-
return /* @__PURE__ */ (0,
|
|
39551
|
-
/* @__PURE__ */ (0,
|
|
39552
|
-
/* @__PURE__ */ (0,
|
|
39553
|
-
|
|
41102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
41103
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
41104
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41105
|
+
import_material45.Typography,
|
|
39554
41106
|
{
|
|
39555
41107
|
variant: "h5",
|
|
39556
41108
|
sx: { fontWeight: 600, mb: 1, color: "primary.main", fontSize: { xs: "1.6rem", md: "1.8rem" } },
|
|
39557
41109
|
children: "AI Provider Configuration"
|
|
39558
41110
|
}
|
|
39559
41111
|
),
|
|
39560
|
-
/* @__PURE__ */ (0,
|
|
39561
|
-
|
|
41112
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41113
|
+
import_material45.Typography,
|
|
39562
41114
|
{
|
|
39563
41115
|
variant: "body1",
|
|
39564
41116
|
color: "text.secondary",
|
|
@@ -39567,23 +41119,23 @@ var ProviderTab = () => {
|
|
|
39567
41119
|
children: "Configure your AI provider for chat, generation, and model services. This determines which backend service powers your AI interactions."
|
|
39568
41120
|
}
|
|
39569
41121
|
),
|
|
39570
|
-
/* @__PURE__ */ (0,
|
|
39571
|
-
/* @__PURE__ */ (0,
|
|
39572
|
-
currentProvider ? /* @__PURE__ */ (0,
|
|
39573
|
-
/* @__PURE__ */ (0,
|
|
39574
|
-
|
|
41122
|
+
/* @__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: [
|
|
41123
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "h6", sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Current Provider" }),
|
|
41124
|
+
currentProvider ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
41125
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41126
|
+
import_material45.Chip,
|
|
39575
41127
|
{
|
|
39576
41128
|
label: currentProvider.getProviderType().toUpperCase(),
|
|
39577
41129
|
color: "primary",
|
|
39578
41130
|
variant: "filled"
|
|
39579
41131
|
}
|
|
39580
41132
|
),
|
|
39581
|
-
/* @__PURE__ */ (0,
|
|
39582
|
-
] }) : /* @__PURE__ */ (0,
|
|
41133
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "body2", color: "text.secondary", children: currentProviderConfig?.baseUrl || currentProviderConfig?.gatewayUrl || "No URL configured" })
|
|
41134
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Chip, { label: "No Provider Configured", color: "warning" })
|
|
39583
41135
|
] }),
|
|
39584
|
-
/* @__PURE__ */ (0,
|
|
39585
|
-
/* @__PURE__ */ (0,
|
|
39586
|
-
|
|
41136
|
+
/* @__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: [
|
|
41137
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41138
|
+
import_material45.Box,
|
|
39587
41139
|
{
|
|
39588
41140
|
sx: {
|
|
39589
41141
|
display: "flex",
|
|
@@ -39594,9 +41146,9 @@ var ProviderTab = () => {
|
|
|
39594
41146
|
mb: 3
|
|
39595
41147
|
},
|
|
39596
41148
|
children: [
|
|
39597
|
-
/* @__PURE__ */ (0,
|
|
39598
|
-
/* @__PURE__ */ (0,
|
|
39599
|
-
|
|
41149
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
|
|
41150
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41151
|
+
import_material45.Button,
|
|
39600
41152
|
{
|
|
39601
41153
|
variant: "outlined",
|
|
39602
41154
|
onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
|
|
@@ -39610,9 +41162,9 @@ var ProviderTab = () => {
|
|
|
39610
41162
|
]
|
|
39611
41163
|
}
|
|
39612
41164
|
),
|
|
39613
|
-
isProviderConfigOpen && /* @__PURE__ */ (0,
|
|
39614
|
-
/* @__PURE__ */ (0,
|
|
39615
|
-
|
|
41165
|
+
isProviderConfigOpen && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { mt: 3 }, children: [
|
|
41166
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41167
|
+
import_material45.TextField,
|
|
39616
41168
|
{
|
|
39617
41169
|
label: "Provider Type",
|
|
39618
41170
|
select: true,
|
|
@@ -39621,19 +41173,19 @@ var ProviderTab = () => {
|
|
|
39621
41173
|
fullWidth: true,
|
|
39622
41174
|
sx: { mb: 3 },
|
|
39623
41175
|
children: [
|
|
39624
|
-
/* @__PURE__ */ (0,
|
|
39625
|
-
/* @__PURE__ */ (0,
|
|
39626
|
-
/* @__PURE__ */ (0,
|
|
39627
|
-
/* @__PURE__ */ (0,
|
|
39628
|
-
/* @__PURE__ */ (0,
|
|
39629
|
-
/* @__PURE__ */ (0,
|
|
39630
|
-
/* @__PURE__ */ (0,
|
|
41176
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "gateway", children: "Gateway (Recommended)" }),
|
|
41177
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
41178
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
41179
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
41180
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "bandit", children: "Bandit AI" }),
|
|
41181
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "xai", children: "xAI" }),
|
|
41182
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "playground", children: "Playground (Mock Demo)" })
|
|
39631
41183
|
]
|
|
39632
41184
|
}
|
|
39633
41185
|
),
|
|
39634
|
-
providerConfig.type === "gateway" && /* @__PURE__ */ (0,
|
|
39635
|
-
/* @__PURE__ */ (0,
|
|
39636
|
-
|
|
41186
|
+
providerConfig.type === "gateway" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41187
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41188
|
+
import_material45.TextField,
|
|
39637
41189
|
{
|
|
39638
41190
|
label: "Gateway URL",
|
|
39639
41191
|
value: providerConfig.gatewayUrl || "",
|
|
@@ -39643,8 +41195,8 @@ var ProviderTab = () => {
|
|
|
39643
41195
|
placeholder: "https://your-gateway-api.com"
|
|
39644
41196
|
}
|
|
39645
41197
|
),
|
|
39646
|
-
/* @__PURE__ */ (0,
|
|
39647
|
-
|
|
41198
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
41199
|
+
import_material45.TextField,
|
|
39648
41200
|
{
|
|
39649
41201
|
label: "Backend Provider",
|
|
39650
41202
|
select: true,
|
|
@@ -39656,18 +41208,18 @@ var ProviderTab = () => {
|
|
|
39656
41208
|
fullWidth: true,
|
|
39657
41209
|
sx: { mb: 2 },
|
|
39658
41210
|
children: [
|
|
39659
|
-
/* @__PURE__ */ (0,
|
|
39660
|
-
/* @__PURE__ */ (0,
|
|
39661
|
-
/* @__PURE__ */ (0,
|
|
39662
|
-
/* @__PURE__ */ (0,
|
|
39663
|
-
/* @__PURE__ */ (0,
|
|
39664
|
-
/* @__PURE__ */ (0,
|
|
41211
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
41212
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
41213
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
41214
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
41215
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "bandit", children: "Bandit AI" }),
|
|
41216
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_material45.MenuItem, { value: "xai", children: "xAI" })
|
|
39665
41217
|
]
|
|
39666
41218
|
}
|
|
39667
41219
|
)
|
|
39668
41220
|
] }),
|
|
39669
|
-
providerConfig.type === "ollama" && /* @__PURE__ */ (0,
|
|
39670
|
-
|
|
41221
|
+
providerConfig.type === "ollama" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41222
|
+
import_material45.TextField,
|
|
39671
41223
|
{
|
|
39672
41224
|
label: "Ollama URL",
|
|
39673
41225
|
value: providerConfig.baseUrl || "",
|
|
@@ -39676,9 +41228,9 @@ var ProviderTab = () => {
|
|
|
39676
41228
|
placeholder: "http://localhost:11434"
|
|
39677
41229
|
}
|
|
39678
41230
|
),
|
|
39679
|
-
providerConfig.type === "bandit" && /* @__PURE__ */ (0,
|
|
39680
|
-
/* @__PURE__ */ (0,
|
|
39681
|
-
|
|
41231
|
+
providerConfig.type === "bandit" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41232
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41233
|
+
import_material45.TextField,
|
|
39682
41234
|
{
|
|
39683
41235
|
label: "API Base URL",
|
|
39684
41236
|
value: providerConfig.baseUrl || "",
|
|
@@ -39692,8 +41244,8 @@ var ProviderTab = () => {
|
|
|
39692
41244
|
helperText: "Defaults to https://api.burtson.ai"
|
|
39693
41245
|
}
|
|
39694
41246
|
),
|
|
39695
|
-
/* @__PURE__ */ (0,
|
|
39696
|
-
|
|
41247
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41248
|
+
import_material45.TextField,
|
|
39697
41249
|
{
|
|
39698
41250
|
label: "API Key",
|
|
39699
41251
|
type: "password",
|
|
@@ -39707,8 +41259,8 @@ var ProviderTab = () => {
|
|
|
39707
41259
|
placeholder: "bai_..."
|
|
39708
41260
|
}
|
|
39709
41261
|
),
|
|
39710
|
-
/* @__PURE__ */ (0,
|
|
39711
|
-
|
|
41262
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41263
|
+
import_material45.TextField,
|
|
39712
41264
|
{
|
|
39713
41265
|
label: "Default Model ID",
|
|
39714
41266
|
value: providerConfig.defaultModel || "",
|
|
@@ -39722,9 +41274,9 @@ var ProviderTab = () => {
|
|
|
39722
41274
|
}
|
|
39723
41275
|
)
|
|
39724
41276
|
] }),
|
|
39725
|
-
providerConfig.type === "openai" && /* @__PURE__ */ (0,
|
|
39726
|
-
/* @__PURE__ */ (0,
|
|
39727
|
-
|
|
41277
|
+
providerConfig.type === "openai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41278
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41279
|
+
import_material45.TextField,
|
|
39728
41280
|
{
|
|
39729
41281
|
label: "API Base URL",
|
|
39730
41282
|
value: providerConfig.baseUrl || "",
|
|
@@ -39737,8 +41289,8 @@ var ProviderTab = () => {
|
|
|
39737
41289
|
placeholder: "https://api.openai.com/v1"
|
|
39738
41290
|
}
|
|
39739
41291
|
),
|
|
39740
|
-
/* @__PURE__ */ (0,
|
|
39741
|
-
|
|
41292
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41293
|
+
import_material45.TextField,
|
|
39742
41294
|
{
|
|
39743
41295
|
label: "API Key",
|
|
39744
41296
|
type: "password",
|
|
@@ -39752,8 +41304,8 @@ var ProviderTab = () => {
|
|
|
39752
41304
|
placeholder: "sk-..."
|
|
39753
41305
|
}
|
|
39754
41306
|
),
|
|
39755
|
-
/* @__PURE__ */ (0,
|
|
39756
|
-
|
|
41307
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41308
|
+
import_material45.TextField,
|
|
39757
41309
|
{
|
|
39758
41310
|
label: "Default Model ID",
|
|
39759
41311
|
value: providerConfig.defaultModel || "",
|
|
@@ -39767,9 +41319,9 @@ var ProviderTab = () => {
|
|
|
39767
41319
|
}
|
|
39768
41320
|
)
|
|
39769
41321
|
] }),
|
|
39770
|
-
providerConfig.type === "azure-openai" && /* @__PURE__ */ (0,
|
|
39771
|
-
/* @__PURE__ */ (0,
|
|
39772
|
-
|
|
41322
|
+
providerConfig.type === "azure-openai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41323
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41324
|
+
import_material45.TextField,
|
|
39773
41325
|
{
|
|
39774
41326
|
label: "Azure Endpoint",
|
|
39775
41327
|
value: providerConfig.baseUrl || "",
|
|
@@ -39779,8 +41331,8 @@ var ProviderTab = () => {
|
|
|
39779
41331
|
placeholder: "https://your-resource.openai.azure.com"
|
|
39780
41332
|
}
|
|
39781
41333
|
),
|
|
39782
|
-
/* @__PURE__ */ (0,
|
|
39783
|
-
|
|
41334
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41335
|
+
import_material45.TextField,
|
|
39784
41336
|
{
|
|
39785
41337
|
label: "API Key",
|
|
39786
41338
|
type: "password",
|
|
@@ -39790,8 +41342,8 @@ var ProviderTab = () => {
|
|
|
39790
41342
|
sx: { mb: 2 }
|
|
39791
41343
|
}
|
|
39792
41344
|
),
|
|
39793
|
-
/* @__PURE__ */ (0,
|
|
39794
|
-
|
|
41345
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41346
|
+
import_material45.TextField,
|
|
39795
41347
|
{
|
|
39796
41348
|
label: "API Version",
|
|
39797
41349
|
value: providerConfig.apiVersion || "",
|
|
@@ -39801,8 +41353,8 @@ var ProviderTab = () => {
|
|
|
39801
41353
|
placeholder: "2024-02-01"
|
|
39802
41354
|
}
|
|
39803
41355
|
),
|
|
39804
|
-
/* @__PURE__ */ (0,
|
|
39805
|
-
|
|
41356
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41357
|
+
import_material45.TextField,
|
|
39806
41358
|
{
|
|
39807
41359
|
label: "Deployment Name",
|
|
39808
41360
|
value: providerConfig.deploymentName || "",
|
|
@@ -39812,9 +41364,9 @@ var ProviderTab = () => {
|
|
|
39812
41364
|
}
|
|
39813
41365
|
)
|
|
39814
41366
|
] }),
|
|
39815
|
-
providerConfig.type === "xai" && /* @__PURE__ */ (0,
|
|
39816
|
-
/* @__PURE__ */ (0,
|
|
39817
|
-
|
|
41367
|
+
providerConfig.type === "xai" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { children: [
|
|
41368
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41369
|
+
import_material45.TextField,
|
|
39818
41370
|
{
|
|
39819
41371
|
label: "API Base URL",
|
|
39820
41372
|
value: providerConfig.baseUrl || "",
|
|
@@ -39827,8 +41379,8 @@ var ProviderTab = () => {
|
|
|
39827
41379
|
placeholder: "https://api.x.ai/v1"
|
|
39828
41380
|
}
|
|
39829
41381
|
),
|
|
39830
|
-
/* @__PURE__ */ (0,
|
|
39831
|
-
|
|
41382
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41383
|
+
import_material45.TextField,
|
|
39832
41384
|
{
|
|
39833
41385
|
label: "API Key",
|
|
39834
41386
|
type: "password",
|
|
@@ -39842,8 +41394,8 @@ var ProviderTab = () => {
|
|
|
39842
41394
|
placeholder: "xai-..."
|
|
39843
41395
|
}
|
|
39844
41396
|
),
|
|
39845
|
-
/* @__PURE__ */ (0,
|
|
39846
|
-
|
|
41397
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41398
|
+
import_material45.TextField,
|
|
39847
41399
|
{
|
|
39848
41400
|
label: "Default Model ID",
|
|
39849
41401
|
value: providerConfig.defaultModel || "",
|
|
@@ -39857,10 +41409,10 @@ var ProviderTab = () => {
|
|
|
39857
41409
|
}
|
|
39858
41410
|
)
|
|
39859
41411
|
] }),
|
|
39860
|
-
providerConfig.type === "anthropic" && /* @__PURE__ */ (0,
|
|
39861
|
-
/* @__PURE__ */ (0,
|
|
39862
|
-
/* @__PURE__ */ (0,
|
|
39863
|
-
|
|
41412
|
+
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." }),
|
|
41413
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Box, { sx: { display: "flex", gap: 2, mt: 3 }, children: [
|
|
41414
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41415
|
+
import_material45.Button,
|
|
39864
41416
|
{
|
|
39865
41417
|
variant: "outlined",
|
|
39866
41418
|
onClick: handleTestProviderConnection,
|
|
@@ -39868,8 +41420,8 @@ var ProviderTab = () => {
|
|
|
39868
41420
|
children: "Test Connection"
|
|
39869
41421
|
}
|
|
39870
41422
|
),
|
|
39871
|
-
/* @__PURE__ */ (0,
|
|
39872
|
-
|
|
41423
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41424
|
+
import_material45.Button,
|
|
39873
41425
|
{
|
|
39874
41426
|
variant: "contained",
|
|
39875
41427
|
onClick: handleSaveProviderConfig,
|
|
@@ -39880,20 +41432,20 @@ var ProviderTab = () => {
|
|
|
39880
41432
|
] })
|
|
39881
41433
|
] })
|
|
39882
41434
|
] }),
|
|
39883
|
-
/* @__PURE__ */ (0,
|
|
39884
|
-
/* @__PURE__ */ (0,
|
|
39885
|
-
/* @__PURE__ */ (0,
|
|
41435
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_material45.Paper, { sx: { p: 3, bgcolor: "info.main", color: "info.contrastText", borderRadius: 2 }, children: [
|
|
41436
|
+
/* @__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" }),
|
|
41437
|
+
/* @__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." })
|
|
39886
41438
|
] })
|
|
39887
41439
|
] }),
|
|
39888
|
-
/* @__PURE__ */ (0,
|
|
39889
|
-
|
|
41440
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41441
|
+
import_material45.Snackbar,
|
|
39890
41442
|
{
|
|
39891
41443
|
open: showSnackbar,
|
|
39892
41444
|
autoHideDuration: 6e3,
|
|
39893
41445
|
onClose: () => setShowSnackbar(false),
|
|
39894
41446
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
39895
|
-
children: /* @__PURE__ */ (0,
|
|
39896
|
-
|
|
41447
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
41448
|
+
import_material45.Alert,
|
|
39897
41449
|
{
|
|
39898
41450
|
onClose: () => setShowSnackbar(false),
|
|
39899
41451
|
severity: snackbarSeverity,
|
|
@@ -39908,9 +41460,9 @@ var ProviderTab = () => {
|
|
|
39908
41460
|
};
|
|
39909
41461
|
|
|
39910
41462
|
// src/management/components/MCPToolsTabV2.tsx
|
|
39911
|
-
var
|
|
39912
|
-
var
|
|
39913
|
-
var
|
|
41463
|
+
var import_react56 = require("react");
|
|
41464
|
+
var import_material46 = require("@mui/material");
|
|
41465
|
+
var import_Refresh5 = __toESM(require("@mui/icons-material/Refresh"));
|
|
39914
41466
|
var import_HealthAndSafety = __toESM(require("@mui/icons-material/HealthAndSafety"));
|
|
39915
41467
|
var import_ErrorOutline3 = __toESM(require("@mui/icons-material/ErrorOutline"));
|
|
39916
41468
|
var import_Settings3 = __toESM(require("@mui/icons-material/Settings"));
|
|
@@ -39927,7 +41479,7 @@ var isPlaygroundMode2 = () => {
|
|
|
39927
41479
|
const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
|
|
39928
41480
|
return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
|
|
39929
41481
|
};
|
|
39930
|
-
function
|
|
41482
|
+
function buildUrl3(path) {
|
|
39931
41483
|
if (isPlaygroundMode2()) {
|
|
39932
41484
|
debugLogger.info("MCP controller URL build skipped in playground mode", { path });
|
|
39933
41485
|
return path.startsWith("/") ? path : `/${path}`;
|
|
@@ -39950,7 +41502,7 @@ async function fetchAvailableMcpTools() {
|
|
|
39950
41502
|
debugLogger.info("Skipping remote MCP tool fetch \u2014 playground mode active");
|
|
39951
41503
|
return [];
|
|
39952
41504
|
}
|
|
39953
|
-
const url =
|
|
41505
|
+
const url = buildUrl3("/mcp/tools");
|
|
39954
41506
|
try {
|
|
39955
41507
|
const res = await fetch(url, { headers: authHeaders() });
|
|
39956
41508
|
const data = await res.json();
|
|
@@ -39974,7 +41526,7 @@ async function fetchMcpHealth() {
|
|
|
39974
41526
|
availableTools: []
|
|
39975
41527
|
};
|
|
39976
41528
|
}
|
|
39977
|
-
const url =
|
|
41529
|
+
const url = buildUrl3("/mcp/health");
|
|
39978
41530
|
try {
|
|
39979
41531
|
const res = await fetch(url, { headers: authHeaders() });
|
|
39980
41532
|
const data = await res.json();
|
|
@@ -39991,14 +41543,14 @@ async function fetchMcpHealth() {
|
|
|
39991
41543
|
// src/management/components/MCPToolsTabV2.tsx
|
|
39992
41544
|
init_mcpToolsStore();
|
|
39993
41545
|
init_packageSettingsStore();
|
|
39994
|
-
var
|
|
41546
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
39995
41547
|
var MCPToolsTabV2 = () => {
|
|
39996
41548
|
const { settings } = usePackageSettingsStore();
|
|
39997
41549
|
const { tools: localTools, loadTools, toggleTool, addTool, updateTool, isLoaded } = useMCPToolsStore();
|
|
39998
|
-
const [loading, setLoading] = (0,
|
|
39999
|
-
const [error, setError] = (0,
|
|
40000
|
-
const [tools, setTools] = (0,
|
|
40001
|
-
const [health, setHealth] = (0,
|
|
41550
|
+
const [loading, setLoading] = (0, import_react56.useState)(true);
|
|
41551
|
+
const [error, setError] = (0, import_react56.useState)(null);
|
|
41552
|
+
const [tools, setTools] = (0, import_react56.useState)([]);
|
|
41553
|
+
const [health, setHealth] = (0, import_react56.useState)(null);
|
|
40002
41554
|
const gatewayConfigured = !!settings?.gatewayApiUrl;
|
|
40003
41555
|
const refresh = async () => {
|
|
40004
41556
|
setLoading(true);
|
|
@@ -40052,7 +41604,7 @@ var MCPToolsTabV2 = () => {
|
|
|
40052
41604
|
setLoading(false);
|
|
40053
41605
|
}
|
|
40054
41606
|
};
|
|
40055
|
-
(0,
|
|
41607
|
+
(0, import_react56.useEffect)(() => {
|
|
40056
41608
|
if (isLoaded) {
|
|
40057
41609
|
refresh();
|
|
40058
41610
|
} else {
|
|
@@ -40061,7 +41613,7 @@ var MCPToolsTabV2 = () => {
|
|
|
40061
41613
|
});
|
|
40062
41614
|
}
|
|
40063
41615
|
}, [isLoaded]);
|
|
40064
|
-
const localEnabledMap = (0,
|
|
41616
|
+
const localEnabledMap = (0, import_react56.useMemo)(() => {
|
|
40065
41617
|
const map23 = /* @__PURE__ */ new Map();
|
|
40066
41618
|
const sortedTools = [...localTools].sort((a, b) => {
|
|
40067
41619
|
if (a.isBuiltIn && !b.isBuiltIn) return -1;
|
|
@@ -40077,17 +41629,17 @@ var MCPToolsTabV2 = () => {
|
|
|
40077
41629
|
});
|
|
40078
41630
|
return map23;
|
|
40079
41631
|
}, [localTools]);
|
|
40080
|
-
return /* @__PURE__ */ (0,
|
|
40081
|
-
/* @__PURE__ */ (0,
|
|
40082
|
-
/* @__PURE__ */ (0,
|
|
40083
|
-
/* @__PURE__ */ (0,
|
|
41632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { children: [
|
|
41633
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
41634
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "h5", sx: { fontWeight: 600, color: "primary.main" }, children: "Available Tools" }),
|
|
41635
|
+
/* @__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, {}) }) }) })
|
|
40084
41636
|
] }),
|
|
40085
|
-
!gatewayConfigured && /* @__PURE__ */ (0,
|
|
40086
|
-
/* @__PURE__ */ (0,
|
|
40087
|
-
health?.status === "healthy" ? /* @__PURE__ */ (0,
|
|
40088
|
-
/* @__PURE__ */ (0,
|
|
40089
|
-
/* @__PURE__ */ (0,
|
|
40090
|
-
|
|
41637
|
+
!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." }) }),
|
|
41638
|
+
/* @__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: [
|
|
41639
|
+
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" }),
|
|
41640
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "Controller Health" }),
|
|
41641
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
41642
|
+
import_material46.Chip,
|
|
40091
41643
|
{
|
|
40092
41644
|
size: "small",
|
|
40093
41645
|
label: (health?.status || "unknown").toString(),
|
|
@@ -40095,11 +41647,11 @@ var MCPToolsTabV2 = () => {
|
|
|
40095
41647
|
sx: { ml: 1 }
|
|
40096
41648
|
}
|
|
40097
41649
|
),
|
|
40098
|
-
health?.timestamp && /* @__PURE__ */ (0,
|
|
41650
|
+
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() })
|
|
40099
41651
|
] }) }),
|
|
40100
|
-
loading && /* @__PURE__ */ (0,
|
|
40101
|
-
error && /* @__PURE__ */ (0,
|
|
40102
|
-
/* @__PURE__ */ (0,
|
|
41652
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Box, { sx: { mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.LinearProgress, {}) }),
|
|
41653
|
+
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 }) }),
|
|
41654
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Stack, { spacing: 2, children: tools.map((tool) => {
|
|
40103
41655
|
let locallyEnabled = localEnabledMap.get(tool.id);
|
|
40104
41656
|
if (locallyEnabled === void 0) {
|
|
40105
41657
|
locallyEnabled = localEnabledMap.get(tool.name);
|
|
@@ -40110,17 +41662,17 @@ var MCPToolsTabV2 = () => {
|
|
|
40110
41662
|
);
|
|
40111
41663
|
locallyEnabled = directLookup?.enabled ?? tool.isEnabled;
|
|
40112
41664
|
}
|
|
40113
|
-
return /* @__PURE__ */ (0,
|
|
40114
|
-
/* @__PURE__ */ (0,
|
|
40115
|
-
/* @__PURE__ */ (0,
|
|
40116
|
-
/* @__PURE__ */ (0,
|
|
40117
|
-
/* @__PURE__ */ (0,
|
|
41665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Paper, { sx: { p: 2 }, children: [
|
|
41666
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
41667
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { children: [
|
|
41668
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "h6", sx: { fontWeight: 700 }, children: tool.name }),
|
|
41669
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: tool.description })
|
|
40118
41670
|
] }),
|
|
40119
|
-
/* @__PURE__ */ (0,
|
|
40120
|
-
/* @__PURE__ */ (0,
|
|
40121
|
-
|
|
41671
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
41672
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
41673
|
+
import_material46.FormControlLabel,
|
|
40122
41674
|
{
|
|
40123
|
-
control: /* @__PURE__ */ (0,
|
|
41675
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Switch, { checked: !!locallyEnabled, onChange: () => {
|
|
40124
41676
|
let local = localTools.find((t) => t.function.name === tool.id);
|
|
40125
41677
|
if (!local) {
|
|
40126
41678
|
local = localTools.find((t) => t.function.name === tool.name);
|
|
@@ -40140,12 +41692,12 @@ var MCPToolsTabV2 = () => {
|
|
|
40140
41692
|
label: locallyEnabled ? "Enabled" : "Disabled"
|
|
40141
41693
|
}
|
|
40142
41694
|
),
|
|
40143
|
-
/* @__PURE__ */ (0,
|
|
41695
|
+
/* @__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" }) })
|
|
40144
41696
|
] })
|
|
40145
41697
|
] }),
|
|
40146
|
-
!!tool.supportedParameters?.length && /* @__PURE__ */ (0,
|
|
40147
|
-
/* @__PURE__ */ (0,
|
|
40148
|
-
/* @__PURE__ */ (0,
|
|
41698
|
+
!!tool.supportedParameters?.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_material46.Box, { sx: { mt: 1.5 }, children: [
|
|
41699
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_material46.Typography, { variant: "caption", color: "text.secondary", children: "Supported parameters" }),
|
|
41700
|
+
/* @__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)) })
|
|
40149
41701
|
] })
|
|
40150
41702
|
] }, tool.id);
|
|
40151
41703
|
}) })
|
|
@@ -40159,19 +41711,28 @@ init_banditTheme();
|
|
|
40159
41711
|
init_themeMap();
|
|
40160
41712
|
init_util();
|
|
40161
41713
|
init_brandingService();
|
|
41714
|
+
init_authenticationService();
|
|
40162
41715
|
init_debugLogger();
|
|
40163
41716
|
init_packageSettingsStore();
|
|
40164
41717
|
init_preferencesStore();
|
|
40165
41718
|
init_aiProviderStore();
|
|
41719
|
+
init_authenticationStore();
|
|
40166
41720
|
init_useNotificationService();
|
|
40167
41721
|
init_useFeatures();
|
|
40168
|
-
var
|
|
41722
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
40169
41723
|
var preloadChatPage = () => Promise.resolve().then(() => (init_chat2(), chat_exports));
|
|
41724
|
+
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
41725
|
+
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
41726
|
+
if (trimmed.endsWith("/api")) {
|
|
41727
|
+
return `${trimmed}/capabilities`;
|
|
41728
|
+
}
|
|
41729
|
+
return `${trimmed}/api/capabilities`;
|
|
41730
|
+
};
|
|
40170
41731
|
var Management = () => {
|
|
40171
41732
|
const navigate = (0, import_react_router_dom5.useNavigate)();
|
|
40172
41733
|
const notificationService2 = useNotificationService();
|
|
40173
41734
|
const isMobile = (0, import_useMediaQuery2.default)("(max-width:900px)");
|
|
40174
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
41735
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react57.useState)(false);
|
|
40175
41736
|
const getOptimalFabLogo = async () => {
|
|
40176
41737
|
const banditHead7 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
40177
41738
|
try {
|
|
@@ -40211,16 +41772,16 @@ var Management = () => {
|
|
|
40211
41772
|
hasTransparentLogo,
|
|
40212
41773
|
setHasTransparentLogo
|
|
40213
41774
|
} = useModelStore();
|
|
40214
|
-
const [modalOpen, setModalOpen] = (0,
|
|
41775
|
+
const [modalOpen, setModalOpen] = (0, import_react57.useState)(false);
|
|
40215
41776
|
const banditHead6 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
40216
|
-
const [fabLogo, setFabLogo] = (0,
|
|
40217
|
-
const [tabIndex, setTabIndex] = (0,
|
|
40218
|
-
const [logoFile, setLogoFile] = (0,
|
|
40219
|
-
const [logoBase64, setLogoBase64] = (0,
|
|
40220
|
-
const [brandingText, setBrandingText] = (0,
|
|
40221
|
-
const [theme, setTheme] = (0,
|
|
40222
|
-
const [customAvatarBase64, setCustomAvatarBase64] = (0,
|
|
40223
|
-
const [presetAvatar, setPresetAvatar] = (0,
|
|
41777
|
+
const [fabLogo, setFabLogo] = (0, import_react57.useState)(banditHead6);
|
|
41778
|
+
const [tabIndex, setTabIndex] = (0, import_react57.useState)(0);
|
|
41779
|
+
const [logoFile, setLogoFile] = (0, import_react57.useState)(null);
|
|
41780
|
+
const [logoBase64, setLogoBase64] = (0, import_react57.useState)(null);
|
|
41781
|
+
const [brandingText, setBrandingText] = (0, import_react57.useState)("");
|
|
41782
|
+
const [theme, setTheme] = (0, import_react57.useState)("bandit-dark");
|
|
41783
|
+
const [customAvatarBase64, setCustomAvatarBase64] = (0, import_react57.useState)(null);
|
|
41784
|
+
const [presetAvatar, setPresetAvatar] = (0, import_react57.useState)(null);
|
|
40224
41785
|
const showSnackbarMessage = (message, severity = "success") => {
|
|
40225
41786
|
if (severity === "success") {
|
|
40226
41787
|
notificationService2?.showSuccess(message);
|
|
@@ -40228,16 +41789,18 @@ var Management = () => {
|
|
|
40228
41789
|
notificationService2?.showError(message);
|
|
40229
41790
|
}
|
|
40230
41791
|
};
|
|
40231
|
-
const [restoreDialogOpen, setRestoreDialogOpen] = (0,
|
|
40232
|
-
const [brandingLoaded, setBrandingLoaded] = (0,
|
|
40233
|
-
const [isLoadingBranding, setIsLoadingBranding] = (0,
|
|
41792
|
+
const [restoreDialogOpen, setRestoreDialogOpen] = (0, import_react57.useState)(false);
|
|
41793
|
+
const [brandingLoaded, setBrandingLoaded] = (0, import_react57.useState)(false);
|
|
41794
|
+
const [isLoadingBranding, setIsLoadingBranding] = (0, import_react57.useState)(false);
|
|
40234
41795
|
const { initModels } = useModelStore();
|
|
40235
41796
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
41797
|
+
const authToken = useAuthenticationStore((state) => state.token);
|
|
40236
41798
|
const { preferences, updatePreference } = usePreferencesStore();
|
|
40237
41799
|
const { hasAdminDashboard, hasLimitedAdminDashboard, getCurrentTier, hasAdvancedSearch } = useFeatures();
|
|
40238
41800
|
const { showAdminPanel, showLimitedAdminPanel } = useFeatureVisibility();
|
|
40239
41801
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
40240
|
-
const [
|
|
41802
|
+
const [seedPacksEnabled, setSeedPacksEnabled] = (0, import_react57.useState)(false);
|
|
41803
|
+
const [localSelectedModel, setLocalSelectedModel] = (0, import_react57.useState)({
|
|
40241
41804
|
name: "",
|
|
40242
41805
|
tagline: "",
|
|
40243
41806
|
systemPrompt: "",
|
|
@@ -40250,7 +41813,7 @@ var Management = () => {
|
|
|
40250
41813
|
loadDocuments,
|
|
40251
41814
|
clearAllDocuments
|
|
40252
41815
|
} = useKnowledgeStore2();
|
|
40253
|
-
(0,
|
|
41816
|
+
(0, import_react57.useEffect)(() => {
|
|
40254
41817
|
if (selectedModel) {
|
|
40255
41818
|
const selected = availableModels.find((m) => m.name === selectedModel);
|
|
40256
41819
|
if (selected) {
|
|
@@ -40274,7 +41837,7 @@ var Management = () => {
|
|
|
40274
41837
|
}
|
|
40275
41838
|
}
|
|
40276
41839
|
}, [selectedModel, availableModels]);
|
|
40277
|
-
const loadBrandingConfig = (0,
|
|
41840
|
+
const loadBrandingConfig = (0, import_react57.useCallback)(async () => {
|
|
40278
41841
|
if (isLoadingBranding || brandingLoaded) {
|
|
40279
41842
|
debugLogger.warn("Branding loading already in progress or completed, skipping");
|
|
40280
41843
|
return;
|
|
@@ -40389,15 +41952,15 @@ var Management = () => {
|
|
|
40389
41952
|
setTagline,
|
|
40390
41953
|
setTheme
|
|
40391
41954
|
]);
|
|
40392
|
-
(0,
|
|
41955
|
+
(0, import_react57.useEffect)(() => {
|
|
40393
41956
|
void loadBrandingConfig();
|
|
40394
41957
|
}, [loadBrandingConfig]);
|
|
40395
41958
|
const handleOpenModal = () => setModalOpen(true);
|
|
40396
41959
|
const handleCloseModal = () => setModalOpen(false);
|
|
40397
|
-
(0,
|
|
41960
|
+
(0, import_react57.useEffect)(() => {
|
|
40398
41961
|
getOptimalFabLogo().then(setFabLogo);
|
|
40399
41962
|
}, []);
|
|
40400
|
-
(0,
|
|
41963
|
+
(0, import_react57.useEffect)(() => {
|
|
40401
41964
|
if (logoBase64) {
|
|
40402
41965
|
setFabLogo(logoBase64);
|
|
40403
41966
|
} else {
|
|
@@ -40844,7 +42407,7 @@ var Management = () => {
|
|
|
40844
42407
|
reader.readAsText(file);
|
|
40845
42408
|
}
|
|
40846
42409
|
};
|
|
40847
|
-
(0,
|
|
42410
|
+
(0, import_react57.useEffect)(() => {
|
|
40848
42411
|
if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
|
|
40849
42412
|
setLocalSelectedModel((prev) => ({
|
|
40850
42413
|
...prev,
|
|
@@ -40852,51 +42415,120 @@ var Management = () => {
|
|
|
40852
42415
|
}));
|
|
40853
42416
|
}
|
|
40854
42417
|
}, [availableModels, localSelectedModel.selectedModel]);
|
|
40855
|
-
(0,
|
|
42418
|
+
(0, import_react57.useEffect)(() => {
|
|
40856
42419
|
loadDocuments();
|
|
40857
42420
|
}, [loadDocuments]);
|
|
40858
|
-
|
|
42421
|
+
(0, import_react57.useEffect)(() => {
|
|
42422
|
+
const gatewayApiUrl = packageSettings?.gatewayApiUrl;
|
|
42423
|
+
if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
|
|
42424
|
+
setSeedPacksEnabled(false);
|
|
42425
|
+
return;
|
|
42426
|
+
}
|
|
42427
|
+
let isActive = true;
|
|
42428
|
+
const loadCapabilities = async () => {
|
|
42429
|
+
try {
|
|
42430
|
+
const token = authToken ?? authenticationService.getToken();
|
|
42431
|
+
const headers = {
|
|
42432
|
+
"Content-Type": "application/json"
|
|
42433
|
+
};
|
|
42434
|
+
if (token) {
|
|
42435
|
+
headers.Authorization = `Bearer ${token}`;
|
|
42436
|
+
}
|
|
42437
|
+
const response = await fetch(buildCapabilitiesUrl(gatewayApiUrl), {
|
|
42438
|
+
method: "GET",
|
|
42439
|
+
headers
|
|
42440
|
+
});
|
|
42441
|
+
if (!response.ok) {
|
|
42442
|
+
throw new Error(`Capabilities request failed: ${response.status}`);
|
|
42443
|
+
}
|
|
42444
|
+
const payload = await response.json();
|
|
42445
|
+
if (!isActive) {
|
|
42446
|
+
return;
|
|
42447
|
+
}
|
|
42448
|
+
setSeedPacksEnabled(Boolean(payload?.seedPacksEnabled));
|
|
42449
|
+
} catch (error) {
|
|
42450
|
+
if (!isActive) {
|
|
42451
|
+
return;
|
|
42452
|
+
}
|
|
42453
|
+
setSeedPacksEnabled(false);
|
|
42454
|
+
debugLogger.warn("Management: failed to load capabilities", {
|
|
42455
|
+
error: error instanceof Error ? error.message : String(error)
|
|
42456
|
+
});
|
|
42457
|
+
}
|
|
42458
|
+
};
|
|
42459
|
+
loadCapabilities();
|
|
42460
|
+
return () => {
|
|
42461
|
+
isActive = false;
|
|
42462
|
+
};
|
|
42463
|
+
}, [packageSettings?.gatewayApiUrl, authToken]);
|
|
42464
|
+
const currentTheme = (0, import_react57.useMemo)(() => {
|
|
42465
|
+
const baseTheme = predefinedThemes[theme] || banditDarkTheme;
|
|
42466
|
+
return (0, import_styles31.createTheme)(baseTheme, {
|
|
42467
|
+
components: {
|
|
42468
|
+
MuiInputBase: {
|
|
42469
|
+
styleOverrides: {
|
|
42470
|
+
input: {
|
|
42471
|
+
outline: "none",
|
|
42472
|
+
boxShadow: "none",
|
|
42473
|
+
"&:focus, &:focus-visible": {
|
|
42474
|
+
outline: "none",
|
|
42475
|
+
boxShadow: "none"
|
|
42476
|
+
}
|
|
42477
|
+
},
|
|
42478
|
+
inputMultiline: {
|
|
42479
|
+
outline: "none",
|
|
42480
|
+
boxShadow: "none",
|
|
42481
|
+
"&:focus, &:focus-visible": {
|
|
42482
|
+
outline: "none",
|
|
42483
|
+
boxShadow: "none"
|
|
42484
|
+
}
|
|
42485
|
+
}
|
|
42486
|
+
}
|
|
42487
|
+
}
|
|
42488
|
+
}
|
|
42489
|
+
});
|
|
42490
|
+
}, [theme]);
|
|
40859
42491
|
if (!brandingLoaded) return null;
|
|
40860
42492
|
const allNavTabs = [
|
|
40861
42493
|
{
|
|
40862
42494
|
label: "Personalities",
|
|
40863
|
-
icon: /* @__PURE__ */ (0,
|
|
42495
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_FaceRetouchingNatural.default, {}),
|
|
40864
42496
|
requiresFeature: "limitedAdminDashboard"
|
|
40865
42497
|
// Available to premium+
|
|
40866
42498
|
},
|
|
40867
42499
|
{
|
|
40868
42500
|
label: "Branding",
|
|
40869
|
-
icon: /* @__PURE__ */ (0,
|
|
42501
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Brush.default, {}),
|
|
40870
42502
|
requiresFeature: "limitedAdminDashboard"
|
|
40871
42503
|
// Available to premium+
|
|
40872
42504
|
},
|
|
40873
42505
|
{
|
|
40874
42506
|
label: "Knowledge",
|
|
40875
|
-
icon: /* @__PURE__ */ (0,
|
|
42507
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_MenuBook.default, {}),
|
|
40876
42508
|
requiresFeature: "limitedAdminDashboard"
|
|
40877
42509
|
// Available to premium+
|
|
40878
42510
|
},
|
|
40879
42511
|
{
|
|
40880
42512
|
label: "Storage",
|
|
40881
|
-
icon: /* @__PURE__ */ (0,
|
|
42513
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Storage2.default, {}),
|
|
40882
42514
|
requiresFeature: "limitedAdminDashboard"
|
|
40883
42515
|
// Available to premium+ (changed from adminDashboardEnabled)
|
|
40884
42516
|
},
|
|
40885
42517
|
{
|
|
40886
42518
|
label: "Preferences",
|
|
40887
|
-
icon: /* @__PURE__ */ (0,
|
|
42519
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Tune.default, {}),
|
|
40888
42520
|
requiresFeature: "limitedAdminDashboard"
|
|
40889
42521
|
// Available to premium+
|
|
40890
42522
|
},
|
|
40891
42523
|
{
|
|
40892
42524
|
label: "Provider",
|
|
40893
|
-
icon: /* @__PURE__ */ (0,
|
|
42525
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Cloud2.default, {}),
|
|
40894
42526
|
requiresFeature: "advancedSearch"
|
|
40895
42527
|
// Pro/Team users with advanced features
|
|
40896
42528
|
},
|
|
40897
42529
|
{
|
|
40898
42530
|
label: "MCP Tools",
|
|
40899
|
-
icon: /* @__PURE__ */ (0,
|
|
42531
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_Build.default, {}),
|
|
40900
42532
|
requiresFeature: "advancedSearch"
|
|
40901
42533
|
// Pro/Team users with advanced features
|
|
40902
42534
|
}
|
|
@@ -40913,8 +42545,8 @@ var Management = () => {
|
|
|
40913
42545
|
}
|
|
40914
42546
|
return true;
|
|
40915
42547
|
});
|
|
40916
|
-
const navigationContent = /* @__PURE__ */ (0,
|
|
40917
|
-
|
|
42548
|
+
const navigationContent = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42549
|
+
import_material47.Box,
|
|
40918
42550
|
{
|
|
40919
42551
|
sx: {
|
|
40920
42552
|
display: "flex",
|
|
@@ -40924,29 +42556,29 @@ var Management = () => {
|
|
|
40924
42556
|
bgcolor: "inherit"
|
|
40925
42557
|
},
|
|
40926
42558
|
children: [
|
|
40927
|
-
isMobile && /* @__PURE__ */ (0,
|
|
40928
|
-
|
|
42559
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42560
|
+
import_material47.Box,
|
|
40929
42561
|
{
|
|
40930
42562
|
sx: {
|
|
40931
42563
|
height: 6,
|
|
40932
42564
|
width: 56,
|
|
40933
42565
|
borderRadius: 999,
|
|
40934
|
-
bgcolor: (theme2) => (0,
|
|
42566
|
+
bgcolor: (theme2) => (0, import_styles31.alpha)(theme2.palette.text.primary, 0.18),
|
|
40935
42567
|
alignSelf: "center",
|
|
40936
42568
|
mt: 1.25,
|
|
40937
42569
|
mb: 0.75
|
|
40938
42570
|
}
|
|
40939
42571
|
}
|
|
40940
42572
|
),
|
|
40941
|
-
/* @__PURE__ */ (0,
|
|
40942
|
-
|
|
42573
|
+
/* @__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)(
|
|
42574
|
+
import_material47.Button,
|
|
40943
42575
|
{
|
|
40944
42576
|
onClick: () => {
|
|
40945
42577
|
if (isMobile) setSidebarOpen(false);
|
|
40946
42578
|
navigate("/chat");
|
|
40947
42579
|
},
|
|
40948
42580
|
onMouseEnter: preloadChatPage,
|
|
40949
|
-
startIcon: /* @__PURE__ */ (0,
|
|
42581
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_ChevronLeft.default, { sx: { fontSize: 20 } }),
|
|
40950
42582
|
fullWidth: true,
|
|
40951
42583
|
variant: "outlined",
|
|
40952
42584
|
sx: {
|
|
@@ -40973,9 +42605,9 @@ var Management = () => {
|
|
|
40973
42605
|
children: "Back to Chat"
|
|
40974
42606
|
}
|
|
40975
42607
|
) }),
|
|
40976
|
-
/* @__PURE__ */ (0,
|
|
40977
|
-
/* @__PURE__ */ (0,
|
|
40978
|
-
|
|
42608
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Divider, { sx: { mx: isMobile ? 2 : 3, mb: 2, opacity: 0.6 } }),
|
|
42609
|
+
/* @__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)(
|
|
42610
|
+
import_material47.ListItemButton,
|
|
40979
42611
|
{
|
|
40980
42612
|
selected: tabIndex === idx,
|
|
40981
42613
|
onClick: () => {
|
|
@@ -41024,8 +42656,8 @@ var Management = () => {
|
|
|
41024
42656
|
}
|
|
41025
42657
|
},
|
|
41026
42658
|
children: [
|
|
41027
|
-
/* @__PURE__ */ (0,
|
|
41028
|
-
|
|
42659
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42660
|
+
import_material47.ListItemIcon,
|
|
41029
42661
|
{
|
|
41030
42662
|
sx: {
|
|
41031
42663
|
color: tabIndex === idx ? "primary.main" : "text.secondary",
|
|
@@ -41035,8 +42667,8 @@ var Management = () => {
|
|
|
41035
42667
|
children: tab.icon
|
|
41036
42668
|
}
|
|
41037
42669
|
),
|
|
41038
|
-
/* @__PURE__ */ (0,
|
|
41039
|
-
|
|
42670
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42671
|
+
import_material47.ListItemText,
|
|
41040
42672
|
{
|
|
41041
42673
|
primary: tab.label,
|
|
41042
42674
|
primaryTypographyProps: {
|
|
@@ -41046,8 +42678,8 @@ var Management = () => {
|
|
|
41046
42678
|
}
|
|
41047
42679
|
}
|
|
41048
42680
|
),
|
|
41049
|
-
tabIndex === idx && /* @__PURE__ */ (0,
|
|
41050
|
-
|
|
42681
|
+
tabIndex === idx && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42682
|
+
import_material47.Box,
|
|
41051
42683
|
{
|
|
41052
42684
|
sx: {
|
|
41053
42685
|
position: "absolute",
|
|
@@ -41069,10 +42701,10 @@ var Management = () => {
|
|
|
41069
42701
|
]
|
|
41070
42702
|
}
|
|
41071
42703
|
);
|
|
41072
|
-
return /* @__PURE__ */ (0,
|
|
41073
|
-
/* @__PURE__ */ (0,
|
|
41074
|
-
/* @__PURE__ */ (0,
|
|
41075
|
-
|
|
42704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_material47.ThemeProvider, { theme: currentTheme, children: [
|
|
42705
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.CssBaseline, {}),
|
|
42706
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42707
|
+
import_material47.Box,
|
|
41076
42708
|
{
|
|
41077
42709
|
display: "flex",
|
|
41078
42710
|
height: "100vh",
|
|
@@ -41084,8 +42716,8 @@ var Management = () => {
|
|
|
41084
42716
|
position: "relative"
|
|
41085
42717
|
},
|
|
41086
42718
|
children: [
|
|
41087
|
-
isMobile && /* @__PURE__ */ (0,
|
|
41088
|
-
|
|
42719
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42720
|
+
import_material47.Box,
|
|
41089
42721
|
{
|
|
41090
42722
|
sx: {
|
|
41091
42723
|
width: "100%",
|
|
@@ -41104,8 +42736,8 @@ var Management = () => {
|
|
|
41104
42736
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
41105
42737
|
},
|
|
41106
42738
|
children: [
|
|
41107
|
-
/* @__PURE__ */ (0,
|
|
41108
|
-
|
|
42739
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42740
|
+
import_material47.Button,
|
|
41109
42741
|
{
|
|
41110
42742
|
onClick: () => setSidebarOpen((o) => !o),
|
|
41111
42743
|
sx: {
|
|
@@ -41126,7 +42758,7 @@ var Management = () => {
|
|
|
41126
42758
|
transform: sidebarOpen ? "rotate(90deg) scale(0.95)" : "scale(0.95)"
|
|
41127
42759
|
}
|
|
41128
42760
|
},
|
|
41129
|
-
children: /* @__PURE__ */ (0,
|
|
42761
|
+
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)(
|
|
41130
42762
|
"path",
|
|
41131
42763
|
{
|
|
41132
42764
|
d: sidebarOpen ? "M18 6L6 18M6 6L18 18" : "M3 12H21M3 6H21M3 18H21",
|
|
@@ -41138,8 +42770,8 @@ var Management = () => {
|
|
|
41138
42770
|
) })
|
|
41139
42771
|
}
|
|
41140
42772
|
),
|
|
41141
|
-
/* @__PURE__ */ (0,
|
|
41142
|
-
|
|
42773
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42774
|
+
import_material47.Typography,
|
|
41143
42775
|
{
|
|
41144
42776
|
variant: "h6",
|
|
41145
42777
|
sx: {
|
|
@@ -41151,14 +42783,14 @@ var Management = () => {
|
|
|
41151
42783
|
children: "Management"
|
|
41152
42784
|
}
|
|
41153
42785
|
),
|
|
41154
|
-
/* @__PURE__ */ (0,
|
|
42786
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_material47.Box, { sx: {
|
|
41155
42787
|
px: 2,
|
|
41156
42788
|
py: 0.5,
|
|
41157
42789
|
borderRadius: 2,
|
|
41158
42790
|
bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.12)" : "rgba(25,118,210,0.08)",
|
|
41159
42791
|
border: (theme2) => `1px solid ${theme2.palette.primary.main}20`
|
|
41160
|
-
}, children: /* @__PURE__ */ (0,
|
|
41161
|
-
|
|
42792
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42793
|
+
import_material47.Typography,
|
|
41162
42794
|
{
|
|
41163
42795
|
variant: "caption",
|
|
41164
42796
|
sx: {
|
|
@@ -41172,8 +42804,8 @@ var Management = () => {
|
|
|
41172
42804
|
]
|
|
41173
42805
|
}
|
|
41174
42806
|
),
|
|
41175
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
41176
|
-
|
|
42807
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42808
|
+
import_material47.SwipeableDrawer,
|
|
41177
42809
|
{
|
|
41178
42810
|
anchor: "bottom",
|
|
41179
42811
|
open: sidebarOpen,
|
|
@@ -41193,8 +42825,8 @@ var Management = () => {
|
|
|
41193
42825
|
},
|
|
41194
42826
|
children: navigationContent
|
|
41195
42827
|
}
|
|
41196
|
-
) : /* @__PURE__ */ (0,
|
|
41197
|
-
|
|
42828
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42829
|
+
import_material47.Box,
|
|
41198
42830
|
{
|
|
41199
42831
|
sx: {
|
|
41200
42832
|
width: 280,
|
|
@@ -41217,8 +42849,8 @@ var Management = () => {
|
|
|
41217
42849
|
children: navigationContent
|
|
41218
42850
|
}
|
|
41219
42851
|
),
|
|
41220
|
-
/* @__PURE__ */ (0,
|
|
41221
|
-
|
|
42852
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
42853
|
+
import_material47.Box,
|
|
41222
42854
|
{
|
|
41223
42855
|
sx: {
|
|
41224
42856
|
flex: 1,
|
|
@@ -41246,7 +42878,7 @@ var Management = () => {
|
|
|
41246
42878
|
// IE and Edge
|
|
41247
42879
|
},
|
|
41248
42880
|
children: [
|
|
41249
|
-
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ (0,
|
|
42881
|
+
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41250
42882
|
PersonalitiesTab_default,
|
|
41251
42883
|
{
|
|
41252
42884
|
availableModels,
|
|
@@ -41265,7 +42897,7 @@ var Management = () => {
|
|
|
41265
42897
|
showSnackbar: showSnackbarMessage
|
|
41266
42898
|
}
|
|
41267
42899
|
),
|
|
41268
|
-
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ (0,
|
|
42900
|
+
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41269
42901
|
BrandingTab_default,
|
|
41270
42902
|
{
|
|
41271
42903
|
logoFile,
|
|
@@ -41284,8 +42916,8 @@ var Management = () => {
|
|
|
41284
42916
|
setLogoBase64
|
|
41285
42917
|
}
|
|
41286
42918
|
),
|
|
41287
|
-
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ (0,
|
|
41288
|
-
|
|
42919
|
+
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42920
|
+
KnowledgeHubTab_default,
|
|
41289
42921
|
{
|
|
41290
42922
|
documents,
|
|
41291
42923
|
addDocuments,
|
|
@@ -41293,11 +42925,12 @@ var Management = () => {
|
|
|
41293
42925
|
loadDocuments,
|
|
41294
42926
|
clearAllDocuments,
|
|
41295
42927
|
currentTheme,
|
|
41296
|
-
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard()
|
|
42928
|
+
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard(),
|
|
42929
|
+
seedPacksEnabled
|
|
41297
42930
|
}
|
|
41298
42931
|
),
|
|
41299
|
-
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ (0,
|
|
41300
|
-
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ (0,
|
|
42932
|
+
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(StorageTab_default, { currentTheme }),
|
|
42933
|
+
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41301
42934
|
PreferencesTab_default,
|
|
41302
42935
|
{
|
|
41303
42936
|
preferences,
|
|
@@ -41307,13 +42940,13 @@ var Management = () => {
|
|
|
41307
42940
|
showSnackbar: showSnackbarMessage
|
|
41308
42941
|
}
|
|
41309
42942
|
),
|
|
41310
|
-
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ (0,
|
|
41311
|
-
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ (0,
|
|
42943
|
+
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ProviderTab, {}),
|
|
42944
|
+
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MCPToolsTabV2_default, {})
|
|
41312
42945
|
]
|
|
41313
42946
|
}
|
|
41314
42947
|
),
|
|
41315
|
-
/* @__PURE__ */ (0,
|
|
41316
|
-
|
|
42948
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
42949
|
+
import_material47.Fab,
|
|
41317
42950
|
{
|
|
41318
42951
|
"aria-label": "AI",
|
|
41319
42952
|
onClick: handleOpenModal,
|
|
@@ -41334,7 +42967,7 @@ var Management = () => {
|
|
|
41334
42967
|
boxShadow: theme2.shadows[6],
|
|
41335
42968
|
zIndex: 2e3
|
|
41336
42969
|
}),
|
|
41337
|
-
children: /* @__PURE__ */ (0,
|
|
42970
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
41338
42971
|
"img",
|
|
41339
42972
|
{
|
|
41340
42973
|
src: fabLogo,
|
|
@@ -41348,7 +42981,7 @@ var Management = () => {
|
|
|
41348
42981
|
)
|
|
41349
42982
|
}
|
|
41350
42983
|
),
|
|
41351
|
-
/* @__PURE__ */ (0,
|
|
42984
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(chat_modal_default, { open: modalOpen, onClose: handleCloseModal })
|
|
41352
42985
|
]
|
|
41353
42986
|
}
|
|
41354
42987
|
)
|
|
@@ -41357,7 +42990,7 @@ var Management = () => {
|
|
|
41357
42990
|
var management_default = Management;
|
|
41358
42991
|
|
|
41359
42992
|
// src/shared/custom-element.ts
|
|
41360
|
-
var
|
|
42993
|
+
var import_react58 = __toESM(require("react"));
|
|
41361
42994
|
var import_client = __toESM(require("react-dom/client"));
|
|
41362
42995
|
function defineCustomElement(name, Component) {
|
|
41363
42996
|
if (customElements.get(name)) return;
|
|
@@ -41385,7 +43018,7 @@ function defineCustomElement(name, Component) {
|
|
|
41385
43018
|
if (!this.root) {
|
|
41386
43019
|
this.root = import_client.default.createRoot(this.mountPoint);
|
|
41387
43020
|
}
|
|
41388
|
-
this.root.render(
|
|
43021
|
+
this.root.render(import_react58.default.createElement(Component, props));
|
|
41389
43022
|
}
|
|
41390
43023
|
}
|
|
41391
43024
|
customElements.define(name, ReactElement);
|
|
@@ -41594,7 +43227,7 @@ var getFeatureMatrix = () => featureFlagService.generateFeatureMatrix();
|
|
|
41594
43227
|
init_featureFlags();
|
|
41595
43228
|
|
|
41596
43229
|
// src/hooks/useVoices.ts
|
|
41597
|
-
var
|
|
43230
|
+
var import_react59 = require("react");
|
|
41598
43231
|
init_voiceStore();
|
|
41599
43232
|
init_packageSettingsStore();
|
|
41600
43233
|
init_authenticationStore();
|
|
@@ -41614,7 +43247,7 @@ var useVoices = () => {
|
|
|
41614
43247
|
} = useVoiceStore();
|
|
41615
43248
|
const gatewayApiUrl = usePackageSettingsStore((state) => state.settings?.gatewayApiUrl);
|
|
41616
43249
|
const { token } = useAuthenticationStore();
|
|
41617
|
-
(0,
|
|
43250
|
+
(0, import_react59.useEffect)(() => {
|
|
41618
43251
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
41619
43252
|
if (gatewayApiUrl && token && isAuthenticated && !isServiceAvailable) {
|
|
41620
43253
|
debugLogger.debug("Gateway API URL and JWT token available, loading voice models...");
|
|
@@ -41649,9 +43282,9 @@ init_useTTS();
|
|
|
41649
43282
|
init_streaming_tts();
|
|
41650
43283
|
|
|
41651
43284
|
// src/modals/SubscriptionExpiredModal.tsx
|
|
41652
|
-
var
|
|
43285
|
+
var import_material48 = require("@mui/material");
|
|
41653
43286
|
var import_icons_material13 = require("@mui/icons-material");
|
|
41654
|
-
var
|
|
43287
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
41655
43288
|
var SubscriptionExpiredModal = ({
|
|
41656
43289
|
open,
|
|
41657
43290
|
onNavigateHome,
|
|
@@ -41673,8 +43306,8 @@ var SubscriptionExpiredModal = ({
|
|
|
41673
43306
|
window.location.href = "/manage-subscription";
|
|
41674
43307
|
}
|
|
41675
43308
|
};
|
|
41676
|
-
return /* @__PURE__ */ (0,
|
|
41677
|
-
|
|
43309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
43310
|
+
import_material48.Dialog,
|
|
41678
43311
|
{
|
|
41679
43312
|
open,
|
|
41680
43313
|
onClose,
|
|
@@ -41688,47 +43321,47 @@ var SubscriptionExpiredModal = ({
|
|
|
41688
43321
|
}
|
|
41689
43322
|
},
|
|
41690
43323
|
children: [
|
|
41691
|
-
/* @__PURE__ */ (0,
|
|
41692
|
-
/* @__PURE__ */ (0,
|
|
41693
|
-
/* @__PURE__ */ (0,
|
|
43324
|
+
/* @__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: [
|
|
43325
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.Warning, { color: "warning", sx: { fontSize: 32 } }),
|
|
43326
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Typography, { variant: "h5", component: "span", fontWeight: "bold", children: "Subscription Expired" })
|
|
41694
43327
|
] }) }),
|
|
41695
|
-
/* @__PURE__ */ (0,
|
|
41696
|
-
/* @__PURE__ */ (0,
|
|
41697
|
-
userEmail && /* @__PURE__ */ (0,
|
|
43328
|
+
/* @__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: [
|
|
43329
|
+
/* @__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." }) }),
|
|
43330
|
+
userEmail && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Typography, { variant: "body2", color: "text.secondary", sx: { textAlign: "center" }, children: [
|
|
41698
43331
|
"Account: ",
|
|
41699
|
-
/* @__PURE__ */ (0,
|
|
43332
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: userEmail })
|
|
41700
43333
|
] }),
|
|
41701
|
-
/* @__PURE__ */ (0,
|
|
41702
|
-
/* @__PURE__ */ (0,
|
|
43334
|
+
/* @__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." }),
|
|
43335
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_material48.Box, { sx: {
|
|
41703
43336
|
bgcolor: "background.paper",
|
|
41704
43337
|
border: 1,
|
|
41705
43338
|
borderColor: "divider",
|
|
41706
43339
|
borderRadius: 1,
|
|
41707
43340
|
p: 2,
|
|
41708
43341
|
mt: 2
|
|
41709
|
-
}, children: /* @__PURE__ */ (0,
|
|
41710
|
-
/* @__PURE__ */ (0,
|
|
43342
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.Typography, { variant: "caption", color: "text.secondary", sx: { fontStyle: "italic" }, children: [
|
|
43343
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("strong", { children: "What's affected:" }),
|
|
41711
43344
|
" All premium features including document upload, voice controls, advanced search, and admin dashboard access have been disabled until your subscription is renewed."
|
|
41712
43345
|
] }) })
|
|
41713
43346
|
] }) }),
|
|
41714
|
-
/* @__PURE__ */ (0,
|
|
41715
|
-
/* @__PURE__ */ (0,
|
|
41716
|
-
|
|
43347
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_material48.DialogActions, { sx: { px: 3, pb: 3, gap: 1, justifyContent: "center" }, children: [
|
|
43348
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
43349
|
+
import_material48.Button,
|
|
41717
43350
|
{
|
|
41718
43351
|
onClick: handleNavigateHome,
|
|
41719
43352
|
variant: "outlined",
|
|
41720
|
-
startIcon: /* @__PURE__ */ (0,
|
|
43353
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.Home, {}),
|
|
41721
43354
|
size: "large",
|
|
41722
43355
|
sx: { minWidth: 140 },
|
|
41723
43356
|
children: "Go Home"
|
|
41724
43357
|
}
|
|
41725
43358
|
),
|
|
41726
|
-
/* @__PURE__ */ (0,
|
|
41727
|
-
|
|
43359
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
43360
|
+
import_material48.Button,
|
|
41728
43361
|
{
|
|
41729
43362
|
onClick: handleManageSubscription,
|
|
41730
43363
|
variant: "contained",
|
|
41731
|
-
startIcon: /* @__PURE__ */ (0,
|
|
43364
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_icons_material13.CreditCard, {}),
|
|
41732
43365
|
size: "large",
|
|
41733
43366
|
color: "primary",
|
|
41734
43367
|
sx: { minWidth: 140 },
|
|
@@ -41742,9 +43375,9 @@ var SubscriptionExpiredModal = ({
|
|
|
41742
43375
|
};
|
|
41743
43376
|
|
|
41744
43377
|
// src/guards/SubscriptionExpiredGuard.tsx
|
|
41745
|
-
var
|
|
43378
|
+
var import_react60 = require("react");
|
|
41746
43379
|
init_useFeatures();
|
|
41747
|
-
var
|
|
43380
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
41748
43381
|
var SubscriptionExpiredGuard = ({
|
|
41749
43382
|
children,
|
|
41750
43383
|
onNavigateHome,
|
|
@@ -41753,9 +43386,9 @@ var SubscriptionExpiredGuard = ({
|
|
|
41753
43386
|
allowContinue = false
|
|
41754
43387
|
}) => {
|
|
41755
43388
|
const { isExpiredTier, getFullEvaluation } = useFeatures();
|
|
41756
|
-
const [showModal, setShowModal] = (0,
|
|
41757
|
-
const [userDismissed, setUserDismissed] = (0,
|
|
41758
|
-
(0,
|
|
43389
|
+
const [showModal, setShowModal] = (0, import_react60.useState)(false);
|
|
43390
|
+
const [userDismissed, setUserDismissed] = (0, import_react60.useState)(false);
|
|
43391
|
+
(0, import_react60.useEffect)(() => {
|
|
41759
43392
|
if (isExpiredTier() && !userDismissed) {
|
|
41760
43393
|
setShowModal(true);
|
|
41761
43394
|
} else {
|
|
@@ -41781,9 +43414,9 @@ var SubscriptionExpiredGuard = ({
|
|
|
41781
43414
|
}
|
|
41782
43415
|
return void 0;
|
|
41783
43416
|
})() : void 0;
|
|
41784
|
-
return /* @__PURE__ */ (0,
|
|
43417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
41785
43418
|
children,
|
|
41786
|
-
/* @__PURE__ */ (0,
|
|
43419
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
41787
43420
|
SubscriptionExpiredModal,
|
|
41788
43421
|
{
|
|
41789
43422
|
open: showModal,
|
|
@@ -41810,8 +43443,8 @@ init_useNotificationService();
|
|
|
41810
43443
|
// src/services/http/httpErrorHandler.ts
|
|
41811
43444
|
init_notificationService();
|
|
41812
43445
|
init_debugLogger();
|
|
41813
|
-
var
|
|
41814
|
-
var isHttpErrorLike = (error) =>
|
|
43446
|
+
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
43447
|
+
var isHttpErrorLike = (error) => isRecord6(error);
|
|
41815
43448
|
var extractString = (record, key) => {
|
|
41816
43449
|
const value = record[key];
|
|
41817
43450
|
return typeof value === "string" ? value : void 0;
|
|
@@ -41826,7 +43459,7 @@ var normalizeMessages = (value) => {
|
|
|
41826
43459
|
if (Array.isArray(value)) {
|
|
41827
43460
|
return value.flatMap(normalizeMessages);
|
|
41828
43461
|
}
|
|
41829
|
-
if (
|
|
43462
|
+
if (isRecord6(value) && typeof value.message === "string") {
|
|
41830
43463
|
return [value.message];
|
|
41831
43464
|
}
|
|
41832
43465
|
return [];
|
|
@@ -41836,7 +43469,7 @@ var handleHttpError = (error, context) => {
|
|
|
41836
43469
|
if (isHttpErrorLike(error) && error.response) {
|
|
41837
43470
|
const status = error.response.status;
|
|
41838
43471
|
const data = error.response.data;
|
|
41839
|
-
const dataRecord =
|
|
43472
|
+
const dataRecord = isRecord6(data) ? data : {};
|
|
41840
43473
|
const errorMessage = extractString(dataRecord, "message") || extractString(dataRecord, "error") || extractString(dataRecord, "detail");
|
|
41841
43474
|
const errorCode = extractString(dataRecord, "code") || extractString(dataRecord, "error_code");
|
|
41842
43475
|
debugLogger.error(`${contextPrefix}HTTP Error ${status}:`, {
|
|
@@ -41884,7 +43517,7 @@ var handleValidationError = (errors, context) => {
|
|
|
41884
43517
|
notificationService.handleValidationError(messages, `${contextPrefix}Please check your input`);
|
|
41885
43518
|
return;
|
|
41886
43519
|
}
|
|
41887
|
-
} else if (
|
|
43520
|
+
} else if (isRecord6(errors)) {
|
|
41888
43521
|
const collected = [];
|
|
41889
43522
|
Object.values(errors).forEach((value) => {
|
|
41890
43523
|
collected.push(...normalizeMessages(value));
|