@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
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StreamingMarkdown_default
|
|
3
|
+
} from "./chunk-N7RMUOFB.mjs";
|
|
1
4
|
import {
|
|
2
5
|
aiProviderInitService
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EWUUF4GE.mjs";
|
|
4
7
|
import {
|
|
5
8
|
useMCPToolsStore
|
|
6
9
|
} from "./chunk-EHNWQ4T3.mjs";
|
|
7
10
|
import {
|
|
8
11
|
chat_modal_default
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LXD3IV6Z.mjs";
|
|
10
13
|
import {
|
|
11
14
|
DocumentCard_default,
|
|
12
15
|
banditDarkTheme,
|
|
@@ -14,7 +17,7 @@ import {
|
|
|
14
17
|
predefinedThemes,
|
|
15
18
|
useNotificationService,
|
|
16
19
|
useVoiceStore
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-HETIHZ42.mjs";
|
|
18
21
|
import {
|
|
19
22
|
authenticationService,
|
|
20
23
|
brandingService_default,
|
|
@@ -27,7 +30,7 @@ import {
|
|
|
27
30
|
useFeatures,
|
|
28
31
|
useKnowledgeStore2 as useKnowledgeStore,
|
|
29
32
|
useVectorStore
|
|
30
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IDH2YOW3.mjs";
|
|
31
34
|
import {
|
|
32
35
|
indexedDBService_default,
|
|
33
36
|
models,
|
|
@@ -45,21 +48,21 @@ import {
|
|
|
45
48
|
} from "./chunk-KCI46M23.mjs";
|
|
46
49
|
|
|
47
50
|
// src/management/management.tsx
|
|
48
|
-
import { useState as
|
|
49
|
-
import
|
|
50
|
-
import { alpha as alpha2 } from "@mui/material/styles";
|
|
51
|
+
import { useState as useState14, useEffect as useEffect11, useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
52
|
+
import useMediaQuery7 from "@mui/material/useMediaQuery";
|
|
53
|
+
import { alpha as alpha2, createTheme } from "@mui/material/styles";
|
|
51
54
|
import {
|
|
52
|
-
Box as
|
|
53
|
-
Button as
|
|
54
|
-
Typography as
|
|
55
|
+
Box as Box13,
|
|
56
|
+
Button as Button10,
|
|
57
|
+
Typography as Typography12,
|
|
55
58
|
ThemeProvider,
|
|
56
59
|
CssBaseline,
|
|
57
60
|
Fab,
|
|
58
|
-
List as
|
|
59
|
-
ListItemButton,
|
|
61
|
+
List as List3,
|
|
62
|
+
ListItemButton as ListItemButton2,
|
|
60
63
|
ListItemIcon as ListItemIcon2,
|
|
61
64
|
ListItemText as ListItemText2,
|
|
62
|
-
Divider,
|
|
65
|
+
Divider as Divider2,
|
|
63
66
|
SwipeableDrawer
|
|
64
67
|
} from "@mui/material";
|
|
65
68
|
import FaceRetouchingNaturalIcon from "@mui/icons-material/FaceRetouchingNatural";
|
|
@@ -4162,6 +4165,12 @@ var BrandingTab = ({
|
|
|
4162
4165
|
};
|
|
4163
4166
|
var BrandingTab_default = BrandingTab;
|
|
4164
4167
|
|
|
4168
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
4169
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
4170
|
+
import { Box as Box9, Tab as Tab2, Tabs as Tabs2, useMediaQuery as useMediaQuery5, useTheme as useTheme6 } from "@mui/material";
|
|
4171
|
+
import DescriptionIcon3 from "@mui/icons-material/Description";
|
|
4172
|
+
import AutoStoriesIcon from "@mui/icons-material/AutoStories";
|
|
4173
|
+
|
|
4165
4174
|
// src/management/components/KnowledgeTab.tsx
|
|
4166
4175
|
import { useState as useState8, useMemo as useMemo2, useCallback as useCallback5, useEffect as useEffect5 } from "react";
|
|
4167
4176
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -5919,214 +5928,1694 @@ var KnowledgeTab = ({
|
|
|
5919
5928
|
};
|
|
5920
5929
|
var KnowledgeTab_default = KnowledgeTab;
|
|
5921
5930
|
|
|
5922
|
-
// src/management/components/
|
|
5923
|
-
import {
|
|
5931
|
+
// src/management/components/SeedPacksTab.tsx
|
|
5932
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo3, useRef as useRef5, useState as useState9 } from "react";
|
|
5924
5933
|
import {
|
|
5934
|
+
Alert as Alert7,
|
|
5925
5935
|
Box as Box8,
|
|
5926
|
-
Typography as Typography8,
|
|
5927
5936
|
Button as Button7,
|
|
5928
5937
|
Card as Card4,
|
|
5929
5938
|
CardContent as CardContent4,
|
|
5930
|
-
|
|
5939
|
+
Chip as Chip6,
|
|
5931
5940
|
Dialog as Dialog6,
|
|
5932
|
-
|
|
5941
|
+
DialogActions as DialogActions5,
|
|
5933
5942
|
DialogContent as DialogContent6,
|
|
5934
5943
|
DialogContentText as DialogContentText3,
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
Accordion,
|
|
5940
|
-
AccordionSummary,
|
|
5941
|
-
AccordionDetails,
|
|
5944
|
+
DialogTitle as DialogTitle5,
|
|
5945
|
+
Divider,
|
|
5946
|
+
IconButton as IconButton5,
|
|
5947
|
+
LinearProgress as LinearProgress3,
|
|
5942
5948
|
List,
|
|
5943
|
-
|
|
5944
|
-
ListItemIcon,
|
|
5945
|
-
ListItemText,
|
|
5946
|
-
CircularProgress,
|
|
5949
|
+
ListItemButton,
|
|
5947
5950
|
Snackbar as Snackbar3,
|
|
5948
|
-
|
|
5951
|
+
Stack as Stack3,
|
|
5952
|
+
TextField as TextField5,
|
|
5953
|
+
Tooltip as Tooltip2,
|
|
5954
|
+
Typography as Typography8
|
|
5949
5955
|
} from "@mui/material";
|
|
5950
|
-
import
|
|
5956
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
5957
|
+
import ArchiveIcon from "@mui/icons-material/Archive";
|
|
5951
5958
|
import DeleteIcon3 from "@mui/icons-material/Delete";
|
|
5952
|
-
import RefreshIcon2 from "@mui/icons-material/Refresh";
|
|
5953
|
-
import WarningIcon from "@mui/icons-material/Warning";
|
|
5954
|
-
import InfoIcon from "@mui/icons-material/Info";
|
|
5955
|
-
import CleaningServicesIcon from "@mui/icons-material/CleaningServices";
|
|
5956
5959
|
import DescriptionIcon2 from "@mui/icons-material/Description";
|
|
5960
|
+
import GroupIcon2 from "@mui/icons-material/Group";
|
|
5957
5961
|
import PersonIcon2 from "@mui/icons-material/Person";
|
|
5958
|
-
import
|
|
5959
|
-
import
|
|
5960
|
-
import
|
|
5961
|
-
import
|
|
5962
|
-
import
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
var
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5962
|
+
import PublishIcon from "@mui/icons-material/Publish";
|
|
5963
|
+
import RefreshIcon2 from "@mui/icons-material/Refresh";
|
|
5964
|
+
import SaveIcon2 from "@mui/icons-material/Save";
|
|
5965
|
+
import SearchIcon2 from "@mui/icons-material/Search";
|
|
5966
|
+
import UploadFileIcon2 from "@mui/icons-material/UploadFile";
|
|
5967
|
+
|
|
5968
|
+
// src/services/seedPacks/seedPackService.ts
|
|
5969
|
+
var HttpResponseError = class extends Error {
|
|
5970
|
+
constructor(message, status, payload, code) {
|
|
5971
|
+
super(message);
|
|
5972
|
+
this.status = status;
|
|
5973
|
+
this.payload = payload;
|
|
5974
|
+
this.code = code;
|
|
5975
|
+
this.name = "HttpResponseError";
|
|
5976
|
+
}
|
|
5972
5977
|
};
|
|
5973
|
-
var
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5978
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
5979
|
+
var getString = (record, key) => {
|
|
5980
|
+
const value = record[key];
|
|
5981
|
+
return typeof value === "string" ? value : void 0;
|
|
5982
|
+
};
|
|
5983
|
+
var getNumber = (record, key) => {
|
|
5984
|
+
const value = record[key];
|
|
5985
|
+
if (typeof value === "number") {
|
|
5986
|
+
return value;
|
|
5987
|
+
}
|
|
5988
|
+
if (typeof value === "string") {
|
|
5989
|
+
const parsed = Number(value);
|
|
5990
|
+
if (!Number.isNaN(parsed)) {
|
|
5991
|
+
return parsed;
|
|
5981
5992
|
}
|
|
5993
|
+
}
|
|
5994
|
+
return void 0;
|
|
5995
|
+
};
|
|
5996
|
+
var getStringArray = (record, key) => {
|
|
5997
|
+
const value = record[key];
|
|
5998
|
+
if (Array.isArray(value)) {
|
|
5999
|
+
return value.filter((item) => typeof item === "string");
|
|
6000
|
+
}
|
|
6001
|
+
if (typeof value === "string") {
|
|
6002
|
+
return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
6003
|
+
}
|
|
6004
|
+
return void 0;
|
|
6005
|
+
};
|
|
6006
|
+
var toSeedPackStatus = (value) => {
|
|
6007
|
+
if (value === "draft" || value === "published" || value === "archived") {
|
|
6008
|
+
return value;
|
|
6009
|
+
}
|
|
6010
|
+
return "draft";
|
|
6011
|
+
};
|
|
6012
|
+
var toSeedPackScope = (value) => {
|
|
6013
|
+
if (value === "team" || value === "user") {
|
|
6014
|
+
return value;
|
|
6015
|
+
}
|
|
6016
|
+
return void 0;
|
|
6017
|
+
};
|
|
6018
|
+
var normalizeSeedPack = (record) => {
|
|
6019
|
+
const sid = getString(record, "sid") ?? getString(record, "id") ?? "";
|
|
6020
|
+
return {
|
|
6021
|
+
sid,
|
|
6022
|
+
name: getString(record, "name") ?? "Untitled Seed Pack",
|
|
6023
|
+
description: getString(record, "description"),
|
|
6024
|
+
status: toSeedPackStatus(getString(record, "status")),
|
|
6025
|
+
version: getNumber(record, "version"),
|
|
6026
|
+
contentType: getString(record, "contentType") ?? "markdown",
|
|
6027
|
+
content: getString(record, "content"),
|
|
6028
|
+
summary: getString(record, "summary"),
|
|
6029
|
+
tags: getStringArray(record, "tags"),
|
|
6030
|
+
scopeType: toSeedPackScope(getString(record, "scopeType")),
|
|
6031
|
+
scopeSid: getString(record, "scopeSid"),
|
|
6032
|
+
createdBySid: getString(record, "createdBySid"),
|
|
6033
|
+
updatedBySid: getString(record, "updatedBySid"),
|
|
6034
|
+
publishedBySid: getString(record, "publishedBySid"),
|
|
6035
|
+
createdAt: getString(record, "createdAt"),
|
|
6036
|
+
updatedAt: getString(record, "updatedAt"),
|
|
6037
|
+
publishedAt: getString(record, "publishedAt")
|
|
6038
|
+
};
|
|
6039
|
+
};
|
|
6040
|
+
var extractSeedPack = (payload) => {
|
|
6041
|
+
if (!isRecord(payload)) {
|
|
6042
|
+
return null;
|
|
6043
|
+
}
|
|
6044
|
+
const candidate = isRecord(payload.seedPack) && payload.seedPack || isRecord(payload.data) && payload.data || payload;
|
|
6045
|
+
if (!isRecord(candidate)) {
|
|
6046
|
+
return null;
|
|
6047
|
+
}
|
|
6048
|
+
const pack = normalizeSeedPack(candidate);
|
|
6049
|
+
if (!pack.sid) {
|
|
6050
|
+
return null;
|
|
6051
|
+
}
|
|
6052
|
+
return pack;
|
|
6053
|
+
};
|
|
6054
|
+
var extractSeedPackList = (payload) => {
|
|
6055
|
+
if (Array.isArray(payload)) {
|
|
6056
|
+
return payload.map((item) => isRecord(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
6057
|
+
}
|
|
6058
|
+
if (!isRecord(payload)) {
|
|
6059
|
+
return [];
|
|
6060
|
+
}
|
|
6061
|
+
const candidates = [
|
|
6062
|
+
payload.seedPacks,
|
|
6063
|
+
payload.items,
|
|
6064
|
+
payload.results,
|
|
6065
|
+
payload.data
|
|
6066
|
+
];
|
|
6067
|
+
const list = candidates.find(Array.isArray);
|
|
6068
|
+
if (!Array.isArray(list)) {
|
|
6069
|
+
return [];
|
|
6070
|
+
}
|
|
6071
|
+
return list.map((item) => isRecord(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
|
|
6072
|
+
};
|
|
6073
|
+
var buildUrl = (path) => {
|
|
6074
|
+
const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "");
|
|
6075
|
+
if (!base) {
|
|
6076
|
+
throw new Error("Gateway API is not configured");
|
|
6077
|
+
}
|
|
6078
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
6079
|
+
return `${base}${normalized}`;
|
|
6080
|
+
};
|
|
6081
|
+
var buildHeaders = () => {
|
|
6082
|
+
const headers = {
|
|
6083
|
+
"Content-Type": "application/json"
|
|
6084
|
+
};
|
|
6085
|
+
const token = authenticationService.getToken();
|
|
6086
|
+
if (token) {
|
|
6087
|
+
headers.Authorization = `Bearer ${token}`;
|
|
6088
|
+
}
|
|
6089
|
+
return headers;
|
|
6090
|
+
};
|
|
6091
|
+
var handleJsonResponse = async (response, fallbackMessage) => {
|
|
6092
|
+
let data = null;
|
|
6093
|
+
try {
|
|
6094
|
+
data = await response.json();
|
|
5982
6095
|
} catch (error) {
|
|
5983
|
-
debugLogger.warn("
|
|
6096
|
+
debugLogger.warn("seedPackService: failed to parse JSON response", { error });
|
|
5984
6097
|
}
|
|
5985
|
-
|
|
6098
|
+
if (!response.ok) {
|
|
6099
|
+
const record = isRecord(data) ? data : {};
|
|
6100
|
+
const message = getString(record, "error") || getString(record, "message") || getString(record, "detail") || fallbackMessage;
|
|
6101
|
+
const code = getString(record, "code") || getString(record, "error_code");
|
|
6102
|
+
throw new HttpResponseError(message, response.status, data, code);
|
|
6103
|
+
}
|
|
6104
|
+
return data;
|
|
5986
6105
|
};
|
|
5987
|
-
var
|
|
5988
|
-
const
|
|
6106
|
+
var buildDraftPayload = (draft) => {
|
|
6107
|
+
const payload = {
|
|
6108
|
+
name: draft.name,
|
|
6109
|
+
contentType: draft.contentType ?? "markdown"
|
|
6110
|
+
};
|
|
6111
|
+
if (draft.description !== void 0) {
|
|
6112
|
+
payload.description = draft.description;
|
|
6113
|
+
}
|
|
6114
|
+
if (draft.content !== void 0) {
|
|
6115
|
+
payload.content = draft.content;
|
|
6116
|
+
}
|
|
6117
|
+
if (draft.tags) {
|
|
6118
|
+
payload.tags = draft.tags;
|
|
6119
|
+
}
|
|
6120
|
+
return payload;
|
|
6121
|
+
};
|
|
6122
|
+
var listSeedPacks = async () => {
|
|
6123
|
+
const url = buildUrl("/seed-packs");
|
|
5989
6124
|
try {
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
}
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
debugLogger.info(`Found conversations in database: ${dbName}`);
|
|
6009
|
-
break;
|
|
6010
|
-
}
|
|
6011
|
-
} catch (error) {
|
|
6012
|
-
debugLogger.warn(`Failed to check conversations in ${dbName}`, { error });
|
|
6013
|
-
}
|
|
6125
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders() });
|
|
6126
|
+
const payload = await handleJsonResponse(response, "Failed to load seed packs");
|
|
6127
|
+
return extractSeedPackList(payload);
|
|
6128
|
+
} catch (error) {
|
|
6129
|
+
debugLogger.error("seedPackService: failed to list seed packs", {
|
|
6130
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6131
|
+
});
|
|
6132
|
+
throw error;
|
|
6133
|
+
}
|
|
6134
|
+
};
|
|
6135
|
+
var getSeedPack = async (sid) => {
|
|
6136
|
+
const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
6137
|
+
try {
|
|
6138
|
+
const response = await fetch(url, { method: "GET", headers: buildHeaders() });
|
|
6139
|
+
const payload = await handleJsonResponse(response, "Failed to load seed pack");
|
|
6140
|
+
const pack = extractSeedPack(payload);
|
|
6141
|
+
if (!pack) {
|
|
6142
|
+
throw new Error("Seed pack response was empty");
|
|
6014
6143
|
}
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
itemCount: chatSize.count,
|
|
6021
|
-
description: "Conversation history and messages",
|
|
6022
|
-
stores: foundConversationDb ? [`${foundConversationDb}.conversations`] : [],
|
|
6023
|
-
canClear: chatSize.count > 0,
|
|
6024
|
-
clearWarning: "This will permanently delete all your chat conversations and message history."
|
|
6144
|
+
return pack;
|
|
6145
|
+
} catch (error) {
|
|
6146
|
+
debugLogger.error("seedPackService: failed to load seed pack", {
|
|
6147
|
+
sid,
|
|
6148
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6025
6149
|
});
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6150
|
+
throw error;
|
|
6151
|
+
}
|
|
6152
|
+
};
|
|
6153
|
+
var createSeedPack = async (draft) => {
|
|
6154
|
+
const url = buildUrl("/seed-packs");
|
|
6155
|
+
try {
|
|
6156
|
+
const response = await fetch(url, {
|
|
6157
|
+
method: "POST",
|
|
6158
|
+
headers: buildHeaders(),
|
|
6159
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
6031
6160
|
});
|
|
6032
|
-
const
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
try {
|
|
6037
|
-
const result = await estimateStoreSize(dbName, "documents");
|
|
6038
|
-
debugLogger.info(`Knowledge database ${dbName} check result:`, {
|
|
6039
|
-
size: result.size,
|
|
6040
|
-
count: result.count,
|
|
6041
|
-
sizeFormatted: `${(result.size / 1024).toFixed(2)} KB`
|
|
6042
|
-
});
|
|
6043
|
-
if (result.count > 0) {
|
|
6044
|
-
knowledgeSize = result;
|
|
6045
|
-
foundKnowledgeDb = dbName;
|
|
6046
|
-
debugLogger.info(`Found knowledge documents in database: ${dbName}`, {
|
|
6047
|
-
totalSize: result.size,
|
|
6048
|
-
itemCount: result.count
|
|
6049
|
-
});
|
|
6050
|
-
break;
|
|
6051
|
-
}
|
|
6052
|
-
} catch (error) {
|
|
6053
|
-
debugLogger.warn(`Failed to check knowledge in ${dbName}`, { error });
|
|
6054
|
-
}
|
|
6161
|
+
const payload = await handleJsonResponse(response, "Failed to create seed pack");
|
|
6162
|
+
const pack = extractSeedPack(payload);
|
|
6163
|
+
if (!pack) {
|
|
6164
|
+
throw new Error("Seed pack response was empty");
|
|
6055
6165
|
}
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
size: knowledgeSize.size,
|
|
6061
|
-
itemCount: knowledgeSize.count,
|
|
6062
|
-
description: "Uploaded documents and their embeddings",
|
|
6063
|
-
stores: foundKnowledgeDb ? [`${foundKnowledgeDb}.documents`] : [],
|
|
6064
|
-
canClear: knowledgeSize.count > 0,
|
|
6065
|
-
clearWarning: "This will remove all uploaded documents and their AI embeddings. You will need to re-upload documents."
|
|
6166
|
+
return pack;
|
|
6167
|
+
} catch (error) {
|
|
6168
|
+
debugLogger.error("seedPackService: failed to create seed pack", {
|
|
6169
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6066
6170
|
});
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6171
|
+
throw error;
|
|
6172
|
+
}
|
|
6173
|
+
};
|
|
6174
|
+
var updateSeedPack = async (sid, draft) => {
|
|
6175
|
+
const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}`);
|
|
6176
|
+
try {
|
|
6177
|
+
const response = await fetch(url, {
|
|
6178
|
+
method: "PUT",
|
|
6179
|
+
headers: buildHeaders(),
|
|
6180
|
+
body: JSON.stringify(buildDraftPayload(draft))
|
|
6073
6181
|
});
|
|
6074
|
-
const
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
try {
|
|
6079
|
-
const result = await estimateStoreSize(dbName, "memories");
|
|
6080
|
-
if (result.count > 0) {
|
|
6081
|
-
memorySize = result;
|
|
6082
|
-
foundMemoryDb = dbName;
|
|
6083
|
-
debugLogger.info(`Found memories in database: ${dbName}`);
|
|
6084
|
-
break;
|
|
6085
|
-
}
|
|
6086
|
-
} catch (error) {
|
|
6087
|
-
debugLogger.warn(`Failed to check memories in ${dbName}`, { error });
|
|
6088
|
-
}
|
|
6182
|
+
const payload = await handleJsonResponse(response, "Failed to update seed pack");
|
|
6183
|
+
const pack = extractSeedPack(payload);
|
|
6184
|
+
if (!pack) {
|
|
6185
|
+
throw new Error("Seed pack response was empty");
|
|
6089
6186
|
}
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
itemCount: memorySize.count,
|
|
6096
|
-
description: "AI memory entries and learned patterns",
|
|
6097
|
-
stores: foundMemoryDb ? [`${foundMemoryDb}.memories`] : [],
|
|
6098
|
-
canClear: memorySize.count > 0,
|
|
6099
|
-
clearWarning: "This will delete all AI memory entries and learned conversation patterns."
|
|
6187
|
+
return pack;
|
|
6188
|
+
} catch (error) {
|
|
6189
|
+
debugLogger.error("seedPackService: failed to update seed pack", {
|
|
6190
|
+
sid,
|
|
6191
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6100
6192
|
});
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
}
|
|
6113
|
-
} catch (error) {
|
|
6114
|
-
debugLogger.warn(`Failed to check config in ${dbName}`, { error });
|
|
6115
|
-
}
|
|
6193
|
+
throw error;
|
|
6194
|
+
}
|
|
6195
|
+
};
|
|
6196
|
+
var publishSeedPack = async (sid) => {
|
|
6197
|
+
const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}/publish`);
|
|
6198
|
+
try {
|
|
6199
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders() });
|
|
6200
|
+
const payload = await handleJsonResponse(response, "Failed to publish seed pack");
|
|
6201
|
+
const pack = extractSeedPack(payload);
|
|
6202
|
+
if (!pack) {
|
|
6203
|
+
throw new Error("Seed pack response was empty");
|
|
6116
6204
|
}
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
itemCount: configSize.count,
|
|
6123
|
-
description: "Custom models, app settings, and user preferences",
|
|
6124
|
-
stores: foundConfigDb ? [`${foundConfigDb}.config`] : [],
|
|
6125
|
-
canClear: configSize.count > 0,
|
|
6126
|
-
clearWarning: "This will delete all custom AI models, app settings, themes, and preferences. The app will reset to defaults."
|
|
6205
|
+
return pack;
|
|
6206
|
+
} catch (error) {
|
|
6207
|
+
debugLogger.error("seedPackService: failed to publish seed pack", {
|
|
6208
|
+
sid,
|
|
6209
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6127
6210
|
});
|
|
6128
|
-
|
|
6129
|
-
|
|
6211
|
+
throw error;
|
|
6212
|
+
}
|
|
6213
|
+
};
|
|
6214
|
+
var archiveSeedPack = async (sid) => {
|
|
6215
|
+
const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}/archive`);
|
|
6216
|
+
try {
|
|
6217
|
+
const response = await fetch(url, { method: "POST", headers: buildHeaders() });
|
|
6218
|
+
const payload = await handleJsonResponse(response, "Failed to archive seed pack");
|
|
6219
|
+
const pack = extractSeedPack(payload);
|
|
6220
|
+
if (!pack) {
|
|
6221
|
+
throw new Error("Seed pack response was empty");
|
|
6222
|
+
}
|
|
6223
|
+
return pack;
|
|
6224
|
+
} catch (error) {
|
|
6225
|
+
debugLogger.error("seedPackService: failed to archive seed pack", {
|
|
6226
|
+
sid,
|
|
6227
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6228
|
+
});
|
|
6229
|
+
throw error;
|
|
6230
|
+
}
|
|
6231
|
+
};
|
|
6232
|
+
|
|
6233
|
+
// src/management/components/SeedPacksTab.tsx
|
|
6234
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6235
|
+
var parseTags = (value) => value.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
6236
|
+
var normalizeTags = (tags) => (tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
6237
|
+
var areArraysEqual = (a, b) => {
|
|
6238
|
+
if (a.length !== b.length) {
|
|
6239
|
+
return false;
|
|
6240
|
+
}
|
|
6241
|
+
return a.every((value, index) => value === b[index]);
|
|
6242
|
+
};
|
|
6243
|
+
var formatTimestamp = (value) => {
|
|
6244
|
+
if (!value) {
|
|
6245
|
+
return "Not set";
|
|
6246
|
+
}
|
|
6247
|
+
const parsed = Date.parse(value);
|
|
6248
|
+
if (Number.isNaN(parsed)) {
|
|
6249
|
+
return value;
|
|
6250
|
+
}
|
|
6251
|
+
return new Date(parsed).toLocaleString();
|
|
6252
|
+
};
|
|
6253
|
+
var formatFileSize2 = (bytes) => {
|
|
6254
|
+
if (bytes === 0) return "0 B";
|
|
6255
|
+
const k = 1024;
|
|
6256
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
6257
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
6258
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
6259
|
+
};
|
|
6260
|
+
var getPreviewSnippet = (content) => {
|
|
6261
|
+
const trimmed = content.trim();
|
|
6262
|
+
if (!trimmed) {
|
|
6263
|
+
return "No preview available";
|
|
6264
|
+
}
|
|
6265
|
+
return trimmed.length > 120 ? `${trimmed.slice(0, 120)}...` : trimmed;
|
|
6266
|
+
};
|
|
6267
|
+
var mergeMarkdownFiles = (existing, incoming) => {
|
|
6268
|
+
const next = [...existing];
|
|
6269
|
+
incoming.forEach((file) => {
|
|
6270
|
+
const index = next.findIndex((item) => item.name === file.name);
|
|
6271
|
+
if (index >= 0) {
|
|
6272
|
+
next[index] = file;
|
|
6273
|
+
} else {
|
|
6274
|
+
next.push(file);
|
|
6275
|
+
}
|
|
6276
|
+
});
|
|
6277
|
+
return next;
|
|
6278
|
+
};
|
|
6279
|
+
var buildMarkdownContent = (files) => {
|
|
6280
|
+
return files.map((file) => file.content.trim()).filter((content) => content.length > 0).join("\n\n---\n\n");
|
|
6281
|
+
};
|
|
6282
|
+
var readMarkdownFiles = async (files) => {
|
|
6283
|
+
const list = Array.from(files);
|
|
6284
|
+
const markdownFiles = list.filter((file) => file.name.toLowerCase().endsWith(".md"));
|
|
6285
|
+
const imported = await Promise.all(
|
|
6286
|
+
markdownFiles.map(async (file) => ({
|
|
6287
|
+
id: `${file.name}-${file.lastModified}`,
|
|
6288
|
+
name: file.name,
|
|
6289
|
+
size: file.size,
|
|
6290
|
+
content: await file.text(),
|
|
6291
|
+
lastModified: file.lastModified
|
|
6292
|
+
}))
|
|
6293
|
+
);
|
|
6294
|
+
return { imported, skipped: list.length - markdownFiles.length };
|
|
6295
|
+
};
|
|
6296
|
+
var getStatusChip = (status) => {
|
|
6297
|
+
switch (status) {
|
|
6298
|
+
case "published":
|
|
6299
|
+
return { label: "Published", color: "success" };
|
|
6300
|
+
case "archived":
|
|
6301
|
+
return { label: "Archived", color: "default" };
|
|
6302
|
+
case "draft":
|
|
6303
|
+
default:
|
|
6304
|
+
return { label: "Draft", color: "warning" };
|
|
6305
|
+
}
|
|
6306
|
+
};
|
|
6307
|
+
var getSeedPackTimestamp = (pack) => {
|
|
6308
|
+
const candidate = pack.updatedAt ?? pack.publishedAt ?? pack.createdAt;
|
|
6309
|
+
if (!candidate) {
|
|
6310
|
+
return 0;
|
|
6311
|
+
}
|
|
6312
|
+
const parsed = Date.parse(candidate);
|
|
6313
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
6314
|
+
};
|
|
6315
|
+
var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE__ */ jsx8(
|
|
6316
|
+
Card4,
|
|
6317
|
+
{
|
|
6318
|
+
sx: {
|
|
6319
|
+
position: "relative",
|
|
6320
|
+
height: { xs: 240, sm: 260, md: 280 },
|
|
6321
|
+
cursor: "pointer",
|
|
6322
|
+
transition: "all 0.3s ease-in-out",
|
|
6323
|
+
border: "1px solid",
|
|
6324
|
+
borderColor: "divider",
|
|
6325
|
+
bgcolor: "background.paper",
|
|
6326
|
+
display: "flex",
|
|
6327
|
+
flexDirection: "column",
|
|
6328
|
+
"&:hover": {
|
|
6329
|
+
boxShadow: 6,
|
|
6330
|
+
transform: "translateY(-2px)"
|
|
6331
|
+
}
|
|
6332
|
+
},
|
|
6333
|
+
onClick: onPreview,
|
|
6334
|
+
children: /* @__PURE__ */ jsxs8(
|
|
6335
|
+
CardContent4,
|
|
6336
|
+
{
|
|
6337
|
+
sx: {
|
|
6338
|
+
p: { xs: 1.5, sm: 2 },
|
|
6339
|
+
height: "100%",
|
|
6340
|
+
display: "flex",
|
|
6341
|
+
flexDirection: "column",
|
|
6342
|
+
overflow: "hidden"
|
|
6343
|
+
},
|
|
6344
|
+
children: [
|
|
6345
|
+
/* @__PURE__ */ jsxs8(
|
|
6346
|
+
Box8,
|
|
6347
|
+
{
|
|
6348
|
+
sx: {
|
|
6349
|
+
display: "flex",
|
|
6350
|
+
justifyContent: "space-between",
|
|
6351
|
+
alignItems: "flex-start",
|
|
6352
|
+
mb: 1,
|
|
6353
|
+
height: 32
|
|
6354
|
+
},
|
|
6355
|
+
children: [
|
|
6356
|
+
/* @__PURE__ */ jsx8(DescriptionIcon2, { sx: { fontSize: 32, color: "#388e3c", flexShrink: 0 } }),
|
|
6357
|
+
!isReadOnly && /* @__PURE__ */ jsx8(
|
|
6358
|
+
IconButton5,
|
|
6359
|
+
{
|
|
6360
|
+
size: "small",
|
|
6361
|
+
color: "error",
|
|
6362
|
+
onClick: (event) => {
|
|
6363
|
+
event.stopPropagation();
|
|
6364
|
+
onRemove();
|
|
6365
|
+
},
|
|
6366
|
+
sx: { width: 24, height: 24 },
|
|
6367
|
+
children: /* @__PURE__ */ jsx8(DeleteIcon3, { fontSize: "small" })
|
|
6368
|
+
}
|
|
6369
|
+
)
|
|
6370
|
+
]
|
|
6371
|
+
}
|
|
6372
|
+
),
|
|
6373
|
+
/* @__PURE__ */ jsx8(
|
|
6374
|
+
Box8,
|
|
6375
|
+
{
|
|
6376
|
+
sx: {
|
|
6377
|
+
mb: 1.5,
|
|
6378
|
+
p: { xs: 1, sm: 1.5 },
|
|
6379
|
+
borderRadius: 1.5,
|
|
6380
|
+
bgcolor: "background.paper",
|
|
6381
|
+
border: "1px solid",
|
|
6382
|
+
borderColor: "divider",
|
|
6383
|
+
overflow: "hidden",
|
|
6384
|
+
position: "relative",
|
|
6385
|
+
height: { xs: 60, sm: 70, md: 80 },
|
|
6386
|
+
display: "flex",
|
|
6387
|
+
alignItems: "center"
|
|
6388
|
+
},
|
|
6389
|
+
children: /* @__PURE__ */ jsx8(
|
|
6390
|
+
Typography8,
|
|
6391
|
+
{
|
|
6392
|
+
variant: "body2",
|
|
6393
|
+
sx: {
|
|
6394
|
+
display: "-webkit-box",
|
|
6395
|
+
WebkitLineClamp: 3,
|
|
6396
|
+
WebkitBoxOrient: "vertical",
|
|
6397
|
+
overflow: "hidden",
|
|
6398
|
+
textOverflow: "ellipsis",
|
|
6399
|
+
color: "text.secondary",
|
|
6400
|
+
lineHeight: 1.3,
|
|
6401
|
+
fontSize: "0.8rem"
|
|
6402
|
+
},
|
|
6403
|
+
children: getPreviewSnippet(file.content)
|
|
6404
|
+
}
|
|
6405
|
+
)
|
|
6406
|
+
}
|
|
6407
|
+
),
|
|
6408
|
+
/* @__PURE__ */ jsx8(Tooltip2, { title: file.name, arrow: true, children: /* @__PURE__ */ jsx8(
|
|
6409
|
+
Typography8,
|
|
6410
|
+
{
|
|
6411
|
+
variant: "body2",
|
|
6412
|
+
sx: {
|
|
6413
|
+
fontWeight: 600,
|
|
6414
|
+
whiteSpace: "nowrap",
|
|
6415
|
+
overflow: "hidden",
|
|
6416
|
+
textOverflow: "ellipsis",
|
|
6417
|
+
mb: 1,
|
|
6418
|
+
color: "text.primary",
|
|
6419
|
+
fontSize: { xs: "0.8rem", sm: "0.875rem" },
|
|
6420
|
+
height: { xs: "1.2rem", sm: "1.3rem" }
|
|
6421
|
+
},
|
|
6422
|
+
children: file.name
|
|
6423
|
+
}
|
|
6424
|
+
) }),
|
|
6425
|
+
/* @__PURE__ */ jsxs8(
|
|
6426
|
+
Box8,
|
|
6427
|
+
{
|
|
6428
|
+
sx: {
|
|
6429
|
+
display: "flex",
|
|
6430
|
+
justifyContent: "space-between",
|
|
6431
|
+
alignItems: "flex-start",
|
|
6432
|
+
mb: 1,
|
|
6433
|
+
minHeight: 40
|
|
6434
|
+
},
|
|
6435
|
+
children: [
|
|
6436
|
+
/* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", flex: 1, mr: 1 }, children: [
|
|
6437
|
+
/* @__PURE__ */ jsx8(
|
|
6438
|
+
Chip6,
|
|
6439
|
+
{
|
|
6440
|
+
icon: /* @__PURE__ */ jsx8(PersonIcon2, { sx: { fontSize: "0.9rem !important" } }),
|
|
6441
|
+
label: "Local",
|
|
6442
|
+
size: "small",
|
|
6443
|
+
sx: {
|
|
6444
|
+
bgcolor: "#388e3c20",
|
|
6445
|
+
color: "#388e3c",
|
|
6446
|
+
fontWeight: 700,
|
|
6447
|
+
fontSize: "0.75rem",
|
|
6448
|
+
border: "2px solid #388e3c60",
|
|
6449
|
+
"& .MuiChip-icon": {
|
|
6450
|
+
color: "#388e3c !important"
|
|
6451
|
+
},
|
|
6452
|
+
boxShadow: "0 2px 4px #388e3c20"
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6455
|
+
),
|
|
6456
|
+
/* @__PURE__ */ jsx8(
|
|
6457
|
+
Chip6,
|
|
6458
|
+
{
|
|
6459
|
+
icon: /* @__PURE__ */ jsx8(DescriptionIcon2, { sx: { fontSize: "0.85rem !important" } }),
|
|
6460
|
+
label: "Markdown",
|
|
6461
|
+
size: "small",
|
|
6462
|
+
sx: {
|
|
6463
|
+
bgcolor: "#388e3c15",
|
|
6464
|
+
color: "#388e3c",
|
|
6465
|
+
fontWeight: 500,
|
|
6466
|
+
fontSize: "0.65rem"
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
)
|
|
6470
|
+
] }),
|
|
6471
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", sx: { flexShrink: 0 }, children: formatFileSize2(file.size) })
|
|
6472
|
+
]
|
|
6473
|
+
}
|
|
6474
|
+
),
|
|
6475
|
+
/* @__PURE__ */ jsx8(Box8, { sx: { mt: "auto" }, children: /* @__PURE__ */ jsx8(
|
|
6476
|
+
Button7,
|
|
6477
|
+
{
|
|
6478
|
+
variant: "outlined",
|
|
6479
|
+
size: "small",
|
|
6480
|
+
fullWidth: true,
|
|
6481
|
+
sx: {
|
|
6482
|
+
textTransform: "none",
|
|
6483
|
+
height: { xs: 32, sm: 36, md: 40 },
|
|
6484
|
+
flexShrink: 0,
|
|
6485
|
+
borderWidth: 2,
|
|
6486
|
+
fontSize: { xs: "0.75rem", sm: "0.8rem", md: "0.875rem" },
|
|
6487
|
+
fontWeight: 600,
|
|
6488
|
+
"&:hover": {
|
|
6489
|
+
borderWidth: 2,
|
|
6490
|
+
bgcolor: "primary.main",
|
|
6491
|
+
color: "primary.contrastText",
|
|
6492
|
+
transform: "translateY(-1px)",
|
|
6493
|
+
boxShadow: 2
|
|
6494
|
+
}
|
|
6495
|
+
},
|
|
6496
|
+
onClick: (event) => {
|
|
6497
|
+
event.stopPropagation();
|
|
6498
|
+
onPreview();
|
|
6499
|
+
},
|
|
6500
|
+
startIcon: /* @__PURE__ */ jsx8(SearchIcon2, { sx: { fontSize: { xs: "1rem", sm: "1.1rem" } } }),
|
|
6501
|
+
children: "Preview"
|
|
6502
|
+
}
|
|
6503
|
+
) })
|
|
6504
|
+
]
|
|
6505
|
+
}
|
|
6506
|
+
)
|
|
6507
|
+
}
|
|
6508
|
+
);
|
|
6509
|
+
var SeedPacksTab = () => {
|
|
6510
|
+
const { settings } = usePackageSettingsStore();
|
|
6511
|
+
const authStore = useAuthenticationStore();
|
|
6512
|
+
const gatewayConfigured = Boolean(settings?.gatewayApiUrl);
|
|
6513
|
+
const isTeamScope = Boolean(authStore.user?.teamSid);
|
|
6514
|
+
const seedPackAdminRoles = /* @__PURE__ */ new Set(["admin", "super-user", "team_admin", "team_owner"]);
|
|
6515
|
+
const userRoles = authStore.user?.roles ?? [];
|
|
6516
|
+
const canManage = userRoles.some((role) => seedPackAdminRoles.has(role));
|
|
6517
|
+
const [seedPacks, setSeedPacks] = useState9([]);
|
|
6518
|
+
const [selectedSid, setSelectedSid] = useState9(null);
|
|
6519
|
+
const [selectedSeedPack, setSelectedSeedPack] = useState9(null);
|
|
6520
|
+
const [draft, setDraft] = useState9({
|
|
6521
|
+
name: "",
|
|
6522
|
+
description: "",
|
|
6523
|
+
content: ""
|
|
6524
|
+
});
|
|
6525
|
+
const [tagsInput, setTagsInput] = useState9("");
|
|
6526
|
+
const [importedFiles, setImportedFiles] = useState9([]);
|
|
6527
|
+
const [createImportedFiles, setCreateImportedFiles] = useState9([]);
|
|
6528
|
+
const [previewFile, setPreviewFile] = useState9(null);
|
|
6529
|
+
const fileInputRef = useRef5(null);
|
|
6530
|
+
const createFileInputRef = useRef5(null);
|
|
6531
|
+
const [isLoadingList, setIsLoadingList] = useState9(false);
|
|
6532
|
+
const [isLoadingDetail, setIsLoadingDetail] = useState9(false);
|
|
6533
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
6534
|
+
const [isPublishing, setIsPublishing] = useState9(false);
|
|
6535
|
+
const [isArchiving, setIsArchiving] = useState9(false);
|
|
6536
|
+
const [isCreating, setIsCreating] = useState9(false);
|
|
6537
|
+
const [createDialogOpen, setCreateDialogOpen] = useState9(false);
|
|
6538
|
+
const [publishDialogOpen, setPublishDialogOpen] = useState9(false);
|
|
6539
|
+
const [archiveDialogOpen, setArchiveDialogOpen] = useState9(false);
|
|
6540
|
+
const [newPackName, setNewPackName] = useState9("");
|
|
6541
|
+
const [newPackDescription, setNewPackDescription] = useState9("");
|
|
6542
|
+
const [newPackTags, setNewPackTags] = useState9("");
|
|
6543
|
+
const [snackbarOpen, setSnackbarOpen] = useState9(false);
|
|
6544
|
+
const [snackbarMessage, setSnackbarMessage] = useState9("");
|
|
6545
|
+
const [snackbarSeverity, setSnackbarSeverity] = useState9("success");
|
|
6546
|
+
const parsedTags = useMemo3(() => parseTags(tagsInput), [tagsInput]);
|
|
6547
|
+
const normalizedSelectedTags = useMemo3(
|
|
6548
|
+
() => normalizeTags(selectedSeedPack?.tags),
|
|
6549
|
+
[selectedSeedPack?.tags]
|
|
6550
|
+
);
|
|
6551
|
+
const isDirty = useMemo3(() => {
|
|
6552
|
+
if (!selectedSeedPack) {
|
|
6553
|
+
return false;
|
|
6554
|
+
}
|
|
6555
|
+
const nameChanged = draft.name.trim() !== (selectedSeedPack.name ?? "").trim();
|
|
6556
|
+
const descriptionChanged = draft.description.trim() !== (selectedSeedPack.description ?? "").trim();
|
|
6557
|
+
const contentChanged = draft.content !== (selectedSeedPack.content ?? "");
|
|
6558
|
+
const tagsChanged = !areArraysEqual(parsedTags, normalizedSelectedTags);
|
|
6559
|
+
return nameChanged || descriptionChanged || contentChanged || tagsChanged;
|
|
6560
|
+
}, [draft, parsedTags, normalizedSelectedTags, selectedSeedPack]);
|
|
6561
|
+
const isReadOnly = !canManage || selectedSeedPack?.status === "archived";
|
|
6562
|
+
const sortedSeedPacks = useMemo3(() => {
|
|
6563
|
+
return [...seedPacks].sort((a, b) => getSeedPackTimestamp(b) - getSeedPackTimestamp(a));
|
|
6564
|
+
}, [seedPacks]);
|
|
6565
|
+
const scopeLabel = isTeamScope ? "Team scope" : "Personal scope";
|
|
6566
|
+
const scopeDescription = isTeamScope ? "Applies to all members of your team." : "Applies only to your account.";
|
|
6567
|
+
const showSnackbar = useCallback6((message, severity) => {
|
|
6568
|
+
setSnackbarMessage(message);
|
|
6569
|
+
setSnackbarSeverity(severity);
|
|
6570
|
+
setSnackbarOpen(true);
|
|
6571
|
+
}, []);
|
|
6572
|
+
const hydrateDraft = useCallback6((pack) => {
|
|
6573
|
+
setDraft({
|
|
6574
|
+
name: pack.name ?? "",
|
|
6575
|
+
description: pack.description ?? "",
|
|
6576
|
+
content: pack.content ?? ""
|
|
6577
|
+
});
|
|
6578
|
+
setTagsInput((pack.tags ?? []).join(", "));
|
|
6579
|
+
setImportedFiles([]);
|
|
6580
|
+
setPreviewFile(null);
|
|
6581
|
+
}, []);
|
|
6582
|
+
const resetCreateDialog = useCallback6(() => {
|
|
6583
|
+
setCreateDialogOpen(false);
|
|
6584
|
+
setNewPackName("");
|
|
6585
|
+
setNewPackDescription("");
|
|
6586
|
+
setNewPackTags("");
|
|
6587
|
+
setCreateImportedFiles([]);
|
|
6588
|
+
}, []);
|
|
6589
|
+
const refreshSeedPacks = useCallback6(
|
|
6590
|
+
async (nextSelectedSid) => {
|
|
6591
|
+
if (!gatewayConfigured) {
|
|
6592
|
+
return;
|
|
6593
|
+
}
|
|
6594
|
+
setIsLoadingList(true);
|
|
6595
|
+
try {
|
|
6596
|
+
const packs = await listSeedPacks();
|
|
6597
|
+
setSeedPacks(packs);
|
|
6598
|
+
const activeSid = nextSelectedSid ?? selectedSid;
|
|
6599
|
+
if (activeSid && !packs.some((pack) => pack.sid === activeSid)) {
|
|
6600
|
+
setSelectedSid(null);
|
|
6601
|
+
setSelectedSeedPack(null);
|
|
6602
|
+
}
|
|
6603
|
+
} catch (error) {
|
|
6604
|
+
showSnackbar("Failed to load seed packs.", "error");
|
|
6605
|
+
debugLogger.error("SeedPacksTab: failed to load seed packs", {
|
|
6606
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6607
|
+
});
|
|
6608
|
+
} finally {
|
|
6609
|
+
setIsLoadingList(false);
|
|
6610
|
+
}
|
|
6611
|
+
},
|
|
6612
|
+
[gatewayConfigured, selectedSid, showSnackbar]
|
|
6613
|
+
);
|
|
6614
|
+
const loadSeedPackDetail = useCallback6(
|
|
6615
|
+
async (sid) => {
|
|
6616
|
+
if (!gatewayConfigured) {
|
|
6617
|
+
return;
|
|
6618
|
+
}
|
|
6619
|
+
setIsLoadingDetail(true);
|
|
6620
|
+
try {
|
|
6621
|
+
const pack = await getSeedPack(sid);
|
|
6622
|
+
setSelectedSeedPack(pack);
|
|
6623
|
+
hydrateDraft(pack);
|
|
6624
|
+
} catch (error) {
|
|
6625
|
+
showSnackbar("Failed to load seed pack details.", "error");
|
|
6626
|
+
debugLogger.error("SeedPacksTab: failed to load seed pack details", {
|
|
6627
|
+
sid,
|
|
6628
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6629
|
+
});
|
|
6630
|
+
} finally {
|
|
6631
|
+
setIsLoadingDetail(false);
|
|
6632
|
+
}
|
|
6633
|
+
},
|
|
6634
|
+
[gatewayConfigured, hydrateDraft, showSnackbar]
|
|
6635
|
+
);
|
|
6636
|
+
useEffect6(() => {
|
|
6637
|
+
void refreshSeedPacks();
|
|
6638
|
+
}, [refreshSeedPacks, authStore.token]);
|
|
6639
|
+
useEffect6(() => {
|
|
6640
|
+
if (selectedSid) {
|
|
6641
|
+
void loadSeedPackDetail(selectedSid);
|
|
6642
|
+
}
|
|
6643
|
+
}, [selectedSid, loadSeedPackDetail]);
|
|
6644
|
+
const handleSelectPack = (pack) => {
|
|
6645
|
+
setSelectedSid(pack.sid);
|
|
6646
|
+
setSelectedSeedPack(pack);
|
|
6647
|
+
hydrateDraft(pack);
|
|
6648
|
+
};
|
|
6649
|
+
const handleImportFiles = useCallback6(
|
|
6650
|
+
async (files) => {
|
|
6651
|
+
if (!files || files.length === 0) {
|
|
6652
|
+
return;
|
|
6653
|
+
}
|
|
6654
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
6655
|
+
if (skipped > 0) {
|
|
6656
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
6657
|
+
}
|
|
6658
|
+
if (imported.length === 0) {
|
|
6659
|
+
return;
|
|
6660
|
+
}
|
|
6661
|
+
try {
|
|
6662
|
+
const newlyAdded = imported.filter(
|
|
6663
|
+
(file) => !importedFiles.some((existing) => existing.name === file.name)
|
|
6664
|
+
);
|
|
6665
|
+
setImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
6666
|
+
const combined = buildMarkdownContent(newlyAdded);
|
|
6667
|
+
if (combined.length > 0) {
|
|
6668
|
+
setDraft((prev) => {
|
|
6669
|
+
const current = prev.content.trim();
|
|
6670
|
+
const nextContent = current ? `${current}
|
|
6671
|
+
|
|
6672
|
+
---
|
|
6673
|
+
|
|
6674
|
+
${combined}` : combined;
|
|
6675
|
+
return { ...prev, content: nextContent };
|
|
6676
|
+
});
|
|
6677
|
+
}
|
|
6678
|
+
showSnackbar(
|
|
6679
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} into the editor.`,
|
|
6680
|
+
"success"
|
|
6681
|
+
);
|
|
6682
|
+
} catch (error) {
|
|
6683
|
+
showSnackbar("Failed to import markdown files.", "error");
|
|
6684
|
+
debugLogger.error("SeedPacksTab: failed to import markdown files", {
|
|
6685
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6686
|
+
});
|
|
6687
|
+
}
|
|
6688
|
+
},
|
|
6689
|
+
[importedFiles, showSnackbar]
|
|
6690
|
+
);
|
|
6691
|
+
const handleFileInputChange = useCallback6(
|
|
6692
|
+
async (event) => {
|
|
6693
|
+
await handleImportFiles(event.target.files);
|
|
6694
|
+
event.target.value = "";
|
|
6695
|
+
},
|
|
6696
|
+
[handleImportFiles]
|
|
6697
|
+
);
|
|
6698
|
+
const handleRemoveImportedFile = useCallback6((id) => {
|
|
6699
|
+
setImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
6700
|
+
}, []);
|
|
6701
|
+
const handleCreateImportFiles = useCallback6(
|
|
6702
|
+
async (files) => {
|
|
6703
|
+
if (!files || files.length === 0) {
|
|
6704
|
+
return;
|
|
6705
|
+
}
|
|
6706
|
+
const { imported, skipped } = await readMarkdownFiles(files);
|
|
6707
|
+
if (skipped > 0) {
|
|
6708
|
+
showSnackbar("Only .md files are supported for seed packs.", "error");
|
|
6709
|
+
}
|
|
6710
|
+
if (imported.length === 0) {
|
|
6711
|
+
return;
|
|
6712
|
+
}
|
|
6713
|
+
setCreateImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
|
|
6714
|
+
showSnackbar(
|
|
6715
|
+
`Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} for this seed pack.`,
|
|
6716
|
+
"success"
|
|
6717
|
+
);
|
|
6718
|
+
},
|
|
6719
|
+
[showSnackbar]
|
|
6720
|
+
);
|
|
6721
|
+
const handleCreateFileInputChange = useCallback6(
|
|
6722
|
+
async (event) => {
|
|
6723
|
+
await handleCreateImportFiles(event.target.files);
|
|
6724
|
+
event.target.value = "";
|
|
6725
|
+
},
|
|
6726
|
+
[handleCreateImportFiles]
|
|
6727
|
+
);
|
|
6728
|
+
const handleRemoveCreateImportedFile = useCallback6((id) => {
|
|
6729
|
+
setCreateImportedFiles((prev) => prev.filter((file) => file.id !== id));
|
|
6730
|
+
}, []);
|
|
6731
|
+
const buildDraftPayload2 = useCallback6(() => {
|
|
6732
|
+
const name = draft.name.trim();
|
|
6733
|
+
if (!name) {
|
|
6734
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
6735
|
+
return null;
|
|
6736
|
+
}
|
|
6737
|
+
return {
|
|
6738
|
+
name,
|
|
6739
|
+
description: draft.description.trim(),
|
|
6740
|
+
content: draft.content,
|
|
6741
|
+
tags: parsedTags,
|
|
6742
|
+
contentType: "markdown"
|
|
6743
|
+
};
|
|
6744
|
+
}, [draft, parsedTags, showSnackbar]);
|
|
6745
|
+
const saveDraft = useCallback6(async () => {
|
|
6746
|
+
if (!selectedSeedPack) {
|
|
6747
|
+
return null;
|
|
6748
|
+
}
|
|
6749
|
+
const payload = buildDraftPayload2();
|
|
6750
|
+
if (!payload) {
|
|
6751
|
+
return null;
|
|
6752
|
+
}
|
|
6753
|
+
setIsSaving(true);
|
|
6754
|
+
try {
|
|
6755
|
+
const updated = await updateSeedPack(selectedSeedPack.sid, payload);
|
|
6756
|
+
setSelectedSeedPack(updated);
|
|
6757
|
+
hydrateDraft(updated);
|
|
6758
|
+
await refreshSeedPacks(updated.sid);
|
|
6759
|
+
return updated;
|
|
6760
|
+
} catch (error) {
|
|
6761
|
+
showSnackbar("Failed to save seed pack.", "error");
|
|
6762
|
+
debugLogger.error("SeedPacksTab: failed to save seed pack", {
|
|
6763
|
+
sid: selectedSeedPack.sid,
|
|
6764
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6765
|
+
});
|
|
6766
|
+
return null;
|
|
6767
|
+
} finally {
|
|
6768
|
+
setIsSaving(false);
|
|
6769
|
+
}
|
|
6770
|
+
}, [selectedSeedPack, buildDraftPayload2, hydrateDraft, refreshSeedPacks, showSnackbar]);
|
|
6771
|
+
const handleSaveDraft = async () => {
|
|
6772
|
+
const updated = await saveDraft();
|
|
6773
|
+
if (updated) {
|
|
6774
|
+
showSnackbar("Seed pack saved.", "success");
|
|
6775
|
+
}
|
|
6776
|
+
};
|
|
6777
|
+
const handleResetDraft = () => {
|
|
6778
|
+
if (selectedSeedPack) {
|
|
6779
|
+
hydrateDraft(selectedSeedPack);
|
|
6780
|
+
}
|
|
6781
|
+
};
|
|
6782
|
+
const handleCreateSeedPack = async () => {
|
|
6783
|
+
const name = newPackName.trim();
|
|
6784
|
+
if (!name) {
|
|
6785
|
+
showSnackbar("Seed pack name is required.", "error");
|
|
6786
|
+
return;
|
|
6787
|
+
}
|
|
6788
|
+
const importedContent = buildMarkdownContent(createImportedFiles);
|
|
6789
|
+
const payload = {
|
|
6790
|
+
name,
|
|
6791
|
+
description: newPackDescription.trim(),
|
|
6792
|
+
tags: parseTags(newPackTags),
|
|
6793
|
+
content: importedContent,
|
|
6794
|
+
contentType: "markdown"
|
|
6795
|
+
};
|
|
6796
|
+
setIsCreating(true);
|
|
6797
|
+
try {
|
|
6798
|
+
const created = await createSeedPack(payload);
|
|
6799
|
+
resetCreateDialog();
|
|
6800
|
+
await refreshSeedPacks(created.sid);
|
|
6801
|
+
setSelectedSid(created.sid);
|
|
6802
|
+
setSelectedSeedPack(created);
|
|
6803
|
+
hydrateDraft(created);
|
|
6804
|
+
if (createImportedFiles.length > 0) {
|
|
6805
|
+
setImportedFiles(createImportedFiles);
|
|
6806
|
+
}
|
|
6807
|
+
setCreateImportedFiles([]);
|
|
6808
|
+
showSnackbar("Seed pack created.", "success");
|
|
6809
|
+
} catch (error) {
|
|
6810
|
+
showSnackbar("Failed to create seed pack.", "error");
|
|
6811
|
+
debugLogger.error("SeedPacksTab: failed to create seed pack", {
|
|
6812
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6813
|
+
});
|
|
6814
|
+
} finally {
|
|
6815
|
+
setIsCreating(false);
|
|
6816
|
+
}
|
|
6817
|
+
};
|
|
6818
|
+
const handlePublish = async () => {
|
|
6819
|
+
if (!selectedSeedPack) {
|
|
6820
|
+
return;
|
|
6821
|
+
}
|
|
6822
|
+
setPublishDialogOpen(false);
|
|
6823
|
+
setIsPublishing(true);
|
|
6824
|
+
try {
|
|
6825
|
+
if (isDirty) {
|
|
6826
|
+
const saved = await saveDraft();
|
|
6827
|
+
if (!saved) {
|
|
6828
|
+
return;
|
|
6829
|
+
}
|
|
6830
|
+
}
|
|
6831
|
+
const published = await publishSeedPack(selectedSeedPack.sid);
|
|
6832
|
+
setSelectedSeedPack(published);
|
|
6833
|
+
hydrateDraft(published);
|
|
6834
|
+
await refreshSeedPacks(published.sid);
|
|
6835
|
+
showSnackbar("Seed pack published.", "success");
|
|
6836
|
+
} catch (error) {
|
|
6837
|
+
showSnackbar("Failed to publish seed pack.", "error");
|
|
6838
|
+
debugLogger.error("SeedPacksTab: failed to publish seed pack", {
|
|
6839
|
+
sid: selectedSeedPack.sid,
|
|
6840
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6841
|
+
});
|
|
6842
|
+
} finally {
|
|
6843
|
+
setIsPublishing(false);
|
|
6844
|
+
}
|
|
6845
|
+
};
|
|
6846
|
+
const handleArchive = async () => {
|
|
6847
|
+
if (!selectedSeedPack) {
|
|
6848
|
+
return;
|
|
6849
|
+
}
|
|
6850
|
+
setArchiveDialogOpen(false);
|
|
6851
|
+
setIsArchiving(true);
|
|
6852
|
+
try {
|
|
6853
|
+
const archived = await archiveSeedPack(selectedSeedPack.sid);
|
|
6854
|
+
setSelectedSeedPack(archived);
|
|
6855
|
+
hydrateDraft(archived);
|
|
6856
|
+
await refreshSeedPacks(archived.sid);
|
|
6857
|
+
showSnackbar("Seed pack archived.", "success");
|
|
6858
|
+
} catch (error) {
|
|
6859
|
+
showSnackbar("Failed to archive seed pack.", "error");
|
|
6860
|
+
debugLogger.error("SeedPacksTab: failed to archive seed pack", {
|
|
6861
|
+
sid: selectedSeedPack.sid,
|
|
6862
|
+
error: error instanceof Error ? error.message : String(error)
|
|
6863
|
+
});
|
|
6864
|
+
} finally {
|
|
6865
|
+
setIsArchiving(false);
|
|
6866
|
+
}
|
|
6867
|
+
};
|
|
6868
|
+
const previewContent = draft.content.trim().length > 0 ? draft.content : "Preview will appear here as you type.";
|
|
6869
|
+
const selectedStatus = selectedSeedPack?.status ?? "draft";
|
|
6870
|
+
const statusChip = getStatusChip(selectedStatus);
|
|
6871
|
+
return /* @__PURE__ */ jsxs8(Box8, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
6872
|
+
/* @__PURE__ */ jsxs8(Box8, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
6873
|
+
/* @__PURE__ */ jsxs8(
|
|
6874
|
+
Stack3,
|
|
6875
|
+
{
|
|
6876
|
+
direction: { xs: "column", md: "row" },
|
|
6877
|
+
spacing: { xs: 1.5, md: 2 },
|
|
6878
|
+
alignItems: { xs: "flex-start", md: "center" },
|
|
6879
|
+
justifyContent: "space-between",
|
|
6880
|
+
children: [
|
|
6881
|
+
/* @__PURE__ */ jsxs8(Box8, { children: [
|
|
6882
|
+
/* @__PURE__ */ jsx8(
|
|
6883
|
+
Typography8,
|
|
6884
|
+
{
|
|
6885
|
+
variant: "h5",
|
|
6886
|
+
color: "text.primary",
|
|
6887
|
+
sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.55rem", md: "1.8rem" } },
|
|
6888
|
+
children: "Seed Packs"
|
|
6889
|
+
}
|
|
6890
|
+
),
|
|
6891
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "body1", color: "text.secondary", children: "Curated internal knowledge that is always available to assistants, without showing up as visible sources." })
|
|
6892
|
+
] }),
|
|
6893
|
+
/* @__PURE__ */ jsx8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: /* @__PURE__ */ jsx8(
|
|
6894
|
+
Chip6,
|
|
6895
|
+
{
|
|
6896
|
+
icon: isTeamScope ? /* @__PURE__ */ jsx8(GroupIcon2, {}) : /* @__PURE__ */ jsx8(PersonIcon2, {}),
|
|
6897
|
+
label: scopeLabel,
|
|
6898
|
+
color: "info",
|
|
6899
|
+
variant: "outlined"
|
|
6900
|
+
}
|
|
6901
|
+
) })
|
|
6902
|
+
]
|
|
6903
|
+
}
|
|
6904
|
+
),
|
|
6905
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", children: scopeDescription })
|
|
6906
|
+
] }),
|
|
6907
|
+
!gatewayConfigured && /* @__PURE__ */ jsx8(Alert7, { severity: "warning", sx: { mb: 2 }, children: "Gateway API is not configured. Seed packs require a gateway URL in package settings." }),
|
|
6908
|
+
gatewayConfigured && !canManage && /* @__PURE__ */ jsx8(Alert7, { severity: "info", sx: { mb: 2 }, children: "You have view-only access. Admin rights are required to create, publish, or archive team seed packs." }),
|
|
6909
|
+
/* @__PURE__ */ jsxs8(
|
|
6910
|
+
Box8,
|
|
6911
|
+
{
|
|
6912
|
+
sx: {
|
|
6913
|
+
display: "grid",
|
|
6914
|
+
gridTemplateColumns: { xs: "1fr", md: "320px 1fr" },
|
|
6915
|
+
gap: { xs: 2, md: 3 }
|
|
6916
|
+
},
|
|
6917
|
+
children: [
|
|
6918
|
+
/* @__PURE__ */ jsxs8(Card4, { sx: { height: "fit-content" }, children: [
|
|
6919
|
+
/* @__PURE__ */ jsx8(CardContent4, { sx: { pb: 1.5 }, children: /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
6920
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "h6", sx: { fontWeight: 600 }, children: "Packs" }),
|
|
6921
|
+
/* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, children: [
|
|
6922
|
+
/* @__PURE__ */ jsx8(
|
|
6923
|
+
Button7,
|
|
6924
|
+
{
|
|
6925
|
+
size: "small",
|
|
6926
|
+
variant: "outlined",
|
|
6927
|
+
onClick: () => refreshSeedPacks(),
|
|
6928
|
+
startIcon: /* @__PURE__ */ jsx8(RefreshIcon2, {}),
|
|
6929
|
+
disabled: !gatewayConfigured || isLoadingList,
|
|
6930
|
+
children: "Refresh"
|
|
6931
|
+
}
|
|
6932
|
+
),
|
|
6933
|
+
canManage && /* @__PURE__ */ jsx8(
|
|
6934
|
+
Button7,
|
|
6935
|
+
{
|
|
6936
|
+
size: "small",
|
|
6937
|
+
variant: "contained",
|
|
6938
|
+
startIcon: /* @__PURE__ */ jsx8(AddIcon, {}),
|
|
6939
|
+
onClick: () => setCreateDialogOpen(true),
|
|
6940
|
+
disabled: !gatewayConfigured,
|
|
6941
|
+
children: "New"
|
|
6942
|
+
}
|
|
6943
|
+
)
|
|
6944
|
+
] })
|
|
6945
|
+
] }) }),
|
|
6946
|
+
/* @__PURE__ */ jsx8(Divider, {}),
|
|
6947
|
+
/* @__PURE__ */ jsxs8(Box8, { sx: { px: 2, pb: 2 }, children: [
|
|
6948
|
+
isLoadingList && /* @__PURE__ */ jsx8(LinearProgress3, { sx: { mb: 2 } }),
|
|
6949
|
+
sortedSeedPacks.length === 0 ? /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: "No seed packs yet. Create one to start sharing internal knowledge." }) : /* @__PURE__ */ jsx8(List, { sx: { px: 0 }, children: sortedSeedPacks.map((pack) => {
|
|
6950
|
+
const status = getStatusChip(pack.status);
|
|
6951
|
+
const tags = normalizeTags(pack.tags);
|
|
6952
|
+
return /* @__PURE__ */ jsx8(
|
|
6953
|
+
ListItemButton,
|
|
6954
|
+
{
|
|
6955
|
+
selected: pack.sid === selectedSid,
|
|
6956
|
+
onClick: () => handleSelectPack(pack),
|
|
6957
|
+
sx: {
|
|
6958
|
+
mb: 1,
|
|
6959
|
+
borderRadius: 2,
|
|
6960
|
+
alignItems: "flex-start",
|
|
6961
|
+
border: pack.sid === selectedSid ? "1px solid" : "1px solid transparent",
|
|
6962
|
+
borderColor: pack.sid === selectedSid ? "primary.main" : "transparent"
|
|
6963
|
+
},
|
|
6964
|
+
children: /* @__PURE__ */ jsxs8(Box8, { sx: { flex: 1 }, children: [
|
|
6965
|
+
/* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", sx: { mb: 0.5 }, children: [
|
|
6966
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle1", sx: { fontWeight: 600 }, children: pack.name }),
|
|
6967
|
+
/* @__PURE__ */ jsx8(Chip6, { size: "small", label: status.label, color: status.color })
|
|
6968
|
+
] }),
|
|
6969
|
+
/* @__PURE__ */ jsxs8(Typography8, { variant: "caption", color: "text.secondary", children: [
|
|
6970
|
+
pack.version ? `v${pack.version}` : "v0",
|
|
6971
|
+
" | Last published:",
|
|
6972
|
+
" ",
|
|
6973
|
+
formatTimestamp(pack.publishedAt)
|
|
6974
|
+
] }),
|
|
6975
|
+
tags.length > 0 && /* @__PURE__ */ jsx8(Stack3, { direction: "row", spacing: 0.5, flexWrap: "wrap", sx: { mt: 1 }, children: tags.map((tag) => /* @__PURE__ */ jsx8(Chip6, { size: "small", label: tag, variant: "outlined" }, tag)) })
|
|
6976
|
+
] })
|
|
6977
|
+
},
|
|
6978
|
+
pack.sid
|
|
6979
|
+
);
|
|
6980
|
+
}) })
|
|
6981
|
+
] })
|
|
6982
|
+
] }),
|
|
6983
|
+
/* @__PURE__ */ jsx8(Card4, { children: /* @__PURE__ */ jsxs8(CardContent4, { children: [
|
|
6984
|
+
/* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
6985
|
+
/* @__PURE__ */ jsxs8(Box8, { children: [
|
|
6986
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "h6", sx: { fontWeight: 600 }, children: selectedSeedPack ? "Seed Pack Editor" : "Seed Pack Details" }),
|
|
6987
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: "Draft content stays internal and is never shown as user-facing sources." })
|
|
6988
|
+
] }),
|
|
6989
|
+
selectedSeedPack && /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
6990
|
+
isDirty && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: "Unsaved changes", color: "warning" }),
|
|
6991
|
+
/* @__PURE__ */ jsx8(Chip6, { size: "small", label: statusChip.label, color: statusChip.color })
|
|
6992
|
+
] })
|
|
6993
|
+
] }),
|
|
6994
|
+
/* @__PURE__ */ jsx8(Divider, { sx: { my: 2 } }),
|
|
6995
|
+
!selectedSeedPack && /* @__PURE__ */ jsxs8(Box8, { children: [
|
|
6996
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Select a seed pack from the list or create a new one to begin editing." }),
|
|
6997
|
+
canManage && /* @__PURE__ */ jsx8(
|
|
6998
|
+
Button7,
|
|
6999
|
+
{
|
|
7000
|
+
variant: "contained",
|
|
7001
|
+
startIcon: /* @__PURE__ */ jsx8(AddIcon, {}),
|
|
7002
|
+
onClick: () => setCreateDialogOpen(true),
|
|
7003
|
+
disabled: !gatewayConfigured,
|
|
7004
|
+
children: "Create seed pack"
|
|
7005
|
+
}
|
|
7006
|
+
)
|
|
7007
|
+
] }),
|
|
7008
|
+
selectedSeedPack && /* @__PURE__ */ jsxs8(Stack3, { spacing: 2, children: [
|
|
7009
|
+
isLoadingDetail && /* @__PURE__ */ jsx8(LinearProgress3, {}),
|
|
7010
|
+
/* @__PURE__ */ jsx8(
|
|
7011
|
+
TextField5,
|
|
7012
|
+
{
|
|
7013
|
+
label: "Name",
|
|
7014
|
+
value: draft.name,
|
|
7015
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, name: event.target.value })),
|
|
7016
|
+
fullWidth: true,
|
|
7017
|
+
disabled: isReadOnly
|
|
7018
|
+
}
|
|
7019
|
+
),
|
|
7020
|
+
/* @__PURE__ */ jsx8(
|
|
7021
|
+
TextField5,
|
|
7022
|
+
{
|
|
7023
|
+
label: "Description",
|
|
7024
|
+
value: draft.description,
|
|
7025
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, description: event.target.value })),
|
|
7026
|
+
fullWidth: true,
|
|
7027
|
+
multiline: true,
|
|
7028
|
+
minRows: 2,
|
|
7029
|
+
disabled: isReadOnly
|
|
7030
|
+
}
|
|
7031
|
+
),
|
|
7032
|
+
/* @__PURE__ */ jsx8(
|
|
7033
|
+
TextField5,
|
|
7034
|
+
{
|
|
7035
|
+
label: "Tags (comma separated)",
|
|
7036
|
+
value: tagsInput,
|
|
7037
|
+
onChange: (event) => setTagsInput(event.target.value),
|
|
7038
|
+
fullWidth: true,
|
|
7039
|
+
disabled: isReadOnly
|
|
7040
|
+
}
|
|
7041
|
+
),
|
|
7042
|
+
/* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
|
|
7043
|
+
/* @__PURE__ */ jsx8(Chip6, { size: "small", label: scopeLabel, icon: isTeamScope ? /* @__PURE__ */ jsx8(GroupIcon2, {}) : /* @__PURE__ */ jsx8(PersonIcon2, {}) }),
|
|
7044
|
+
selectedSeedPack.version && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: `Version ${selectedSeedPack.version}`, variant: "outlined" }),
|
|
7045
|
+
selectedSeedPack.updatedAt && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: `Updated ${formatTimestamp(selectedSeedPack.updatedAt)}`, variant: "outlined" })
|
|
7046
|
+
] }),
|
|
7047
|
+
/* @__PURE__ */ jsx8(Alert7, { severity: "info", children: "Treat seed pack content as internal knowledge. Do not include instructions that override system or developer messages." }),
|
|
7048
|
+
/* @__PURE__ */ jsxs8(
|
|
7049
|
+
Box8,
|
|
7050
|
+
{
|
|
7051
|
+
sx: {
|
|
7052
|
+
display: "grid",
|
|
7053
|
+
gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" },
|
|
7054
|
+
gap: 2,
|
|
7055
|
+
alignItems: "start"
|
|
7056
|
+
},
|
|
7057
|
+
children: [
|
|
7058
|
+
/* @__PURE__ */ jsxs8(Box8, { children: [
|
|
7059
|
+
/* @__PURE__ */ jsxs8(
|
|
7060
|
+
Stack3,
|
|
7061
|
+
{
|
|
7062
|
+
direction: { xs: "column", sm: "row" },
|
|
7063
|
+
spacing: 1,
|
|
7064
|
+
alignItems: { xs: "flex-start", sm: "center" },
|
|
7065
|
+
justifyContent: "space-between",
|
|
7066
|
+
sx: { mb: 1 },
|
|
7067
|
+
children: [
|
|
7068
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", children: "Markdown content" }),
|
|
7069
|
+
/* @__PURE__ */ jsx8(
|
|
7070
|
+
Button7,
|
|
7071
|
+
{
|
|
7072
|
+
size: "small",
|
|
7073
|
+
variant: "outlined",
|
|
7074
|
+
startIcon: /* @__PURE__ */ jsx8(UploadFileIcon2, {}),
|
|
7075
|
+
onClick: () => fileInputRef.current?.click(),
|
|
7076
|
+
disabled: isReadOnly,
|
|
7077
|
+
children: "Import .md"
|
|
7078
|
+
}
|
|
7079
|
+
),
|
|
7080
|
+
/* @__PURE__ */ jsx8(
|
|
7081
|
+
"input",
|
|
7082
|
+
{
|
|
7083
|
+
ref: fileInputRef,
|
|
7084
|
+
type: "file",
|
|
7085
|
+
accept: ".md",
|
|
7086
|
+
multiple: true,
|
|
7087
|
+
onChange: handleFileInputChange,
|
|
7088
|
+
style: { display: "none" }
|
|
7089
|
+
}
|
|
7090
|
+
)
|
|
7091
|
+
]
|
|
7092
|
+
}
|
|
7093
|
+
),
|
|
7094
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", sx: { mb: 1, display: "block" }, children: "Paste or import markdown files. Imports copy content into the editor." }),
|
|
7095
|
+
/* @__PURE__ */ jsx8(
|
|
7096
|
+
TextField5,
|
|
7097
|
+
{
|
|
7098
|
+
label: "Content",
|
|
7099
|
+
value: draft.content,
|
|
7100
|
+
onChange: (event) => setDraft((prev) => ({ ...prev, content: event.target.value })),
|
|
7101
|
+
fullWidth: true,
|
|
7102
|
+
multiline: true,
|
|
7103
|
+
minRows: 12,
|
|
7104
|
+
disabled: isReadOnly
|
|
7105
|
+
}
|
|
7106
|
+
),
|
|
7107
|
+
importedFiles.length > 0 && /* @__PURE__ */ jsxs8(Box8, { sx: { mt: 2 }, children: [
|
|
7108
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
7109
|
+
/* @__PURE__ */ jsx8(
|
|
7110
|
+
Box8,
|
|
7111
|
+
{
|
|
7112
|
+
sx: {
|
|
7113
|
+
display: "grid",
|
|
7114
|
+
gridTemplateColumns: {
|
|
7115
|
+
xs: "1fr",
|
|
7116
|
+
sm: "repeat(2, minmax(0, 1fr))",
|
|
7117
|
+
md: "repeat(3, minmax(0, 1fr))"
|
|
7118
|
+
},
|
|
7119
|
+
gap: 2
|
|
7120
|
+
},
|
|
7121
|
+
children: importedFiles.map((file) => /* @__PURE__ */ jsx8(
|
|
7122
|
+
SeedPackFileCard,
|
|
7123
|
+
{
|
|
7124
|
+
file,
|
|
7125
|
+
isReadOnly,
|
|
7126
|
+
onPreview: () => setPreviewFile(file),
|
|
7127
|
+
onRemove: () => handleRemoveImportedFile(file.id)
|
|
7128
|
+
},
|
|
7129
|
+
file.id
|
|
7130
|
+
))
|
|
7131
|
+
}
|
|
7132
|
+
)
|
|
7133
|
+
] })
|
|
7134
|
+
] }),
|
|
7135
|
+
/* @__PURE__ */ jsx8(Card4, { variant: "outlined", children: /* @__PURE__ */ jsxs8(CardContent4, { children: [
|
|
7136
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Preview" }),
|
|
7137
|
+
/* @__PURE__ */ jsx8(StreamingMarkdown_default, { content: previewContent })
|
|
7138
|
+
] }) })
|
|
7139
|
+
]
|
|
7140
|
+
}
|
|
7141
|
+
),
|
|
7142
|
+
selectedSeedPack.summary && /* @__PURE__ */ jsx8(
|
|
7143
|
+
TextField5,
|
|
7144
|
+
{
|
|
7145
|
+
label: "Summary (auto-generated)",
|
|
7146
|
+
value: selectedSeedPack.summary,
|
|
7147
|
+
fullWidth: true,
|
|
7148
|
+
multiline: true,
|
|
7149
|
+
minRows: 3,
|
|
7150
|
+
InputProps: { readOnly: true }
|
|
7151
|
+
}
|
|
7152
|
+
),
|
|
7153
|
+
canManage && /* @__PURE__ */ jsxs8(Stack3, { direction: { xs: "column", sm: "row" }, spacing: 1, flexWrap: "wrap", children: [
|
|
7154
|
+
/* @__PURE__ */ jsx8(
|
|
7155
|
+
Button7,
|
|
7156
|
+
{
|
|
7157
|
+
variant: "outlined",
|
|
7158
|
+
startIcon: /* @__PURE__ */ jsx8(SaveIcon2, {}),
|
|
7159
|
+
onClick: handleSaveDraft,
|
|
7160
|
+
disabled: isReadOnly || !isDirty || isSaving,
|
|
7161
|
+
children: isSaving ? "Saving..." : "Save draft"
|
|
7162
|
+
}
|
|
7163
|
+
),
|
|
7164
|
+
/* @__PURE__ */ jsx8(
|
|
7165
|
+
Button7,
|
|
7166
|
+
{
|
|
7167
|
+
variant: "outlined",
|
|
7168
|
+
onClick: handleResetDraft,
|
|
7169
|
+
disabled: !isDirty || isReadOnly,
|
|
7170
|
+
children: "Reset changes"
|
|
7171
|
+
}
|
|
7172
|
+
),
|
|
7173
|
+
/* @__PURE__ */ jsx8(
|
|
7174
|
+
Button7,
|
|
7175
|
+
{
|
|
7176
|
+
variant: "contained",
|
|
7177
|
+
startIcon: /* @__PURE__ */ jsx8(PublishIcon, {}),
|
|
7178
|
+
onClick: () => setPublishDialogOpen(true),
|
|
7179
|
+
disabled: isReadOnly || isPublishing,
|
|
7180
|
+
children: isPublishing ? "Publishing..." : "Publish"
|
|
7181
|
+
}
|
|
7182
|
+
),
|
|
7183
|
+
/* @__PURE__ */ jsx8(
|
|
7184
|
+
Button7,
|
|
7185
|
+
{
|
|
7186
|
+
variant: "text",
|
|
7187
|
+
color: "error",
|
|
7188
|
+
startIcon: /* @__PURE__ */ jsx8(ArchiveIcon, {}),
|
|
7189
|
+
onClick: () => setArchiveDialogOpen(true),
|
|
7190
|
+
disabled: isReadOnly || isArchiving,
|
|
7191
|
+
children: isArchiving ? "Archiving..." : "Archive"
|
|
7192
|
+
}
|
|
7193
|
+
)
|
|
7194
|
+
] })
|
|
7195
|
+
] })
|
|
7196
|
+
] }) })
|
|
7197
|
+
]
|
|
7198
|
+
}
|
|
7199
|
+
),
|
|
7200
|
+
/* @__PURE__ */ jsxs8(Dialog6, { open: createDialogOpen, onClose: resetCreateDialog, maxWidth: "sm", fullWidth: true, children: [
|
|
7201
|
+
/* @__PURE__ */ jsx8(DialogTitle5, { children: "Create seed pack" }),
|
|
7202
|
+
/* @__PURE__ */ jsxs8(DialogContent6, { children: [
|
|
7203
|
+
/* @__PURE__ */ jsxs8(DialogContentText3, { sx: { mb: 2 }, children: [
|
|
7204
|
+
"Seed packs are scoped automatically based on your sign-in. ",
|
|
7205
|
+
scopeLabel,
|
|
7206
|
+
" - ",
|
|
7207
|
+
scopeDescription
|
|
7208
|
+
] }),
|
|
7209
|
+
/* @__PURE__ */ jsxs8(Stack3, { spacing: 2, children: [
|
|
7210
|
+
/* @__PURE__ */ jsx8(
|
|
7211
|
+
TextField5,
|
|
7212
|
+
{
|
|
7213
|
+
label: "Name",
|
|
7214
|
+
value: newPackName,
|
|
7215
|
+
onChange: (event) => setNewPackName(event.target.value),
|
|
7216
|
+
fullWidth: true,
|
|
7217
|
+
autoFocus: true
|
|
7218
|
+
}
|
|
7219
|
+
),
|
|
7220
|
+
/* @__PURE__ */ jsx8(
|
|
7221
|
+
TextField5,
|
|
7222
|
+
{
|
|
7223
|
+
label: "Description",
|
|
7224
|
+
value: newPackDescription,
|
|
7225
|
+
onChange: (event) => setNewPackDescription(event.target.value),
|
|
7226
|
+
fullWidth: true,
|
|
7227
|
+
multiline: true,
|
|
7228
|
+
minRows: 2
|
|
7229
|
+
}
|
|
7230
|
+
),
|
|
7231
|
+
/* @__PURE__ */ jsx8(
|
|
7232
|
+
TextField5,
|
|
7233
|
+
{
|
|
7234
|
+
label: "Tags (comma separated)",
|
|
7235
|
+
value: newPackTags,
|
|
7236
|
+
onChange: (event) => setNewPackTags(event.target.value),
|
|
7237
|
+
fullWidth: true
|
|
7238
|
+
}
|
|
7239
|
+
),
|
|
7240
|
+
/* @__PURE__ */ jsx8(Divider, {}),
|
|
7241
|
+
/* @__PURE__ */ jsxs8(Stack3, { direction: { xs: "column", sm: "row" }, spacing: 1, alignItems: "center", children: [
|
|
7242
|
+
/* @__PURE__ */ jsx8(
|
|
7243
|
+
Button7,
|
|
7244
|
+
{
|
|
7245
|
+
size: "small",
|
|
7246
|
+
variant: "outlined",
|
|
7247
|
+
startIcon: /* @__PURE__ */ jsx8(UploadFileIcon2, {}),
|
|
7248
|
+
onClick: () => createFileInputRef.current?.click(),
|
|
7249
|
+
disabled: !canManage,
|
|
7250
|
+
children: "Import .md files"
|
|
7251
|
+
}
|
|
7252
|
+
),
|
|
7253
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", children: "Optional. Files are merged into the draft content." }),
|
|
7254
|
+
/* @__PURE__ */ jsx8(
|
|
7255
|
+
"input",
|
|
7256
|
+
{
|
|
7257
|
+
ref: createFileInputRef,
|
|
7258
|
+
type: "file",
|
|
7259
|
+
accept: ".md",
|
|
7260
|
+
multiple: true,
|
|
7261
|
+
onChange: handleCreateFileInputChange,
|
|
7262
|
+
style: { display: "none" }
|
|
7263
|
+
}
|
|
7264
|
+
)
|
|
7265
|
+
] }),
|
|
7266
|
+
createImportedFiles.length > 0 && /* @__PURE__ */ jsxs8(Box8, { children: [
|
|
7267
|
+
/* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
|
|
7268
|
+
/* @__PURE__ */ jsx8(
|
|
7269
|
+
Box8,
|
|
7270
|
+
{
|
|
7271
|
+
sx: {
|
|
7272
|
+
display: "grid",
|
|
7273
|
+
gridTemplateColumns: {
|
|
7274
|
+
xs: "1fr",
|
|
7275
|
+
sm: "repeat(2, minmax(0, 1fr))"
|
|
7276
|
+
},
|
|
7277
|
+
gap: 2
|
|
7278
|
+
},
|
|
7279
|
+
children: createImportedFiles.map((file) => /* @__PURE__ */ jsx8(
|
|
7280
|
+
SeedPackFileCard,
|
|
7281
|
+
{
|
|
7282
|
+
file,
|
|
7283
|
+
isReadOnly: !canManage,
|
|
7284
|
+
onPreview: () => setPreviewFile(file),
|
|
7285
|
+
onRemove: () => handleRemoveCreateImportedFile(file.id)
|
|
7286
|
+
},
|
|
7287
|
+
file.id
|
|
7288
|
+
))
|
|
7289
|
+
}
|
|
7290
|
+
)
|
|
7291
|
+
] })
|
|
7292
|
+
] })
|
|
7293
|
+
] }),
|
|
7294
|
+
/* @__PURE__ */ jsxs8(DialogActions5, { children: [
|
|
7295
|
+
/* @__PURE__ */ jsx8(Button7, { onClick: resetCreateDialog, children: "Cancel" }),
|
|
7296
|
+
/* @__PURE__ */ jsx8(
|
|
7297
|
+
Button7,
|
|
7298
|
+
{
|
|
7299
|
+
variant: "contained",
|
|
7300
|
+
onClick: handleCreateSeedPack,
|
|
7301
|
+
disabled: !gatewayConfigured || isCreating,
|
|
7302
|
+
children: isCreating ? "Creating..." : "Create"
|
|
7303
|
+
}
|
|
7304
|
+
)
|
|
7305
|
+
] })
|
|
7306
|
+
] }),
|
|
7307
|
+
/* @__PURE__ */ jsxs8(Dialog6, { open: publishDialogOpen, onClose: () => setPublishDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
7308
|
+
/* @__PURE__ */ jsx8(DialogTitle5, { children: "Publish seed pack" }),
|
|
7309
|
+
/* @__PURE__ */ jsxs8(DialogContent6, { children: [
|
|
7310
|
+
/* @__PURE__ */ jsx8(DialogContentText3, { children: "Publishing locks a new version and makes it available for internal retrieval. This content is never shown as a user-facing source." }),
|
|
7311
|
+
isDirty && /* @__PURE__ */ jsx8(Alert7, { severity: "info", sx: { mt: 2 }, children: "You have unsaved changes. They will be included in the published version." })
|
|
7312
|
+
] }),
|
|
7313
|
+
/* @__PURE__ */ jsxs8(DialogActions5, { children: [
|
|
7314
|
+
/* @__PURE__ */ jsx8(Button7, { onClick: () => setPublishDialogOpen(false), children: "Cancel" }),
|
|
7315
|
+
/* @__PURE__ */ jsx8(Button7, { variant: "contained", onClick: handlePublish, disabled: isPublishing, children: isPublishing ? "Publishing..." : "Publish" })
|
|
7316
|
+
] })
|
|
7317
|
+
] }),
|
|
7318
|
+
/* @__PURE__ */ jsxs8(Dialog6, { open: archiveDialogOpen, onClose: () => setArchiveDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
|
|
7319
|
+
/* @__PURE__ */ jsx8(DialogTitle5, { children: "Archive seed pack" }),
|
|
7320
|
+
/* @__PURE__ */ jsx8(DialogContent6, { children: /* @__PURE__ */ jsx8(DialogContentText3, { children: "Archiving stops this seed pack from being used in new conversations. You can keep it for reference or audit history." }) }),
|
|
7321
|
+
/* @__PURE__ */ jsxs8(DialogActions5, { children: [
|
|
7322
|
+
/* @__PURE__ */ jsx8(Button7, { onClick: () => setArchiveDialogOpen(false), children: "Cancel" }),
|
|
7323
|
+
/* @__PURE__ */ jsx8(Button7, { variant: "contained", color: "error", onClick: handleArchive, disabled: isArchiving, children: isArchiving ? "Archiving..." : "Archive" })
|
|
7324
|
+
] })
|
|
7325
|
+
] }),
|
|
7326
|
+
/* @__PURE__ */ jsxs8(
|
|
7327
|
+
Dialog6,
|
|
7328
|
+
{
|
|
7329
|
+
open: Boolean(previewFile),
|
|
7330
|
+
onClose: () => setPreviewFile(null),
|
|
7331
|
+
maxWidth: "md",
|
|
7332
|
+
fullWidth: true,
|
|
7333
|
+
children: [
|
|
7334
|
+
/* @__PURE__ */ jsx8(DialogTitle5, { children: previewFile?.name ?? "Markdown preview" }),
|
|
7335
|
+
/* @__PURE__ */ jsx8(DialogContent6, { dividers: true, children: /* @__PURE__ */ jsx8(StreamingMarkdown_default, { content: previewFile?.content ?? "" }) }),
|
|
7336
|
+
/* @__PURE__ */ jsx8(DialogActions5, { children: /* @__PURE__ */ jsx8(Button7, { onClick: () => setPreviewFile(null), children: "Close" }) })
|
|
7337
|
+
]
|
|
7338
|
+
}
|
|
7339
|
+
),
|
|
7340
|
+
/* @__PURE__ */ jsx8(
|
|
7341
|
+
Snackbar3,
|
|
7342
|
+
{
|
|
7343
|
+
open: snackbarOpen,
|
|
7344
|
+
autoHideDuration: 4e3,
|
|
7345
|
+
onClose: () => setSnackbarOpen(false),
|
|
7346
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
7347
|
+
children: /* @__PURE__ */ jsx8(Alert7, { onClose: () => setSnackbarOpen(false), severity: snackbarSeverity, sx: { width: "100%" }, children: snackbarMessage })
|
|
7348
|
+
}
|
|
7349
|
+
)
|
|
7350
|
+
] });
|
|
7351
|
+
};
|
|
7352
|
+
var SeedPacksTab_default = SeedPacksTab;
|
|
7353
|
+
|
|
7354
|
+
// src/management/components/KnowledgeHubTab.tsx
|
|
7355
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
7356
|
+
var KnowledgeHubTab = (props) => {
|
|
7357
|
+
const theme = useTheme6();
|
|
7358
|
+
const isMobile = useMediaQuery5(theme.breakpoints.down("sm"));
|
|
7359
|
+
const { seedPacksEnabled = false } = props;
|
|
7360
|
+
const [tabIndex, setTabIndex] = useState10(0);
|
|
7361
|
+
const effectiveTabIndex = seedPacksEnabled ? tabIndex : 0;
|
|
7362
|
+
useEffect7(() => {
|
|
7363
|
+
if (!seedPacksEnabled && tabIndex !== 0) {
|
|
7364
|
+
setTabIndex(0);
|
|
7365
|
+
}
|
|
7366
|
+
}, [seedPacksEnabled, tabIndex]);
|
|
7367
|
+
return /* @__PURE__ */ jsxs9(Box9, { children: [
|
|
7368
|
+
/* @__PURE__ */ jsx9(Box9, { sx: { px: { xs: 1.5, sm: 3, md: 4 }, pt: { xs: 1.5, md: 2 } }, children: /* @__PURE__ */ jsxs9(
|
|
7369
|
+
Tabs2,
|
|
7370
|
+
{
|
|
7371
|
+
value: effectiveTabIndex,
|
|
7372
|
+
onChange: (_, newValue) => setTabIndex(newValue),
|
|
7373
|
+
variant: isMobile ? "fullWidth" : "standard",
|
|
7374
|
+
sx: {
|
|
7375
|
+
borderBottom: 1,
|
|
7376
|
+
borderColor: "divider",
|
|
7377
|
+
"& .MuiTab-root": {
|
|
7378
|
+
textTransform: "none",
|
|
7379
|
+
fontWeight: 600,
|
|
7380
|
+
fontSize: { xs: "0.95rem", sm: "1rem" },
|
|
7381
|
+
minWidth: { xs: "auto", md: 160 },
|
|
7382
|
+
px: { xs: 1.2, sm: 1.5 }
|
|
7383
|
+
}
|
|
7384
|
+
},
|
|
7385
|
+
children: [
|
|
7386
|
+
/* @__PURE__ */ jsx9(
|
|
7387
|
+
Tab2,
|
|
7388
|
+
{
|
|
7389
|
+
icon: /* @__PURE__ */ jsx9(DescriptionIcon3, { fontSize: isMobile ? "small" : "medium" }),
|
|
7390
|
+
iconPosition: isMobile ? "top" : "start",
|
|
7391
|
+
label: "Documents"
|
|
7392
|
+
}
|
|
7393
|
+
),
|
|
7394
|
+
seedPacksEnabled && /* @__PURE__ */ jsx9(
|
|
7395
|
+
Tab2,
|
|
7396
|
+
{
|
|
7397
|
+
icon: /* @__PURE__ */ jsx9(AutoStoriesIcon, { fontSize: isMobile ? "small" : "medium" }),
|
|
7398
|
+
iconPosition: isMobile ? "top" : "start",
|
|
7399
|
+
label: "Seed Packs"
|
|
7400
|
+
}
|
|
7401
|
+
)
|
|
7402
|
+
]
|
|
7403
|
+
}
|
|
7404
|
+
) }),
|
|
7405
|
+
/* @__PURE__ */ jsx9(Box9, { sx: { display: effectiveTabIndex === 0 ? "block" : "none" }, children: /* @__PURE__ */ jsx9(KnowledgeTab_default, { ...props }) }),
|
|
7406
|
+
seedPacksEnabled && /* @__PURE__ */ jsx9(Box9, { sx: { display: effectiveTabIndex === 1 ? "block" : "none" }, children: /* @__PURE__ */ jsx9(SeedPacksTab_default, {}) })
|
|
7407
|
+
] });
|
|
7408
|
+
};
|
|
7409
|
+
var KnowledgeHubTab_default = KnowledgeHubTab;
|
|
7410
|
+
|
|
7411
|
+
// src/management/components/StorageTab.tsx
|
|
7412
|
+
import { useState as useState11, useEffect as useEffect8, useMemo as useMemo4 } from "react";
|
|
7413
|
+
import {
|
|
7414
|
+
Box as Box10,
|
|
7415
|
+
Typography as Typography9,
|
|
7416
|
+
Button as Button8,
|
|
7417
|
+
Card as Card5,
|
|
7418
|
+
CardContent as CardContent5,
|
|
7419
|
+
LinearProgress as LinearProgress4,
|
|
7420
|
+
Dialog as Dialog7,
|
|
7421
|
+
DialogTitle as DialogTitle6,
|
|
7422
|
+
DialogContent as DialogContent7,
|
|
7423
|
+
DialogContentText as DialogContentText4,
|
|
7424
|
+
DialogActions as DialogActions6,
|
|
7425
|
+
Alert as Alert8,
|
|
7426
|
+
Stack as Stack4,
|
|
7427
|
+
Chip as Chip7,
|
|
7428
|
+
Accordion,
|
|
7429
|
+
AccordionSummary,
|
|
7430
|
+
AccordionDetails,
|
|
7431
|
+
List as List2,
|
|
7432
|
+
ListItem,
|
|
7433
|
+
ListItemIcon,
|
|
7434
|
+
ListItemText,
|
|
7435
|
+
CircularProgress,
|
|
7436
|
+
Snackbar as Snackbar4,
|
|
7437
|
+
useTheme as useTheme7
|
|
7438
|
+
} from "@mui/material";
|
|
7439
|
+
import StorageIcon from "@mui/icons-material/Storage";
|
|
7440
|
+
import DeleteIcon4 from "@mui/icons-material/Delete";
|
|
7441
|
+
import RefreshIcon3 from "@mui/icons-material/Refresh";
|
|
7442
|
+
import WarningIcon from "@mui/icons-material/Warning";
|
|
7443
|
+
import InfoIcon from "@mui/icons-material/Info";
|
|
7444
|
+
import CleaningServicesIcon from "@mui/icons-material/CleaningServices";
|
|
7445
|
+
import DescriptionIcon4 from "@mui/icons-material/Description";
|
|
7446
|
+
import PersonIcon3 from "@mui/icons-material/Person";
|
|
7447
|
+
import ChatIcon from "@mui/icons-material/Chat";
|
|
7448
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
|
7449
|
+
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
7450
|
+
import CheckCircleIcon3 from "@mui/icons-material/CheckCircle";
|
|
7451
|
+
import ErrorIcon3 from "@mui/icons-material/Error";
|
|
7452
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
7453
|
+
var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
|
|
7454
|
+
var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
|
|
7455
|
+
var formatBytes = (bytes) => {
|
|
7456
|
+
if (bytes === 0) return "0 B";
|
|
7457
|
+
const k = 1024;
|
|
7458
|
+
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
|
7459
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
7460
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
7461
|
+
};
|
|
7462
|
+
var getStorageQuota = async () => {
|
|
7463
|
+
try {
|
|
7464
|
+
if ("storage" in navigator && "estimate" in navigator.storage) {
|
|
7465
|
+
const estimate = await navigator.storage.estimate();
|
|
7466
|
+
return {
|
|
7467
|
+
used: estimate.usage || 0,
|
|
7468
|
+
quota: estimate.quota || 0
|
|
7469
|
+
};
|
|
7470
|
+
}
|
|
7471
|
+
} catch (error) {
|
|
7472
|
+
debugLogger.warn("Could not get storage estimate", { error });
|
|
7473
|
+
}
|
|
7474
|
+
return { used: 0, quota: 0 };
|
|
7475
|
+
};
|
|
7476
|
+
var getIndexedDBSize = async () => {
|
|
7477
|
+
const categories = [];
|
|
7478
|
+
try {
|
|
7479
|
+
debugLogger.info("Starting IndexedDB size estimation");
|
|
7480
|
+
try {
|
|
7481
|
+
const databases = await indexedDB.databases();
|
|
7482
|
+
debugLogger.info("Available IndexedDB databases:", {
|
|
7483
|
+
databases: databases.map((db) => ({ name: db.name, version: db.version }))
|
|
7484
|
+
});
|
|
7485
|
+
} catch (error) {
|
|
7486
|
+
debugLogger.warn("Could not list databases", { error });
|
|
7487
|
+
}
|
|
7488
|
+
const conversationDbNames = ["bandit-conversations", "banditConversations", "conversations"];
|
|
7489
|
+
let chatSize = { size: 0, count: 0 };
|
|
7490
|
+
let foundConversationDb = "";
|
|
7491
|
+
for (const dbName of conversationDbNames) {
|
|
7492
|
+
try {
|
|
7493
|
+
const result = await estimateStoreSize(dbName, "conversations");
|
|
7494
|
+
if (result.count > 0) {
|
|
7495
|
+
chatSize = result;
|
|
7496
|
+
foundConversationDb = dbName;
|
|
7497
|
+
debugLogger.info(`Found conversations in database: ${dbName}`);
|
|
7498
|
+
break;
|
|
7499
|
+
}
|
|
7500
|
+
} catch (error) {
|
|
7501
|
+
debugLogger.warn(`Failed to check conversations in ${dbName}`, { error });
|
|
7502
|
+
}
|
|
7503
|
+
}
|
|
7504
|
+
categories.push({
|
|
7505
|
+
name: "Chat History",
|
|
7506
|
+
icon: ChatIcon,
|
|
7507
|
+
color: "#4caf50",
|
|
7508
|
+
size: chatSize.size,
|
|
7509
|
+
itemCount: chatSize.count,
|
|
7510
|
+
description: "Conversation history and messages",
|
|
7511
|
+
stores: foundConversationDb ? [`${foundConversationDb}.conversations`] : [],
|
|
7512
|
+
canClear: chatSize.count > 0,
|
|
7513
|
+
clearWarning: "This will permanently delete all your chat conversations and message history."
|
|
7514
|
+
});
|
|
7515
|
+
debugLogger.info(`Chat History category created:`, {
|
|
7516
|
+
itemCount: chatSize.count,
|
|
7517
|
+
size: chatSize.size,
|
|
7518
|
+
canClear: chatSize.count > 0,
|
|
7519
|
+
foundDb: foundConversationDb
|
|
7520
|
+
});
|
|
7521
|
+
const knowledgeDbNames = ["bandit-knowledge", "banditKnowledge", "knowledge"];
|
|
7522
|
+
let knowledgeSize = { size: 0, count: 0 };
|
|
7523
|
+
let foundKnowledgeDb = "";
|
|
7524
|
+
for (const dbName of knowledgeDbNames) {
|
|
7525
|
+
try {
|
|
7526
|
+
const result = await estimateStoreSize(dbName, "documents");
|
|
7527
|
+
debugLogger.info(`Knowledge database ${dbName} check result:`, {
|
|
7528
|
+
size: result.size,
|
|
7529
|
+
count: result.count,
|
|
7530
|
+
sizeFormatted: `${(result.size / 1024).toFixed(2)} KB`
|
|
7531
|
+
});
|
|
7532
|
+
if (result.count > 0) {
|
|
7533
|
+
knowledgeSize = result;
|
|
7534
|
+
foundKnowledgeDb = dbName;
|
|
7535
|
+
debugLogger.info(`Found knowledge documents in database: ${dbName}`, {
|
|
7536
|
+
totalSize: result.size,
|
|
7537
|
+
itemCount: result.count
|
|
7538
|
+
});
|
|
7539
|
+
break;
|
|
7540
|
+
}
|
|
7541
|
+
} catch (error) {
|
|
7542
|
+
debugLogger.warn(`Failed to check knowledge in ${dbName}`, { error });
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
categories.push({
|
|
7546
|
+
name: "Knowledge Documents",
|
|
7547
|
+
icon: DescriptionIcon4,
|
|
7548
|
+
color: "#2196f3",
|
|
7549
|
+
size: knowledgeSize.size,
|
|
7550
|
+
itemCount: knowledgeSize.count,
|
|
7551
|
+
description: "Uploaded documents and their embeddings",
|
|
7552
|
+
stores: foundKnowledgeDb ? [`${foundKnowledgeDb}.documents`] : [],
|
|
7553
|
+
canClear: knowledgeSize.count > 0,
|
|
7554
|
+
clearWarning: "This will remove all uploaded documents and their AI embeddings. You will need to re-upload documents."
|
|
7555
|
+
});
|
|
7556
|
+
debugLogger.info(`Knowledge Documents category created:`, {
|
|
7557
|
+
itemCount: knowledgeSize.count,
|
|
7558
|
+
size: knowledgeSize.size,
|
|
7559
|
+
sizeFormatted: `${(knowledgeSize.size / 1024).toFixed(2)} KB`,
|
|
7560
|
+
canClear: knowledgeSize.count > 0,
|
|
7561
|
+
foundDb: foundKnowledgeDb
|
|
7562
|
+
});
|
|
7563
|
+
const memoryDbNames = ["bandit-memory-db", "banditMemories", "bandit-memories"];
|
|
7564
|
+
let memorySize = { size: 0, count: 0 };
|
|
7565
|
+
let foundMemoryDb = "";
|
|
7566
|
+
for (const dbName of memoryDbNames) {
|
|
7567
|
+
try {
|
|
7568
|
+
const result = await estimateStoreSize(dbName, "memories");
|
|
7569
|
+
if (result.count > 0) {
|
|
7570
|
+
memorySize = result;
|
|
7571
|
+
foundMemoryDb = dbName;
|
|
7572
|
+
debugLogger.info(`Found memories in database: ${dbName}`);
|
|
7573
|
+
break;
|
|
7574
|
+
}
|
|
7575
|
+
} catch (error) {
|
|
7576
|
+
debugLogger.warn(`Failed to check memories in ${dbName}`, { error });
|
|
7577
|
+
}
|
|
7578
|
+
}
|
|
7579
|
+
categories.push({
|
|
7580
|
+
name: "AI Memories",
|
|
7581
|
+
icon: PersonIcon3,
|
|
7582
|
+
color: "#ff9800",
|
|
7583
|
+
size: memorySize.size,
|
|
7584
|
+
itemCount: memorySize.count,
|
|
7585
|
+
description: "AI memory entries and learned patterns",
|
|
7586
|
+
stores: foundMemoryDb ? [`${foundMemoryDb}.memories`] : [],
|
|
7587
|
+
canClear: memorySize.count > 0,
|
|
7588
|
+
clearWarning: "This will delete all AI memory entries and learned conversation patterns."
|
|
7589
|
+
});
|
|
7590
|
+
const configDbNames = ["banditConfig", "bandit-config"];
|
|
7591
|
+
let configSize = { size: 0, count: 0 };
|
|
7592
|
+
let foundConfigDb = "";
|
|
7593
|
+
for (const dbName of configDbNames) {
|
|
7594
|
+
try {
|
|
7595
|
+
const result = await estimateStoreSize(dbName, "config");
|
|
7596
|
+
if (result.count > 0) {
|
|
7597
|
+
configSize = result;
|
|
7598
|
+
foundConfigDb = dbName;
|
|
7599
|
+
debugLogger.info(`Found config in database: ${dbName}`);
|
|
7600
|
+
break;
|
|
7601
|
+
}
|
|
7602
|
+
} catch (error) {
|
|
7603
|
+
debugLogger.warn(`Failed to check config in ${dbName}`, { error });
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7606
|
+
categories.push({
|
|
7607
|
+
name: "App Settings & Models",
|
|
7608
|
+
icon: SettingsIcon,
|
|
7609
|
+
color: "#9c27b0",
|
|
7610
|
+
size: configSize.size,
|
|
7611
|
+
itemCount: configSize.count,
|
|
7612
|
+
description: "Custom models, app settings, and user preferences",
|
|
7613
|
+
stores: foundConfigDb ? [`${foundConfigDb}.config`] : [],
|
|
7614
|
+
canClear: configSize.count > 0,
|
|
7615
|
+
clearWarning: "This will delete all custom AI models, app settings, themes, and preferences. The app will reset to defaults."
|
|
7616
|
+
});
|
|
7617
|
+
const queryDbNames = ["banditAIQuery", "ai-query-db"];
|
|
7618
|
+
let querySize = { size: 0, count: 0 };
|
|
6130
7619
|
let foundQueryDb = "";
|
|
6131
7620
|
for (const dbName of queryDbNames) {
|
|
6132
7621
|
try {
|
|
@@ -6144,7 +7633,7 @@ var getIndexedDBSize = async () => {
|
|
|
6144
7633
|
if (querySize.count > 0) {
|
|
6145
7634
|
categories.push({
|
|
6146
7635
|
name: "AI Query Cache",
|
|
6147
|
-
icon:
|
|
7636
|
+
icon: PersonIcon3,
|
|
6148
7637
|
color: "#ff5722",
|
|
6149
7638
|
size: querySize.size,
|
|
6150
7639
|
itemCount: querySize.count,
|
|
@@ -6256,21 +7745,21 @@ var clearEntireDatabase = async (dbName) => {
|
|
|
6256
7745
|
});
|
|
6257
7746
|
};
|
|
6258
7747
|
var StorageTab = ({ currentTheme }) => {
|
|
6259
|
-
const theme =
|
|
6260
|
-
const [storageQuota, setStorageQuota] =
|
|
7748
|
+
const theme = useTheme7();
|
|
7749
|
+
const [storageQuota, setStorageQuota] = useState11({
|
|
6261
7750
|
used: 0,
|
|
6262
7751
|
quota: 0,
|
|
6263
7752
|
available: 0,
|
|
6264
7753
|
browserQuotaEstimate: 0
|
|
6265
7754
|
});
|
|
6266
|
-
const [storageCategories, setStorageCategories] =
|
|
6267
|
-
const [loading, setLoading] =
|
|
6268
|
-
const [clearAllDialogOpen, setClearAllDialogOpen] =
|
|
6269
|
-
const [clearCategoryDialog, setClearCategoryDialog] =
|
|
6270
|
-
const [clearing, setClearing] =
|
|
6271
|
-
const [snackbarMessage, setSnackbarMessage] =
|
|
6272
|
-
const [showSnackbar, setShowSnackbar] =
|
|
6273
|
-
const [snackbarSeverity, setSnackbarSeverity] =
|
|
7755
|
+
const [storageCategories, setStorageCategories] = useState11([]);
|
|
7756
|
+
const [loading, setLoading] = useState11(true);
|
|
7757
|
+
const [clearAllDialogOpen, setClearAllDialogOpen] = useState11(false);
|
|
7758
|
+
const [clearCategoryDialog, setClearCategoryDialog] = useState11(null);
|
|
7759
|
+
const [clearing, setClearing] = useState11(false);
|
|
7760
|
+
const [snackbarMessage, setSnackbarMessage] = useState11("");
|
|
7761
|
+
const [showSnackbar, setShowSnackbar] = useState11(false);
|
|
7762
|
+
const [snackbarSeverity, setSnackbarSeverity] = useState11("success");
|
|
6274
7763
|
const { syncEnabled, isAdvancedVectorFeaturesEnabled } = useConversationSyncStore((state) => ({
|
|
6275
7764
|
syncEnabled: state.syncEnabled,
|
|
6276
7765
|
isAdvancedVectorFeaturesEnabled: state.isAdvancedVectorFeaturesEnabled
|
|
@@ -6322,18 +7811,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6322
7811
|
setLoading(false);
|
|
6323
7812
|
}
|
|
6324
7813
|
};
|
|
6325
|
-
|
|
7814
|
+
useEffect8(() => {
|
|
6326
7815
|
loadStorageData();
|
|
6327
7816
|
}, []);
|
|
6328
|
-
const totalUsed =
|
|
7817
|
+
const totalUsed = useMemo4(() => {
|
|
6329
7818
|
return storageCategories.reduce((sum, cat) => sum + cat.size, 0);
|
|
6330
7819
|
}, [storageCategories]);
|
|
6331
|
-
const usagePercentage =
|
|
7820
|
+
const usagePercentage = useMemo4(() => {
|
|
6332
7821
|
if (storageQuota.quota === 0) return 0;
|
|
6333
7822
|
const percentage = Math.min(storageQuota.used / storageQuota.quota * 100, 100);
|
|
6334
7823
|
return percentage > 0 && percentage < 0.1 ? 0.1 : percentage;
|
|
6335
7824
|
}, [storageQuota]);
|
|
6336
|
-
const clearableCategories =
|
|
7825
|
+
const clearableCategories = useMemo4(() => {
|
|
6337
7826
|
return storageCategories.filter((cat) => cat.canClear);
|
|
6338
7827
|
}, [storageCategories]);
|
|
6339
7828
|
const handleClearCategory = async (category) => {
|
|
@@ -6418,13 +7907,13 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6418
7907
|
}
|
|
6419
7908
|
};
|
|
6420
7909
|
if (loading) {
|
|
6421
|
-
return /* @__PURE__ */
|
|
6422
|
-
/* @__PURE__ */
|
|
6423
|
-
/* @__PURE__ */
|
|
7910
|
+
return /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 8 }, children: [
|
|
7911
|
+
/* @__PURE__ */ jsx10(CircularProgress, {}),
|
|
7912
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body1", color: "text.secondary", sx: { ml: 2 }, children: "Analyzing storage usage..." })
|
|
6424
7913
|
] });
|
|
6425
7914
|
}
|
|
6426
|
-
return /* @__PURE__ */
|
|
6427
|
-
/* @__PURE__ */
|
|
7915
|
+
return /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { px: { xs: 2, sm: 4, md: 6 }, pt: 3, pb: 5 }, children: [
|
|
7916
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { mb: 4 }, children: /* @__PURE__ */ jsxs10(Box10, { sx: {
|
|
6428
7917
|
display: "flex",
|
|
6429
7918
|
flexDirection: { xs: "column", sm: "row" },
|
|
6430
7919
|
justifyContent: "space-between",
|
|
@@ -6432,19 +7921,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6432
7921
|
gap: { xs: 2, sm: 0 },
|
|
6433
7922
|
mb: 2
|
|
6434
7923
|
}, children: [
|
|
6435
|
-
/* @__PURE__ */
|
|
6436
|
-
/* @__PURE__ */
|
|
6437
|
-
/* @__PURE__ */
|
|
7924
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { flex: 1 }, children: [
|
|
7925
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "h5", color: "text.primary", sx: { mb: 1, fontWeight: 600 }, children: "Storage Management" }),
|
|
7926
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body1", color: "text.secondary", children: "Monitor and manage your local browser storage usage" })
|
|
6438
7927
|
] }),
|
|
6439
|
-
/* @__PURE__ */
|
|
7928
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: {
|
|
6440
7929
|
display: "flex",
|
|
6441
7930
|
gap: 1,
|
|
6442
7931
|
flexWrap: { xs: "wrap", sm: "nowrap" },
|
|
6443
7932
|
justifyContent: { xs: "stretch", sm: "flex-end" },
|
|
6444
7933
|
width: { xs: "100%", sm: "auto" }
|
|
6445
7934
|
}, children: [
|
|
6446
|
-
/* @__PURE__ */
|
|
6447
|
-
|
|
7935
|
+
/* @__PURE__ */ jsxs10(
|
|
7936
|
+
Button8,
|
|
6448
7937
|
{
|
|
6449
7938
|
variant: "outlined",
|
|
6450
7939
|
size: "small",
|
|
@@ -6456,22 +7945,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6456
7945
|
minHeight: 36
|
|
6457
7946
|
},
|
|
6458
7947
|
children: [
|
|
6459
|
-
/* @__PURE__ */
|
|
6460
|
-
/* @__PURE__ */
|
|
7948
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { display: { xs: "none", sm: "flex" }, alignItems: "center", gap: 1 }, children: [
|
|
7949
|
+
/* @__PURE__ */ jsx10(RefreshIcon3, { fontSize: "medium" }),
|
|
6461
7950
|
"Refresh"
|
|
6462
7951
|
] }),
|
|
6463
|
-
/* @__PURE__ */
|
|
7952
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "flex", sm: "none" }, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx10(RefreshIcon3, { fontSize: "medium" }) })
|
|
6464
7953
|
]
|
|
6465
7954
|
}
|
|
6466
7955
|
),
|
|
6467
|
-
clearableCategories.length > 0 && /* @__PURE__ */
|
|
6468
|
-
/* @__PURE__ */
|
|
6469
|
-
|
|
7956
|
+
clearableCategories.length > 0 && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
7957
|
+
/* @__PURE__ */ jsxs10(
|
|
7958
|
+
Button8,
|
|
6470
7959
|
{
|
|
6471
7960
|
variant: "outlined",
|
|
6472
7961
|
color: "error",
|
|
6473
7962
|
size: "small",
|
|
6474
|
-
startIcon: /* @__PURE__ */
|
|
7963
|
+
startIcon: /* @__PURE__ */ jsx10(CleaningServicesIcon, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
6475
7964
|
onClick: () => setClearAllDialogOpen(true),
|
|
6476
7965
|
sx: {
|
|
6477
7966
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -6479,18 +7968,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6479
7968
|
px: { xs: 1, sm: 2 }
|
|
6480
7969
|
},
|
|
6481
7970
|
children: [
|
|
6482
|
-
/* @__PURE__ */
|
|
6483
|
-
/* @__PURE__ */
|
|
7971
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "none", sm: "inline" } }, children: "Clear All Data" }),
|
|
7972
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "inline", sm: "none" } }, children: "Clear All" })
|
|
6484
7973
|
]
|
|
6485
7974
|
}
|
|
6486
7975
|
),
|
|
6487
|
-
/* @__PURE__ */
|
|
6488
|
-
|
|
7976
|
+
/* @__PURE__ */ jsxs10(
|
|
7977
|
+
Button8,
|
|
6489
7978
|
{
|
|
6490
7979
|
variant: "outlined",
|
|
6491
7980
|
color: "error",
|
|
6492
7981
|
size: "small",
|
|
6493
|
-
startIcon: /* @__PURE__ */
|
|
7982
|
+
startIcon: /* @__PURE__ */ jsx10(DeleteIcon4, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
|
|
6494
7983
|
onClick: () => handleNuclearClear(),
|
|
6495
7984
|
sx: {
|
|
6496
7985
|
minWidth: { xs: "auto", sm: "fit-content" },
|
|
@@ -6498,28 +7987,28 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6498
7987
|
px: { xs: 1, sm: 2 }
|
|
6499
7988
|
},
|
|
6500
7989
|
children: [
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
7990
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "none", sm: "inline" } }, children: "Nuclear Clear" }),
|
|
7991
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "inline", sm: "none" } }, children: "Nuclear" })
|
|
6503
7992
|
]
|
|
6504
7993
|
}
|
|
6505
7994
|
)
|
|
6506
7995
|
] })
|
|
6507
7996
|
] })
|
|
6508
7997
|
] }) }),
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
7998
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { mb: 4 }, children: [
|
|
7999
|
+
/* @__PURE__ */ jsx10(Card5, { sx: { mb: 3 }, children: /* @__PURE__ */ jsxs10(CardContent5, { sx: {
|
|
6511
8000
|
display: "flex",
|
|
6512
8001
|
flexDirection: "column",
|
|
6513
8002
|
minHeight: 180
|
|
6514
8003
|
}, children: [
|
|
6515
|
-
/* @__PURE__ */
|
|
6516
|
-
/* @__PURE__ */
|
|
8004
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
8005
|
+
/* @__PURE__ */ jsx10(StorageIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
6517
8006
|
"Storage Quota"
|
|
6518
8007
|
] }),
|
|
6519
|
-
/* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6522
|
-
|
|
8008
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { mb: 2, flex: 1 }, children: [
|
|
8009
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
8010
|
+
/* @__PURE__ */ jsx10(
|
|
8011
|
+
Chip7,
|
|
6523
8012
|
{
|
|
6524
8013
|
label: `${formatBytes(storageQuota.used)} Used`,
|
|
6525
8014
|
color: "warning",
|
|
@@ -6527,8 +8016,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6527
8016
|
variant: "outlined"
|
|
6528
8017
|
}
|
|
6529
8018
|
),
|
|
6530
|
-
/* @__PURE__ */
|
|
6531
|
-
|
|
8019
|
+
/* @__PURE__ */ jsx10(
|
|
8020
|
+
Chip7,
|
|
6532
8021
|
{
|
|
6533
8022
|
label: `${formatBytes(storageQuota.available)} Available`,
|
|
6534
8023
|
color: "success",
|
|
@@ -6536,8 +8025,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6536
8025
|
variant: "outlined"
|
|
6537
8026
|
}
|
|
6538
8027
|
),
|
|
6539
|
-
/* @__PURE__ */
|
|
6540
|
-
|
|
8028
|
+
/* @__PURE__ */ jsx10(
|
|
8029
|
+
Chip7,
|
|
6541
8030
|
{
|
|
6542
8031
|
label: `${formatBytes(storageQuota.quota)} Total`,
|
|
6543
8032
|
color: "info",
|
|
@@ -6545,8 +8034,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6545
8034
|
variant: "outlined"
|
|
6546
8035
|
}
|
|
6547
8036
|
),
|
|
6548
|
-
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */
|
|
6549
|
-
|
|
8037
|
+
storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ jsx10(
|
|
8038
|
+
Chip7,
|
|
6550
8039
|
{
|
|
6551
8040
|
label: `\u2248${formatBytes(storageQuota.browserQuotaEstimate)} Browser Estimate`,
|
|
6552
8041
|
color: "default",
|
|
@@ -6555,8 +8044,8 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6555
8044
|
}
|
|
6556
8045
|
)
|
|
6557
8046
|
] }),
|
|
6558
|
-
/* @__PURE__ */
|
|
6559
|
-
|
|
8047
|
+
/* @__PURE__ */ jsx10(
|
|
8048
|
+
LinearProgress4,
|
|
6560
8049
|
{
|
|
6561
8050
|
variant: "determinate",
|
|
6562
8051
|
value: usagePercentage,
|
|
@@ -6571,38 +8060,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6571
8060
|
}
|
|
6572
8061
|
}
|
|
6573
8062
|
),
|
|
6574
|
-
/* @__PURE__ */
|
|
8063
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "caption", color: "text.secondary", sx: { mt: 0.5, display: "block" }, children: [
|
|
6575
8064
|
usagePercentage.toFixed(1),
|
|
6576
8065
|
"% used"
|
|
6577
8066
|
] })
|
|
6578
8067
|
] }),
|
|
6579
|
-
usagePercentage > 80 && /* @__PURE__ */
|
|
8068
|
+
usagePercentage > 80 && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: "auto" }, children: "Storage usage is high. Consider clearing unused data." })
|
|
6580
8069
|
] }) }),
|
|
6581
|
-
/* @__PURE__ */
|
|
8070
|
+
/* @__PURE__ */ jsx10(Card5, { children: /* @__PURE__ */ jsxs10(CardContent5, { sx: {
|
|
6582
8071
|
display: "flex",
|
|
6583
8072
|
flexDirection: "column",
|
|
6584
8073
|
minHeight: 140
|
|
6585
8074
|
}, children: [
|
|
6586
|
-
/* @__PURE__ */
|
|
6587
|
-
/* @__PURE__ */
|
|
6588
|
-
/* @__PURE__ */
|
|
6589
|
-
|
|
8075
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: "Usage Summary" }),
|
|
8076
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
|
|
8077
|
+
/* @__PURE__ */ jsx10(
|
|
8078
|
+
Chip7,
|
|
6590
8079
|
{
|
|
6591
8080
|
label: `${storageCategories.length} Categories`,
|
|
6592
8081
|
color: "primary",
|
|
6593
8082
|
size: "small"
|
|
6594
8083
|
}
|
|
6595
8084
|
),
|
|
6596
|
-
/* @__PURE__ */
|
|
6597
|
-
|
|
8085
|
+
/* @__PURE__ */ jsx10(
|
|
8086
|
+
Chip7,
|
|
6598
8087
|
{
|
|
6599
8088
|
label: `${storageCategories.reduce((sum, cat) => sum + cat.itemCount, 0)} Items`,
|
|
6600
8089
|
color: "secondary",
|
|
6601
8090
|
size: "small"
|
|
6602
8091
|
}
|
|
6603
8092
|
),
|
|
6604
|
-
/* @__PURE__ */
|
|
6605
|
-
|
|
8093
|
+
/* @__PURE__ */ jsx10(
|
|
8094
|
+
Chip7,
|
|
6606
8095
|
{
|
|
6607
8096
|
label: `${formatBytes(totalUsed)} Used`,
|
|
6608
8097
|
color: "info",
|
|
@@ -6610,11 +8099,11 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6610
8099
|
}
|
|
6611
8100
|
)
|
|
6612
8101
|
] }),
|
|
6613
|
-
/* @__PURE__ */
|
|
8102
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
|
|
6614
8103
|
] }) })
|
|
6615
8104
|
] }),
|
|
6616
|
-
/* @__PURE__ */
|
|
6617
|
-
/* @__PURE__ */
|
|
8105
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
|
|
8106
|
+
/* @__PURE__ */ jsx10(Box10, { sx: {
|
|
6618
8107
|
maxHeight: "60vh",
|
|
6619
8108
|
overflow: "auto",
|
|
6620
8109
|
"&::-webkit-scrollbar": {
|
|
@@ -6622,15 +8111,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6622
8111
|
},
|
|
6623
8112
|
msOverflowStyle: "none",
|
|
6624
8113
|
scrollbarWidth: "none"
|
|
6625
|
-
}, children: storageCategories.length === 0 ? /* @__PURE__ */
|
|
6626
|
-
/* @__PURE__ */
|
|
6627
|
-
/* @__PURE__ */
|
|
6628
|
-
/* @__PURE__ */
|
|
6629
|
-
/* @__PURE__ */
|
|
6630
|
-
/* @__PURE__ */
|
|
8114
|
+
}, children: storageCategories.length === 0 ? /* @__PURE__ */ jsxs10(Alert8, { severity: "info", sx: { mt: 2 }, children: [
|
|
8115
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", children: "No storage data found. This could mean:" }),
|
|
8116
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
|
|
8117
|
+
/* @__PURE__ */ jsx10("li", { children: "All databases are empty" }),
|
|
8118
|
+
/* @__PURE__ */ jsx10("li", { children: "Data is stored under different names" }),
|
|
8119
|
+
/* @__PURE__ */ jsx10("li", { children: "There was an error accessing the databases" })
|
|
6631
8120
|
] }),
|
|
6632
|
-
/* @__PURE__ */
|
|
6633
|
-
] }) : /* @__PURE__ */
|
|
8121
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", sx: { mt: 1 }, children: 'Try clicking "Refresh" or check the browser console for more details.' })
|
|
8122
|
+
] }) : /* @__PURE__ */ jsx10(Stack4, { spacing: 2, children: storageCategories.map((category) => {
|
|
6634
8123
|
const IconComponent = category.icon;
|
|
6635
8124
|
const categoryPercentage = storageQuota.quota > 0 ? category.size / storageQuota.quota * 100 : 0;
|
|
6636
8125
|
const categoryRelativePercentage = totalUsed > 0 ? category.size / totalUsed * 100 : 0;
|
|
@@ -6641,18 +8130,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6641
8130
|
categoryPercentage: categoryPercentage.toFixed(2),
|
|
6642
8131
|
categoryRelativePercentage: categoryRelativePercentage.toFixed(2)
|
|
6643
8132
|
});
|
|
6644
|
-
return /* @__PURE__ */
|
|
6645
|
-
/* @__PURE__ */
|
|
8133
|
+
return /* @__PURE__ */ jsxs10(Accordion, { sx: { bgcolor: "background.paper" }, children: [
|
|
8134
|
+
/* @__PURE__ */ jsx10(
|
|
6646
8135
|
AccordionSummary,
|
|
6647
8136
|
{
|
|
6648
|
-
expandIcon: /* @__PURE__ */
|
|
8137
|
+
expandIcon: /* @__PURE__ */ jsx10(ExpandMoreIcon, {}),
|
|
6649
8138
|
"aria-controls": `${category.name}-content`,
|
|
6650
8139
|
id: `${category.name}-header`,
|
|
6651
|
-
children: /* @__PURE__ */
|
|
6652
|
-
/* @__PURE__ */
|
|
6653
|
-
/* @__PURE__ */
|
|
6654
|
-
/* @__PURE__ */
|
|
6655
|
-
|
|
8140
|
+
children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", width: "100%", pr: 2 }, children: [
|
|
8141
|
+
/* @__PURE__ */ jsx10(IconComponent, { sx: { color: category.color, mr: 2 } }),
|
|
8142
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { flex: 1 }, children: [
|
|
8143
|
+
/* @__PURE__ */ jsx10(
|
|
8144
|
+
Typography9,
|
|
6656
8145
|
{
|
|
6657
8146
|
variant: "body1",
|
|
6658
8147
|
style: {
|
|
@@ -6662,18 +8151,18 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6662
8151
|
children: category.name
|
|
6663
8152
|
}
|
|
6664
8153
|
),
|
|
6665
|
-
/* @__PURE__ */
|
|
6666
|
-
/* @__PURE__ */
|
|
6667
|
-
/* @__PURE__ */
|
|
6668
|
-
|
|
8154
|
+
/* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 2, mt: 0.5 }, children: [
|
|
8155
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", children: formatBytes(category.size) }),
|
|
8156
|
+
/* @__PURE__ */ jsx10(
|
|
8157
|
+
Chip7,
|
|
6669
8158
|
{
|
|
6670
8159
|
label: `${category.itemCount} items`,
|
|
6671
8160
|
size: "small",
|
|
6672
8161
|
variant: "outlined"
|
|
6673
8162
|
}
|
|
6674
8163
|
),
|
|
6675
|
-
/* @__PURE__ */
|
|
6676
|
-
|
|
8164
|
+
/* @__PURE__ */ jsx10(Box10, { sx: { flex: 1, mx: 2 }, children: /* @__PURE__ */ jsx10(
|
|
8165
|
+
LinearProgress4,
|
|
6677
8166
|
{
|
|
6678
8167
|
variant: "determinate",
|
|
6679
8168
|
value: Math.min(categoryRelativePercentage, 100),
|
|
@@ -6688,7 +8177,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6688
8177
|
}
|
|
6689
8178
|
}
|
|
6690
8179
|
) }),
|
|
6691
|
-
/* @__PURE__ */
|
|
8180
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "caption", color: "text.secondary", children: [
|
|
6692
8181
|
categoryRelativePercentage.toFixed(1),
|
|
6693
8182
|
"%"
|
|
6694
8183
|
] })
|
|
@@ -6697,12 +8186,12 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6697
8186
|
] })
|
|
6698
8187
|
}
|
|
6699
8188
|
),
|
|
6700
|
-
/* @__PURE__ */
|
|
6701
|
-
/* @__PURE__ */
|
|
6702
|
-
/* @__PURE__ */
|
|
6703
|
-
/* @__PURE__ */
|
|
6704
|
-
/* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
8189
|
+
/* @__PURE__ */ jsx10(AccordionDetails, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { pl: 5 }, children: [
|
|
8190
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", paragraph: true, children: category.description }),
|
|
8191
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "subtitle2", gutterBottom: true, children: "Storage Locations:" }),
|
|
8192
|
+
/* @__PURE__ */ jsx10(List2, { dense: true, children: category.stores.map((store) => /* @__PURE__ */ jsxs10(ListItem, { sx: { py: 0.5 }, children: [
|
|
8193
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx10(StorageIcon, { fontSize: "small" }) }),
|
|
8194
|
+
/* @__PURE__ */ jsx10(
|
|
6706
8195
|
ListItemText,
|
|
6707
8196
|
{
|
|
6708
8197
|
primary: store,
|
|
@@ -6710,14 +8199,14 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6710
8199
|
}
|
|
6711
8200
|
)
|
|
6712
8201
|
] }, store)) }),
|
|
6713
|
-
category.canClear ? /* @__PURE__ */
|
|
6714
|
-
/* @__PURE__ */
|
|
6715
|
-
|
|
8202
|
+
category.canClear ? /* @__PURE__ */ jsxs10(Box10, { sx: { mt: 2, pt: 2, borderTop: 1, borderColor: "divider" }, children: [
|
|
8203
|
+
/* @__PURE__ */ jsxs10(
|
|
8204
|
+
Button8,
|
|
6716
8205
|
{
|
|
6717
8206
|
variant: "outlined",
|
|
6718
8207
|
color: "error",
|
|
6719
8208
|
size: "small",
|
|
6720
|
-
startIcon: /* @__PURE__ */
|
|
8209
|
+
startIcon: /* @__PURE__ */ jsx10(DeleteIcon4, {}),
|
|
6721
8210
|
onClick: () => setClearCategoryDialog(category),
|
|
6722
8211
|
disabled: clearing,
|
|
6723
8212
|
children: [
|
|
@@ -6726,19 +8215,19 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6726
8215
|
]
|
|
6727
8216
|
}
|
|
6728
8217
|
),
|
|
6729
|
-
category.clearWarning && /* @__PURE__ */
|
|
6730
|
-
] }) : /* @__PURE__ */
|
|
8218
|
+
category.clearWarning && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: 2 }, children: /* @__PURE__ */ jsx10(Typography9, { variant: "caption", children: category.clearWarning }) })
|
|
8219
|
+
] }) : /* @__PURE__ */ jsx10(Alert8, { severity: "info", sx: { mt: 2 }, children: /* @__PURE__ */ jsx10(Typography9, { variant: "caption", children: category.itemCount === 0 ? "This category is empty." : "This category cannot be cleared automatically." }) })
|
|
6731
8220
|
] }) })
|
|
6732
8221
|
] }, category.name);
|
|
6733
8222
|
}) }) }),
|
|
6734
|
-
/* @__PURE__ */
|
|
6735
|
-
/* @__PURE__ */
|
|
6736
|
-
/* @__PURE__ */
|
|
8223
|
+
/* @__PURE__ */ jsx10(Card5, { sx: { mt: 4 }, children: /* @__PURE__ */ jsxs10(CardContent5, { children: [
|
|
8224
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
|
|
8225
|
+
/* @__PURE__ */ jsx10(InfoIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
|
|
6737
8226
|
"Storage Tips & Clear Options"
|
|
6738
8227
|
] }),
|
|
6739
|
-
/* @__PURE__ */
|
|
6740
|
-
/* @__PURE__ */
|
|
6741
|
-
/* @__PURE__ */
|
|
8228
|
+
/* @__PURE__ */ jsxs10(List2, { children: [
|
|
8229
|
+
/* @__PURE__ */ jsxs10(ListItem, { children: [
|
|
8230
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(
|
|
6742
8231
|
CheckCircleIcon3,
|
|
6743
8232
|
{
|
|
6744
8233
|
sx: {
|
|
@@ -6746,7 +8235,7 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6746
8235
|
}
|
|
6747
8236
|
}
|
|
6748
8237
|
) }),
|
|
6749
|
-
/* @__PURE__ */
|
|
8238
|
+
/* @__PURE__ */ jsx10(
|
|
6750
8239
|
ListItemText,
|
|
6751
8240
|
{
|
|
6752
8241
|
primary: storageStatusPrimary,
|
|
@@ -6754,9 +8243,9 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6754
8243
|
}
|
|
6755
8244
|
)
|
|
6756
8245
|
] }),
|
|
6757
|
-
/* @__PURE__ */
|
|
6758
|
-
/* @__PURE__ */
|
|
6759
|
-
/* @__PURE__ */
|
|
8246
|
+
/* @__PURE__ */ jsxs10(ListItem, { children: [
|
|
8247
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(CleaningServicesIcon, { color: "info" }) }),
|
|
8248
|
+
/* @__PURE__ */ jsx10(
|
|
6760
8249
|
ListItemText,
|
|
6761
8250
|
{
|
|
6762
8251
|
primary: "Clear All Data (Safe)",
|
|
@@ -6764,9 +8253,9 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6764
8253
|
}
|
|
6765
8254
|
)
|
|
6766
8255
|
] }),
|
|
6767
|
-
/* @__PURE__ */
|
|
6768
|
-
/* @__PURE__ */
|
|
6769
|
-
/* @__PURE__ */
|
|
8256
|
+
/* @__PURE__ */ jsxs10(ListItem, { children: [
|
|
8257
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(DeleteIcon4, { color: "error" }) }),
|
|
8258
|
+
/* @__PURE__ */ jsx10(
|
|
6770
8259
|
ListItemText,
|
|
6771
8260
|
{
|
|
6772
8261
|
primary: "Nuclear Clear (Complete Reset)",
|
|
@@ -6774,9 +8263,9 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6774
8263
|
}
|
|
6775
8264
|
)
|
|
6776
8265
|
] }),
|
|
6777
|
-
/* @__PURE__ */
|
|
6778
|
-
/* @__PURE__ */
|
|
6779
|
-
/* @__PURE__ */
|
|
8266
|
+
/* @__PURE__ */ jsxs10(ListItem, { children: [
|
|
8267
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(WarningIcon, { color: "warning" }) }),
|
|
8268
|
+
/* @__PURE__ */ jsx10(
|
|
6780
8269
|
ListItemText,
|
|
6781
8270
|
{
|
|
6782
8271
|
primary: "Backup important data",
|
|
@@ -6786,38 +8275,38 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6786
8275
|
] })
|
|
6787
8276
|
] })
|
|
6788
8277
|
] }) }),
|
|
6789
|
-
/* @__PURE__ */
|
|
6790
|
-
|
|
8278
|
+
/* @__PURE__ */ jsxs10(
|
|
8279
|
+
Dialog7,
|
|
6791
8280
|
{
|
|
6792
8281
|
open: !!clearCategoryDialog,
|
|
6793
8282
|
onClose: () => setClearCategoryDialog(null),
|
|
6794
8283
|
maxWidth: "sm",
|
|
6795
8284
|
fullWidth: true,
|
|
6796
8285
|
children: [
|
|
6797
|
-
/* @__PURE__ */
|
|
6798
|
-
/* @__PURE__ */
|
|
8286
|
+
/* @__PURE__ */ jsx10(DialogTitle6, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
8287
|
+
/* @__PURE__ */ jsx10(WarningIcon, { color: "warning" }),
|
|
6799
8288
|
"Clear ",
|
|
6800
8289
|
clearCategoryDialog?.name,
|
|
6801
8290
|
"?"
|
|
6802
8291
|
] }) }),
|
|
6803
|
-
/* @__PURE__ */
|
|
6804
|
-
/* @__PURE__ */
|
|
8292
|
+
/* @__PURE__ */ jsxs10(DialogContent7, { children: [
|
|
8293
|
+
/* @__PURE__ */ jsxs10(DialogContentText4, { children: [
|
|
6805
8294
|
'This will permanently delete all data in the "',
|
|
6806
8295
|
clearCategoryDialog?.name,
|
|
6807
8296
|
'" category.'
|
|
6808
8297
|
] }),
|
|
6809
|
-
clearCategoryDialog?.clearWarning && /* @__PURE__ */
|
|
6810
|
-
clearCategoryDialog && /* @__PURE__ */
|
|
6811
|
-
/* @__PURE__ */
|
|
6812
|
-
/* @__PURE__ */
|
|
8298
|
+
clearCategoryDialog?.clearWarning && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: 2 }, children: clearCategoryDialog.clearWarning }),
|
|
8299
|
+
clearCategoryDialog && /* @__PURE__ */ jsxs10(Box10, { sx: { mt: 2, p: 2, bgcolor: "action.hover", borderRadius: 1 }, children: [
|
|
8300
|
+
/* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ jsx10("strong", { children: "Will clear:" }) }),
|
|
8301
|
+
/* @__PURE__ */ jsxs10(Typography9, { variant: "body2", sx: { fontFamily: "monospace", mt: 1 }, children: [
|
|
6813
8302
|
"\u2022 ",
|
|
6814
8303
|
clearCategoryDialog.itemCount,
|
|
6815
8304
|
" items",
|
|
6816
|
-
/* @__PURE__ */
|
|
8305
|
+
/* @__PURE__ */ jsx10("br", {}),
|
|
6817
8306
|
"\u2022 ",
|
|
6818
8307
|
formatBytes(clearCategoryDialog.size),
|
|
6819
8308
|
" of data",
|
|
6820
|
-
/* @__PURE__ */
|
|
8309
|
+
/* @__PURE__ */ jsx10("br", {}),
|
|
6821
8310
|
"\u2022 ",
|
|
6822
8311
|
clearCategoryDialog.stores.length,
|
|
6823
8312
|
" storage location",
|
|
@@ -6825,22 +8314,22 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6825
8314
|
] })
|
|
6826
8315
|
] })
|
|
6827
8316
|
] }),
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__PURE__ */
|
|
6830
|
-
|
|
8317
|
+
/* @__PURE__ */ jsxs10(DialogActions6, { children: [
|
|
8318
|
+
/* @__PURE__ */ jsx10(
|
|
8319
|
+
Button8,
|
|
6831
8320
|
{
|
|
6832
8321
|
onClick: () => setClearCategoryDialog(null),
|
|
6833
8322
|
disabled: clearing,
|
|
6834
8323
|
children: "Cancel"
|
|
6835
8324
|
}
|
|
6836
8325
|
),
|
|
6837
|
-
/* @__PURE__ */
|
|
6838
|
-
|
|
8326
|
+
/* @__PURE__ */ jsx10(
|
|
8327
|
+
Button8,
|
|
6839
8328
|
{
|
|
6840
8329
|
onClick: () => clearCategoryDialog && handleClearCategory(clearCategoryDialog),
|
|
6841
8330
|
color: "error",
|
|
6842
8331
|
variant: "contained",
|
|
6843
|
-
startIcon: clearing ? /* @__PURE__ */
|
|
8332
|
+
startIcon: clearing ? /* @__PURE__ */ jsx10(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx10(DeleteIcon4, {}),
|
|
6844
8333
|
disabled: clearing,
|
|
6845
8334
|
children: clearing ? "Clearing..." : "Clear Data"
|
|
6846
8335
|
}
|
|
@@ -6849,23 +8338,23 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6849
8338
|
]
|
|
6850
8339
|
}
|
|
6851
8340
|
),
|
|
6852
|
-
/* @__PURE__ */
|
|
6853
|
-
|
|
8341
|
+
/* @__PURE__ */ jsxs10(
|
|
8342
|
+
Dialog7,
|
|
6854
8343
|
{
|
|
6855
8344
|
open: clearAllDialogOpen,
|
|
6856
8345
|
onClose: () => setClearAllDialogOpen(false),
|
|
6857
8346
|
maxWidth: "sm",
|
|
6858
8347
|
fullWidth: true,
|
|
6859
8348
|
children: [
|
|
6860
|
-
/* @__PURE__ */
|
|
6861
|
-
/* @__PURE__ */
|
|
8349
|
+
/* @__PURE__ */ jsx10(DialogTitle6, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
8350
|
+
/* @__PURE__ */ jsx10(ErrorIcon3, { color: "error" }),
|
|
6862
8351
|
"Clear All Storage Data?"
|
|
6863
8352
|
] }) }),
|
|
6864
|
-
/* @__PURE__ */
|
|
6865
|
-
/* @__PURE__ */
|
|
6866
|
-
/* @__PURE__ */
|
|
6867
|
-
/* @__PURE__ */
|
|
6868
|
-
/* @__PURE__ */
|
|
8353
|
+
/* @__PURE__ */ jsxs10(DialogContent7, { children: [
|
|
8354
|
+
/* @__PURE__ */ jsx10(DialogContentText4, { children: "This will permanently delete ALL your local data including:" }),
|
|
8355
|
+
/* @__PURE__ */ jsx10(List2, { dense: true, sx: { mt: 1 }, children: clearableCategories.map((category) => /* @__PURE__ */ jsxs10(ListItem, { children: [
|
|
8356
|
+
/* @__PURE__ */ jsx10(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx10(category.icon, { fontSize: "small", sx: { color: category.color } }) }),
|
|
8357
|
+
/* @__PURE__ */ jsx10(
|
|
6869
8358
|
ListItemText,
|
|
6870
8359
|
{
|
|
6871
8360
|
primary: category.name,
|
|
@@ -6873,27 +8362,27 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6873
8362
|
}
|
|
6874
8363
|
)
|
|
6875
8364
|
] }, category.name)) }),
|
|
6876
|
-
/* @__PURE__ */
|
|
6877
|
-
/* @__PURE__ */
|
|
8365
|
+
/* @__PURE__ */ jsx10(Alert8, { severity: "error", sx: { mt: 2 }, children: /* @__PURE__ */ jsxs10(Typography9, { variant: "body2", children: [
|
|
8366
|
+
/* @__PURE__ */ jsx10("strong", { children: "This action cannot be undone!" }),
|
|
6878
8367
|
" Make sure to export any important data before proceeding."
|
|
6879
8368
|
] }) })
|
|
6880
8369
|
] }),
|
|
6881
|
-
/* @__PURE__ */
|
|
6882
|
-
/* @__PURE__ */
|
|
6883
|
-
|
|
8370
|
+
/* @__PURE__ */ jsxs10(DialogActions6, { children: [
|
|
8371
|
+
/* @__PURE__ */ jsx10(
|
|
8372
|
+
Button8,
|
|
6884
8373
|
{
|
|
6885
8374
|
onClick: () => setClearAllDialogOpen(false),
|
|
6886
8375
|
disabled: clearing,
|
|
6887
8376
|
children: "Cancel"
|
|
6888
8377
|
}
|
|
6889
8378
|
),
|
|
6890
|
-
/* @__PURE__ */
|
|
6891
|
-
|
|
8379
|
+
/* @__PURE__ */ jsx10(
|
|
8380
|
+
Button8,
|
|
6892
8381
|
{
|
|
6893
8382
|
onClick: handleClearAll,
|
|
6894
8383
|
color: "error",
|
|
6895
8384
|
variant: "contained",
|
|
6896
|
-
startIcon: clearing ? /* @__PURE__ */
|
|
8385
|
+
startIcon: clearing ? /* @__PURE__ */ jsx10(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx10(CleaningServicesIcon, {}),
|
|
6897
8386
|
disabled: clearing,
|
|
6898
8387
|
children: clearing ? "Clearing All..." : "Clear All Data"
|
|
6899
8388
|
}
|
|
@@ -6902,15 +8391,15 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6902
8391
|
]
|
|
6903
8392
|
}
|
|
6904
8393
|
),
|
|
6905
|
-
/* @__PURE__ */
|
|
6906
|
-
|
|
8394
|
+
/* @__PURE__ */ jsx10(
|
|
8395
|
+
Snackbar4,
|
|
6907
8396
|
{
|
|
6908
8397
|
open: showSnackbar,
|
|
6909
8398
|
autoHideDuration: 4e3,
|
|
6910
8399
|
onClose: () => setShowSnackbar(false),
|
|
6911
8400
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
6912
|
-
children: /* @__PURE__ */
|
|
6913
|
-
|
|
8401
|
+
children: /* @__PURE__ */ jsx10(
|
|
8402
|
+
Alert8,
|
|
6914
8403
|
{
|
|
6915
8404
|
onClose: () => setShowSnackbar(false),
|
|
6916
8405
|
severity: snackbarSeverity,
|
|
@@ -6926,27 +8415,27 @@ var StorageTab = ({ currentTheme }) => {
|
|
|
6926
8415
|
var StorageTab_default = StorageTab;
|
|
6927
8416
|
|
|
6928
8417
|
// src/management/components/ProviderTab.tsx
|
|
6929
|
-
import { useState as
|
|
8418
|
+
import { useState as useState12, useEffect as useEffect9, useCallback as useCallback7 } from "react";
|
|
6930
8419
|
import {
|
|
6931
|
-
Box as
|
|
6932
|
-
Typography as
|
|
8420
|
+
Box as Box11,
|
|
8421
|
+
Typography as Typography10,
|
|
6933
8422
|
Paper as Paper5,
|
|
6934
|
-
Button as
|
|
6935
|
-
TextField as
|
|
8423
|
+
Button as Button9,
|
|
8424
|
+
TextField as TextField6,
|
|
6936
8425
|
MenuItem as MenuItem3,
|
|
6937
|
-
Chip as
|
|
6938
|
-
Snackbar as
|
|
6939
|
-
Alert as
|
|
6940
|
-
useTheme as
|
|
6941
|
-
useMediaQuery as
|
|
8426
|
+
Chip as Chip8,
|
|
8427
|
+
Snackbar as Snackbar5,
|
|
8428
|
+
Alert as Alert9,
|
|
8429
|
+
useTheme as useTheme8,
|
|
8430
|
+
useMediaQuery as useMediaQuery6
|
|
6942
8431
|
} from "@mui/material";
|
|
6943
|
-
import { jsx as
|
|
8432
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6944
8433
|
var ProviderTab = () => {
|
|
6945
8434
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
6946
8435
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
6947
|
-
const theme =
|
|
6948
|
-
const isMobile =
|
|
6949
|
-
const getSuggestedModel =
|
|
8436
|
+
const theme = useTheme8();
|
|
8437
|
+
const isMobile = useMediaQuery6(theme.breakpoints.down("sm"));
|
|
8438
|
+
const getSuggestedModel = useCallback7((type) => {
|
|
6950
8439
|
const configuredDefault = packageSettings?.defaultModel?.trim();
|
|
6951
8440
|
if (configuredDefault) {
|
|
6952
8441
|
return configuredDefault;
|
|
@@ -6962,7 +8451,7 @@ var ProviderTab = () => {
|
|
|
6962
8451
|
return "";
|
|
6963
8452
|
}
|
|
6964
8453
|
}, [packageSettings?.defaultModel]);
|
|
6965
|
-
const applyDefaultModel =
|
|
8454
|
+
const applyDefaultModel = useCallback7((config) => {
|
|
6966
8455
|
const normalized = { ...config };
|
|
6967
8456
|
const trimmed = typeof normalized.defaultModel === "string" ? normalized.defaultModel.trim() : void 0;
|
|
6968
8457
|
const requiresModel = normalized.type === "openai" /* OPENAI */ || normalized.type === "xai" /* XAI */ || normalized.type === "bandit" /* BANDIT */;
|
|
@@ -6982,7 +8471,7 @@ var ProviderTab = () => {
|
|
|
6982
8471
|
}
|
|
6983
8472
|
return normalized;
|
|
6984
8473
|
}, [getSuggestedModel]);
|
|
6985
|
-
const sanitizeConfigForSave =
|
|
8474
|
+
const sanitizeConfigForSave = useCallback7((config) => {
|
|
6986
8475
|
const sanitized = { ...config };
|
|
6987
8476
|
if (typeof sanitized.defaultModel === "string") {
|
|
6988
8477
|
const trimmed = sanitized.defaultModel.trim();
|
|
@@ -6994,15 +8483,15 @@ var ProviderTab = () => {
|
|
|
6994
8483
|
}
|
|
6995
8484
|
return sanitized;
|
|
6996
8485
|
}, []);
|
|
6997
|
-
const [providerConfig, setProviderConfig] =
|
|
8486
|
+
const [providerConfig, setProviderConfig] = useState12({
|
|
6998
8487
|
type: "gateway",
|
|
6999
8488
|
gatewayUrl: packageSettings?.gatewayApiUrl || "",
|
|
7000
8489
|
provider: "bandit"
|
|
7001
8490
|
});
|
|
7002
|
-
const [isProviderConfigOpen, setIsProviderConfigOpen] =
|
|
7003
|
-
const [snackbarMessage, setSnackbarMessage] =
|
|
7004
|
-
const [showSnackbar, setShowSnackbar] =
|
|
7005
|
-
const [snackbarSeverity, setSnackbarSeverity] =
|
|
8491
|
+
const [isProviderConfigOpen, setIsProviderConfigOpen] = useState12(false);
|
|
8492
|
+
const [snackbarMessage, setSnackbarMessage] = useState12("");
|
|
8493
|
+
const [showSnackbar, setShowSnackbar] = useState12(false);
|
|
8494
|
+
const [snackbarSeverity, setSnackbarSeverity] = useState12("success");
|
|
7006
8495
|
const saveProviderConfigToDB = async (config) => {
|
|
7007
8496
|
try {
|
|
7008
8497
|
const { tokenFactory: _tokenFactory, ...persistableConfig } = config;
|
|
@@ -7043,7 +8532,7 @@ var ProviderTab = () => {
|
|
|
7043
8532
|
}
|
|
7044
8533
|
return null;
|
|
7045
8534
|
};
|
|
7046
|
-
const convertAnthropicConfig =
|
|
8535
|
+
const convertAnthropicConfig = useCallback7((config) => {
|
|
7047
8536
|
if (!config) return null;
|
|
7048
8537
|
if (config.type !== "anthropic" /* ANTHROPIC */) {
|
|
7049
8538
|
return config;
|
|
@@ -7059,7 +8548,7 @@ var ProviderTab = () => {
|
|
|
7059
8548
|
};
|
|
7060
8549
|
return converted;
|
|
7061
8550
|
}, [packageSettings?.gatewayApiUrl]);
|
|
7062
|
-
|
|
8551
|
+
useEffect9(() => {
|
|
7063
8552
|
const initializeProviderConfig = async () => {
|
|
7064
8553
|
const savedConfig = await loadProviderConfigFromDB();
|
|
7065
8554
|
if (savedConfig) {
|
|
@@ -7194,18 +8683,18 @@ var ProviderTab = () => {
|
|
|
7194
8683
|
showMessage("Connection test failed. Please check your configuration.", "error");
|
|
7195
8684
|
}
|
|
7196
8685
|
};
|
|
7197
|
-
return /* @__PURE__ */
|
|
7198
|
-
/* @__PURE__ */
|
|
7199
|
-
/* @__PURE__ */
|
|
7200
|
-
|
|
8686
|
+
return /* @__PURE__ */ jsxs11(Box11, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
|
|
8687
|
+
/* @__PURE__ */ jsxs11(Box11, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
|
|
8688
|
+
/* @__PURE__ */ jsx11(
|
|
8689
|
+
Typography10,
|
|
7201
8690
|
{
|
|
7202
8691
|
variant: "h5",
|
|
7203
8692
|
sx: { fontWeight: 600, mb: 1, color: "primary.main", fontSize: { xs: "1.6rem", md: "1.8rem" } },
|
|
7204
8693
|
children: "AI Provider Configuration"
|
|
7205
8694
|
}
|
|
7206
8695
|
),
|
|
7207
|
-
/* @__PURE__ */
|
|
7208
|
-
|
|
8696
|
+
/* @__PURE__ */ jsx11(
|
|
8697
|
+
Typography10,
|
|
7209
8698
|
{
|
|
7210
8699
|
variant: "body1",
|
|
7211
8700
|
color: "text.secondary",
|
|
@@ -7214,23 +8703,23 @@ var ProviderTab = () => {
|
|
|
7214
8703
|
children: "Configure your AI provider for chat, generation, and model services. This determines which backend service powers your AI interactions."
|
|
7215
8704
|
}
|
|
7216
8705
|
),
|
|
7217
|
-
/* @__PURE__ */
|
|
7218
|
-
/* @__PURE__ */
|
|
7219
|
-
currentProvider ? /* @__PURE__ */
|
|
7220
|
-
/* @__PURE__ */
|
|
7221
|
-
|
|
8706
|
+
/* @__PURE__ */ jsxs11(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
|
|
8707
|
+
/* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Current Provider" }),
|
|
8708
|
+
currentProvider ? /* @__PURE__ */ jsxs11(Box11, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
8709
|
+
/* @__PURE__ */ jsx11(
|
|
8710
|
+
Chip8,
|
|
7222
8711
|
{
|
|
7223
8712
|
label: currentProvider.getProviderType().toUpperCase(),
|
|
7224
8713
|
color: "primary",
|
|
7225
8714
|
variant: "filled"
|
|
7226
8715
|
}
|
|
7227
8716
|
),
|
|
7228
|
-
/* @__PURE__ */
|
|
7229
|
-
] }) : /* @__PURE__ */
|
|
8717
|
+
/* @__PURE__ */ jsx11(Typography10, { variant: "body2", color: "text.secondary", children: currentProviderConfig?.baseUrl || currentProviderConfig?.gatewayUrl || "No URL configured" })
|
|
8718
|
+
] }) : /* @__PURE__ */ jsx11(Chip8, { label: "No Provider Configured", color: "warning" })
|
|
7230
8719
|
] }),
|
|
7231
|
-
/* @__PURE__ */
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
|
|
8720
|
+
/* @__PURE__ */ jsxs11(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
|
|
8721
|
+
/* @__PURE__ */ jsxs11(
|
|
8722
|
+
Box11,
|
|
7234
8723
|
{
|
|
7235
8724
|
sx: {
|
|
7236
8725
|
display: "flex",
|
|
@@ -7241,9 +8730,9 @@ var ProviderTab = () => {
|
|
|
7241
8730
|
mb: 3
|
|
7242
8731
|
},
|
|
7243
8732
|
children: [
|
|
7244
|
-
/* @__PURE__ */
|
|
7245
|
-
/* @__PURE__ */
|
|
7246
|
-
|
|
8733
|
+
/* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
|
|
8734
|
+
/* @__PURE__ */ jsxs11(
|
|
8735
|
+
Button9,
|
|
7247
8736
|
{
|
|
7248
8737
|
variant: "outlined",
|
|
7249
8738
|
onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
|
|
@@ -7257,9 +8746,9 @@ var ProviderTab = () => {
|
|
|
7257
8746
|
]
|
|
7258
8747
|
}
|
|
7259
8748
|
),
|
|
7260
|
-
isProviderConfigOpen && /* @__PURE__ */
|
|
7261
|
-
/* @__PURE__ */
|
|
7262
|
-
|
|
8749
|
+
isProviderConfigOpen && /* @__PURE__ */ jsxs11(Box11, { sx: { mt: 3 }, children: [
|
|
8750
|
+
/* @__PURE__ */ jsxs11(
|
|
8751
|
+
TextField6,
|
|
7263
8752
|
{
|
|
7264
8753
|
label: "Provider Type",
|
|
7265
8754
|
select: true,
|
|
@@ -7268,19 +8757,19 @@ var ProviderTab = () => {
|
|
|
7268
8757
|
fullWidth: true,
|
|
7269
8758
|
sx: { mb: 3 },
|
|
7270
8759
|
children: [
|
|
7271
|
-
/* @__PURE__ */
|
|
7272
|
-
/* @__PURE__ */
|
|
7273
|
-
/* @__PURE__ */
|
|
7274
|
-
/* @__PURE__ */
|
|
7275
|
-
/* @__PURE__ */
|
|
7276
|
-
/* @__PURE__ */
|
|
7277
|
-
/* @__PURE__ */
|
|
8760
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "gateway", children: "Gateway (Recommended)" }),
|
|
8761
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "ollama", children: "Ollama" }),
|
|
8762
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "openai", children: "OpenAI" }),
|
|
8763
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
8764
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "bandit", children: "Bandit AI" }),
|
|
8765
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "xai", children: "xAI" }),
|
|
8766
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "playground", children: "Playground (Mock Demo)" })
|
|
7278
8767
|
]
|
|
7279
8768
|
}
|
|
7280
8769
|
),
|
|
7281
|
-
providerConfig.type === "gateway" && /* @__PURE__ */
|
|
7282
|
-
/* @__PURE__ */
|
|
7283
|
-
|
|
8770
|
+
providerConfig.type === "gateway" && /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
8771
|
+
/* @__PURE__ */ jsx11(
|
|
8772
|
+
TextField6,
|
|
7284
8773
|
{
|
|
7285
8774
|
label: "Gateway URL",
|
|
7286
8775
|
value: providerConfig.gatewayUrl || "",
|
|
@@ -7290,8 +8779,8 @@ var ProviderTab = () => {
|
|
|
7290
8779
|
placeholder: "https://your-gateway-api.com"
|
|
7291
8780
|
}
|
|
7292
8781
|
),
|
|
7293
|
-
/* @__PURE__ */
|
|
7294
|
-
|
|
8782
|
+
/* @__PURE__ */ jsxs11(
|
|
8783
|
+
TextField6,
|
|
7295
8784
|
{
|
|
7296
8785
|
label: "Backend Provider",
|
|
7297
8786
|
select: true,
|
|
@@ -7303,18 +8792,18 @@ var ProviderTab = () => {
|
|
|
7303
8792
|
fullWidth: true,
|
|
7304
8793
|
sx: { mb: 2 },
|
|
7305
8794
|
children: [
|
|
7306
|
-
/* @__PURE__ */
|
|
7307
|
-
/* @__PURE__ */
|
|
7308
|
-
/* @__PURE__ */
|
|
7309
|
-
/* @__PURE__ */
|
|
7310
|
-
/* @__PURE__ */
|
|
7311
|
-
/* @__PURE__ */
|
|
8795
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "openai", children: "OpenAI" }),
|
|
8796
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
8797
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "anthropic", children: "Anthropic" }),
|
|
8798
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "ollama", children: "Ollama" }),
|
|
8799
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "bandit", children: "Bandit AI" }),
|
|
8800
|
+
/* @__PURE__ */ jsx11(MenuItem3, { value: "xai", children: "xAI" })
|
|
7312
8801
|
]
|
|
7313
8802
|
}
|
|
7314
8803
|
)
|
|
7315
8804
|
] }),
|
|
7316
|
-
providerConfig.type === "ollama" && /* @__PURE__ */
|
|
7317
|
-
|
|
8805
|
+
providerConfig.type === "ollama" && /* @__PURE__ */ jsx11(
|
|
8806
|
+
TextField6,
|
|
7318
8807
|
{
|
|
7319
8808
|
label: "Ollama URL",
|
|
7320
8809
|
value: providerConfig.baseUrl || "",
|
|
@@ -7323,9 +8812,9 @@ var ProviderTab = () => {
|
|
|
7323
8812
|
placeholder: "http://localhost:11434"
|
|
7324
8813
|
}
|
|
7325
8814
|
),
|
|
7326
|
-
providerConfig.type === "bandit" && /* @__PURE__ */
|
|
7327
|
-
/* @__PURE__ */
|
|
7328
|
-
|
|
8815
|
+
providerConfig.type === "bandit" && /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
8816
|
+
/* @__PURE__ */ jsx11(
|
|
8817
|
+
TextField6,
|
|
7329
8818
|
{
|
|
7330
8819
|
label: "API Base URL",
|
|
7331
8820
|
value: providerConfig.baseUrl || "",
|
|
@@ -7339,8 +8828,8 @@ var ProviderTab = () => {
|
|
|
7339
8828
|
helperText: "Defaults to https://api.burtson.ai"
|
|
7340
8829
|
}
|
|
7341
8830
|
),
|
|
7342
|
-
/* @__PURE__ */
|
|
7343
|
-
|
|
8831
|
+
/* @__PURE__ */ jsx11(
|
|
8832
|
+
TextField6,
|
|
7344
8833
|
{
|
|
7345
8834
|
label: "API Key",
|
|
7346
8835
|
type: "password",
|
|
@@ -7354,8 +8843,8 @@ var ProviderTab = () => {
|
|
|
7354
8843
|
placeholder: "bai_..."
|
|
7355
8844
|
}
|
|
7356
8845
|
),
|
|
7357
|
-
/* @__PURE__ */
|
|
7358
|
-
|
|
8846
|
+
/* @__PURE__ */ jsx11(
|
|
8847
|
+
TextField6,
|
|
7359
8848
|
{
|
|
7360
8849
|
label: "Default Model ID",
|
|
7361
8850
|
value: providerConfig.defaultModel || "",
|
|
@@ -7369,9 +8858,9 @@ var ProviderTab = () => {
|
|
|
7369
8858
|
}
|
|
7370
8859
|
)
|
|
7371
8860
|
] }),
|
|
7372
|
-
providerConfig.type === "openai" && /* @__PURE__ */
|
|
7373
|
-
/* @__PURE__ */
|
|
7374
|
-
|
|
8861
|
+
providerConfig.type === "openai" && /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
8862
|
+
/* @__PURE__ */ jsx11(
|
|
8863
|
+
TextField6,
|
|
7375
8864
|
{
|
|
7376
8865
|
label: "API Base URL",
|
|
7377
8866
|
value: providerConfig.baseUrl || "",
|
|
@@ -7384,8 +8873,8 @@ var ProviderTab = () => {
|
|
|
7384
8873
|
placeholder: "https://api.openai.com/v1"
|
|
7385
8874
|
}
|
|
7386
8875
|
),
|
|
7387
|
-
/* @__PURE__ */
|
|
7388
|
-
|
|
8876
|
+
/* @__PURE__ */ jsx11(
|
|
8877
|
+
TextField6,
|
|
7389
8878
|
{
|
|
7390
8879
|
label: "API Key",
|
|
7391
8880
|
type: "password",
|
|
@@ -7399,8 +8888,8 @@ var ProviderTab = () => {
|
|
|
7399
8888
|
placeholder: "sk-..."
|
|
7400
8889
|
}
|
|
7401
8890
|
),
|
|
7402
|
-
/* @__PURE__ */
|
|
7403
|
-
|
|
8891
|
+
/* @__PURE__ */ jsx11(
|
|
8892
|
+
TextField6,
|
|
7404
8893
|
{
|
|
7405
8894
|
label: "Default Model ID",
|
|
7406
8895
|
value: providerConfig.defaultModel || "",
|
|
@@ -7414,9 +8903,9 @@ var ProviderTab = () => {
|
|
|
7414
8903
|
}
|
|
7415
8904
|
)
|
|
7416
8905
|
] }),
|
|
7417
|
-
providerConfig.type === "azure-openai" && /* @__PURE__ */
|
|
7418
|
-
/* @__PURE__ */
|
|
7419
|
-
|
|
8906
|
+
providerConfig.type === "azure-openai" && /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
8907
|
+
/* @__PURE__ */ jsx11(
|
|
8908
|
+
TextField6,
|
|
7420
8909
|
{
|
|
7421
8910
|
label: "Azure Endpoint",
|
|
7422
8911
|
value: providerConfig.baseUrl || "",
|
|
@@ -7426,8 +8915,8 @@ var ProviderTab = () => {
|
|
|
7426
8915
|
placeholder: "https://your-resource.openai.azure.com"
|
|
7427
8916
|
}
|
|
7428
8917
|
),
|
|
7429
|
-
/* @__PURE__ */
|
|
7430
|
-
|
|
8918
|
+
/* @__PURE__ */ jsx11(
|
|
8919
|
+
TextField6,
|
|
7431
8920
|
{
|
|
7432
8921
|
label: "API Key",
|
|
7433
8922
|
type: "password",
|
|
@@ -7437,8 +8926,8 @@ var ProviderTab = () => {
|
|
|
7437
8926
|
sx: { mb: 2 }
|
|
7438
8927
|
}
|
|
7439
8928
|
),
|
|
7440
|
-
/* @__PURE__ */
|
|
7441
|
-
|
|
8929
|
+
/* @__PURE__ */ jsx11(
|
|
8930
|
+
TextField6,
|
|
7442
8931
|
{
|
|
7443
8932
|
label: "API Version",
|
|
7444
8933
|
value: providerConfig.apiVersion || "",
|
|
@@ -7448,8 +8937,8 @@ var ProviderTab = () => {
|
|
|
7448
8937
|
placeholder: "2024-02-01"
|
|
7449
8938
|
}
|
|
7450
8939
|
),
|
|
7451
|
-
/* @__PURE__ */
|
|
7452
|
-
|
|
8940
|
+
/* @__PURE__ */ jsx11(
|
|
8941
|
+
TextField6,
|
|
7453
8942
|
{
|
|
7454
8943
|
label: "Deployment Name",
|
|
7455
8944
|
value: providerConfig.deploymentName || "",
|
|
@@ -7459,9 +8948,9 @@ var ProviderTab = () => {
|
|
|
7459
8948
|
}
|
|
7460
8949
|
)
|
|
7461
8950
|
] }),
|
|
7462
|
-
providerConfig.type === "xai" && /* @__PURE__ */
|
|
7463
|
-
/* @__PURE__ */
|
|
7464
|
-
|
|
8951
|
+
providerConfig.type === "xai" && /* @__PURE__ */ jsxs11(Box11, { children: [
|
|
8952
|
+
/* @__PURE__ */ jsx11(
|
|
8953
|
+
TextField6,
|
|
7465
8954
|
{
|
|
7466
8955
|
label: "API Base URL",
|
|
7467
8956
|
value: providerConfig.baseUrl || "",
|
|
@@ -7474,8 +8963,8 @@ var ProviderTab = () => {
|
|
|
7474
8963
|
placeholder: "https://api.x.ai/v1"
|
|
7475
8964
|
}
|
|
7476
8965
|
),
|
|
7477
|
-
/* @__PURE__ */
|
|
7478
|
-
|
|
8966
|
+
/* @__PURE__ */ jsx11(
|
|
8967
|
+
TextField6,
|
|
7479
8968
|
{
|
|
7480
8969
|
label: "API Key",
|
|
7481
8970
|
type: "password",
|
|
@@ -7489,8 +8978,8 @@ var ProviderTab = () => {
|
|
|
7489
8978
|
placeholder: "xai-..."
|
|
7490
8979
|
}
|
|
7491
8980
|
),
|
|
7492
|
-
/* @__PURE__ */
|
|
7493
|
-
|
|
8981
|
+
/* @__PURE__ */ jsx11(
|
|
8982
|
+
TextField6,
|
|
7494
8983
|
{
|
|
7495
8984
|
label: "Default Model ID",
|
|
7496
8985
|
value: providerConfig.defaultModel || "",
|
|
@@ -7504,10 +8993,10 @@ var ProviderTab = () => {
|
|
|
7504
8993
|
}
|
|
7505
8994
|
)
|
|
7506
8995
|
] }),
|
|
7507
|
-
providerConfig.type === "anthropic" && /* @__PURE__ */
|
|
7508
|
-
/* @__PURE__ */
|
|
7509
|
-
/* @__PURE__ */
|
|
7510
|
-
|
|
8996
|
+
providerConfig.type === "anthropic" && /* @__PURE__ */ jsx11(Alert9, { 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." }),
|
|
8997
|
+
/* @__PURE__ */ jsxs11(Box11, { sx: { display: "flex", gap: 2, mt: 3 }, children: [
|
|
8998
|
+
/* @__PURE__ */ jsx11(
|
|
8999
|
+
Button9,
|
|
7511
9000
|
{
|
|
7512
9001
|
variant: "outlined",
|
|
7513
9002
|
onClick: handleTestProviderConnection,
|
|
@@ -7515,8 +9004,8 @@ var ProviderTab = () => {
|
|
|
7515
9004
|
children: "Test Connection"
|
|
7516
9005
|
}
|
|
7517
9006
|
),
|
|
7518
|
-
/* @__PURE__ */
|
|
7519
|
-
|
|
9007
|
+
/* @__PURE__ */ jsx11(
|
|
9008
|
+
Button9,
|
|
7520
9009
|
{
|
|
7521
9010
|
variant: "contained",
|
|
7522
9011
|
onClick: handleSaveProviderConfig,
|
|
@@ -7527,20 +9016,20 @@ var ProviderTab = () => {
|
|
|
7527
9016
|
] })
|
|
7528
9017
|
] })
|
|
7529
9018
|
] }),
|
|
7530
|
-
/* @__PURE__ */
|
|
7531
|
-
/* @__PURE__ */
|
|
7532
|
-
/* @__PURE__ */
|
|
9019
|
+
/* @__PURE__ */ jsxs11(Paper5, { sx: { p: 3, bgcolor: "info.main", color: "info.contrastText", borderRadius: 2 }, children: [
|
|
9020
|
+
/* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { mb: 1, fontWeight: 600, color: "text.primary" }, children: "\u{1F680} Gateway Provider Recommended" }),
|
|
9021
|
+
/* @__PURE__ */ jsx11(Typography10, { 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." })
|
|
7533
9022
|
] })
|
|
7534
9023
|
] }),
|
|
7535
|
-
/* @__PURE__ */
|
|
7536
|
-
|
|
9024
|
+
/* @__PURE__ */ jsx11(
|
|
9025
|
+
Snackbar5,
|
|
7537
9026
|
{
|
|
7538
9027
|
open: showSnackbar,
|
|
7539
9028
|
autoHideDuration: 6e3,
|
|
7540
9029
|
onClose: () => setShowSnackbar(false),
|
|
7541
9030
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
7542
|
-
children: /* @__PURE__ */
|
|
7543
|
-
|
|
9031
|
+
children: /* @__PURE__ */ jsx11(
|
|
9032
|
+
Alert9,
|
|
7544
9033
|
{
|
|
7545
9034
|
onClose: () => setShowSnackbar(false),
|
|
7546
9035
|
severity: snackbarSeverity,
|
|
@@ -7555,9 +9044,9 @@ var ProviderTab = () => {
|
|
|
7555
9044
|
};
|
|
7556
9045
|
|
|
7557
9046
|
// src/management/components/MCPToolsTabV2.tsx
|
|
7558
|
-
import { useEffect as
|
|
7559
|
-
import { Box as
|
|
7560
|
-
import
|
|
9047
|
+
import { useEffect as useEffect10, useMemo as useMemo5, useState as useState13 } from "react";
|
|
9048
|
+
import { Box as Box12, Typography as Typography11, Paper as Paper6, Chip as Chip9, Stack as Stack5, IconButton as IconButton6, Tooltip as Tooltip3, LinearProgress as LinearProgress5, Switch as Switch3, FormControlLabel as FormControlLabel2 } from "@mui/material";
|
|
9049
|
+
import RefreshIcon4 from "@mui/icons-material/Refresh";
|
|
7561
9050
|
import HealthAndSafetyIcon from "@mui/icons-material/HealthAndSafety";
|
|
7562
9051
|
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
|
|
7563
9052
|
import SettingsIcon2 from "@mui/icons-material/Settings";
|
|
@@ -7571,7 +9060,7 @@ var isPlaygroundMode = () => {
|
|
|
7571
9060
|
const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
|
|
7572
9061
|
return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
|
|
7573
9062
|
};
|
|
7574
|
-
function
|
|
9063
|
+
function buildUrl2(path) {
|
|
7575
9064
|
if (isPlaygroundMode()) {
|
|
7576
9065
|
debugLogger.info("MCP controller URL build skipped in playground mode", { path });
|
|
7577
9066
|
return path.startsWith("/") ? path : `/${path}`;
|
|
@@ -7594,7 +9083,7 @@ async function fetchAvailableMcpTools() {
|
|
|
7594
9083
|
debugLogger.info("Skipping remote MCP tool fetch \u2014 playground mode active");
|
|
7595
9084
|
return [];
|
|
7596
9085
|
}
|
|
7597
|
-
const url =
|
|
9086
|
+
const url = buildUrl2("/mcp/tools");
|
|
7598
9087
|
try {
|
|
7599
9088
|
const res = await fetch(url, { headers: authHeaders() });
|
|
7600
9089
|
const data = await res.json();
|
|
@@ -7618,7 +9107,7 @@ async function fetchMcpHealth() {
|
|
|
7618
9107
|
availableTools: []
|
|
7619
9108
|
};
|
|
7620
9109
|
}
|
|
7621
|
-
const url =
|
|
9110
|
+
const url = buildUrl2("/mcp/health");
|
|
7622
9111
|
try {
|
|
7623
9112
|
const res = await fetch(url, { headers: authHeaders() });
|
|
7624
9113
|
const data = await res.json();
|
|
@@ -7633,14 +9122,14 @@ async function fetchMcpHealth() {
|
|
|
7633
9122
|
}
|
|
7634
9123
|
|
|
7635
9124
|
// src/management/components/MCPToolsTabV2.tsx
|
|
7636
|
-
import { jsx as
|
|
9125
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
7637
9126
|
var MCPToolsTabV2 = () => {
|
|
7638
9127
|
const { settings } = usePackageSettingsStore();
|
|
7639
9128
|
const { tools: localTools, loadTools, toggleTool, addTool, updateTool, isLoaded } = useMCPToolsStore();
|
|
7640
|
-
const [loading, setLoading] =
|
|
7641
|
-
const [error, setError] =
|
|
7642
|
-
const [tools, setTools] =
|
|
7643
|
-
const [health, setHealth] =
|
|
9129
|
+
const [loading, setLoading] = useState13(true);
|
|
9130
|
+
const [error, setError] = useState13(null);
|
|
9131
|
+
const [tools, setTools] = useState13([]);
|
|
9132
|
+
const [health, setHealth] = useState13(null);
|
|
7644
9133
|
const gatewayConfigured = !!settings?.gatewayApiUrl;
|
|
7645
9134
|
const refresh = async () => {
|
|
7646
9135
|
setLoading(true);
|
|
@@ -7694,7 +9183,7 @@ var MCPToolsTabV2 = () => {
|
|
|
7694
9183
|
setLoading(false);
|
|
7695
9184
|
}
|
|
7696
9185
|
};
|
|
7697
|
-
|
|
9186
|
+
useEffect10(() => {
|
|
7698
9187
|
if (isLoaded) {
|
|
7699
9188
|
refresh();
|
|
7700
9189
|
} else {
|
|
@@ -7703,7 +9192,7 @@ var MCPToolsTabV2 = () => {
|
|
|
7703
9192
|
});
|
|
7704
9193
|
}
|
|
7705
9194
|
}, [isLoaded]);
|
|
7706
|
-
const localEnabledMap =
|
|
9195
|
+
const localEnabledMap = useMemo5(() => {
|
|
7707
9196
|
const map = /* @__PURE__ */ new Map();
|
|
7708
9197
|
const sortedTools = [...localTools].sort((a, b) => {
|
|
7709
9198
|
if (a.isBuiltIn && !b.isBuiltIn) return -1;
|
|
@@ -7719,17 +9208,17 @@ var MCPToolsTabV2 = () => {
|
|
|
7719
9208
|
});
|
|
7720
9209
|
return map;
|
|
7721
9210
|
}, [localTools]);
|
|
7722
|
-
return /* @__PURE__ */
|
|
7723
|
-
/* @__PURE__ */
|
|
7724
|
-
/* @__PURE__ */
|
|
7725
|
-
/* @__PURE__ */
|
|
9211
|
+
return /* @__PURE__ */ jsxs12(Box12, { children: [
|
|
9212
|
+
/* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
9213
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "h5", sx: { fontWeight: 600, color: "primary.main" }, children: "Available Tools" }),
|
|
9214
|
+
/* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Tooltip3, { title: "Refresh", children: /* @__PURE__ */ jsx12(IconButton6, { onClick: refresh, children: /* @__PURE__ */ jsx12(RefreshIcon4, {}) }) }) })
|
|
7726
9215
|
] }),
|
|
7727
|
-
!gatewayConfigured && /* @__PURE__ */
|
|
7728
|
-
/* @__PURE__ */
|
|
7729
|
-
health?.status === "healthy" ? /* @__PURE__ */
|
|
7730
|
-
/* @__PURE__ */
|
|
7731
|
-
/* @__PURE__ */
|
|
7732
|
-
|
|
9216
|
+
!gatewayConfigured && /* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx12(Typography11, { variant: "body2", color: "text.secondary", children: "Gateway API URL isn\u2019t configured. The controller endpoints will be fetched relative to this origin." }) }),
|
|
9217
|
+
/* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
9218
|
+
health?.status === "healthy" ? /* @__PURE__ */ jsx12(HealthAndSafetyIcon, { color: "success" }) : health?.status === "unhealthy" ? /* @__PURE__ */ jsx12(ErrorOutlineIcon, { color: "error" }) : /* @__PURE__ */ jsx12(ErrorOutlineIcon, { color: "disabled" }),
|
|
9219
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "Controller Health" }),
|
|
9220
|
+
/* @__PURE__ */ jsx12(
|
|
9221
|
+
Chip9,
|
|
7733
9222
|
{
|
|
7734
9223
|
size: "small",
|
|
7735
9224
|
label: (health?.status || "unknown").toString(),
|
|
@@ -7737,11 +9226,11 @@ var MCPToolsTabV2 = () => {
|
|
|
7737
9226
|
sx: { ml: 1 }
|
|
7738
9227
|
}
|
|
7739
9228
|
),
|
|
7740
|
-
health?.timestamp && /* @__PURE__ */
|
|
9229
|
+
health?.timestamp && /* @__PURE__ */ jsx12(Typography11, { variant: "caption", color: "text.secondary", sx: { ml: 1 }, children: new Date(health.timestamp).toLocaleString() })
|
|
7741
9230
|
] }) }),
|
|
7742
|
-
loading && /* @__PURE__ */
|
|
7743
|
-
error && /* @__PURE__ */
|
|
7744
|
-
/* @__PURE__ */
|
|
9231
|
+
loading && /* @__PURE__ */ jsx12(Box12, { sx: { mb: 2 }, children: /* @__PURE__ */ jsx12(LinearProgress5, {}) }),
|
|
9232
|
+
error && /* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx12(Typography11, { color: "error", children: error }) }),
|
|
9233
|
+
/* @__PURE__ */ jsx12(Stack5, { spacing: 2, children: tools.map((tool) => {
|
|
7745
9234
|
let locallyEnabled = localEnabledMap.get(tool.id);
|
|
7746
9235
|
if (locallyEnabled === void 0) {
|
|
7747
9236
|
locallyEnabled = localEnabledMap.get(tool.name);
|
|
@@ -7752,17 +9241,17 @@ var MCPToolsTabV2 = () => {
|
|
|
7752
9241
|
);
|
|
7753
9242
|
locallyEnabled = directLookup?.enabled ?? tool.isEnabled;
|
|
7754
9243
|
}
|
|
7755
|
-
return /* @__PURE__ */
|
|
7756
|
-
/* @__PURE__ */
|
|
7757
|
-
/* @__PURE__ */
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
9244
|
+
return /* @__PURE__ */ jsxs12(Paper6, { sx: { p: 2 }, children: [
|
|
9245
|
+
/* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
9246
|
+
/* @__PURE__ */ jsxs12(Box12, { children: [
|
|
9247
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "h6", sx: { fontWeight: 700 }, children: tool.name }),
|
|
9248
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: tool.description })
|
|
7760
9249
|
] }),
|
|
7761
|
-
/* @__PURE__ */
|
|
7762
|
-
/* @__PURE__ */
|
|
9250
|
+
/* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
9251
|
+
/* @__PURE__ */ jsx12(
|
|
7763
9252
|
FormControlLabel2,
|
|
7764
9253
|
{
|
|
7765
|
-
control: /* @__PURE__ */
|
|
9254
|
+
control: /* @__PURE__ */ jsx12(Switch3, { checked: !!locallyEnabled, onChange: () => {
|
|
7766
9255
|
let local = localTools.find((t) => t.function.name === tool.id);
|
|
7767
9256
|
if (!local) {
|
|
7768
9257
|
local = localTools.find((t) => t.function.name === tool.name);
|
|
@@ -7782,12 +9271,12 @@ var MCPToolsTabV2 = () => {
|
|
|
7782
9271
|
label: locallyEnabled ? "Enabled" : "Disabled"
|
|
7783
9272
|
}
|
|
7784
9273
|
),
|
|
7785
|
-
/* @__PURE__ */
|
|
9274
|
+
/* @__PURE__ */ jsx12(Tooltip3, { title: "Controller-driven tools (read-only schema)", children: /* @__PURE__ */ jsx12(SettingsIcon2, { color: "disabled" }) })
|
|
7786
9275
|
] })
|
|
7787
9276
|
] }),
|
|
7788
|
-
!!tool.supportedParameters?.length && /* @__PURE__ */
|
|
7789
|
-
/* @__PURE__ */
|
|
7790
|
-
/* @__PURE__ */
|
|
9277
|
+
!!tool.supportedParameters?.length && /* @__PURE__ */ jsxs12(Box12, { sx: { mt: 1.5 }, children: [
|
|
9278
|
+
/* @__PURE__ */ jsx12(Typography11, { variant: "caption", color: "text.secondary", children: "Supported parameters" }),
|
|
9279
|
+
/* @__PURE__ */ jsx12(Box12, { sx: { mt: 0.5, display: "flex", flexWrap: "wrap", gap: 1 }, children: tool.supportedParameters.map((p) => /* @__PURE__ */ jsx12(Chip9, { size: "small", label: p }, p)) })
|
|
7791
9280
|
] })
|
|
7792
9281
|
] }, tool.id);
|
|
7793
9282
|
}) })
|
|
@@ -7796,13 +9285,20 @@ var MCPToolsTabV2 = () => {
|
|
|
7796
9285
|
var MCPToolsTabV2_default = MCPToolsTabV2;
|
|
7797
9286
|
|
|
7798
9287
|
// src/management/management.tsx
|
|
7799
|
-
import { jsx as
|
|
7800
|
-
var preloadChatPage = () => import("./chat-
|
|
9288
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9289
|
+
var preloadChatPage = () => import("./chat-W5IFNEUC.mjs");
|
|
9290
|
+
var buildCapabilitiesUrl = (gatewayApiUrl) => {
|
|
9291
|
+
const trimmed = gatewayApiUrl.replace(/\/$/, "");
|
|
9292
|
+
if (trimmed.endsWith("/api")) {
|
|
9293
|
+
return `${trimmed}/capabilities`;
|
|
9294
|
+
}
|
|
9295
|
+
return `${trimmed}/api/capabilities`;
|
|
9296
|
+
};
|
|
7801
9297
|
var Management = () => {
|
|
7802
9298
|
const navigate = useNavigate();
|
|
7803
9299
|
const notificationService = useNotificationService();
|
|
7804
|
-
const isMobile =
|
|
7805
|
-
const [sidebarOpen, setSidebarOpen] =
|
|
9300
|
+
const isMobile = useMediaQuery7("(max-width:900px)");
|
|
9301
|
+
const [sidebarOpen, setSidebarOpen] = useState14(false);
|
|
7806
9302
|
const getOptimalFabLogo = async () => {
|
|
7807
9303
|
const banditHead2 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
7808
9304
|
try {
|
|
@@ -7842,16 +9338,16 @@ var Management = () => {
|
|
|
7842
9338
|
hasTransparentLogo,
|
|
7843
9339
|
setHasTransparentLogo
|
|
7844
9340
|
} = useModelStore();
|
|
7845
|
-
const [modalOpen, setModalOpen] =
|
|
9341
|
+
const [modalOpen, setModalOpen] = useState14(false);
|
|
7846
9342
|
const banditHead = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
7847
|
-
const [fabLogo, setFabLogo] =
|
|
7848
|
-
const [tabIndex, setTabIndex] =
|
|
7849
|
-
const [logoFile, setLogoFile] =
|
|
7850
|
-
const [logoBase64, setLogoBase64] =
|
|
7851
|
-
const [brandingText, setBrandingText] =
|
|
7852
|
-
const [theme, setTheme] =
|
|
7853
|
-
const [customAvatarBase64, setCustomAvatarBase64] =
|
|
7854
|
-
const [presetAvatar, setPresetAvatar] =
|
|
9343
|
+
const [fabLogo, setFabLogo] = useState14(banditHead);
|
|
9344
|
+
const [tabIndex, setTabIndex] = useState14(0);
|
|
9345
|
+
const [logoFile, setLogoFile] = useState14(null);
|
|
9346
|
+
const [logoBase64, setLogoBase64] = useState14(null);
|
|
9347
|
+
const [brandingText, setBrandingText] = useState14("");
|
|
9348
|
+
const [theme, setTheme] = useState14("bandit-dark");
|
|
9349
|
+
const [customAvatarBase64, setCustomAvatarBase64] = useState14(null);
|
|
9350
|
+
const [presetAvatar, setPresetAvatar] = useState14(null);
|
|
7855
9351
|
const showSnackbarMessage = (message, severity = "success") => {
|
|
7856
9352
|
if (severity === "success") {
|
|
7857
9353
|
notificationService?.showSuccess(message);
|
|
@@ -7859,16 +9355,18 @@ var Management = () => {
|
|
|
7859
9355
|
notificationService?.showError(message);
|
|
7860
9356
|
}
|
|
7861
9357
|
};
|
|
7862
|
-
const [restoreDialogOpen, setRestoreDialogOpen] =
|
|
7863
|
-
const [brandingLoaded, setBrandingLoaded] =
|
|
7864
|
-
const [isLoadingBranding, setIsLoadingBranding] =
|
|
9358
|
+
const [restoreDialogOpen, setRestoreDialogOpen] = useState14(false);
|
|
9359
|
+
const [brandingLoaded, setBrandingLoaded] = useState14(false);
|
|
9360
|
+
const [isLoadingBranding, setIsLoadingBranding] = useState14(false);
|
|
7865
9361
|
const { initModels } = useModelStore();
|
|
7866
9362
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
9363
|
+
const authToken = useAuthenticationStore((state) => state.token);
|
|
7867
9364
|
const { preferences, updatePreference } = usePreferencesStore();
|
|
7868
9365
|
const { hasAdminDashboard, hasLimitedAdminDashboard, getCurrentTier, hasAdvancedSearch } = useFeatures();
|
|
7869
9366
|
const { showAdminPanel, showLimitedAdminPanel } = useFeatureVisibility();
|
|
7870
9367
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
7871
|
-
const [
|
|
9368
|
+
const [seedPacksEnabled, setSeedPacksEnabled] = useState14(false);
|
|
9369
|
+
const [localSelectedModel, setLocalSelectedModel] = useState14({
|
|
7872
9370
|
name: "",
|
|
7873
9371
|
tagline: "",
|
|
7874
9372
|
systemPrompt: "",
|
|
@@ -7881,7 +9379,7 @@ var Management = () => {
|
|
|
7881
9379
|
loadDocuments,
|
|
7882
9380
|
clearAllDocuments
|
|
7883
9381
|
} = useKnowledgeStore();
|
|
7884
|
-
|
|
9382
|
+
useEffect11(() => {
|
|
7885
9383
|
if (selectedModel) {
|
|
7886
9384
|
const selected = availableModels.find((m) => m.name === selectedModel);
|
|
7887
9385
|
if (selected) {
|
|
@@ -7905,7 +9403,7 @@ var Management = () => {
|
|
|
7905
9403
|
}
|
|
7906
9404
|
}
|
|
7907
9405
|
}, [selectedModel, availableModels]);
|
|
7908
|
-
const loadBrandingConfig =
|
|
9406
|
+
const loadBrandingConfig = useCallback8(async () => {
|
|
7909
9407
|
if (isLoadingBranding || brandingLoaded) {
|
|
7910
9408
|
debugLogger.warn("Branding loading already in progress or completed, skipping");
|
|
7911
9409
|
return;
|
|
@@ -8020,15 +9518,15 @@ var Management = () => {
|
|
|
8020
9518
|
setTagline,
|
|
8021
9519
|
setTheme
|
|
8022
9520
|
]);
|
|
8023
|
-
|
|
9521
|
+
useEffect11(() => {
|
|
8024
9522
|
void loadBrandingConfig();
|
|
8025
9523
|
}, [loadBrandingConfig]);
|
|
8026
9524
|
const handleOpenModal = () => setModalOpen(true);
|
|
8027
9525
|
const handleCloseModal = () => setModalOpen(false);
|
|
8028
|
-
|
|
9526
|
+
useEffect11(() => {
|
|
8029
9527
|
getOptimalFabLogo().then(setFabLogo);
|
|
8030
9528
|
}, []);
|
|
8031
|
-
|
|
9529
|
+
useEffect11(() => {
|
|
8032
9530
|
if (logoBase64) {
|
|
8033
9531
|
setFabLogo(logoBase64);
|
|
8034
9532
|
} else {
|
|
@@ -8475,7 +9973,7 @@ var Management = () => {
|
|
|
8475
9973
|
reader.readAsText(file);
|
|
8476
9974
|
}
|
|
8477
9975
|
};
|
|
8478
|
-
|
|
9976
|
+
useEffect11(() => {
|
|
8479
9977
|
if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
|
|
8480
9978
|
setLocalSelectedModel((prev) => ({
|
|
8481
9979
|
...prev,
|
|
@@ -8483,51 +9981,120 @@ var Management = () => {
|
|
|
8483
9981
|
}));
|
|
8484
9982
|
}
|
|
8485
9983
|
}, [availableModels, localSelectedModel.selectedModel]);
|
|
8486
|
-
|
|
9984
|
+
useEffect11(() => {
|
|
8487
9985
|
loadDocuments();
|
|
8488
9986
|
}, [loadDocuments]);
|
|
8489
|
-
|
|
9987
|
+
useEffect11(() => {
|
|
9988
|
+
const gatewayApiUrl = packageSettings?.gatewayApiUrl;
|
|
9989
|
+
if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
|
|
9990
|
+
setSeedPacksEnabled(false);
|
|
9991
|
+
return;
|
|
9992
|
+
}
|
|
9993
|
+
let isActive = true;
|
|
9994
|
+
const loadCapabilities = async () => {
|
|
9995
|
+
try {
|
|
9996
|
+
const token = authToken ?? authenticationService.getToken();
|
|
9997
|
+
const headers = {
|
|
9998
|
+
"Content-Type": "application/json"
|
|
9999
|
+
};
|
|
10000
|
+
if (token) {
|
|
10001
|
+
headers.Authorization = `Bearer ${token}`;
|
|
10002
|
+
}
|
|
10003
|
+
const response = await fetch(buildCapabilitiesUrl(gatewayApiUrl), {
|
|
10004
|
+
method: "GET",
|
|
10005
|
+
headers
|
|
10006
|
+
});
|
|
10007
|
+
if (!response.ok) {
|
|
10008
|
+
throw new Error(`Capabilities request failed: ${response.status}`);
|
|
10009
|
+
}
|
|
10010
|
+
const payload = await response.json();
|
|
10011
|
+
if (!isActive) {
|
|
10012
|
+
return;
|
|
10013
|
+
}
|
|
10014
|
+
setSeedPacksEnabled(Boolean(payload?.seedPacksEnabled));
|
|
10015
|
+
} catch (error) {
|
|
10016
|
+
if (!isActive) {
|
|
10017
|
+
return;
|
|
10018
|
+
}
|
|
10019
|
+
setSeedPacksEnabled(false);
|
|
10020
|
+
debugLogger.warn("Management: failed to load capabilities", {
|
|
10021
|
+
error: error instanceof Error ? error.message : String(error)
|
|
10022
|
+
});
|
|
10023
|
+
}
|
|
10024
|
+
};
|
|
10025
|
+
loadCapabilities();
|
|
10026
|
+
return () => {
|
|
10027
|
+
isActive = false;
|
|
10028
|
+
};
|
|
10029
|
+
}, [packageSettings?.gatewayApiUrl, authToken]);
|
|
10030
|
+
const currentTheme = useMemo6(() => {
|
|
10031
|
+
const baseTheme = predefinedThemes[theme] || banditDarkTheme;
|
|
10032
|
+
return createTheme(baseTheme, {
|
|
10033
|
+
components: {
|
|
10034
|
+
MuiInputBase: {
|
|
10035
|
+
styleOverrides: {
|
|
10036
|
+
input: {
|
|
10037
|
+
outline: "none",
|
|
10038
|
+
boxShadow: "none",
|
|
10039
|
+
"&:focus, &:focus-visible": {
|
|
10040
|
+
outline: "none",
|
|
10041
|
+
boxShadow: "none"
|
|
10042
|
+
}
|
|
10043
|
+
},
|
|
10044
|
+
inputMultiline: {
|
|
10045
|
+
outline: "none",
|
|
10046
|
+
boxShadow: "none",
|
|
10047
|
+
"&:focus, &:focus-visible": {
|
|
10048
|
+
outline: "none",
|
|
10049
|
+
boxShadow: "none"
|
|
10050
|
+
}
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
10054
|
+
}
|
|
10055
|
+
});
|
|
10056
|
+
}, [theme]);
|
|
8490
10057
|
if (!brandingLoaded) return null;
|
|
8491
10058
|
const allNavTabs = [
|
|
8492
10059
|
{
|
|
8493
10060
|
label: "Personalities",
|
|
8494
|
-
icon: /* @__PURE__ */
|
|
10061
|
+
icon: /* @__PURE__ */ jsx13(FaceRetouchingNaturalIcon, {}),
|
|
8495
10062
|
requiresFeature: "limitedAdminDashboard"
|
|
8496
10063
|
// Available to premium+
|
|
8497
10064
|
},
|
|
8498
10065
|
{
|
|
8499
10066
|
label: "Branding",
|
|
8500
|
-
icon: /* @__PURE__ */
|
|
10067
|
+
icon: /* @__PURE__ */ jsx13(BrushIcon, {}),
|
|
8501
10068
|
requiresFeature: "limitedAdminDashboard"
|
|
8502
10069
|
// Available to premium+
|
|
8503
10070
|
},
|
|
8504
10071
|
{
|
|
8505
10072
|
label: "Knowledge",
|
|
8506
|
-
icon: /* @__PURE__ */
|
|
10073
|
+
icon: /* @__PURE__ */ jsx13(MenuBookIcon, {}),
|
|
8507
10074
|
requiresFeature: "limitedAdminDashboard"
|
|
8508
10075
|
// Available to premium+
|
|
8509
10076
|
},
|
|
8510
10077
|
{
|
|
8511
10078
|
label: "Storage",
|
|
8512
|
-
icon: /* @__PURE__ */
|
|
10079
|
+
icon: /* @__PURE__ */ jsx13(StorageIcon2, {}),
|
|
8513
10080
|
requiresFeature: "limitedAdminDashboard"
|
|
8514
10081
|
// Available to premium+ (changed from adminDashboardEnabled)
|
|
8515
10082
|
},
|
|
8516
10083
|
{
|
|
8517
10084
|
label: "Preferences",
|
|
8518
|
-
icon: /* @__PURE__ */
|
|
10085
|
+
icon: /* @__PURE__ */ jsx13(TuneIcon, {}),
|
|
8519
10086
|
requiresFeature: "limitedAdminDashboard"
|
|
8520
10087
|
// Available to premium+
|
|
8521
10088
|
},
|
|
8522
10089
|
{
|
|
8523
10090
|
label: "Provider",
|
|
8524
|
-
icon: /* @__PURE__ */
|
|
10091
|
+
icon: /* @__PURE__ */ jsx13(CloudIcon, {}),
|
|
8525
10092
|
requiresFeature: "advancedSearch"
|
|
8526
10093
|
// Pro/Team users with advanced features
|
|
8527
10094
|
},
|
|
8528
10095
|
{
|
|
8529
10096
|
label: "MCP Tools",
|
|
8530
|
-
icon: /* @__PURE__ */
|
|
10097
|
+
icon: /* @__PURE__ */ jsx13(BuildIcon, {}),
|
|
8531
10098
|
requiresFeature: "advancedSearch"
|
|
8532
10099
|
// Pro/Team users with advanced features
|
|
8533
10100
|
}
|
|
@@ -8544,8 +10111,8 @@ var Management = () => {
|
|
|
8544
10111
|
}
|
|
8545
10112
|
return true;
|
|
8546
10113
|
});
|
|
8547
|
-
const navigationContent = /* @__PURE__ */
|
|
8548
|
-
|
|
10114
|
+
const navigationContent = /* @__PURE__ */ jsxs13(
|
|
10115
|
+
Box13,
|
|
8549
10116
|
{
|
|
8550
10117
|
sx: {
|
|
8551
10118
|
display: "flex",
|
|
@@ -8555,8 +10122,8 @@ var Management = () => {
|
|
|
8555
10122
|
bgcolor: "inherit"
|
|
8556
10123
|
},
|
|
8557
10124
|
children: [
|
|
8558
|
-
isMobile && /* @__PURE__ */
|
|
8559
|
-
|
|
10125
|
+
isMobile && /* @__PURE__ */ jsx13(
|
|
10126
|
+
Box13,
|
|
8560
10127
|
{
|
|
8561
10128
|
sx: {
|
|
8562
10129
|
height: 6,
|
|
@@ -8569,15 +10136,15 @@ var Management = () => {
|
|
|
8569
10136
|
}
|
|
8570
10137
|
}
|
|
8571
10138
|
),
|
|
8572
|
-
/* @__PURE__ */
|
|
8573
|
-
|
|
10139
|
+
/* @__PURE__ */ jsx13(Box13, { sx: { p: isMobile ? 2.5 : 3, pb: isMobile ? 1.5 : 2 }, children: /* @__PURE__ */ jsx13(
|
|
10140
|
+
Button10,
|
|
8574
10141
|
{
|
|
8575
10142
|
onClick: () => {
|
|
8576
10143
|
if (isMobile) setSidebarOpen(false);
|
|
8577
10144
|
navigate("/chat");
|
|
8578
10145
|
},
|
|
8579
10146
|
onMouseEnter: preloadChatPage,
|
|
8580
|
-
startIcon: /* @__PURE__ */
|
|
10147
|
+
startIcon: /* @__PURE__ */ jsx13(ChevronLeftIcon, { sx: { fontSize: 20 } }),
|
|
8581
10148
|
fullWidth: true,
|
|
8582
10149
|
variant: "outlined",
|
|
8583
10150
|
sx: {
|
|
@@ -8604,9 +10171,9 @@ var Management = () => {
|
|
|
8604
10171
|
children: "Back to Chat"
|
|
8605
10172
|
}
|
|
8606
10173
|
) }),
|
|
8607
|
-
/* @__PURE__ */
|
|
8608
|
-
/* @__PURE__ */
|
|
8609
|
-
|
|
10174
|
+
/* @__PURE__ */ jsx13(Divider2, { sx: { mx: isMobile ? 2 : 3, mb: 2, opacity: 0.6 } }),
|
|
10175
|
+
/* @__PURE__ */ jsx13(Box13, { sx: { flex: 1, px: isMobile ? 1.5 : 2, pb: 3, overflowY: "auto" }, children: /* @__PURE__ */ jsx13(List3, { sx: { px: 0, py: 0 }, children: navTabs.map((tab, idx) => /* @__PURE__ */ jsxs13(
|
|
10176
|
+
ListItemButton2,
|
|
8610
10177
|
{
|
|
8611
10178
|
selected: tabIndex === idx,
|
|
8612
10179
|
onClick: () => {
|
|
@@ -8655,7 +10222,7 @@ var Management = () => {
|
|
|
8655
10222
|
}
|
|
8656
10223
|
},
|
|
8657
10224
|
children: [
|
|
8658
|
-
/* @__PURE__ */
|
|
10225
|
+
/* @__PURE__ */ jsx13(
|
|
8659
10226
|
ListItemIcon2,
|
|
8660
10227
|
{
|
|
8661
10228
|
sx: {
|
|
@@ -8666,7 +10233,7 @@ var Management = () => {
|
|
|
8666
10233
|
children: tab.icon
|
|
8667
10234
|
}
|
|
8668
10235
|
),
|
|
8669
|
-
/* @__PURE__ */
|
|
10236
|
+
/* @__PURE__ */ jsx13(
|
|
8670
10237
|
ListItemText2,
|
|
8671
10238
|
{
|
|
8672
10239
|
primary: tab.label,
|
|
@@ -8677,8 +10244,8 @@ var Management = () => {
|
|
|
8677
10244
|
}
|
|
8678
10245
|
}
|
|
8679
10246
|
),
|
|
8680
|
-
tabIndex === idx && /* @__PURE__ */
|
|
8681
|
-
|
|
10247
|
+
tabIndex === idx && /* @__PURE__ */ jsx13(
|
|
10248
|
+
Box13,
|
|
8682
10249
|
{
|
|
8683
10250
|
sx: {
|
|
8684
10251
|
position: "absolute",
|
|
@@ -8700,10 +10267,10 @@ var Management = () => {
|
|
|
8700
10267
|
]
|
|
8701
10268
|
}
|
|
8702
10269
|
);
|
|
8703
|
-
return /* @__PURE__ */
|
|
8704
|
-
/* @__PURE__ */
|
|
8705
|
-
/* @__PURE__ */
|
|
8706
|
-
|
|
10270
|
+
return /* @__PURE__ */ jsxs13(ThemeProvider, { theme: currentTheme, children: [
|
|
10271
|
+
/* @__PURE__ */ jsx13(CssBaseline, {}),
|
|
10272
|
+
/* @__PURE__ */ jsxs13(
|
|
10273
|
+
Box13,
|
|
8707
10274
|
{
|
|
8708
10275
|
display: "flex",
|
|
8709
10276
|
height: "100vh",
|
|
@@ -8715,8 +10282,8 @@ var Management = () => {
|
|
|
8715
10282
|
position: "relative"
|
|
8716
10283
|
},
|
|
8717
10284
|
children: [
|
|
8718
|
-
isMobile && /* @__PURE__ */
|
|
8719
|
-
|
|
10285
|
+
isMobile && /* @__PURE__ */ jsxs13(
|
|
10286
|
+
Box13,
|
|
8720
10287
|
{
|
|
8721
10288
|
sx: {
|
|
8722
10289
|
width: "100%",
|
|
@@ -8735,8 +10302,8 @@ var Management = () => {
|
|
|
8735
10302
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
8736
10303
|
},
|
|
8737
10304
|
children: [
|
|
8738
|
-
/* @__PURE__ */
|
|
8739
|
-
|
|
10305
|
+
/* @__PURE__ */ jsx13(
|
|
10306
|
+
Button10,
|
|
8740
10307
|
{
|
|
8741
10308
|
onClick: () => setSidebarOpen((o) => !o),
|
|
8742
10309
|
sx: {
|
|
@@ -8757,7 +10324,7 @@ var Management = () => {
|
|
|
8757
10324
|
transform: sidebarOpen ? "rotate(90deg) scale(0.95)" : "scale(0.95)"
|
|
8758
10325
|
}
|
|
8759
10326
|
},
|
|
8760
|
-
children: /* @__PURE__ */
|
|
10327
|
+
children: /* @__PURE__ */ jsx13("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx13(
|
|
8761
10328
|
"path",
|
|
8762
10329
|
{
|
|
8763
10330
|
d: sidebarOpen ? "M18 6L6 18M6 6L18 18" : "M3 12H21M3 6H21M3 18H21",
|
|
@@ -8769,8 +10336,8 @@ var Management = () => {
|
|
|
8769
10336
|
) })
|
|
8770
10337
|
}
|
|
8771
10338
|
),
|
|
8772
|
-
/* @__PURE__ */
|
|
8773
|
-
|
|
10339
|
+
/* @__PURE__ */ jsx13(
|
|
10340
|
+
Typography12,
|
|
8774
10341
|
{
|
|
8775
10342
|
variant: "h6",
|
|
8776
10343
|
sx: {
|
|
@@ -8782,14 +10349,14 @@ var Management = () => {
|
|
|
8782
10349
|
children: "Management"
|
|
8783
10350
|
}
|
|
8784
10351
|
),
|
|
8785
|
-
/* @__PURE__ */
|
|
10352
|
+
/* @__PURE__ */ jsx13(Box13, { sx: {
|
|
8786
10353
|
px: 2,
|
|
8787
10354
|
py: 0.5,
|
|
8788
10355
|
borderRadius: 2,
|
|
8789
10356
|
bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.12)" : "rgba(25,118,210,0.08)",
|
|
8790
10357
|
border: (theme2) => `1px solid ${theme2.palette.primary.main}20`
|
|
8791
|
-
}, children: /* @__PURE__ */
|
|
8792
|
-
|
|
10358
|
+
}, children: /* @__PURE__ */ jsx13(
|
|
10359
|
+
Typography12,
|
|
8793
10360
|
{
|
|
8794
10361
|
variant: "caption",
|
|
8795
10362
|
sx: {
|
|
@@ -8803,7 +10370,7 @@ var Management = () => {
|
|
|
8803
10370
|
]
|
|
8804
10371
|
}
|
|
8805
10372
|
),
|
|
8806
|
-
isMobile ? /* @__PURE__ */
|
|
10373
|
+
isMobile ? /* @__PURE__ */ jsx13(
|
|
8807
10374
|
SwipeableDrawer,
|
|
8808
10375
|
{
|
|
8809
10376
|
anchor: "bottom",
|
|
@@ -8824,8 +10391,8 @@ var Management = () => {
|
|
|
8824
10391
|
},
|
|
8825
10392
|
children: navigationContent
|
|
8826
10393
|
}
|
|
8827
|
-
) : /* @__PURE__ */
|
|
8828
|
-
|
|
10394
|
+
) : /* @__PURE__ */ jsx13(
|
|
10395
|
+
Box13,
|
|
8829
10396
|
{
|
|
8830
10397
|
sx: {
|
|
8831
10398
|
width: 280,
|
|
@@ -8848,8 +10415,8 @@ var Management = () => {
|
|
|
8848
10415
|
children: navigationContent
|
|
8849
10416
|
}
|
|
8850
10417
|
),
|
|
8851
|
-
/* @__PURE__ */
|
|
8852
|
-
|
|
10418
|
+
/* @__PURE__ */ jsxs13(
|
|
10419
|
+
Box13,
|
|
8853
10420
|
{
|
|
8854
10421
|
sx: {
|
|
8855
10422
|
flex: 1,
|
|
@@ -8877,7 +10444,7 @@ var Management = () => {
|
|
|
8877
10444
|
// IE and Edge
|
|
8878
10445
|
},
|
|
8879
10446
|
children: [
|
|
8880
|
-
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */
|
|
10447
|
+
navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ jsx13(
|
|
8881
10448
|
PersonalitiesTab_default,
|
|
8882
10449
|
{
|
|
8883
10450
|
availableModels,
|
|
@@ -8896,7 +10463,7 @@ var Management = () => {
|
|
|
8896
10463
|
showSnackbar: showSnackbarMessage
|
|
8897
10464
|
}
|
|
8898
10465
|
),
|
|
8899
|
-
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */
|
|
10466
|
+
navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ jsx13(
|
|
8900
10467
|
BrandingTab_default,
|
|
8901
10468
|
{
|
|
8902
10469
|
logoFile,
|
|
@@ -8915,8 +10482,8 @@ var Management = () => {
|
|
|
8915
10482
|
setLogoBase64
|
|
8916
10483
|
}
|
|
8917
10484
|
),
|
|
8918
|
-
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */
|
|
8919
|
-
|
|
10485
|
+
navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ jsx13(
|
|
10486
|
+
KnowledgeHubTab_default,
|
|
8920
10487
|
{
|
|
8921
10488
|
documents,
|
|
8922
10489
|
addDocuments,
|
|
@@ -8924,11 +10491,12 @@ var Management = () => {
|
|
|
8924
10491
|
loadDocuments,
|
|
8925
10492
|
clearAllDocuments,
|
|
8926
10493
|
currentTheme,
|
|
8927
|
-
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard()
|
|
10494
|
+
isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard(),
|
|
10495
|
+
seedPacksEnabled
|
|
8928
10496
|
}
|
|
8929
10497
|
),
|
|
8930
|
-
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */
|
|
8931
|
-
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */
|
|
10498
|
+
navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ jsx13(StorageTab_default, { currentTheme }),
|
|
10499
|
+
navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ jsx13(
|
|
8932
10500
|
PreferencesTab_default,
|
|
8933
10501
|
{
|
|
8934
10502
|
preferences,
|
|
@@ -8938,12 +10506,12 @@ var Management = () => {
|
|
|
8938
10506
|
showSnackbar: showSnackbarMessage
|
|
8939
10507
|
}
|
|
8940
10508
|
),
|
|
8941
|
-
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */
|
|
8942
|
-
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */
|
|
10509
|
+
navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ jsx13(ProviderTab, {}),
|
|
10510
|
+
navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ jsx13(MCPToolsTabV2_default, {})
|
|
8943
10511
|
]
|
|
8944
10512
|
}
|
|
8945
10513
|
),
|
|
8946
|
-
/* @__PURE__ */
|
|
10514
|
+
/* @__PURE__ */ jsx13(
|
|
8947
10515
|
Fab,
|
|
8948
10516
|
{
|
|
8949
10517
|
"aria-label": "AI",
|
|
@@ -8965,7 +10533,7 @@ var Management = () => {
|
|
|
8965
10533
|
boxShadow: theme2.shadows[6],
|
|
8966
10534
|
zIndex: 2e3
|
|
8967
10535
|
}),
|
|
8968
|
-
children: /* @__PURE__ */
|
|
10536
|
+
children: /* @__PURE__ */ jsx13(
|
|
8969
10537
|
"img",
|
|
8970
10538
|
{
|
|
8971
10539
|
src: fabLogo,
|
|
@@ -8979,7 +10547,7 @@ var Management = () => {
|
|
|
8979
10547
|
)
|
|
8980
10548
|
}
|
|
8981
10549
|
),
|
|
8982
|
-
/* @__PURE__ */
|
|
10550
|
+
/* @__PURE__ */ jsx13(chat_modal_default, { open: modalOpen, onClose: handleCloseModal })
|
|
8983
10551
|
]
|
|
8984
10552
|
}
|
|
8985
10553
|
)
|
|
@@ -8993,4 +10561,4 @@ export {
|
|
|
8993
10561
|
useGatewayMemory,
|
|
8994
10562
|
management_default
|
|
8995
10563
|
};
|
|
8996
|
-
//# sourceMappingURL=chunk-
|
|
10564
|
+
//# sourceMappingURL=chunk-JBXNXSAH.mjs.map
|