@axiom-lattice/react-sdk 2.1.23 → 2.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -2
- package/dist/index.d.ts +83 -2
- package/dist/index.js +3091 -266
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3106 -232
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -136,7 +136,7 @@ function useChat(threadId, options = {}) {
|
|
|
136
136
|
stopStreamingRef.current = null;
|
|
137
137
|
}
|
|
138
138
|
const { input, command, streaming = true } = data;
|
|
139
|
-
const { message:
|
|
139
|
+
const { message: message8, files, ...rest } = input || {};
|
|
140
140
|
setState((prev) => ({
|
|
141
141
|
...prev,
|
|
142
142
|
isLoading: true,
|
|
@@ -145,7 +145,7 @@ function useChat(threadId, options = {}) {
|
|
|
145
145
|
}));
|
|
146
146
|
const userMessage = {
|
|
147
147
|
id: Date.now().toString(),
|
|
148
|
-
content:
|
|
148
|
+
content: message8 || command?.resume?.message || "",
|
|
149
149
|
files,
|
|
150
150
|
role: "human"
|
|
151
151
|
};
|
|
@@ -483,7 +483,7 @@ function AgentThreadProvider({
|
|
|
483
483
|
stopStreamingRef.current = null;
|
|
484
484
|
}
|
|
485
485
|
const { input, command, streaming = true } = data;
|
|
486
|
-
const { message:
|
|
486
|
+
const { message: message8, files, ...rest } = input || {};
|
|
487
487
|
setState((prev) => ({
|
|
488
488
|
...prev,
|
|
489
489
|
isLoading: true,
|
|
@@ -491,7 +491,7 @@ function AgentThreadProvider({
|
|
|
491
491
|
}));
|
|
492
492
|
const userMessage = {
|
|
493
493
|
id: Date.now().toString(),
|
|
494
|
-
content:
|
|
494
|
+
content: message8 || command?.resume?.message || "",
|
|
495
495
|
files,
|
|
496
496
|
role: "human"
|
|
497
497
|
};
|
|
@@ -1842,7 +1842,7 @@ import { DownloadOutlined, ExpandAltOutlined } from "@ant-design/icons";
|
|
|
1842
1842
|
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1843
1843
|
var { Text } = Typography;
|
|
1844
1844
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1845
|
-
const { dataSource, message:
|
|
1845
|
+
const { dataSource, message: message8 } = data ?? {};
|
|
1846
1846
|
const [expandedRowKeys, setExpandedRowKeys] = useState8([]);
|
|
1847
1847
|
const { openSideApp } = useChatUIContext();
|
|
1848
1848
|
const processedData = dataSource?.map((item, index) => ({
|
|
@@ -1926,7 +1926,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1926
1926
|
{
|
|
1927
1927
|
size: "small",
|
|
1928
1928
|
title: () => /* @__PURE__ */ jsxs3(Flex, { justify: "space-between", align: "center", children: [
|
|
1929
|
-
/* @__PURE__ */ jsx9(Space, { children: /* @__PURE__ */ jsx9(Text, { strong: true, style: { fontSize: 16 }, children:
|
|
1929
|
+
/* @__PURE__ */ jsx9(Space, { children: /* @__PURE__ */ jsx9(Text, { strong: true, style: { fontSize: 16 }, children: message8 || "" }) }),
|
|
1930
1930
|
/* @__PURE__ */ jsxs3(Space, { children: [
|
|
1931
1931
|
/* @__PURE__ */ jsx9(
|
|
1932
1932
|
Button,
|
|
@@ -1947,8 +1947,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1947
1947
|
onClick: () => {
|
|
1948
1948
|
openSideApp({
|
|
1949
1949
|
component_key: "generic_data_table",
|
|
1950
|
-
message:
|
|
1951
|
-
data: { dataSource, message:
|
|
1950
|
+
message: message8 || "",
|
|
1951
|
+
data: { dataSource, message: message8 }
|
|
1952
1952
|
});
|
|
1953
1953
|
},
|
|
1954
1954
|
children: [
|
|
@@ -2104,11 +2104,11 @@ var ConfirmFeedback = ({
|
|
|
2104
2104
|
data,
|
|
2105
2105
|
interactive = true
|
|
2106
2106
|
}) => {
|
|
2107
|
-
const { message:
|
|
2107
|
+
const { message: message8, type, config, feedback, options } = data ?? {};
|
|
2108
2108
|
const { sendMessage } = useAgentChat();
|
|
2109
2109
|
const [clicked, setClicked] = useState10(false);
|
|
2110
2110
|
return /* @__PURE__ */ jsxs4(Space2, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2111
|
-
/* @__PURE__ */ jsx11(MDResponse, { content:
|
|
2111
|
+
/* @__PURE__ */ jsx11(MDResponse, { content: message8 }),
|
|
2112
2112
|
options ? /* @__PURE__ */ jsx11(Space2, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ jsx11(
|
|
2113
2113
|
Button2,
|
|
2114
2114
|
{
|
|
@@ -3267,7 +3267,7 @@ var AttachmentsCard = ({
|
|
|
3267
3267
|
columns = 1,
|
|
3268
3268
|
showDownloadButton = false
|
|
3269
3269
|
}) => {
|
|
3270
|
-
const { Text:
|
|
3270
|
+
const { Text: Text18 } = Typography7;
|
|
3271
3271
|
const [showAll, setShowAll] = useState13(false);
|
|
3272
3272
|
const { openSideApp } = useChatUIContext();
|
|
3273
3273
|
const getStyles = () => {
|
|
@@ -3342,7 +3342,7 @@ var AttachmentsCard = ({
|
|
|
3342
3342
|
);
|
|
3343
3343
|
};
|
|
3344
3344
|
const renderFileDescription = (item) => /* @__PURE__ */ jsx19(Space7, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ jsx19(Space7, { children: /* @__PURE__ */ jsx19(
|
|
3345
|
-
|
|
3345
|
+
Text18,
|
|
3346
3346
|
{
|
|
3347
3347
|
type: "secondary",
|
|
3348
3348
|
style: {
|
|
@@ -3414,7 +3414,7 @@ var AttachmentsCard = ({
|
|
|
3414
3414
|
}
|
|
3415
3415
|
),
|
|
3416
3416
|
item.files && /* @__PURE__ */ jsxs10("div", { style: { paddingLeft: "12px" }, children: [
|
|
3417
|
-
/* @__PURE__ */ jsxs10(
|
|
3417
|
+
/* @__PURE__ */ jsxs10(Text18, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
3418
3418
|
"\u5305\u542B\u6587\u4EF6(",
|
|
3419
3419
|
item.files.length,
|
|
3420
3420
|
")"
|
|
@@ -4086,7 +4086,7 @@ import {
|
|
|
4086
4086
|
} from "react";
|
|
4087
4087
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4088
4088
|
var LazyBubble = ({
|
|
4089
|
-
message:
|
|
4089
|
+
message: message8,
|
|
4090
4090
|
renderContent,
|
|
4091
4091
|
autoLoadRightPanel
|
|
4092
4092
|
}) => {
|
|
@@ -4117,10 +4117,10 @@ var LazyBubble = ({
|
|
|
4117
4117
|
autoLoadRightPanel?.();
|
|
4118
4118
|
}, []);
|
|
4119
4119
|
const getPlaceholder = () => {
|
|
4120
|
-
const estimatedHeight =
|
|
4120
|
+
const estimatedHeight = message8.content ? Math.min(100, message8.content.length / 5) : 100;
|
|
4121
4121
|
return /* @__PURE__ */ jsx26("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
4122
4122
|
};
|
|
4123
|
-
return /* @__PURE__ */ jsx26(ErrorBoundary, { children: /* @__PURE__ */ jsx26("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(
|
|
4123
|
+
return /* @__PURE__ */ jsx26(ErrorBoundary, { children: /* @__PURE__ */ jsx26("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message8) : getPlaceholder() }) });
|
|
4124
4124
|
};
|
|
4125
4125
|
var MemoizedBubbleList = memo(
|
|
4126
4126
|
({
|
|
@@ -4151,8 +4151,8 @@ var MessageList = ({
|
|
|
4151
4151
|
messageLengthRef.current = messages?.length;
|
|
4152
4152
|
}
|
|
4153
4153
|
}, [messages?.length]);
|
|
4154
|
-
const renderContent = useCallback7((
|
|
4155
|
-
const { content } =
|
|
4154
|
+
const renderContent = useCallback7((message8) => {
|
|
4155
|
+
const { content } = message8;
|
|
4156
4156
|
try {
|
|
4157
4157
|
const json = JSON.parse(content);
|
|
4158
4158
|
if (json.action && json.message) {
|
|
@@ -4160,7 +4160,7 @@ var MessageList = ({
|
|
|
4160
4160
|
}
|
|
4161
4161
|
} catch (error) {
|
|
4162
4162
|
}
|
|
4163
|
-
const tool_calls_md =
|
|
4163
|
+
const tool_calls_md = message8.tool_calls?.map((tool_call) => {
|
|
4164
4164
|
return `\`\`\`tool_call
|
|
4165
4165
|
${JSON.stringify(tool_call)}
|
|
4166
4166
|
\`\`\``;
|
|
@@ -4169,17 +4169,17 @@ ${JSON.stringify(tool_call)}
|
|
|
4169
4169
|
return /* @__PURE__ */ jsx26(Space10, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx26(MDResponse, { content: content_md }) });
|
|
4170
4170
|
}, []);
|
|
4171
4171
|
const items = useMemo4(
|
|
4172
|
-
() => messages.map((
|
|
4173
|
-
key:
|
|
4174
|
-
role:
|
|
4172
|
+
() => messages.map((message8, index) => ({
|
|
4173
|
+
key: message8.id,
|
|
4174
|
+
role: message8.role,
|
|
4175
4175
|
typing: false,
|
|
4176
4176
|
content: /* @__PURE__ */ jsx26(
|
|
4177
4177
|
LazyBubble,
|
|
4178
4178
|
{
|
|
4179
|
-
message:
|
|
4179
|
+
message: message8,
|
|
4180
4180
|
renderContent,
|
|
4181
4181
|
autoLoadRightPanel: () => {
|
|
4182
|
-
const { content, role: role2 } =
|
|
4182
|
+
const { content, role: role2 } = message8;
|
|
4183
4183
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
4184
4184
|
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
4185
4185
|
try {
|
|
@@ -6373,12 +6373,14 @@ var AgentConversations = () => {
|
|
|
6373
6373
|
};
|
|
6374
6374
|
|
|
6375
6375
|
// src/components/Chat/ChatSidebar.tsx
|
|
6376
|
-
import { useState as
|
|
6377
|
-
import { Divider as
|
|
6376
|
+
import { useState as useState27, useEffect as useEffect20, useRef as useRef13 } from "react";
|
|
6377
|
+
import { Divider as Divider4, Tooltip as Tooltip8, Modal as Modal3, Button as Button20 } from "antd";
|
|
6378
6378
|
import {
|
|
6379
6379
|
MenuFoldOutlined,
|
|
6380
6380
|
MenuUnfoldOutlined,
|
|
6381
|
-
SettingOutlined
|
|
6381
|
+
SettingOutlined as SettingOutlined2,
|
|
6382
|
+
ApartmentOutlined,
|
|
6383
|
+
ThunderboltOutlined as ThunderboltOutlined2
|
|
6382
6384
|
} from "@ant-design/icons";
|
|
6383
6385
|
|
|
6384
6386
|
// src/components/Chat/AssistantList.tsx
|
|
@@ -6423,7 +6425,2718 @@ var AssistantList = () => {
|
|
|
6423
6425
|
|
|
6424
6426
|
// src/components/Chat/ChatSidebar.tsx
|
|
6425
6427
|
import { createStyles as createStyles12 } from "antd-style";
|
|
6426
|
-
|
|
6428
|
+
|
|
6429
|
+
// src/components/Chat/AssistantFlow.tsx
|
|
6430
|
+
import { useMemo as useMemo10, useEffect as useEffect17 } from "react";
|
|
6431
|
+
import {
|
|
6432
|
+
ReactFlow,
|
|
6433
|
+
Background,
|
|
6434
|
+
Controls,
|
|
6435
|
+
useNodesState,
|
|
6436
|
+
useEdgesState,
|
|
6437
|
+
ReactFlowProvider
|
|
6438
|
+
} from "@xyflow/react";
|
|
6439
|
+
import "@xyflow/react/dist/style.css";
|
|
6440
|
+
|
|
6441
|
+
// src/components/Chat/AssistantNode.tsx
|
|
6442
|
+
import { useMemo as useMemo9 } from "react";
|
|
6443
|
+
import { Handle, Position } from "@xyflow/react";
|
|
6444
|
+
import { Avatar as Avatar5, Typography as Typography16, theme as theme3, Tag as Tag6, Tooltip as Tooltip6, Space as Space15, Popover as Popover2, Button as Button16, Divider as Divider2 } from "antd";
|
|
6445
|
+
import {
|
|
6446
|
+
UserOutlined as UserOutlined3,
|
|
6447
|
+
ToolOutlined as ToolOutlined2,
|
|
6448
|
+
SettingOutlined,
|
|
6449
|
+
IdcardOutlined,
|
|
6450
|
+
InfoCircleOutlined as InfoCircleOutlined2,
|
|
6451
|
+
CopyOutlined as CopyOutlined2,
|
|
6452
|
+
CodeOutlined as CodeOutlined4,
|
|
6453
|
+
BranchesOutlined
|
|
6454
|
+
} from "@ant-design/icons";
|
|
6455
|
+
import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6456
|
+
var { Text: Text14 } = Typography16;
|
|
6457
|
+
var getBadgeColor = (id) => {
|
|
6458
|
+
const colors = [
|
|
6459
|
+
"#1890ff",
|
|
6460
|
+
// Blue
|
|
6461
|
+
"#52c41a",
|
|
6462
|
+
// Green
|
|
6463
|
+
"#faad14",
|
|
6464
|
+
// Orange
|
|
6465
|
+
"#f5222d",
|
|
6466
|
+
// Red
|
|
6467
|
+
"#722ed1",
|
|
6468
|
+
// Purple
|
|
6469
|
+
"#13c2c2",
|
|
6470
|
+
// Cyan
|
|
6471
|
+
"#eb2f96",
|
|
6472
|
+
// Magenta
|
|
6473
|
+
"#fa8c16"
|
|
6474
|
+
// Orange Red
|
|
6475
|
+
];
|
|
6476
|
+
let hash = 0;
|
|
6477
|
+
for (let i = 0; i < id.length; i++) {
|
|
6478
|
+
hash = id.charCodeAt(i) + ((hash << 5) - hash);
|
|
6479
|
+
}
|
|
6480
|
+
return colors[Math.abs(hash) % colors.length];
|
|
6481
|
+
};
|
|
6482
|
+
var AssistantNode = ({
|
|
6483
|
+
data
|
|
6484
|
+
}) => {
|
|
6485
|
+
const { token } = theme3.useToken();
|
|
6486
|
+
if (!data) {
|
|
6487
|
+
return null;
|
|
6488
|
+
}
|
|
6489
|
+
const { assistant, onClick } = data;
|
|
6490
|
+
if (!assistant) {
|
|
6491
|
+
return null;
|
|
6492
|
+
}
|
|
6493
|
+
const badgeColor = getBadgeColor(assistant.id);
|
|
6494
|
+
const initials = assistant.name?.split(" ").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "A";
|
|
6495
|
+
const { modelKey, tools, agentType, prompt, subAgents } = useMemo9(() => {
|
|
6496
|
+
if (!assistant.graphDefinition) {
|
|
6497
|
+
return {
|
|
6498
|
+
modelKey: void 0,
|
|
6499
|
+
tools: [],
|
|
6500
|
+
agentType: void 0,
|
|
6501
|
+
prompt: void 0,
|
|
6502
|
+
subAgents: []
|
|
6503
|
+
};
|
|
6504
|
+
}
|
|
6505
|
+
try {
|
|
6506
|
+
const graphDef = typeof assistant.graphDefinition === "string" ? JSON.parse(assistant.graphDefinition) : assistant.graphDefinition;
|
|
6507
|
+
return {
|
|
6508
|
+
modelKey: graphDef.modelKey || graphDef.model,
|
|
6509
|
+
tools: graphDef.tools || [],
|
|
6510
|
+
agentType: graphDef.type,
|
|
6511
|
+
prompt: graphDef.prompt,
|
|
6512
|
+
subAgents: graphDef.subAgents || []
|
|
6513
|
+
};
|
|
6514
|
+
} catch (error) {
|
|
6515
|
+
return {
|
|
6516
|
+
modelKey: void 0,
|
|
6517
|
+
tools: [],
|
|
6518
|
+
agentType: void 0,
|
|
6519
|
+
prompt: void 0,
|
|
6520
|
+
subAgents: []
|
|
6521
|
+
};
|
|
6522
|
+
}
|
|
6523
|
+
}, [assistant.graphDefinition]);
|
|
6524
|
+
const getAgentTypeLabel = (type) => {
|
|
6525
|
+
if (!type) return "";
|
|
6526
|
+
const typeMap = {
|
|
6527
|
+
react: "REACT",
|
|
6528
|
+
deep_agent: "DEEP AGENT",
|
|
6529
|
+
plan_execute: "PLAN EXECUTE",
|
|
6530
|
+
sequential: "SEQUENTIAL"
|
|
6531
|
+
};
|
|
6532
|
+
return typeMap[type] || type.toUpperCase();
|
|
6533
|
+
};
|
|
6534
|
+
const handleCopy = (text) => {
|
|
6535
|
+
navigator.clipboard.writeText(text);
|
|
6536
|
+
};
|
|
6537
|
+
const detailCardContent = /* @__PURE__ */ jsxs23(
|
|
6538
|
+
"div",
|
|
6539
|
+
{
|
|
6540
|
+
style: {
|
|
6541
|
+
width: 480,
|
|
6542
|
+
maxHeight: "80vh",
|
|
6543
|
+
overflowY: "auto",
|
|
6544
|
+
padding: 16
|
|
6545
|
+
},
|
|
6546
|
+
children: [
|
|
6547
|
+
/* @__PURE__ */ jsx43(
|
|
6548
|
+
"div",
|
|
6549
|
+
{
|
|
6550
|
+
style: {
|
|
6551
|
+
display: "flex",
|
|
6552
|
+
alignItems: "flex-start",
|
|
6553
|
+
justifyContent: "space-between",
|
|
6554
|
+
marginBottom: 16
|
|
6555
|
+
},
|
|
6556
|
+
children: /* @__PURE__ */ jsxs23("div", { style: { flex: 1 }, children: [
|
|
6557
|
+
/* @__PURE__ */ jsxs23(
|
|
6558
|
+
"div",
|
|
6559
|
+
{
|
|
6560
|
+
style: {
|
|
6561
|
+
display: "flex",
|
|
6562
|
+
alignItems: "center",
|
|
6563
|
+
gap: 8,
|
|
6564
|
+
marginBottom: 8
|
|
6565
|
+
},
|
|
6566
|
+
children: [
|
|
6567
|
+
/* @__PURE__ */ jsx43(
|
|
6568
|
+
Text14,
|
|
6569
|
+
{
|
|
6570
|
+
strong: true,
|
|
6571
|
+
style: {
|
|
6572
|
+
fontSize: 18,
|
|
6573
|
+
fontWeight: 600,
|
|
6574
|
+
color: token.colorText
|
|
6575
|
+
},
|
|
6576
|
+
children: assistant.name
|
|
6577
|
+
}
|
|
6578
|
+
),
|
|
6579
|
+
agentType && /* @__PURE__ */ jsx43(
|
|
6580
|
+
Tag6,
|
|
6581
|
+
{
|
|
6582
|
+
color: "purple",
|
|
6583
|
+
style: {
|
|
6584
|
+
margin: 0,
|
|
6585
|
+
fontSize: 10,
|
|
6586
|
+
padding: "2px 8px",
|
|
6587
|
+
fontWeight: 600
|
|
6588
|
+
},
|
|
6589
|
+
children: getAgentTypeLabel(agentType)
|
|
6590
|
+
}
|
|
6591
|
+
)
|
|
6592
|
+
]
|
|
6593
|
+
}
|
|
6594
|
+
),
|
|
6595
|
+
/* @__PURE__ */ jsx43(
|
|
6596
|
+
"div",
|
|
6597
|
+
{
|
|
6598
|
+
style: {
|
|
6599
|
+
display: "flex",
|
|
6600
|
+
alignItems: "center",
|
|
6601
|
+
gap: 6
|
|
6602
|
+
},
|
|
6603
|
+
children: /* @__PURE__ */ jsx43(
|
|
6604
|
+
Text14,
|
|
6605
|
+
{
|
|
6606
|
+
style: {
|
|
6607
|
+
fontSize: 11,
|
|
6608
|
+
color: token.colorTextTertiary,
|
|
6609
|
+
fontFamily: "monospace"
|
|
6610
|
+
},
|
|
6611
|
+
children: `>_ ${assistant.id}`
|
|
6612
|
+
}
|
|
6613
|
+
)
|
|
6614
|
+
}
|
|
6615
|
+
)
|
|
6616
|
+
] })
|
|
6617
|
+
}
|
|
6618
|
+
),
|
|
6619
|
+
assistant.description && /* @__PURE__ */ jsx43("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs23(
|
|
6620
|
+
Text14,
|
|
6621
|
+
{
|
|
6622
|
+
style: {
|
|
6623
|
+
fontSize: 12,
|
|
6624
|
+
color: token.colorText,
|
|
6625
|
+
lineHeight: 1.6,
|
|
6626
|
+
fontStyle: "italic"
|
|
6627
|
+
},
|
|
6628
|
+
children: [
|
|
6629
|
+
'"',
|
|
6630
|
+
assistant.description,
|
|
6631
|
+
'"'
|
|
6632
|
+
]
|
|
6633
|
+
}
|
|
6634
|
+
) }),
|
|
6635
|
+
modelKey && /* @__PURE__ */ jsxs23("div", { style: { marginBottom: 16 }, children: [
|
|
6636
|
+
/* @__PURE__ */ jsxs23(
|
|
6637
|
+
"div",
|
|
6638
|
+
{
|
|
6639
|
+
style: {
|
|
6640
|
+
display: "flex",
|
|
6641
|
+
alignItems: "center",
|
|
6642
|
+
gap: 8,
|
|
6643
|
+
marginBottom: 8
|
|
6644
|
+
},
|
|
6645
|
+
children: [
|
|
6646
|
+
/* @__PURE__ */ jsx43(
|
|
6647
|
+
SettingOutlined,
|
|
6648
|
+
{
|
|
6649
|
+
style: {
|
|
6650
|
+
fontSize: 14,
|
|
6651
|
+
color: token.colorTextSecondary
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
),
|
|
6655
|
+
/* @__PURE__ */ jsx43(
|
|
6656
|
+
Text14,
|
|
6657
|
+
{
|
|
6658
|
+
style: {
|
|
6659
|
+
fontSize: 12,
|
|
6660
|
+
color: token.colorTextSecondary,
|
|
6661
|
+
fontWeight: 500
|
|
6662
|
+
},
|
|
6663
|
+
children: "Model Engine"
|
|
6664
|
+
}
|
|
6665
|
+
)
|
|
6666
|
+
]
|
|
6667
|
+
}
|
|
6668
|
+
),
|
|
6669
|
+
/* @__PURE__ */ jsx43(
|
|
6670
|
+
Tag6,
|
|
6671
|
+
{
|
|
6672
|
+
color: "blue",
|
|
6673
|
+
style: {
|
|
6674
|
+
fontSize: 11,
|
|
6675
|
+
padding: "4px 12px"
|
|
6676
|
+
},
|
|
6677
|
+
children: modelKey
|
|
6678
|
+
}
|
|
6679
|
+
)
|
|
6680
|
+
] }),
|
|
6681
|
+
prompt && /* @__PURE__ */ jsxs23("div", { style: { marginBottom: 16 }, children: [
|
|
6682
|
+
/* @__PURE__ */ jsxs23(
|
|
6683
|
+
"div",
|
|
6684
|
+
{
|
|
6685
|
+
style: {
|
|
6686
|
+
display: "flex",
|
|
6687
|
+
alignItems: "center",
|
|
6688
|
+
gap: 8,
|
|
6689
|
+
marginBottom: 8
|
|
6690
|
+
},
|
|
6691
|
+
children: [
|
|
6692
|
+
/* @__PURE__ */ jsx43(
|
|
6693
|
+
CodeOutlined4,
|
|
6694
|
+
{
|
|
6695
|
+
style: {
|
|
6696
|
+
fontSize: 14,
|
|
6697
|
+
color: token.colorTextSecondary
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
),
|
|
6701
|
+
/* @__PURE__ */ jsx43(
|
|
6702
|
+
Text14,
|
|
6703
|
+
{
|
|
6704
|
+
style: {
|
|
6705
|
+
fontSize: 12,
|
|
6706
|
+
color: token.colorTextSecondary,
|
|
6707
|
+
fontWeight: 600,
|
|
6708
|
+
letterSpacing: 0.5
|
|
6709
|
+
},
|
|
6710
|
+
children: "SYSTEM PROMPT"
|
|
6711
|
+
}
|
|
6712
|
+
)
|
|
6713
|
+
]
|
|
6714
|
+
}
|
|
6715
|
+
),
|
|
6716
|
+
/* @__PURE__ */ jsx43(
|
|
6717
|
+
"div",
|
|
6718
|
+
{
|
|
6719
|
+
style: {
|
|
6720
|
+
padding: 12,
|
|
6721
|
+
background: token.colorFillTertiary,
|
|
6722
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
6723
|
+
borderRadius: 4,
|
|
6724
|
+
maxHeight: 200,
|
|
6725
|
+
overflowY: "auto"
|
|
6726
|
+
},
|
|
6727
|
+
children: /* @__PURE__ */ jsx43(
|
|
6728
|
+
Text14,
|
|
6729
|
+
{
|
|
6730
|
+
style: {
|
|
6731
|
+
fontSize: 11,
|
|
6732
|
+
color: token.colorText,
|
|
6733
|
+
lineHeight: 1.6,
|
|
6734
|
+
whiteSpace: "pre-wrap"
|
|
6735
|
+
},
|
|
6736
|
+
children: prompt
|
|
6737
|
+
}
|
|
6738
|
+
)
|
|
6739
|
+
}
|
|
6740
|
+
)
|
|
6741
|
+
] }),
|
|
6742
|
+
tools && tools.length > 0 && /* @__PURE__ */ jsxs23("div", { style: { marginBottom: 16 }, children: [
|
|
6743
|
+
/* @__PURE__ */ jsxs23(
|
|
6744
|
+
"div",
|
|
6745
|
+
{
|
|
6746
|
+
style: {
|
|
6747
|
+
display: "flex",
|
|
6748
|
+
alignItems: "center",
|
|
6749
|
+
gap: 8,
|
|
6750
|
+
marginBottom: 8
|
|
6751
|
+
},
|
|
6752
|
+
children: [
|
|
6753
|
+
/* @__PURE__ */ jsx43(
|
|
6754
|
+
ToolOutlined2,
|
|
6755
|
+
{
|
|
6756
|
+
style: {
|
|
6757
|
+
fontSize: 14,
|
|
6758
|
+
color: token.colorTextSecondary
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
),
|
|
6762
|
+
/* @__PURE__ */ jsxs23(
|
|
6763
|
+
Text14,
|
|
6764
|
+
{
|
|
6765
|
+
style: {
|
|
6766
|
+
fontSize: 12,
|
|
6767
|
+
color: token.colorTextSecondary,
|
|
6768
|
+
fontWeight: 500
|
|
6769
|
+
},
|
|
6770
|
+
children: [
|
|
6771
|
+
"Available Tools (",
|
|
6772
|
+
tools.length,
|
|
6773
|
+
")"
|
|
6774
|
+
]
|
|
6775
|
+
}
|
|
6776
|
+
)
|
|
6777
|
+
]
|
|
6778
|
+
}
|
|
6779
|
+
),
|
|
6780
|
+
/* @__PURE__ */ jsx43(Space15, { size: [8, 8], wrap: true, children: tools.map((tool, index) => /* @__PURE__ */ jsx43(
|
|
6781
|
+
Tag6,
|
|
6782
|
+
{
|
|
6783
|
+
color: "blue",
|
|
6784
|
+
style: {
|
|
6785
|
+
fontSize: 11,
|
|
6786
|
+
padding: "4px 12px"
|
|
6787
|
+
},
|
|
6788
|
+
children: tool.replace(/_/g, " ")
|
|
6789
|
+
},
|
|
6790
|
+
index
|
|
6791
|
+
)) })
|
|
6792
|
+
] }),
|
|
6793
|
+
subAgents && subAgents.length > 0 && /* @__PURE__ */ jsxs23("div", { style: { marginBottom: 16 }, children: [
|
|
6794
|
+
/* @__PURE__ */ jsxs23(
|
|
6795
|
+
"div",
|
|
6796
|
+
{
|
|
6797
|
+
style: {
|
|
6798
|
+
display: "flex",
|
|
6799
|
+
alignItems: "center",
|
|
6800
|
+
gap: 8,
|
|
6801
|
+
marginBottom: 8
|
|
6802
|
+
},
|
|
6803
|
+
children: [
|
|
6804
|
+
/* @__PURE__ */ jsx43(
|
|
6805
|
+
BranchesOutlined,
|
|
6806
|
+
{
|
|
6807
|
+
style: {
|
|
6808
|
+
fontSize: 14,
|
|
6809
|
+
color: token.colorTextSecondary
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
6812
|
+
),
|
|
6813
|
+
/* @__PURE__ */ jsxs23(
|
|
6814
|
+
Text14,
|
|
6815
|
+
{
|
|
6816
|
+
style: {
|
|
6817
|
+
fontSize: 12,
|
|
6818
|
+
color: token.colorTextSecondary,
|
|
6819
|
+
fontWeight: 500
|
|
6820
|
+
},
|
|
6821
|
+
children: [
|
|
6822
|
+
"Sub-Agent Architecture (",
|
|
6823
|
+
subAgents.length,
|
|
6824
|
+
")"
|
|
6825
|
+
]
|
|
6826
|
+
}
|
|
6827
|
+
)
|
|
6828
|
+
]
|
|
6829
|
+
}
|
|
6830
|
+
),
|
|
6831
|
+
/* @__PURE__ */ jsx43(Space15, { size: [8, 8], wrap: true, children: subAgents.map((subAgent, index) => /* @__PURE__ */ jsx43(
|
|
6832
|
+
Tag6,
|
|
6833
|
+
{
|
|
6834
|
+
style: {
|
|
6835
|
+
fontSize: 11,
|
|
6836
|
+
padding: "4px 12px",
|
|
6837
|
+
backgroundColor: token.colorFillTertiary,
|
|
6838
|
+
color: token.colorText,
|
|
6839
|
+
border: `1px solid ${token.colorBorderSecondary}`
|
|
6840
|
+
},
|
|
6841
|
+
children: `> ${subAgent}`
|
|
6842
|
+
},
|
|
6843
|
+
index
|
|
6844
|
+
)) })
|
|
6845
|
+
] }),
|
|
6846
|
+
/* @__PURE__ */ jsx43(Divider2, { style: { margin: "16px 0" } }),
|
|
6847
|
+
/* @__PURE__ */ jsxs23(
|
|
6848
|
+
"div",
|
|
6849
|
+
{
|
|
6850
|
+
style: {
|
|
6851
|
+
display: "flex",
|
|
6852
|
+
alignItems: "center",
|
|
6853
|
+
justifyContent: "space-between",
|
|
6854
|
+
gap: 8
|
|
6855
|
+
},
|
|
6856
|
+
children: [
|
|
6857
|
+
/* @__PURE__ */ jsx43(
|
|
6858
|
+
Button16,
|
|
6859
|
+
{
|
|
6860
|
+
type: "primary",
|
|
6861
|
+
block: true,
|
|
6862
|
+
onClick: () => onClick?.(assistant),
|
|
6863
|
+
style: {
|
|
6864
|
+
flex: 1
|
|
6865
|
+
},
|
|
6866
|
+
children: "Configure Agent"
|
|
6867
|
+
}
|
|
6868
|
+
),
|
|
6869
|
+
/* @__PURE__ */ jsx43(
|
|
6870
|
+
Button16,
|
|
6871
|
+
{
|
|
6872
|
+
icon: /* @__PURE__ */ jsx43(CopyOutlined2, {}),
|
|
6873
|
+
onClick: () => handleCopy(assistant.id),
|
|
6874
|
+
title: "\u590D\u5236 ID"
|
|
6875
|
+
}
|
|
6876
|
+
)
|
|
6877
|
+
]
|
|
6878
|
+
}
|
|
6879
|
+
)
|
|
6880
|
+
]
|
|
6881
|
+
}
|
|
6882
|
+
);
|
|
6883
|
+
return /* @__PURE__ */ jsxs23(
|
|
6884
|
+
"div",
|
|
6885
|
+
{
|
|
6886
|
+
style: {
|
|
6887
|
+
padding: 4
|
|
6888
|
+
},
|
|
6889
|
+
children: [
|
|
6890
|
+
/* @__PURE__ */ jsx43(Handle, { type: "target", position: Position.Top }),
|
|
6891
|
+
/* @__PURE__ */ jsxs23(
|
|
6892
|
+
"div",
|
|
6893
|
+
{
|
|
6894
|
+
onClick: () => onClick?.(assistant),
|
|
6895
|
+
style: {
|
|
6896
|
+
width: 260,
|
|
6897
|
+
minHeight: 180,
|
|
6898
|
+
background: token.colorBgContainer,
|
|
6899
|
+
borderRadius: 8,
|
|
6900
|
+
boxShadow: `0 1px 4px rgba(0, 0, 0, 0.08)`,
|
|
6901
|
+
cursor: onClick ? "pointer" : "default",
|
|
6902
|
+
overflow: "hidden",
|
|
6903
|
+
transition: "all 0.2s ease",
|
|
6904
|
+
position: "relative",
|
|
6905
|
+
border: `1px solid ${token.colorBorder}`,
|
|
6906
|
+
display: "flex",
|
|
6907
|
+
flexDirection: "column"
|
|
6908
|
+
},
|
|
6909
|
+
onMouseEnter: (e) => {
|
|
6910
|
+
if (onClick) {
|
|
6911
|
+
e.currentTarget.style.transform = "translateY(-2px)";
|
|
6912
|
+
e.currentTarget.style.boxShadow = `0 2px 8px rgba(0, 0, 0, 0.12)`;
|
|
6913
|
+
}
|
|
6914
|
+
},
|
|
6915
|
+
onMouseLeave: (e) => {
|
|
6916
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
6917
|
+
e.currentTarget.style.boxShadow = `0 1px 4px rgba(0, 0, 0, 0.08)`;
|
|
6918
|
+
},
|
|
6919
|
+
children: [
|
|
6920
|
+
/* @__PURE__ */ jsx43(
|
|
6921
|
+
Popover2,
|
|
6922
|
+
{
|
|
6923
|
+
content: detailCardContent,
|
|
6924
|
+
title: null,
|
|
6925
|
+
trigger: "hover",
|
|
6926
|
+
placement: "rightTop",
|
|
6927
|
+
overlayStyle: {
|
|
6928
|
+
maxWidth: "none"
|
|
6929
|
+
},
|
|
6930
|
+
overlayInnerStyle: {
|
|
6931
|
+
padding: 0
|
|
6932
|
+
},
|
|
6933
|
+
children: /* @__PURE__ */ jsx43(
|
|
6934
|
+
"div",
|
|
6935
|
+
{
|
|
6936
|
+
onClick: (e) => {
|
|
6937
|
+
e.stopPropagation();
|
|
6938
|
+
},
|
|
6939
|
+
style: {
|
|
6940
|
+
position: "absolute",
|
|
6941
|
+
top: 8,
|
|
6942
|
+
right: 8,
|
|
6943
|
+
zIndex: 10,
|
|
6944
|
+
cursor: "pointer",
|
|
6945
|
+
padding: 4,
|
|
6946
|
+
borderRadius: 4,
|
|
6947
|
+
background: token.colorBgContainer,
|
|
6948
|
+
display: "flex",
|
|
6949
|
+
alignItems: "center",
|
|
6950
|
+
justifyContent: "center",
|
|
6951
|
+
transition: "all 0.2s ease"
|
|
6952
|
+
},
|
|
6953
|
+
onMouseEnter: (e) => {
|
|
6954
|
+
e.currentTarget.style.background = token.colorFillSecondary;
|
|
6955
|
+
},
|
|
6956
|
+
onMouseLeave: (e) => {
|
|
6957
|
+
e.currentTarget.style.background = token.colorBgContainer;
|
|
6958
|
+
},
|
|
6959
|
+
children: /* @__PURE__ */ jsx43(
|
|
6960
|
+
InfoCircleOutlined2,
|
|
6961
|
+
{
|
|
6962
|
+
style: {
|
|
6963
|
+
fontSize: 14,
|
|
6964
|
+
color: token.colorTextSecondary
|
|
6965
|
+
}
|
|
6966
|
+
}
|
|
6967
|
+
)
|
|
6968
|
+
}
|
|
6969
|
+
)
|
|
6970
|
+
}
|
|
6971
|
+
),
|
|
6972
|
+
/* @__PURE__ */ jsxs23(
|
|
6973
|
+
"div",
|
|
6974
|
+
{
|
|
6975
|
+
style: {
|
|
6976
|
+
padding: 12,
|
|
6977
|
+
display: "flex",
|
|
6978
|
+
flexDirection: "column",
|
|
6979
|
+
gap: 10
|
|
6980
|
+
},
|
|
6981
|
+
children: [
|
|
6982
|
+
/* @__PURE__ */ jsxs23(
|
|
6983
|
+
"div",
|
|
6984
|
+
{
|
|
6985
|
+
style: {
|
|
6986
|
+
display: "flex",
|
|
6987
|
+
alignItems: "flex-start",
|
|
6988
|
+
gap: 10
|
|
6989
|
+
},
|
|
6990
|
+
children: [
|
|
6991
|
+
/* @__PURE__ */ jsxs23(
|
|
6992
|
+
"div",
|
|
6993
|
+
{
|
|
6994
|
+
style: {
|
|
6995
|
+
position: "relative",
|
|
6996
|
+
flexShrink: 0
|
|
6997
|
+
},
|
|
6998
|
+
children: [
|
|
6999
|
+
/* @__PURE__ */ jsx43(
|
|
7000
|
+
Avatar5,
|
|
7001
|
+
{
|
|
7002
|
+
size: 44,
|
|
7003
|
+
icon: /* @__PURE__ */ jsx43(UserOutlined3, {}),
|
|
7004
|
+
style: {
|
|
7005
|
+
backgroundColor: badgeColor,
|
|
7006
|
+
color: "#fff",
|
|
7007
|
+
fontSize: 16,
|
|
7008
|
+
fontWeight: 600
|
|
7009
|
+
},
|
|
7010
|
+
children: initials
|
|
7011
|
+
}
|
|
7012
|
+
),
|
|
7013
|
+
/* @__PURE__ */ jsx43(
|
|
7014
|
+
"div",
|
|
7015
|
+
{
|
|
7016
|
+
style: {
|
|
7017
|
+
position: "absolute",
|
|
7018
|
+
bottom: 0,
|
|
7019
|
+
right: 0,
|
|
7020
|
+
width: 10,
|
|
7021
|
+
height: 10,
|
|
7022
|
+
borderRadius: "50%",
|
|
7023
|
+
background: "#52c41a",
|
|
7024
|
+
border: `2px solid ${token.colorBgContainer}`
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
)
|
|
7028
|
+
]
|
|
7029
|
+
}
|
|
7030
|
+
),
|
|
7031
|
+
/* @__PURE__ */ jsxs23(
|
|
7032
|
+
"div",
|
|
7033
|
+
{
|
|
7034
|
+
style: {
|
|
7035
|
+
flex: 1,
|
|
7036
|
+
minWidth: 0
|
|
7037
|
+
},
|
|
7038
|
+
children: [
|
|
7039
|
+
/* @__PURE__ */ jsx43(
|
|
7040
|
+
Text14,
|
|
7041
|
+
{
|
|
7042
|
+
strong: true,
|
|
7043
|
+
style: {
|
|
7044
|
+
fontSize: 14,
|
|
7045
|
+
fontWeight: 600,
|
|
7046
|
+
display: "block",
|
|
7047
|
+
marginBottom: 3,
|
|
7048
|
+
color: token.colorText,
|
|
7049
|
+
lineHeight: 1.3
|
|
7050
|
+
},
|
|
7051
|
+
ellipsis: { tooltip: assistant.name },
|
|
7052
|
+
children: assistant.name
|
|
7053
|
+
}
|
|
7054
|
+
),
|
|
7055
|
+
/* @__PURE__ */ jsxs23(
|
|
7056
|
+
"div",
|
|
7057
|
+
{
|
|
7058
|
+
style: {
|
|
7059
|
+
display: "flex",
|
|
7060
|
+
alignItems: "center",
|
|
7061
|
+
gap: 4
|
|
7062
|
+
},
|
|
7063
|
+
children: [
|
|
7064
|
+
/* @__PURE__ */ jsx43(
|
|
7065
|
+
IdcardOutlined,
|
|
7066
|
+
{
|
|
7067
|
+
style: {
|
|
7068
|
+
fontSize: 9,
|
|
7069
|
+
color: token.colorTextTertiary
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
),
|
|
7073
|
+
/* @__PURE__ */ jsx43(
|
|
7074
|
+
Text14,
|
|
7075
|
+
{
|
|
7076
|
+
style: {
|
|
7077
|
+
fontSize: 9,
|
|
7078
|
+
color: token.colorTextTertiary
|
|
7079
|
+
},
|
|
7080
|
+
ellipsis: { tooltip: assistant.id },
|
|
7081
|
+
children: assistant.id
|
|
7082
|
+
}
|
|
7083
|
+
)
|
|
7084
|
+
]
|
|
7085
|
+
}
|
|
7086
|
+
)
|
|
7087
|
+
]
|
|
7088
|
+
}
|
|
7089
|
+
)
|
|
7090
|
+
]
|
|
7091
|
+
}
|
|
7092
|
+
),
|
|
7093
|
+
assistant.description && /* @__PURE__ */ jsx43(
|
|
7094
|
+
"div",
|
|
7095
|
+
{
|
|
7096
|
+
style: {
|
|
7097
|
+
padding: 8,
|
|
7098
|
+
background: token.colorFillTertiary,
|
|
7099
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
7100
|
+
borderRadius: 4,
|
|
7101
|
+
borderLeft: `2px solid ${badgeColor}`
|
|
7102
|
+
},
|
|
7103
|
+
children: /* @__PURE__ */ jsx43(
|
|
7104
|
+
Tooltip6,
|
|
7105
|
+
{
|
|
7106
|
+
title: assistant.description.length > 150 ? assistant.description : void 0,
|
|
7107
|
+
placement: "top",
|
|
7108
|
+
children: /* @__PURE__ */ jsxs23(
|
|
7109
|
+
"div",
|
|
7110
|
+
{
|
|
7111
|
+
style: {
|
|
7112
|
+
fontSize: 10,
|
|
7113
|
+
color: token.colorText,
|
|
7114
|
+
lineHeight: 1.5,
|
|
7115
|
+
fontStyle: "italic",
|
|
7116
|
+
display: "-webkit-box",
|
|
7117
|
+
WebkitLineClamp: 3,
|
|
7118
|
+
WebkitBoxOrient: "vertical",
|
|
7119
|
+
overflow: "hidden",
|
|
7120
|
+
textOverflow: "ellipsis",
|
|
7121
|
+
cursor: assistant.description.length > 150 ? "help" : "default"
|
|
7122
|
+
},
|
|
7123
|
+
children: [
|
|
7124
|
+
'"',
|
|
7125
|
+
assistant.description,
|
|
7126
|
+
'"'
|
|
7127
|
+
]
|
|
7128
|
+
}
|
|
7129
|
+
)
|
|
7130
|
+
}
|
|
7131
|
+
)
|
|
7132
|
+
}
|
|
7133
|
+
),
|
|
7134
|
+
/* @__PURE__ */ jsxs23(
|
|
7135
|
+
"div",
|
|
7136
|
+
{
|
|
7137
|
+
style: {
|
|
7138
|
+
display: "flex",
|
|
7139
|
+
flexWrap: "wrap",
|
|
7140
|
+
gap: 4,
|
|
7141
|
+
padding: "4px 0",
|
|
7142
|
+
marginTop: "auto"
|
|
7143
|
+
},
|
|
7144
|
+
children: [
|
|
7145
|
+
agentType && /* @__PURE__ */ jsx43(
|
|
7146
|
+
Tag6,
|
|
7147
|
+
{
|
|
7148
|
+
style: {
|
|
7149
|
+
margin: 0,
|
|
7150
|
+
fontSize: 7,
|
|
7151
|
+
padding: "2px 6px",
|
|
7152
|
+
borderRadius: 6,
|
|
7153
|
+
backgroundColor: token.colorPrimaryBg,
|
|
7154
|
+
color: token.colorPrimary,
|
|
7155
|
+
border: `1px solid ${token.colorPrimaryBorder}`,
|
|
7156
|
+
fontWeight: 500,
|
|
7157
|
+
lineHeight: "14px"
|
|
7158
|
+
},
|
|
7159
|
+
children: getAgentTypeLabel(agentType)
|
|
7160
|
+
}
|
|
7161
|
+
),
|
|
7162
|
+
tools && tools.length > 0 && /* @__PURE__ */ jsxs23(
|
|
7163
|
+
Tag6,
|
|
7164
|
+
{
|
|
7165
|
+
style: {
|
|
7166
|
+
margin: 0,
|
|
7167
|
+
fontSize: 7,
|
|
7168
|
+
padding: "2px 6px",
|
|
7169
|
+
borderRadius: 6,
|
|
7170
|
+
backgroundColor: token.colorSuccessBg,
|
|
7171
|
+
color: token.colorSuccess,
|
|
7172
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
7173
|
+
fontWeight: 500,
|
|
7174
|
+
lineHeight: "14px"
|
|
7175
|
+
},
|
|
7176
|
+
children: [
|
|
7177
|
+
tools.length,
|
|
7178
|
+
" Tools"
|
|
7179
|
+
]
|
|
7180
|
+
}
|
|
7181
|
+
),
|
|
7182
|
+
modelKey && /* @__PURE__ */ jsx43(
|
|
7183
|
+
Tag6,
|
|
7184
|
+
{
|
|
7185
|
+
style: {
|
|
7186
|
+
margin: 0,
|
|
7187
|
+
fontSize: 7,
|
|
7188
|
+
padding: "2px 6px",
|
|
7189
|
+
borderRadius: 6,
|
|
7190
|
+
backgroundColor: token.colorWarningBg,
|
|
7191
|
+
color: token.colorWarning,
|
|
7192
|
+
border: `1px solid ${token.colorWarningBorder}`,
|
|
7193
|
+
fontWeight: 500,
|
|
7194
|
+
lineHeight: "14px"
|
|
7195
|
+
},
|
|
7196
|
+
title: modelKey,
|
|
7197
|
+
children: modelKey.length > 12 ? `${modelKey.slice(0, 12)}...` : modelKey
|
|
7198
|
+
}
|
|
7199
|
+
)
|
|
7200
|
+
]
|
|
7201
|
+
}
|
|
7202
|
+
)
|
|
7203
|
+
]
|
|
7204
|
+
}
|
|
7205
|
+
)
|
|
7206
|
+
]
|
|
7207
|
+
}
|
|
7208
|
+
),
|
|
7209
|
+
/* @__PURE__ */ jsx43(Handle, { type: "source", position: Position.Bottom })
|
|
7210
|
+
]
|
|
7211
|
+
}
|
|
7212
|
+
);
|
|
7213
|
+
};
|
|
7214
|
+
var AssistantNode_default = AssistantNode;
|
|
7215
|
+
|
|
7216
|
+
// src/components/Chat/AssistantFlow.tsx
|
|
7217
|
+
import { jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7218
|
+
var AssistantFlowInner = ({
|
|
7219
|
+
assistants,
|
|
7220
|
+
onNodeClick
|
|
7221
|
+
}) => {
|
|
7222
|
+
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
7223
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
7224
|
+
const nodeTypes = useMemo10(
|
|
7225
|
+
() => ({
|
|
7226
|
+
assistant: AssistantNode_default
|
|
7227
|
+
}),
|
|
7228
|
+
[]
|
|
7229
|
+
);
|
|
7230
|
+
useEffect17(() => {
|
|
7231
|
+
if (!assistants || assistants.length === 0) {
|
|
7232
|
+
setNodes([]);
|
|
7233
|
+
setEdges([]);
|
|
7234
|
+
return;
|
|
7235
|
+
}
|
|
7236
|
+
const initialNodes = [];
|
|
7237
|
+
const initialEdges = [];
|
|
7238
|
+
const nodeWidth = 280;
|
|
7239
|
+
const nodeHeight = 200;
|
|
7240
|
+
const horizontalSpacing = 320;
|
|
7241
|
+
const verticalSpacing = 300;
|
|
7242
|
+
const nodesPerRow = Math.ceil(Math.sqrt(assistants.length));
|
|
7243
|
+
const assistantMap = /* @__PURE__ */ new Map();
|
|
7244
|
+
const relationships = [];
|
|
7245
|
+
assistants.forEach((assistant) => {
|
|
7246
|
+
assistantMap.set(assistant.id, assistant);
|
|
7247
|
+
});
|
|
7248
|
+
assistants.forEach((assistant) => {
|
|
7249
|
+
if (assistant.graphDefinition) {
|
|
7250
|
+
try {
|
|
7251
|
+
const graphDef = typeof assistant.graphDefinition === "string" ? JSON.parse(assistant.graphDefinition) : assistant.graphDefinition;
|
|
7252
|
+
if (graphDef.subAgents && Array.isArray(graphDef.subAgents)) {
|
|
7253
|
+
graphDef.subAgents.forEach((subAgentKey) => {
|
|
7254
|
+
const subAssistant = assistants.find(
|
|
7255
|
+
(a) => a.id === subAgentKey || a.id === String(subAgentKey)
|
|
7256
|
+
);
|
|
7257
|
+
if (subAssistant && subAssistant.id !== assistant.id) {
|
|
7258
|
+
relationships.push({
|
|
7259
|
+
source: assistant.id,
|
|
7260
|
+
target: subAssistant.id
|
|
7261
|
+
});
|
|
7262
|
+
}
|
|
7263
|
+
});
|
|
7264
|
+
}
|
|
7265
|
+
if (graphDef.internalSubAgents && Array.isArray(graphDef.internalSubAgents)) {
|
|
7266
|
+
graphDef.internalSubAgents.forEach((internalSubAgent) => {
|
|
7267
|
+
if (internalSubAgent.key) {
|
|
7268
|
+
const subAssistant = assistants.find(
|
|
7269
|
+
(a) => a.id === internalSubAgent.key || a.id === String(internalSubAgent.key)
|
|
7270
|
+
);
|
|
7271
|
+
if (subAssistant && subAssistant.id !== assistant.id) {
|
|
7272
|
+
relationships.push({
|
|
7273
|
+
source: assistant.id,
|
|
7274
|
+
target: subAssistant.id
|
|
7275
|
+
});
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
});
|
|
7279
|
+
}
|
|
7280
|
+
if (graphDef.nodes && Array.isArray(graphDef.nodes)) {
|
|
7281
|
+
graphDef.nodes.forEach((node) => {
|
|
7282
|
+
if (node.assistantId && node.assistantId !== assistant.id) {
|
|
7283
|
+
const targetAssistant = assistants.find(
|
|
7284
|
+
(a) => a.id === node.assistantId || a.id === String(node.assistantId)
|
|
7285
|
+
);
|
|
7286
|
+
if (targetAssistant) {
|
|
7287
|
+
relationships.push({
|
|
7288
|
+
source: assistant.id,
|
|
7289
|
+
target: targetAssistant.id
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
}
|
|
7293
|
+
});
|
|
7294
|
+
}
|
|
7295
|
+
if (graphDef.edges && Array.isArray(graphDef.edges)) {
|
|
7296
|
+
graphDef.edges.forEach((edge) => {
|
|
7297
|
+
if (edge.source && edge.target) {
|
|
7298
|
+
const sourceId = typeof edge.source === "string" ? edge.source : edge.source.id || edge.source.assistantId;
|
|
7299
|
+
const targetId = typeof edge.target === "string" ? edge.target : edge.target.id || edge.target.assistantId;
|
|
7300
|
+
const sourceAssistant = assistants.find(
|
|
7301
|
+
(a) => a.id === sourceId || a.id === String(sourceId)
|
|
7302
|
+
);
|
|
7303
|
+
const targetAssistant = assistants.find(
|
|
7304
|
+
(a) => a.id === targetId || a.id === String(targetId)
|
|
7305
|
+
);
|
|
7306
|
+
if (sourceAssistant && targetAssistant) {
|
|
7307
|
+
relationships.push({
|
|
7308
|
+
source: sourceAssistant.id,
|
|
7309
|
+
target: targetAssistant.id
|
|
7310
|
+
});
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
});
|
|
7314
|
+
}
|
|
7315
|
+
} catch (error) {
|
|
7316
|
+
console.warn(
|
|
7317
|
+
`Failed to parse graphDefinition for assistant ${assistant.id}:`,
|
|
7318
|
+
error
|
|
7319
|
+
);
|
|
7320
|
+
}
|
|
7321
|
+
}
|
|
7322
|
+
});
|
|
7323
|
+
const hasRelationships = relationships.length > 0;
|
|
7324
|
+
if (hasRelationships) {
|
|
7325
|
+
const processedIds = /* @__PURE__ */ new Set();
|
|
7326
|
+
const levelMap = /* @__PURE__ */ new Map();
|
|
7327
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
7328
|
+
relationships.forEach((rel) => {
|
|
7329
|
+
if (!childrenMap.has(rel.source)) {
|
|
7330
|
+
childrenMap.set(rel.source, []);
|
|
7331
|
+
}
|
|
7332
|
+
childrenMap.get(rel.source).push(rel.target);
|
|
7333
|
+
});
|
|
7334
|
+
const queue = [];
|
|
7335
|
+
const rootNodes = assistants.filter(
|
|
7336
|
+
(a) => !relationships.some((r) => r.target === a.id)
|
|
7337
|
+
);
|
|
7338
|
+
if (rootNodes.length === 0 && assistants.length > 0) {
|
|
7339
|
+
queue.push({ id: assistants[0].id, level: 0 });
|
|
7340
|
+
} else {
|
|
7341
|
+
rootNodes.forEach((root) => {
|
|
7342
|
+
queue.push({ id: root.id, level: 0 });
|
|
7343
|
+
});
|
|
7344
|
+
}
|
|
7345
|
+
while (queue.length > 0) {
|
|
7346
|
+
const { id, level } = queue.shift();
|
|
7347
|
+
if (processedIds.has(id)) continue;
|
|
7348
|
+
processedIds.add(id);
|
|
7349
|
+
levelMap.set(id, level);
|
|
7350
|
+
const children = childrenMap.get(id) || [];
|
|
7351
|
+
children.forEach((childId) => {
|
|
7352
|
+
if (!processedIds.has(childId)) {
|
|
7353
|
+
queue.push({ id: childId, level: level + 1 });
|
|
7354
|
+
}
|
|
7355
|
+
});
|
|
7356
|
+
}
|
|
7357
|
+
assistants.forEach((assistant) => {
|
|
7358
|
+
if (!levelMap.has(assistant.id)) {
|
|
7359
|
+
levelMap.set(assistant.id, 0);
|
|
7360
|
+
}
|
|
7361
|
+
});
|
|
7362
|
+
const levelGroups = /* @__PURE__ */ new Map();
|
|
7363
|
+
assistants.forEach((assistant) => {
|
|
7364
|
+
const level = levelMap.get(assistant.id) || 0;
|
|
7365
|
+
if (!levelGroups.has(level)) {
|
|
7366
|
+
levelGroups.set(level, []);
|
|
7367
|
+
}
|
|
7368
|
+
levelGroups.get(level).push(assistant);
|
|
7369
|
+
});
|
|
7370
|
+
levelGroups.forEach((group, level) => {
|
|
7371
|
+
const y = level * verticalSpacing;
|
|
7372
|
+
const groupWidth = (group.length - 1) * horizontalSpacing;
|
|
7373
|
+
const startX = -groupWidth / 2;
|
|
7374
|
+
group.forEach((assistant, index) => {
|
|
7375
|
+
const x = startX + index * horizontalSpacing;
|
|
7376
|
+
initialNodes.push({
|
|
7377
|
+
id: assistant.id,
|
|
7378
|
+
type: "assistant",
|
|
7379
|
+
data: {
|
|
7380
|
+
assistant,
|
|
7381
|
+
onClick: () => onNodeClick?.(assistant)
|
|
7382
|
+
},
|
|
7383
|
+
position: { x, y }
|
|
7384
|
+
});
|
|
7385
|
+
});
|
|
7386
|
+
});
|
|
7387
|
+
relationships.forEach((rel) => {
|
|
7388
|
+
if (assistantMap.has(rel.source) && assistantMap.has(rel.target)) {
|
|
7389
|
+
initialEdges.push({
|
|
7390
|
+
id: `e${rel.source}-${rel.target}`,
|
|
7391
|
+
source: rel.source,
|
|
7392
|
+
target: rel.target,
|
|
7393
|
+
animated: true,
|
|
7394
|
+
style: { stroke: "#1677ff" },
|
|
7395
|
+
type: "smoothstep"
|
|
7396
|
+
});
|
|
7397
|
+
}
|
|
7398
|
+
});
|
|
7399
|
+
} else {
|
|
7400
|
+
assistants.forEach((assistant, index) => {
|
|
7401
|
+
const row = Math.floor(index / nodesPerRow);
|
|
7402
|
+
const col = index % nodesPerRow;
|
|
7403
|
+
const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
|
|
7404
|
+
const y = row * verticalSpacing;
|
|
7405
|
+
initialNodes.push({
|
|
7406
|
+
id: assistant.id,
|
|
7407
|
+
type: "assistant",
|
|
7408
|
+
data: {
|
|
7409
|
+
assistant,
|
|
7410
|
+
onClick: () => onNodeClick?.(assistant)
|
|
7411
|
+
},
|
|
7412
|
+
position: { x, y }
|
|
7413
|
+
});
|
|
7414
|
+
});
|
|
7415
|
+
}
|
|
7416
|
+
setNodes(initialNodes);
|
|
7417
|
+
setEdges(initialEdges);
|
|
7418
|
+
}, [assistants, setNodes, setEdges, onNodeClick]);
|
|
7419
|
+
return /* @__PURE__ */ jsx44("div", { style: { width: "100%", height: "100%", background: "#fafafa" }, children: /* @__PURE__ */ jsxs24(
|
|
7420
|
+
ReactFlow,
|
|
7421
|
+
{
|
|
7422
|
+
nodes,
|
|
7423
|
+
edges,
|
|
7424
|
+
onNodesChange,
|
|
7425
|
+
onEdgesChange,
|
|
7426
|
+
nodeTypes,
|
|
7427
|
+
fitView: true,
|
|
7428
|
+
children: [
|
|
7429
|
+
/* @__PURE__ */ jsx44(Background, { color: "#eee", gap: 20 }),
|
|
7430
|
+
/* @__PURE__ */ jsx44(Controls, {})
|
|
7431
|
+
]
|
|
7432
|
+
}
|
|
7433
|
+
) });
|
|
7434
|
+
};
|
|
7435
|
+
var AssistantFlow = (props) => /* @__PURE__ */ jsx44(ReactFlowProvider, { children: /* @__PURE__ */ jsx44(AssistantFlowInner, { ...props }) });
|
|
7436
|
+
var AssistantFlow_default = AssistantFlow;
|
|
7437
|
+
|
|
7438
|
+
// src/components/Chat/SkillFlow.tsx
|
|
7439
|
+
import { useMemo as useMemo12, useEffect as useEffect19, useState as useState26 } from "react";
|
|
7440
|
+
import {
|
|
7441
|
+
ReactFlow as ReactFlow2,
|
|
7442
|
+
Background as Background2,
|
|
7443
|
+
Controls as Controls2,
|
|
7444
|
+
useNodesState as useNodesState2,
|
|
7445
|
+
useEdgesState as useEdgesState2,
|
|
7446
|
+
ReactFlowProvider as ReactFlowProvider2
|
|
7447
|
+
} from "@xyflow/react";
|
|
7448
|
+
import "@xyflow/react/dist/style.css";
|
|
7449
|
+
import { Button as Button19, theme as theme6 } from "antd";
|
|
7450
|
+
import { PlusOutlined as PlusOutlined3 } from "@ant-design/icons";
|
|
7451
|
+
|
|
7452
|
+
// src/components/Chat/SkillNode.tsx
|
|
7453
|
+
import { useEffect as useEffect18, useMemo as useMemo11, useState as useState24 } from "react";
|
|
7454
|
+
import { Handle as Handle2, Position as Position2 } from "@xyflow/react";
|
|
7455
|
+
import {
|
|
7456
|
+
Avatar as Avatar6,
|
|
7457
|
+
Typography as Typography17,
|
|
7458
|
+
theme as theme4,
|
|
7459
|
+
Tag as Tag7,
|
|
7460
|
+
Tooltip as Tooltip7,
|
|
7461
|
+
Space as Space16,
|
|
7462
|
+
Button as Button17,
|
|
7463
|
+
Divider as Divider3,
|
|
7464
|
+
Input,
|
|
7465
|
+
Modal,
|
|
7466
|
+
message as message5
|
|
7467
|
+
} from "antd";
|
|
7468
|
+
import {
|
|
7469
|
+
BookOutlined,
|
|
7470
|
+
BranchesOutlined as BranchesOutlined2,
|
|
7471
|
+
CopyrightOutlined,
|
|
7472
|
+
InfoCircleOutlined as InfoCircleOutlined3,
|
|
7473
|
+
FileTextOutlined as FileTextOutlined5,
|
|
7474
|
+
CopyOutlined as CopyOutlined3,
|
|
7475
|
+
PlusOutlined
|
|
7476
|
+
} from "@ant-design/icons";
|
|
7477
|
+
import { Fragment as Fragment5, jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7478
|
+
var { Text: Text15 } = Typography17;
|
|
7479
|
+
var { TextArea } = Input;
|
|
7480
|
+
var getBadgeColor2 = (name) => {
|
|
7481
|
+
const colors = [
|
|
7482
|
+
"#1890ff",
|
|
7483
|
+
// Blue
|
|
7484
|
+
"#52c41a",
|
|
7485
|
+
// Green
|
|
7486
|
+
"#faad14",
|
|
7487
|
+
// Orange
|
|
7488
|
+
"#f5222d",
|
|
7489
|
+
// Red
|
|
7490
|
+
"#722ed1",
|
|
7491
|
+
// Purple
|
|
7492
|
+
"#13c2c2",
|
|
7493
|
+
// Cyan
|
|
7494
|
+
"#eb2f96",
|
|
7495
|
+
// Magenta
|
|
7496
|
+
"#fa8c16"
|
|
7497
|
+
// Orange Red
|
|
7498
|
+
];
|
|
7499
|
+
let hash = 0;
|
|
7500
|
+
for (let i = 0; i < name.length; i++) {
|
|
7501
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
7502
|
+
}
|
|
7503
|
+
return colors[Math.abs(hash) % colors.length];
|
|
7504
|
+
};
|
|
7505
|
+
var SkillNode = ({ data }) => {
|
|
7506
|
+
const { token } = theme4.useToken();
|
|
7507
|
+
const { config } = useLatticeChatShellContext();
|
|
7508
|
+
if (!data) {
|
|
7509
|
+
return null;
|
|
7510
|
+
}
|
|
7511
|
+
const { skill, onClick } = data;
|
|
7512
|
+
if (!skill) {
|
|
7513
|
+
return null;
|
|
7514
|
+
}
|
|
7515
|
+
const [currentSkill, setCurrentSkill] = useState24(skill);
|
|
7516
|
+
const badgeColor = getBadgeColor2(currentSkill.name);
|
|
7517
|
+
const initials = currentSkill.name?.split("-").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "SK";
|
|
7518
|
+
const hasSubSkills = currentSkill.subSkills && currentSkill.subSkills.length > 0;
|
|
7519
|
+
const category = currentSkill.metadata && currentSkill.metadata.category || "global";
|
|
7520
|
+
const metadataEntries = useMemo11(
|
|
7521
|
+
() => currentSkill.metadata ? Object.entries(
|
|
7522
|
+
currentSkill.metadata
|
|
7523
|
+
).filter(
|
|
7524
|
+
([key, value]) => key && value
|
|
7525
|
+
) : [],
|
|
7526
|
+
[currentSkill.metadata]
|
|
7527
|
+
);
|
|
7528
|
+
const formatDate = (value) => {
|
|
7529
|
+
if (!value) return "";
|
|
7530
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
7531
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
7532
|
+
return date.toLocaleString();
|
|
7533
|
+
};
|
|
7534
|
+
const handleCopy = (text) => {
|
|
7535
|
+
navigator.clipboard.writeText(text);
|
|
7536
|
+
};
|
|
7537
|
+
const [isEditing, setIsEditing] = useState24(false);
|
|
7538
|
+
const [draftSkill, setDraftSkill] = useState24({
|
|
7539
|
+
...skill,
|
|
7540
|
+
id: skill.name
|
|
7541
|
+
});
|
|
7542
|
+
const [metadataRows, setMetadataRows] = useState24(
|
|
7543
|
+
metadataEntries.map(([key, value]) => ({
|
|
7544
|
+
key,
|
|
7545
|
+
value
|
|
7546
|
+
}))
|
|
7547
|
+
);
|
|
7548
|
+
const [isModalOpen, setIsModalOpen] = useState24(false);
|
|
7549
|
+
const [saving, setSaving] = useState24(false);
|
|
7550
|
+
useEffect18(() => {
|
|
7551
|
+
setIsEditing(false);
|
|
7552
|
+
setCurrentSkill(skill);
|
|
7553
|
+
setDraftSkill({ ...skill, id: skill.name });
|
|
7554
|
+
setMetadataRows(
|
|
7555
|
+
Object.entries(
|
|
7556
|
+
skill.metadata || {}
|
|
7557
|
+
).map(([key, value]) => ({ key, value }))
|
|
7558
|
+
);
|
|
7559
|
+
}, [skill]);
|
|
7560
|
+
const handleFieldChange = (field, value) => {
|
|
7561
|
+
if (field === "name") {
|
|
7562
|
+
setDraftSkill((prev) => ({
|
|
7563
|
+
...prev,
|
|
7564
|
+
name: value,
|
|
7565
|
+
id: value
|
|
7566
|
+
// keep id and name identical
|
|
7567
|
+
}));
|
|
7568
|
+
return;
|
|
7569
|
+
}
|
|
7570
|
+
setDraftSkill((prev) => ({
|
|
7571
|
+
...prev,
|
|
7572
|
+
[field]: value
|
|
7573
|
+
}));
|
|
7574
|
+
};
|
|
7575
|
+
const handleDelete = () => {
|
|
7576
|
+
Modal.confirm({
|
|
7577
|
+
title: "Delete skill",
|
|
7578
|
+
content: `Are you sure you want to delete "${currentSkill.name}"? This action cannot be undone.`,
|
|
7579
|
+
okText: "Delete",
|
|
7580
|
+
okType: "danger",
|
|
7581
|
+
cancelText: "Cancel",
|
|
7582
|
+
onOk: async () => {
|
|
7583
|
+
try {
|
|
7584
|
+
const headers = {};
|
|
7585
|
+
if (config.apiKey) {
|
|
7586
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
7587
|
+
}
|
|
7588
|
+
const response = await fetch(
|
|
7589
|
+
`${config.baseURL}/api/skills/${currentSkill.id}`,
|
|
7590
|
+
{
|
|
7591
|
+
method: "DELETE",
|
|
7592
|
+
headers
|
|
7593
|
+
}
|
|
7594
|
+
);
|
|
7595
|
+
let data2 = {};
|
|
7596
|
+
try {
|
|
7597
|
+
data2 = await response.json();
|
|
7598
|
+
} catch {
|
|
7599
|
+
}
|
|
7600
|
+
if (response.ok && (data2.success ?? true)) {
|
|
7601
|
+
message5.success("Skill deleted successfully");
|
|
7602
|
+
setIsModalOpen(false);
|
|
7603
|
+
onClick?.(currentSkill);
|
|
7604
|
+
} else {
|
|
7605
|
+
message5.error(data2.message || "Failed to delete skill");
|
|
7606
|
+
}
|
|
7607
|
+
} catch (error) {
|
|
7608
|
+
message5.error(
|
|
7609
|
+
error?.message || "An error occurred while deleting the skill"
|
|
7610
|
+
);
|
|
7611
|
+
}
|
|
7612
|
+
}
|
|
7613
|
+
});
|
|
7614
|
+
};
|
|
7615
|
+
const syncMetadataRows = (rows) => {
|
|
7616
|
+
setMetadataRows(rows);
|
|
7617
|
+
const metadataObject = rows.reduce((acc, curr) => {
|
|
7618
|
+
if (curr.key) {
|
|
7619
|
+
acc[curr.key] = curr.value;
|
|
7620
|
+
}
|
|
7621
|
+
return acc;
|
|
7622
|
+
}, {});
|
|
7623
|
+
setDraftSkill((prev) => ({
|
|
7624
|
+
...prev,
|
|
7625
|
+
metadata: metadataObject
|
|
7626
|
+
}));
|
|
7627
|
+
};
|
|
7628
|
+
const handleMetadataChange = (index, field, value) => {
|
|
7629
|
+
const next = [...metadataRows];
|
|
7630
|
+
next[index] = {
|
|
7631
|
+
...next[index],
|
|
7632
|
+
[field]: value
|
|
7633
|
+
};
|
|
7634
|
+
syncMetadataRows(next);
|
|
7635
|
+
};
|
|
7636
|
+
const handleAddMetadataRow = () => {
|
|
7637
|
+
syncMetadataRows([...metadataRows, { key: "", value: "" }]);
|
|
7638
|
+
};
|
|
7639
|
+
const handleSave = async () => {
|
|
7640
|
+
try {
|
|
7641
|
+
setSaving(true);
|
|
7642
|
+
const headers = {
|
|
7643
|
+
"Content-Type": "application/json"
|
|
7644
|
+
};
|
|
7645
|
+
if (config.apiKey) {
|
|
7646
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
7647
|
+
}
|
|
7648
|
+
const requestBody = {
|
|
7649
|
+
name: draftSkill.name,
|
|
7650
|
+
description: draftSkill.description,
|
|
7651
|
+
license: draftSkill.license || void 0,
|
|
7652
|
+
compatibility: draftSkill.compatibility || void 0,
|
|
7653
|
+
metadata: draftSkill.metadata || void 0,
|
|
7654
|
+
content: draftSkill.content || void 0,
|
|
7655
|
+
subSkills: draftSkill.subSkills || void 0
|
|
7656
|
+
};
|
|
7657
|
+
const response = await fetch(
|
|
7658
|
+
`${config.baseURL}/api/skills/${currentSkill.id}`,
|
|
7659
|
+
{
|
|
7660
|
+
method: "PUT",
|
|
7661
|
+
headers,
|
|
7662
|
+
body: JSON.stringify(requestBody)
|
|
7663
|
+
}
|
|
7664
|
+
);
|
|
7665
|
+
const data2 = await response.json();
|
|
7666
|
+
if (response.ok && data2.success) {
|
|
7667
|
+
message5.success("Skill updated successfully");
|
|
7668
|
+
const updatedSkill = data2.data || draftSkill;
|
|
7669
|
+
setCurrentSkill(updatedSkill);
|
|
7670
|
+
setDraftSkill({ ...updatedSkill, id: updatedSkill.name });
|
|
7671
|
+
setMetadataRows(
|
|
7672
|
+
Object.entries(
|
|
7673
|
+
updatedSkill.metadata || {}
|
|
7674
|
+
).map(([key, value]) => ({ key, value }))
|
|
7675
|
+
);
|
|
7676
|
+
setIsEditing(false);
|
|
7677
|
+
onClick?.(updatedSkill);
|
|
7678
|
+
} else {
|
|
7679
|
+
message5.error(data2.message || "Failed to update skill");
|
|
7680
|
+
}
|
|
7681
|
+
} catch (error) {
|
|
7682
|
+
message5.error(
|
|
7683
|
+
error.message || "An error occurred while updating the skill"
|
|
7684
|
+
);
|
|
7685
|
+
} finally {
|
|
7686
|
+
setSaving(false);
|
|
7687
|
+
}
|
|
7688
|
+
};
|
|
7689
|
+
const editingView = /* @__PURE__ */ jsxs25(
|
|
7690
|
+
"div",
|
|
7691
|
+
{
|
|
7692
|
+
style: {
|
|
7693
|
+
display: "flex",
|
|
7694
|
+
flexDirection: "column",
|
|
7695
|
+
gap: 12
|
|
7696
|
+
},
|
|
7697
|
+
children: [
|
|
7698
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7699
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
|
|
7700
|
+
/* @__PURE__ */ jsx45(
|
|
7701
|
+
TextArea,
|
|
7702
|
+
{
|
|
7703
|
+
value: draftSkill.description,
|
|
7704
|
+
onChange: (e) => handleFieldChange("description", e.target.value),
|
|
7705
|
+
placeholder: "Description",
|
|
7706
|
+
autoSize: { minRows: 2, maxRows: 4 }
|
|
7707
|
+
}
|
|
7708
|
+
)
|
|
7709
|
+
] }),
|
|
7710
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7711
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
|
|
7712
|
+
/* @__PURE__ */ jsx45(
|
|
7713
|
+
Input,
|
|
7714
|
+
{
|
|
7715
|
+
value: draftSkill.license,
|
|
7716
|
+
onChange: (e) => handleFieldChange("license", e.target.value),
|
|
7717
|
+
placeholder: "License"
|
|
7718
|
+
}
|
|
7719
|
+
)
|
|
7720
|
+
] }),
|
|
7721
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7722
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
|
|
7723
|
+
/* @__PURE__ */ jsx45(
|
|
7724
|
+
Input,
|
|
7725
|
+
{
|
|
7726
|
+
value: draftSkill.compatibility,
|
|
7727
|
+
onChange: (e) => handleFieldChange("compatibility", e.target.value),
|
|
7728
|
+
placeholder: "Compatibility"
|
|
7729
|
+
}
|
|
7730
|
+
)
|
|
7731
|
+
] }),
|
|
7732
|
+
/* @__PURE__ */ jsxs25(
|
|
7733
|
+
"div",
|
|
7734
|
+
{
|
|
7735
|
+
style: {
|
|
7736
|
+
display: "flex",
|
|
7737
|
+
alignItems: "center",
|
|
7738
|
+
justifyContent: "space-between",
|
|
7739
|
+
gap: 8
|
|
7740
|
+
},
|
|
7741
|
+
children: [
|
|
7742
|
+
/* @__PURE__ */ jsx45(
|
|
7743
|
+
Text15,
|
|
7744
|
+
{
|
|
7745
|
+
style: {
|
|
7746
|
+
fontSize: 12,
|
|
7747
|
+
color: token.colorTextSecondary,
|
|
7748
|
+
fontWeight: 500
|
|
7749
|
+
},
|
|
7750
|
+
children: "Metadata"
|
|
7751
|
+
}
|
|
7752
|
+
),
|
|
7753
|
+
/* @__PURE__ */ jsx45(
|
|
7754
|
+
Button17,
|
|
7755
|
+
{
|
|
7756
|
+
size: "small",
|
|
7757
|
+
icon: /* @__PURE__ */ jsx45(PlusOutlined, {}),
|
|
7758
|
+
onClick: handleAddMetadataRow,
|
|
7759
|
+
children: "Add"
|
|
7760
|
+
}
|
|
7761
|
+
)
|
|
7762
|
+
]
|
|
7763
|
+
}
|
|
7764
|
+
),
|
|
7765
|
+
/* @__PURE__ */ jsxs25(Space16, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
|
|
7766
|
+
metadataRows.length === 0 && /* @__PURE__ */ jsx45(
|
|
7767
|
+
Text15,
|
|
7768
|
+
{
|
|
7769
|
+
style: {
|
|
7770
|
+
fontSize: 11,
|
|
7771
|
+
color: token.colorTextTertiary
|
|
7772
|
+
},
|
|
7773
|
+
children: "No metadata yet. Use Add to create one."
|
|
7774
|
+
}
|
|
7775
|
+
),
|
|
7776
|
+
metadataRows.map((row, index) => /* @__PURE__ */ jsxs25(
|
|
7777
|
+
"div",
|
|
7778
|
+
{
|
|
7779
|
+
style: {
|
|
7780
|
+
display: "flex",
|
|
7781
|
+
flexDirection: "column",
|
|
7782
|
+
gap: 4,
|
|
7783
|
+
width: "100%"
|
|
7784
|
+
},
|
|
7785
|
+
children: [
|
|
7786
|
+
/* @__PURE__ */ jsxs25(Text15, { style: { fontSize: 11, color: token.colorTextSecondary }, children: [
|
|
7787
|
+
"Meta ",
|
|
7788
|
+
index + 1
|
|
7789
|
+
] }),
|
|
7790
|
+
/* @__PURE__ */ jsxs25(Space16, { style: { width: "100%" }, size: 8, wrap: true, children: [
|
|
7791
|
+
/* @__PURE__ */ jsx45(
|
|
7792
|
+
Input,
|
|
7793
|
+
{
|
|
7794
|
+
value: row.key,
|
|
7795
|
+
placeholder: "Key",
|
|
7796
|
+
style: { width: 140 },
|
|
7797
|
+
onChange: (e) => handleMetadataChange(index, "key", e.target.value)
|
|
7798
|
+
}
|
|
7799
|
+
),
|
|
7800
|
+
/* @__PURE__ */ jsx45(
|
|
7801
|
+
Input,
|
|
7802
|
+
{
|
|
7803
|
+
value: row.value,
|
|
7804
|
+
placeholder: "Value",
|
|
7805
|
+
style: { flex: 1, minWidth: 200 },
|
|
7806
|
+
onChange: (e) => handleMetadataChange(index, "value", e.target.value)
|
|
7807
|
+
}
|
|
7808
|
+
)
|
|
7809
|
+
] })
|
|
7810
|
+
]
|
|
7811
|
+
},
|
|
7812
|
+
index
|
|
7813
|
+
))
|
|
7814
|
+
] }),
|
|
7815
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7816
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
|
|
7817
|
+
/* @__PURE__ */ jsx45(
|
|
7818
|
+
TextArea,
|
|
7819
|
+
{
|
|
7820
|
+
value: draftSkill.content,
|
|
7821
|
+
onChange: (e) => handleFieldChange("content", e.target.value),
|
|
7822
|
+
placeholder: "Content",
|
|
7823
|
+
autoSize: { minRows: 4, maxRows: 8 }
|
|
7824
|
+
}
|
|
7825
|
+
)
|
|
7826
|
+
] })
|
|
7827
|
+
]
|
|
7828
|
+
}
|
|
7829
|
+
);
|
|
7830
|
+
const detailCardContent = /* @__PURE__ */ jsxs25(
|
|
7831
|
+
"div",
|
|
7832
|
+
{
|
|
7833
|
+
style: {
|
|
7834
|
+
width: 480,
|
|
7835
|
+
maxHeight: "80vh",
|
|
7836
|
+
overflowY: "auto",
|
|
7837
|
+
padding: 16
|
|
7838
|
+
},
|
|
7839
|
+
children: [
|
|
7840
|
+
/* @__PURE__ */ jsx45(
|
|
7841
|
+
"div",
|
|
7842
|
+
{
|
|
7843
|
+
style: {
|
|
7844
|
+
display: "flex",
|
|
7845
|
+
alignItems: "flex-start",
|
|
7846
|
+
justifyContent: "space-between",
|
|
7847
|
+
marginBottom: 16
|
|
7848
|
+
},
|
|
7849
|
+
children: /* @__PURE__ */ jsxs25("div", { style: { flex: 1 }, children: [
|
|
7850
|
+
/* @__PURE__ */ jsxs25(
|
|
7851
|
+
"div",
|
|
7852
|
+
{
|
|
7853
|
+
style: {
|
|
7854
|
+
display: "flex",
|
|
7855
|
+
alignItems: "center",
|
|
7856
|
+
gap: 8,
|
|
7857
|
+
marginBottom: 8
|
|
7858
|
+
},
|
|
7859
|
+
children: [
|
|
7860
|
+
/* @__PURE__ */ jsx45(
|
|
7861
|
+
Text15,
|
|
7862
|
+
{
|
|
7863
|
+
strong: true,
|
|
7864
|
+
style: {
|
|
7865
|
+
fontSize: 18,
|
|
7866
|
+
fontWeight: 600,
|
|
7867
|
+
color: token.colorText
|
|
7868
|
+
},
|
|
7869
|
+
children: currentSkill.name
|
|
7870
|
+
}
|
|
7871
|
+
),
|
|
7872
|
+
/* @__PURE__ */ jsx45(
|
|
7873
|
+
Tag7,
|
|
7874
|
+
{
|
|
7875
|
+
style: {
|
|
7876
|
+
margin: 0,
|
|
7877
|
+
fontSize: 10,
|
|
7878
|
+
padding: "2px 8px",
|
|
7879
|
+
fontWeight: 600
|
|
7880
|
+
},
|
|
7881
|
+
color: "geekblue",
|
|
7882
|
+
children: category.toUpperCase()
|
|
7883
|
+
}
|
|
7884
|
+
)
|
|
7885
|
+
]
|
|
7886
|
+
}
|
|
7887
|
+
),
|
|
7888
|
+
/* @__PURE__ */ jsx45(
|
|
7889
|
+
"div",
|
|
7890
|
+
{
|
|
7891
|
+
style: {
|
|
7892
|
+
display: "flex",
|
|
7893
|
+
alignItems: "center",
|
|
7894
|
+
gap: 6
|
|
7895
|
+
},
|
|
7896
|
+
children: /* @__PURE__ */ jsx45(
|
|
7897
|
+
Text15,
|
|
7898
|
+
{
|
|
7899
|
+
style: {
|
|
7900
|
+
fontSize: 11,
|
|
7901
|
+
color: token.colorTextTertiary,
|
|
7902
|
+
fontFamily: "monospace"
|
|
7903
|
+
},
|
|
7904
|
+
children: `>_ ${currentSkill.id}`
|
|
7905
|
+
}
|
|
7906
|
+
)
|
|
7907
|
+
}
|
|
7908
|
+
)
|
|
7909
|
+
] })
|
|
7910
|
+
}
|
|
7911
|
+
),
|
|
7912
|
+
isEditing ? editingView : /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
7913
|
+
currentSkill.description && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(
|
|
7914
|
+
Text15,
|
|
7915
|
+
{
|
|
7916
|
+
style: {
|
|
7917
|
+
fontSize: 12,
|
|
7918
|
+
color: token.colorText,
|
|
7919
|
+
lineHeight: 1.6,
|
|
7920
|
+
fontStyle: "italic"
|
|
7921
|
+
},
|
|
7922
|
+
children: [
|
|
7923
|
+
'"',
|
|
7924
|
+
currentSkill.description,
|
|
7925
|
+
'"'
|
|
7926
|
+
]
|
|
7927
|
+
}
|
|
7928
|
+
) }),
|
|
7929
|
+
metadataEntries.length > 0 && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 16 }, children: [
|
|
7930
|
+
/* @__PURE__ */ jsxs25(
|
|
7931
|
+
"div",
|
|
7932
|
+
{
|
|
7933
|
+
style: {
|
|
7934
|
+
display: "flex",
|
|
7935
|
+
alignItems: "center",
|
|
7936
|
+
gap: 8,
|
|
7937
|
+
marginBottom: 8
|
|
7938
|
+
},
|
|
7939
|
+
children: [
|
|
7940
|
+
/* @__PURE__ */ jsx45(
|
|
7941
|
+
InfoCircleOutlined3,
|
|
7942
|
+
{
|
|
7943
|
+
style: {
|
|
7944
|
+
fontSize: 14,
|
|
7945
|
+
color: token.colorTextSecondary
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7948
|
+
),
|
|
7949
|
+
/* @__PURE__ */ jsxs25(
|
|
7950
|
+
Text15,
|
|
7951
|
+
{
|
|
7952
|
+
style: {
|
|
7953
|
+
fontSize: 12,
|
|
7954
|
+
color: token.colorTextSecondary,
|
|
7955
|
+
fontWeight: 500
|
|
7956
|
+
},
|
|
7957
|
+
children: [
|
|
7958
|
+
"Metadata (",
|
|
7959
|
+
metadataEntries.length,
|
|
7960
|
+
")"
|
|
7961
|
+
]
|
|
7962
|
+
}
|
|
7963
|
+
)
|
|
7964
|
+
]
|
|
7965
|
+
}
|
|
7966
|
+
),
|
|
7967
|
+
/* @__PURE__ */ jsx45(
|
|
7968
|
+
"div",
|
|
7969
|
+
{
|
|
7970
|
+
style: {
|
|
7971
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
7972
|
+
borderRadius: 6,
|
|
7973
|
+
overflow: "hidden"
|
|
7974
|
+
},
|
|
7975
|
+
children: metadataEntries.map(([key, value], index) => /* @__PURE__ */ jsxs25(
|
|
7976
|
+
"div",
|
|
7977
|
+
{
|
|
7978
|
+
style: {
|
|
7979
|
+
display: "flex",
|
|
7980
|
+
alignItems: "stretch",
|
|
7981
|
+
borderBottom: index === metadataEntries.length - 1 ? "none" : `1px solid ${token.colorBorderSecondary}`
|
|
7982
|
+
},
|
|
7983
|
+
children: [
|
|
7984
|
+
/* @__PURE__ */ jsx45(
|
|
7985
|
+
"div",
|
|
7986
|
+
{
|
|
7987
|
+
style: {
|
|
7988
|
+
width: 140,
|
|
7989
|
+
padding: "8px 10px",
|
|
7990
|
+
background: token.colorFillTertiary,
|
|
7991
|
+
borderRight: `1px solid ${token.colorBorderSecondary}`,
|
|
7992
|
+
fontSize: 11,
|
|
7993
|
+
color: token.colorTextSecondary,
|
|
7994
|
+
fontWeight: 600,
|
|
7995
|
+
textTransform: "capitalize"
|
|
7996
|
+
},
|
|
7997
|
+
children: key
|
|
7998
|
+
}
|
|
7999
|
+
),
|
|
8000
|
+
/* @__PURE__ */ jsx45(
|
|
8001
|
+
"div",
|
|
8002
|
+
{
|
|
8003
|
+
style: {
|
|
8004
|
+
flex: 1,
|
|
8005
|
+
padding: "8px 10px",
|
|
8006
|
+
fontSize: 11,
|
|
8007
|
+
color: token.colorText,
|
|
8008
|
+
wordBreak: "break-word"
|
|
8009
|
+
},
|
|
8010
|
+
children: value
|
|
8011
|
+
}
|
|
8012
|
+
)
|
|
8013
|
+
]
|
|
8014
|
+
},
|
|
8015
|
+
key
|
|
8016
|
+
))
|
|
8017
|
+
}
|
|
8018
|
+
)
|
|
8019
|
+
] }),
|
|
8020
|
+
hasSubSkills && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 16 }, children: [
|
|
8021
|
+
/* @__PURE__ */ jsxs25(
|
|
8022
|
+
"div",
|
|
8023
|
+
{
|
|
8024
|
+
style: {
|
|
8025
|
+
display: "flex",
|
|
8026
|
+
alignItems: "center",
|
|
8027
|
+
gap: 8,
|
|
8028
|
+
marginBottom: 8
|
|
8029
|
+
},
|
|
8030
|
+
children: [
|
|
8031
|
+
/* @__PURE__ */ jsx45(
|
|
8032
|
+
BranchesOutlined2,
|
|
8033
|
+
{
|
|
8034
|
+
style: {
|
|
8035
|
+
fontSize: 14,
|
|
8036
|
+
color: token.colorTextSecondary
|
|
8037
|
+
}
|
|
8038
|
+
}
|
|
8039
|
+
),
|
|
8040
|
+
/* @__PURE__ */ jsxs25(
|
|
8041
|
+
Text15,
|
|
8042
|
+
{
|
|
8043
|
+
style: {
|
|
8044
|
+
fontSize: 12,
|
|
8045
|
+
color: token.colorTextSecondary,
|
|
8046
|
+
fontWeight: 500
|
|
8047
|
+
},
|
|
8048
|
+
children: [
|
|
8049
|
+
"Sub-Skills (",
|
|
8050
|
+
currentSkill.subSkills.length,
|
|
8051
|
+
")"
|
|
8052
|
+
]
|
|
8053
|
+
}
|
|
8054
|
+
)
|
|
8055
|
+
]
|
|
8056
|
+
}
|
|
8057
|
+
),
|
|
8058
|
+
/* @__PURE__ */ jsx45(Space16, { size: [8, 8], wrap: true, children: currentSkill.subSkills.map(
|
|
8059
|
+
(subSkill, index) => /* @__PURE__ */ jsx45(
|
|
8060
|
+
Tag7,
|
|
8061
|
+
{
|
|
8062
|
+
style: {
|
|
8063
|
+
fontSize: 11,
|
|
8064
|
+
padding: "4px 12px",
|
|
8065
|
+
backgroundColor: token.colorFillTertiary,
|
|
8066
|
+
color: token.colorText,
|
|
8067
|
+
border: `1px solid ${token.colorBorderSecondary}`
|
|
8068
|
+
},
|
|
8069
|
+
children: subSkill
|
|
8070
|
+
},
|
|
8071
|
+
index
|
|
8072
|
+
)
|
|
8073
|
+
) })
|
|
8074
|
+
] }),
|
|
8075
|
+
(currentSkill.license || currentSkill.compatibility) && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(Space16, { size: [8, 8], wrap: true, children: [
|
|
8076
|
+
currentSkill.license && /* @__PURE__ */ jsx45(
|
|
8077
|
+
Tag7,
|
|
8078
|
+
{
|
|
8079
|
+
icon: /* @__PURE__ */ jsx45(CopyrightOutlined, {}),
|
|
8080
|
+
style: {
|
|
8081
|
+
margin: 0,
|
|
8082
|
+
fontSize: 11,
|
|
8083
|
+
padding: "4px 12px",
|
|
8084
|
+
borderRadius: 6,
|
|
8085
|
+
backgroundColor: token.colorInfoBg,
|
|
8086
|
+
color: token.colorInfo,
|
|
8087
|
+
border: `1px solid ${token.colorInfoBorder}`,
|
|
8088
|
+
fontWeight: 500,
|
|
8089
|
+
lineHeight: "16px"
|
|
8090
|
+
},
|
|
8091
|
+
children: currentSkill.license
|
|
8092
|
+
}
|
|
8093
|
+
),
|
|
8094
|
+
currentSkill.compatibility && /* @__PURE__ */ jsx45(
|
|
8095
|
+
Tag7,
|
|
8096
|
+
{
|
|
8097
|
+
style: {
|
|
8098
|
+
margin: 0,
|
|
8099
|
+
fontSize: 11,
|
|
8100
|
+
padding: "4px 12px",
|
|
8101
|
+
borderRadius: 6,
|
|
8102
|
+
backgroundColor: token.colorSuccessBg,
|
|
8103
|
+
color: token.colorSuccess,
|
|
8104
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8105
|
+
fontWeight: 500,
|
|
8106
|
+
lineHeight: "16px",
|
|
8107
|
+
display: "inline-flex",
|
|
8108
|
+
alignItems: "center",
|
|
8109
|
+
gap: 4
|
|
8110
|
+
},
|
|
8111
|
+
children: currentSkill.compatibility
|
|
8112
|
+
}
|
|
8113
|
+
)
|
|
8114
|
+
] }) }),
|
|
8115
|
+
(currentSkill.createdAt || currentSkill.updatedAt) && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(Space16, { direction: "vertical", size: 4, children: [
|
|
8116
|
+
currentSkill.createdAt && /* @__PURE__ */ jsxs25(
|
|
8117
|
+
Text15,
|
|
8118
|
+
{
|
|
8119
|
+
style: {
|
|
8120
|
+
fontSize: 11,
|
|
8121
|
+
color: token.colorTextTertiary,
|
|
8122
|
+
fontFamily: "monospace"
|
|
8123
|
+
},
|
|
8124
|
+
children: [
|
|
8125
|
+
"Created: ",
|
|
8126
|
+
formatDate(currentSkill.createdAt)
|
|
8127
|
+
]
|
|
8128
|
+
}
|
|
8129
|
+
),
|
|
8130
|
+
currentSkill.updatedAt && /* @__PURE__ */ jsxs25(
|
|
8131
|
+
Text15,
|
|
8132
|
+
{
|
|
8133
|
+
style: {
|
|
8134
|
+
fontSize: 11,
|
|
8135
|
+
color: token.colorTextTertiary,
|
|
8136
|
+
fontFamily: "monospace"
|
|
8137
|
+
},
|
|
8138
|
+
children: [
|
|
8139
|
+
"Updated: ",
|
|
8140
|
+
formatDate(currentSkill.updatedAt)
|
|
8141
|
+
]
|
|
8142
|
+
}
|
|
8143
|
+
)
|
|
8144
|
+
] }) }),
|
|
8145
|
+
currentSkill.content && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 0 }, children: [
|
|
8146
|
+
/* @__PURE__ */ jsxs25(
|
|
8147
|
+
"div",
|
|
8148
|
+
{
|
|
8149
|
+
style: {
|
|
8150
|
+
display: "flex",
|
|
8151
|
+
alignItems: "center",
|
|
8152
|
+
gap: 8,
|
|
8153
|
+
marginBottom: 8
|
|
8154
|
+
},
|
|
8155
|
+
children: [
|
|
8156
|
+
/* @__PURE__ */ jsx45(
|
|
8157
|
+
FileTextOutlined5,
|
|
8158
|
+
{
|
|
8159
|
+
style: {
|
|
8160
|
+
fontSize: 14,
|
|
8161
|
+
color: token.colorTextSecondary
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
),
|
|
8165
|
+
/* @__PURE__ */ jsx45(
|
|
8166
|
+
Text15,
|
|
8167
|
+
{
|
|
8168
|
+
style: {
|
|
8169
|
+
fontSize: 12,
|
|
8170
|
+
color: token.colorTextSecondary,
|
|
8171
|
+
fontWeight: 600,
|
|
8172
|
+
letterSpacing: 0.5
|
|
8173
|
+
},
|
|
8174
|
+
children: "CONTENT"
|
|
8175
|
+
}
|
|
8176
|
+
)
|
|
8177
|
+
]
|
|
8178
|
+
}
|
|
8179
|
+
),
|
|
8180
|
+
/* @__PURE__ */ jsx45(
|
|
8181
|
+
"div",
|
|
8182
|
+
{
|
|
8183
|
+
style: {
|
|
8184
|
+
padding: 12,
|
|
8185
|
+
background: token.colorFillTertiary,
|
|
8186
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
8187
|
+
borderRadius: 4,
|
|
8188
|
+
maxHeight: 200,
|
|
8189
|
+
overflowY: "auto"
|
|
8190
|
+
},
|
|
8191
|
+
children: /* @__PURE__ */ jsx45(
|
|
8192
|
+
Text15,
|
|
8193
|
+
{
|
|
8194
|
+
style: {
|
|
8195
|
+
fontSize: 11,
|
|
8196
|
+
color: token.colorText,
|
|
8197
|
+
lineHeight: 1.6,
|
|
8198
|
+
whiteSpace: "pre-wrap"
|
|
8199
|
+
},
|
|
8200
|
+
children: currentSkill.content
|
|
8201
|
+
}
|
|
8202
|
+
)
|
|
8203
|
+
}
|
|
8204
|
+
)
|
|
8205
|
+
] })
|
|
8206
|
+
] }),
|
|
8207
|
+
/* @__PURE__ */ jsx45(Divider3, { style: { margin: "16px 0" } }),
|
|
8208
|
+
/* @__PURE__ */ jsx45(
|
|
8209
|
+
"div",
|
|
8210
|
+
{
|
|
8211
|
+
style: {
|
|
8212
|
+
display: "flex",
|
|
8213
|
+
alignItems: "center",
|
|
8214
|
+
justifyContent: "space-between",
|
|
8215
|
+
gap: 8
|
|
8216
|
+
},
|
|
8217
|
+
children: isEditing ? /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
8218
|
+
/* @__PURE__ */ jsx45(
|
|
8219
|
+
Button17,
|
|
8220
|
+
{
|
|
8221
|
+
block: true,
|
|
8222
|
+
onClick: () => {
|
|
8223
|
+
setIsEditing(false);
|
|
8224
|
+
setDraftSkill(skill);
|
|
8225
|
+
},
|
|
8226
|
+
style: {
|
|
8227
|
+
flex: 1
|
|
8228
|
+
},
|
|
8229
|
+
children: "Cancel"
|
|
8230
|
+
}
|
|
8231
|
+
),
|
|
8232
|
+
/* @__PURE__ */ jsx45(
|
|
8233
|
+
Button17,
|
|
8234
|
+
{
|
|
8235
|
+
type: "primary",
|
|
8236
|
+
block: true,
|
|
8237
|
+
onClick: handleSave,
|
|
8238
|
+
loading: saving,
|
|
8239
|
+
style: {
|
|
8240
|
+
flex: 1
|
|
8241
|
+
},
|
|
8242
|
+
children: "Save"
|
|
8243
|
+
}
|
|
8244
|
+
)
|
|
8245
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
8246
|
+
/* @__PURE__ */ jsx45(
|
|
8247
|
+
Button17,
|
|
8248
|
+
{
|
|
8249
|
+
type: "primary",
|
|
8250
|
+
block: true,
|
|
8251
|
+
onClick: () => setIsEditing(true),
|
|
8252
|
+
style: {
|
|
8253
|
+
flex: 1
|
|
8254
|
+
},
|
|
8255
|
+
children: "Edit Skill"
|
|
8256
|
+
}
|
|
8257
|
+
),
|
|
8258
|
+
/* @__PURE__ */ jsx45(Button17, { danger: true, onClick: handleDelete, children: "Delete" }),
|
|
8259
|
+
/* @__PURE__ */ jsx45(
|
|
8260
|
+
Button17,
|
|
8261
|
+
{
|
|
8262
|
+
icon: /* @__PURE__ */ jsx45(CopyOutlined3, {}),
|
|
8263
|
+
onClick: () => handleCopy(currentSkill.id),
|
|
8264
|
+
title: "Copy ID"
|
|
8265
|
+
}
|
|
8266
|
+
)
|
|
8267
|
+
] })
|
|
8268
|
+
}
|
|
8269
|
+
)
|
|
8270
|
+
]
|
|
8271
|
+
}
|
|
8272
|
+
);
|
|
8273
|
+
const hiddenHandleStyle = {
|
|
8274
|
+
opacity: 0,
|
|
8275
|
+
background: "transparent",
|
|
8276
|
+
border: "none",
|
|
8277
|
+
width: 0,
|
|
8278
|
+
height: 0,
|
|
8279
|
+
pointerEvents: "none"
|
|
8280
|
+
};
|
|
8281
|
+
return /* @__PURE__ */ jsxs25(
|
|
8282
|
+
"div",
|
|
8283
|
+
{
|
|
8284
|
+
style: {
|
|
8285
|
+
padding: 4
|
|
8286
|
+
},
|
|
8287
|
+
children: [
|
|
8288
|
+
/* @__PURE__ */ jsx45(
|
|
8289
|
+
Handle2,
|
|
8290
|
+
{
|
|
8291
|
+
type: "target",
|
|
8292
|
+
position: Position2.Top,
|
|
8293
|
+
style: hiddenHandleStyle,
|
|
8294
|
+
isConnectable: false
|
|
8295
|
+
}
|
|
8296
|
+
),
|
|
8297
|
+
/* @__PURE__ */ jsx45(
|
|
8298
|
+
"div",
|
|
8299
|
+
{
|
|
8300
|
+
onClick: () => {
|
|
8301
|
+
setIsModalOpen(true);
|
|
8302
|
+
},
|
|
8303
|
+
style: {
|
|
8304
|
+
width: 280,
|
|
8305
|
+
minHeight: 200,
|
|
8306
|
+
background: token.colorBgContainer,
|
|
8307
|
+
borderRadius: 8,
|
|
8308
|
+
boxShadow: `0 1px 6px rgba(0, 0, 0, 0.08)`,
|
|
8309
|
+
cursor: onClick ? "pointer" : "default",
|
|
8310
|
+
overflow: "hidden",
|
|
8311
|
+
transition: "all 0.2s ease",
|
|
8312
|
+
position: "relative",
|
|
8313
|
+
border: `1px solid ${token.colorBorder}`,
|
|
8314
|
+
display: "flex",
|
|
8315
|
+
flexDirection: "column"
|
|
8316
|
+
},
|
|
8317
|
+
onMouseEnter: (e) => {
|
|
8318
|
+
if (onClick) {
|
|
8319
|
+
e.currentTarget.style.transform = "translateY(-2px)";
|
|
8320
|
+
e.currentTarget.style.boxShadow = `0 2px 8px rgba(0, 0, 0, 0.12)`;
|
|
8321
|
+
}
|
|
8322
|
+
},
|
|
8323
|
+
onMouseLeave: (e) => {
|
|
8324
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
8325
|
+
e.currentTarget.style.boxShadow = `0 1px 4px rgba(0, 0, 0, 0.08)`;
|
|
8326
|
+
},
|
|
8327
|
+
children: /* @__PURE__ */ jsxs25(
|
|
8328
|
+
"div",
|
|
8329
|
+
{
|
|
8330
|
+
style: {
|
|
8331
|
+
padding: 12,
|
|
8332
|
+
display: "flex",
|
|
8333
|
+
flexDirection: "column",
|
|
8334
|
+
gap: 10
|
|
8335
|
+
},
|
|
8336
|
+
children: [
|
|
8337
|
+
/* @__PURE__ */ jsxs25(
|
|
8338
|
+
"div",
|
|
8339
|
+
{
|
|
8340
|
+
style: {
|
|
8341
|
+
display: "flex",
|
|
8342
|
+
alignItems: "flex-start",
|
|
8343
|
+
gap: 10
|
|
8344
|
+
},
|
|
8345
|
+
children: [
|
|
8346
|
+
/* @__PURE__ */ jsxs25(
|
|
8347
|
+
"div",
|
|
8348
|
+
{
|
|
8349
|
+
style: {
|
|
8350
|
+
position: "relative",
|
|
8351
|
+
flexShrink: 0
|
|
8352
|
+
},
|
|
8353
|
+
children: [
|
|
8354
|
+
/* @__PURE__ */ jsx45(
|
|
8355
|
+
Avatar6,
|
|
8356
|
+
{
|
|
8357
|
+
size: 44,
|
|
8358
|
+
icon: /* @__PURE__ */ jsx45(BookOutlined, {}),
|
|
8359
|
+
style: {
|
|
8360
|
+
backgroundColor: badgeColor,
|
|
8361
|
+
color: "#fff",
|
|
8362
|
+
fontSize: 16,
|
|
8363
|
+
fontWeight: 600
|
|
8364
|
+
},
|
|
8365
|
+
children: initials
|
|
8366
|
+
}
|
|
8367
|
+
),
|
|
8368
|
+
hasSubSkills && /* @__PURE__ */ jsx45(
|
|
8369
|
+
"div",
|
|
8370
|
+
{
|
|
8371
|
+
style: {
|
|
8372
|
+
position: "absolute",
|
|
8373
|
+
bottom: -2,
|
|
8374
|
+
right: -2,
|
|
8375
|
+
width: 18,
|
|
8376
|
+
height: 18,
|
|
8377
|
+
borderRadius: "50%",
|
|
8378
|
+
background: token.colorPrimary,
|
|
8379
|
+
border: `2px solid ${token.colorBgContainer}`,
|
|
8380
|
+
display: "flex",
|
|
8381
|
+
alignItems: "center",
|
|
8382
|
+
justifyContent: "center"
|
|
8383
|
+
},
|
|
8384
|
+
children: /* @__PURE__ */ jsx45(
|
|
8385
|
+
BranchesOutlined2,
|
|
8386
|
+
{
|
|
8387
|
+
style: {
|
|
8388
|
+
fontSize: 10,
|
|
8389
|
+
color: "#fff"
|
|
8390
|
+
}
|
|
8391
|
+
}
|
|
8392
|
+
)
|
|
8393
|
+
}
|
|
8394
|
+
)
|
|
8395
|
+
]
|
|
8396
|
+
}
|
|
8397
|
+
),
|
|
8398
|
+
/* @__PURE__ */ jsxs25(
|
|
8399
|
+
"div",
|
|
8400
|
+
{
|
|
8401
|
+
style: {
|
|
8402
|
+
flex: 1,
|
|
8403
|
+
minWidth: 0
|
|
8404
|
+
},
|
|
8405
|
+
children: [
|
|
8406
|
+
/* @__PURE__ */ jsx45(
|
|
8407
|
+
Text15,
|
|
8408
|
+
{
|
|
8409
|
+
strong: true,
|
|
8410
|
+
style: {
|
|
8411
|
+
fontSize: 14,
|
|
8412
|
+
fontWeight: 600,
|
|
8413
|
+
display: "block",
|
|
8414
|
+
marginBottom: 3,
|
|
8415
|
+
color: token.colorText,
|
|
8416
|
+
lineHeight: 1.3
|
|
8417
|
+
},
|
|
8418
|
+
ellipsis: { tooltip: currentSkill.name },
|
|
8419
|
+
children: currentSkill.name
|
|
8420
|
+
}
|
|
8421
|
+
),
|
|
8422
|
+
/* @__PURE__ */ jsxs25(
|
|
8423
|
+
"div",
|
|
8424
|
+
{
|
|
8425
|
+
style: {
|
|
8426
|
+
display: "flex",
|
|
8427
|
+
alignItems: "center",
|
|
8428
|
+
gap: 4
|
|
8429
|
+
},
|
|
8430
|
+
children: [
|
|
8431
|
+
/* @__PURE__ */ jsx45(
|
|
8432
|
+
FileTextOutlined5,
|
|
8433
|
+
{
|
|
8434
|
+
style: {
|
|
8435
|
+
fontSize: 9,
|
|
8436
|
+
color: token.colorTextTertiary
|
|
8437
|
+
}
|
|
8438
|
+
}
|
|
8439
|
+
),
|
|
8440
|
+
/* @__PURE__ */ jsx45(
|
|
8441
|
+
Text15,
|
|
8442
|
+
{
|
|
8443
|
+
style: {
|
|
8444
|
+
fontSize: 9,
|
|
8445
|
+
color: token.colorTextTertiary
|
|
8446
|
+
},
|
|
8447
|
+
ellipsis: { tooltip: currentSkill.id },
|
|
8448
|
+
children: currentSkill.id
|
|
8449
|
+
}
|
|
8450
|
+
)
|
|
8451
|
+
]
|
|
8452
|
+
}
|
|
8453
|
+
)
|
|
8454
|
+
]
|
|
8455
|
+
}
|
|
8456
|
+
)
|
|
8457
|
+
]
|
|
8458
|
+
}
|
|
8459
|
+
),
|
|
8460
|
+
currentSkill.description && /* @__PURE__ */ jsx45(
|
|
8461
|
+
"div",
|
|
8462
|
+
{
|
|
8463
|
+
style: {
|
|
8464
|
+
padding: 8,
|
|
8465
|
+
background: token.colorFillTertiary,
|
|
8466
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
8467
|
+
borderRadius: 4,
|
|
8468
|
+
borderLeft: `2px solid ${badgeColor}`
|
|
8469
|
+
},
|
|
8470
|
+
children: /* @__PURE__ */ jsx45(
|
|
8471
|
+
Tooltip7,
|
|
8472
|
+
{
|
|
8473
|
+
title: currentSkill.description.length > 150 ? currentSkill.description : void 0,
|
|
8474
|
+
placement: "top",
|
|
8475
|
+
children: /* @__PURE__ */ jsxs25(
|
|
8476
|
+
"div",
|
|
8477
|
+
{
|
|
8478
|
+
style: {
|
|
8479
|
+
fontSize: 10,
|
|
8480
|
+
color: token.colorText,
|
|
8481
|
+
lineHeight: 1.5,
|
|
8482
|
+
fontStyle: "italic",
|
|
8483
|
+
display: "-webkit-box",
|
|
8484
|
+
WebkitLineClamp: 3,
|
|
8485
|
+
WebkitBoxOrient: "vertical",
|
|
8486
|
+
overflow: "hidden",
|
|
8487
|
+
textOverflow: "ellipsis",
|
|
8488
|
+
cursor: currentSkill.description.length > 150 ? "help" : "default"
|
|
8489
|
+
},
|
|
8490
|
+
children: [
|
|
8491
|
+
'"',
|
|
8492
|
+
currentSkill.description,
|
|
8493
|
+
'"'
|
|
8494
|
+
]
|
|
8495
|
+
}
|
|
8496
|
+
)
|
|
8497
|
+
}
|
|
8498
|
+
)
|
|
8499
|
+
}
|
|
8500
|
+
),
|
|
8501
|
+
/* @__PURE__ */ jsxs25(
|
|
8502
|
+
"div",
|
|
8503
|
+
{
|
|
8504
|
+
style: {
|
|
8505
|
+
display: "flex",
|
|
8506
|
+
flexWrap: "wrap",
|
|
8507
|
+
gap: 4,
|
|
8508
|
+
padding: "4px 0",
|
|
8509
|
+
marginTop: "auto"
|
|
8510
|
+
},
|
|
8511
|
+
children: [
|
|
8512
|
+
/* @__PURE__ */ jsx45(
|
|
8513
|
+
Tag7,
|
|
8514
|
+
{
|
|
8515
|
+
style: {
|
|
8516
|
+
margin: 0,
|
|
8517
|
+
fontSize: 8,
|
|
8518
|
+
padding: "2px 6px",
|
|
8519
|
+
borderRadius: 6,
|
|
8520
|
+
backgroundColor: token.colorPrimaryBg,
|
|
8521
|
+
color: token.colorPrimary,
|
|
8522
|
+
border: `1px solid ${token.colorPrimaryBorder}`,
|
|
8523
|
+
fontWeight: 600,
|
|
8524
|
+
lineHeight: "14px",
|
|
8525
|
+
textTransform: "capitalize"
|
|
8526
|
+
},
|
|
8527
|
+
children: category.toUpperCase()
|
|
8528
|
+
}
|
|
8529
|
+
),
|
|
8530
|
+
hasSubSkills && /* @__PURE__ */ jsxs25(
|
|
8531
|
+
Tag7,
|
|
8532
|
+
{
|
|
8533
|
+
style: {
|
|
8534
|
+
margin: 0,
|
|
8535
|
+
fontSize: 8,
|
|
8536
|
+
padding: "2px 6px",
|
|
8537
|
+
borderRadius: 6,
|
|
8538
|
+
backgroundColor: token.colorSuccessBg,
|
|
8539
|
+
color: token.colorSuccess,
|
|
8540
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8541
|
+
fontWeight: 500,
|
|
8542
|
+
lineHeight: "14px",
|
|
8543
|
+
display: "inline-flex",
|
|
8544
|
+
alignItems: "center"
|
|
8545
|
+
},
|
|
8546
|
+
children: [
|
|
8547
|
+
"SUB-SKILLS (",
|
|
8548
|
+
currentSkill.subSkills.length,
|
|
8549
|
+
")"
|
|
8550
|
+
]
|
|
8551
|
+
}
|
|
8552
|
+
),
|
|
8553
|
+
currentSkill.license && /* @__PURE__ */ jsx45(
|
|
8554
|
+
Tag7,
|
|
8555
|
+
{
|
|
8556
|
+
style: {
|
|
8557
|
+
margin: 0,
|
|
8558
|
+
fontSize: 7,
|
|
8559
|
+
padding: "2px 6px",
|
|
8560
|
+
borderRadius: 6,
|
|
8561
|
+
backgroundColor: token.colorInfoBg,
|
|
8562
|
+
color: token.colorInfo,
|
|
8563
|
+
border: `1px solid ${token.colorInfoBorder}`,
|
|
8564
|
+
fontWeight: 500,
|
|
8565
|
+
lineHeight: "14px"
|
|
8566
|
+
},
|
|
8567
|
+
icon: /* @__PURE__ */ jsx45(CopyrightOutlined, {}),
|
|
8568
|
+
children: currentSkill.license
|
|
8569
|
+
}
|
|
8570
|
+
),
|
|
8571
|
+
currentSkill.compatibility && /* @__PURE__ */ jsx45(
|
|
8572
|
+
Tag7,
|
|
8573
|
+
{
|
|
8574
|
+
style: {
|
|
8575
|
+
margin: 0,
|
|
8576
|
+
fontSize: 7,
|
|
8577
|
+
padding: "2px 6px",
|
|
8578
|
+
borderRadius: 6,
|
|
8579
|
+
backgroundColor: token.colorSuccessBg,
|
|
8580
|
+
color: token.colorSuccess,
|
|
8581
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8582
|
+
fontWeight: 500,
|
|
8583
|
+
lineHeight: "14px"
|
|
8584
|
+
},
|
|
8585
|
+
icon: /* @__PURE__ */ jsx45(InfoCircleOutlined3, {}),
|
|
8586
|
+
children: currentSkill.compatibility
|
|
8587
|
+
}
|
|
8588
|
+
)
|
|
8589
|
+
]
|
|
8590
|
+
}
|
|
8591
|
+
)
|
|
8592
|
+
]
|
|
8593
|
+
}
|
|
8594
|
+
)
|
|
8595
|
+
}
|
|
8596
|
+
),
|
|
8597
|
+
/* @__PURE__ */ jsx45(
|
|
8598
|
+
Modal,
|
|
8599
|
+
{
|
|
8600
|
+
open: isModalOpen,
|
|
8601
|
+
onCancel: () => {
|
|
8602
|
+
setIsModalOpen(false);
|
|
8603
|
+
setIsEditing(false);
|
|
8604
|
+
setDraftSkill({ ...currentSkill, id: currentSkill.name });
|
|
8605
|
+
},
|
|
8606
|
+
footer: null,
|
|
8607
|
+
width: 520,
|
|
8608
|
+
destroyOnClose: true,
|
|
8609
|
+
title: null,
|
|
8610
|
+
styles: {
|
|
8611
|
+
body: { padding: 0 }
|
|
8612
|
+
},
|
|
8613
|
+
children: detailCardContent
|
|
8614
|
+
}
|
|
8615
|
+
),
|
|
8616
|
+
/* @__PURE__ */ jsx45(
|
|
8617
|
+
Handle2,
|
|
8618
|
+
{
|
|
8619
|
+
type: "source",
|
|
8620
|
+
position: Position2.Bottom,
|
|
8621
|
+
style: hiddenHandleStyle,
|
|
8622
|
+
isConnectable: false
|
|
8623
|
+
}
|
|
8624
|
+
)
|
|
8625
|
+
]
|
|
8626
|
+
}
|
|
8627
|
+
);
|
|
8628
|
+
};
|
|
8629
|
+
var SkillNode_default = SkillNode;
|
|
8630
|
+
|
|
8631
|
+
// src/components/Chat/CreateSkillModal.tsx
|
|
8632
|
+
import { useState as useState25 } from "react";
|
|
8633
|
+
import {
|
|
8634
|
+
Modal as Modal2,
|
|
8635
|
+
Form,
|
|
8636
|
+
Input as Input2,
|
|
8637
|
+
Button as Button18,
|
|
8638
|
+
message as message6,
|
|
8639
|
+
Space as Space17,
|
|
8640
|
+
Typography as Typography18
|
|
8641
|
+
} from "antd";
|
|
8642
|
+
import { PlusOutlined as PlusOutlined2 } from "@ant-design/icons";
|
|
8643
|
+
import { theme as theme5 } from "antd";
|
|
8644
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8645
|
+
var { TextArea: TextArea2 } = Input2;
|
|
8646
|
+
var { Text: Text16 } = Typography18;
|
|
8647
|
+
var CreateSkillModal = ({
|
|
8648
|
+
open,
|
|
8649
|
+
onCancel,
|
|
8650
|
+
onSuccess
|
|
8651
|
+
}) => {
|
|
8652
|
+
const [form] = Form.useForm();
|
|
8653
|
+
const [loading, setLoading] = useState25(false);
|
|
8654
|
+
const { config } = useLatticeChatShellContext();
|
|
8655
|
+
const { token } = theme5.useToken();
|
|
8656
|
+
const defaultMetadataRows = [{ key: "category", value: "global" }];
|
|
8657
|
+
const [metadataRows, setMetadataRows] = useState25(defaultMetadataRows);
|
|
8658
|
+
const handleSubmit = async () => {
|
|
8659
|
+
try {
|
|
8660
|
+
const values = await form.validateFields();
|
|
8661
|
+
setLoading(true);
|
|
8662
|
+
const headers = {
|
|
8663
|
+
"Content-Type": "application/json"
|
|
8664
|
+
};
|
|
8665
|
+
if (config.apiKey) {
|
|
8666
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
8667
|
+
}
|
|
8668
|
+
const metadataObject = metadataRows.length > 0 ? metadataRows.reduce((acc, curr) => {
|
|
8669
|
+
if (curr.key) {
|
|
8670
|
+
acc[curr.key] = curr.value;
|
|
8671
|
+
}
|
|
8672
|
+
return acc;
|
|
8673
|
+
}, {}) : void 0;
|
|
8674
|
+
const requestBody = {
|
|
8675
|
+
id: values.name,
|
|
8676
|
+
// id must equal name
|
|
8677
|
+
name: values.name,
|
|
8678
|
+
description: values.description,
|
|
8679
|
+
license: values.license || void 0,
|
|
8680
|
+
compatibility: values.compatibility || void 0,
|
|
8681
|
+
metadata: metadataObject,
|
|
8682
|
+
content: values.content || void 0,
|
|
8683
|
+
subSkills: void 0
|
|
8684
|
+
// subSkills not in create form
|
|
8685
|
+
};
|
|
8686
|
+
const response = await fetch(`${config.baseURL}/api/skills`, {
|
|
8687
|
+
method: "POST",
|
|
8688
|
+
headers,
|
|
8689
|
+
body: JSON.stringify(requestBody)
|
|
8690
|
+
});
|
|
8691
|
+
const data = await response.json();
|
|
8692
|
+
if (response.ok && data.success) {
|
|
8693
|
+
message6.success("Skill created successfully");
|
|
8694
|
+
form.resetFields();
|
|
8695
|
+
setMetadataRows(defaultMetadataRows);
|
|
8696
|
+
onSuccess?.();
|
|
8697
|
+
onCancel();
|
|
8698
|
+
} else {
|
|
8699
|
+
message6.error(data.message || "Failed to create skill");
|
|
8700
|
+
}
|
|
8701
|
+
} catch (error) {
|
|
8702
|
+
if (error.errorFields) {
|
|
8703
|
+
return;
|
|
8704
|
+
}
|
|
8705
|
+
message6.error(
|
|
8706
|
+
error.message || "An error occurred while creating the skill"
|
|
8707
|
+
);
|
|
8708
|
+
} finally {
|
|
8709
|
+
setLoading(false);
|
|
8710
|
+
}
|
|
8711
|
+
};
|
|
8712
|
+
const handleCancel = () => {
|
|
8713
|
+
form.resetFields();
|
|
8714
|
+
setMetadataRows(defaultMetadataRows);
|
|
8715
|
+
onCancel();
|
|
8716
|
+
};
|
|
8717
|
+
const handleMetadataChange = (index, field, value) => {
|
|
8718
|
+
const next = [...metadataRows];
|
|
8719
|
+
next[index] = {
|
|
8720
|
+
...next[index],
|
|
8721
|
+
[field]: value
|
|
8722
|
+
};
|
|
8723
|
+
setMetadataRows(next);
|
|
8724
|
+
};
|
|
8725
|
+
const handleAddMetadataRow = () => {
|
|
8726
|
+
setMetadataRows([...metadataRows, { key: "", value: "" }]);
|
|
8727
|
+
};
|
|
8728
|
+
return /* @__PURE__ */ jsx46(
|
|
8729
|
+
Modal2,
|
|
8730
|
+
{
|
|
8731
|
+
title: "Create New Skill",
|
|
8732
|
+
open,
|
|
8733
|
+
onCancel: handleCancel,
|
|
8734
|
+
footer: null,
|
|
8735
|
+
width: 520,
|
|
8736
|
+
destroyOnClose: true,
|
|
8737
|
+
styles: {
|
|
8738
|
+
body: { padding: 16 }
|
|
8739
|
+
},
|
|
8740
|
+
children: /* @__PURE__ */ jsx46(
|
|
8741
|
+
Form,
|
|
8742
|
+
{
|
|
8743
|
+
form,
|
|
8744
|
+
layout: "vertical",
|
|
8745
|
+
onFinish: handleSubmit,
|
|
8746
|
+
autoComplete: "off",
|
|
8747
|
+
children: /* @__PURE__ */ jsxs26(
|
|
8748
|
+
"div",
|
|
8749
|
+
{
|
|
8750
|
+
style: {
|
|
8751
|
+
display: "flex",
|
|
8752
|
+
flexDirection: "column",
|
|
8753
|
+
gap: 12
|
|
8754
|
+
},
|
|
8755
|
+
children: [
|
|
8756
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8757
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Name" }),
|
|
8758
|
+
/* @__PURE__ */ jsx46(
|
|
8759
|
+
Form.Item,
|
|
8760
|
+
{
|
|
8761
|
+
name: "name",
|
|
8762
|
+
rules: [
|
|
8763
|
+
{ required: true, message: "Please enter skill name" },
|
|
8764
|
+
{
|
|
8765
|
+
pattern: /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
8766
|
+
message: "Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"
|
|
8767
|
+
},
|
|
8768
|
+
{ min: 1, max: 64, message: "Name must be 1-64 characters" }
|
|
8769
|
+
],
|
|
8770
|
+
style: { marginBottom: 0 },
|
|
8771
|
+
children: /* @__PURE__ */ jsx46(Input2, { placeholder: "e.g., data-analysis" })
|
|
8772
|
+
}
|
|
8773
|
+
)
|
|
8774
|
+
] }),
|
|
8775
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8776
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
|
|
8777
|
+
/* @__PURE__ */ jsx46(
|
|
8778
|
+
Form.Item,
|
|
8779
|
+
{
|
|
8780
|
+
name: "description",
|
|
8781
|
+
rules: [
|
|
8782
|
+
{ required: true, message: "Please enter skill description" }
|
|
8783
|
+
],
|
|
8784
|
+
style: { marginBottom: 0 },
|
|
8785
|
+
children: /* @__PURE__ */ jsx46(
|
|
8786
|
+
TextArea2,
|
|
8787
|
+
{
|
|
8788
|
+
placeholder: "Description",
|
|
8789
|
+
autoSize: { minRows: 2, maxRows: 4 }
|
|
8790
|
+
}
|
|
8791
|
+
)
|
|
8792
|
+
}
|
|
8793
|
+
)
|
|
8794
|
+
] }),
|
|
8795
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8796
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
|
|
8797
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "license", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(Input2, { placeholder: "License" }) })
|
|
8798
|
+
] }),
|
|
8799
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8800
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
|
|
8801
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "compatibility", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(Input2, { placeholder: "Compatibility" }) })
|
|
8802
|
+
] }),
|
|
8803
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8804
|
+
/* @__PURE__ */ jsxs26(
|
|
8805
|
+
"div",
|
|
8806
|
+
{
|
|
8807
|
+
style: {
|
|
8808
|
+
display: "flex",
|
|
8809
|
+
alignItems: "center",
|
|
8810
|
+
justifyContent: "space-between",
|
|
8811
|
+
gap: 8
|
|
8812
|
+
},
|
|
8813
|
+
children: [
|
|
8814
|
+
/* @__PURE__ */ jsx46(
|
|
8815
|
+
Text16,
|
|
8816
|
+
{
|
|
8817
|
+
style: {
|
|
8818
|
+
fontSize: 12,
|
|
8819
|
+
color: token.colorTextSecondary,
|
|
8820
|
+
fontWeight: 500
|
|
8821
|
+
},
|
|
8822
|
+
children: "Metadata"
|
|
8823
|
+
}
|
|
8824
|
+
),
|
|
8825
|
+
/* @__PURE__ */ jsx46(
|
|
8826
|
+
Button18,
|
|
8827
|
+
{
|
|
8828
|
+
size: "small",
|
|
8829
|
+
icon: /* @__PURE__ */ jsx46(PlusOutlined2, {}),
|
|
8830
|
+
onClick: handleAddMetadataRow,
|
|
8831
|
+
children: "Add"
|
|
8832
|
+
}
|
|
8833
|
+
)
|
|
8834
|
+
]
|
|
8835
|
+
}
|
|
8836
|
+
),
|
|
8837
|
+
/* @__PURE__ */ jsxs26(Space17, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
|
|
8838
|
+
metadataRows.length === 0 && /* @__PURE__ */ jsx46(
|
|
8839
|
+
Text16,
|
|
8840
|
+
{
|
|
8841
|
+
style: {
|
|
8842
|
+
fontSize: 11,
|
|
8843
|
+
color: token.colorTextTertiary
|
|
8844
|
+
},
|
|
8845
|
+
children: "No metadata yet. Use Add to create one."
|
|
8846
|
+
}
|
|
8847
|
+
),
|
|
8848
|
+
metadataRows.map((row, index) => /* @__PURE__ */ jsxs26(
|
|
8849
|
+
"div",
|
|
8850
|
+
{
|
|
8851
|
+
style: {
|
|
8852
|
+
display: "flex",
|
|
8853
|
+
flexDirection: "column",
|
|
8854
|
+
gap: 4,
|
|
8855
|
+
width: "100%"
|
|
8856
|
+
},
|
|
8857
|
+
children: [
|
|
8858
|
+
/* @__PURE__ */ jsxs26(
|
|
8859
|
+
Text16,
|
|
8860
|
+
{
|
|
8861
|
+
style: { fontSize: 11, color: token.colorTextSecondary },
|
|
8862
|
+
children: [
|
|
8863
|
+
"Meta ",
|
|
8864
|
+
index + 1
|
|
8865
|
+
]
|
|
8866
|
+
}
|
|
8867
|
+
),
|
|
8868
|
+
/* @__PURE__ */ jsxs26(Space17, { style: { width: "100%" }, size: 8, wrap: true, children: [
|
|
8869
|
+
/* @__PURE__ */ jsx46(
|
|
8870
|
+
Input2,
|
|
8871
|
+
{
|
|
8872
|
+
value: row.key,
|
|
8873
|
+
placeholder: "Key",
|
|
8874
|
+
style: { width: 140 },
|
|
8875
|
+
onChange: (e) => handleMetadataChange(index, "key", e.target.value)
|
|
8876
|
+
}
|
|
8877
|
+
),
|
|
8878
|
+
/* @__PURE__ */ jsx46(
|
|
8879
|
+
Input2,
|
|
8880
|
+
{
|
|
8881
|
+
value: row.value,
|
|
8882
|
+
placeholder: "Value",
|
|
8883
|
+
style: { flex: 1, minWidth: 200 },
|
|
8884
|
+
onChange: (e) => handleMetadataChange(index, "value", e.target.value)
|
|
8885
|
+
}
|
|
8886
|
+
)
|
|
8887
|
+
] })
|
|
8888
|
+
]
|
|
8889
|
+
},
|
|
8890
|
+
index
|
|
8891
|
+
))
|
|
8892
|
+
] })
|
|
8893
|
+
] }),
|
|
8894
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8895
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
|
|
8896
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "content", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(
|
|
8897
|
+
TextArea2,
|
|
8898
|
+
{
|
|
8899
|
+
placeholder: "Content",
|
|
8900
|
+
autoSize: { minRows: 4, maxRows: 8 }
|
|
8901
|
+
}
|
|
8902
|
+
) })
|
|
8903
|
+
] }),
|
|
8904
|
+
/* @__PURE__ */ jsxs26(
|
|
8905
|
+
"div",
|
|
8906
|
+
{
|
|
8907
|
+
style: {
|
|
8908
|
+
display: "flex",
|
|
8909
|
+
alignItems: "center",
|
|
8910
|
+
justifyContent: "flex-end",
|
|
8911
|
+
gap: 8,
|
|
8912
|
+
marginTop: 8
|
|
8913
|
+
},
|
|
8914
|
+
children: [
|
|
8915
|
+
/* @__PURE__ */ jsx46(Button18, { onClick: handleCancel, children: "Cancel" }),
|
|
8916
|
+
/* @__PURE__ */ jsx46(Button18, { type: "primary", htmlType: "submit", loading, children: "Create Skill" })
|
|
8917
|
+
]
|
|
8918
|
+
}
|
|
8919
|
+
)
|
|
8920
|
+
]
|
|
8921
|
+
}
|
|
8922
|
+
)
|
|
8923
|
+
}
|
|
8924
|
+
)
|
|
8925
|
+
}
|
|
8926
|
+
);
|
|
8927
|
+
};
|
|
8928
|
+
var CreateSkillModal_default = CreateSkillModal;
|
|
8929
|
+
|
|
8930
|
+
// src/components/Chat/SkillFlow.tsx
|
|
8931
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8932
|
+
var SkillFlowInner = ({
|
|
8933
|
+
skills,
|
|
8934
|
+
onNodeClick,
|
|
8935
|
+
onRefresh
|
|
8936
|
+
}) => {
|
|
8937
|
+
const [nodes, setNodes, onNodesChange] = useNodesState2([]);
|
|
8938
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState2([]);
|
|
8939
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = useState26(false);
|
|
8940
|
+
const { token } = theme6.useToken();
|
|
8941
|
+
const nodeTypes = useMemo12(
|
|
8942
|
+
() => ({
|
|
8943
|
+
skill: SkillNode_default
|
|
8944
|
+
}),
|
|
8945
|
+
[]
|
|
8946
|
+
);
|
|
8947
|
+
useEffect19(() => {
|
|
8948
|
+
if (!skills || skills.length === 0) {
|
|
8949
|
+
setNodes([]);
|
|
8950
|
+
setEdges([]);
|
|
8951
|
+
return;
|
|
8952
|
+
}
|
|
8953
|
+
const initialNodes = [];
|
|
8954
|
+
const initialEdges = [];
|
|
8955
|
+
const nodeWidth = 280;
|
|
8956
|
+
const nodeHeight = 220;
|
|
8957
|
+
const horizontalSpacing = 320;
|
|
8958
|
+
const verticalSpacing = 300;
|
|
8959
|
+
const skillMap = /* @__PURE__ */ new Map();
|
|
8960
|
+
const relationships = [];
|
|
8961
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
8962
|
+
skills.forEach((skill) => {
|
|
8963
|
+
skillMap.set(skill.name, skill);
|
|
8964
|
+
if (skill.subSkills && skill.subSkills.length > 0) {
|
|
8965
|
+
if (!childrenMap.has(skill.name)) {
|
|
8966
|
+
childrenMap.set(skill.name, []);
|
|
8967
|
+
}
|
|
8968
|
+
skill.subSkills.forEach((subSkillName) => {
|
|
8969
|
+
const subSkill = skills.find((s) => s.name === subSkillName);
|
|
8970
|
+
if (subSkill) {
|
|
8971
|
+
relationships.push({
|
|
8972
|
+
source: skill.name,
|
|
8973
|
+
target: subSkillName
|
|
8974
|
+
});
|
|
8975
|
+
childrenMap.get(skill.name).push(subSkillName);
|
|
8976
|
+
}
|
|
8977
|
+
});
|
|
8978
|
+
}
|
|
8979
|
+
});
|
|
8980
|
+
const hasRelationships = relationships.length > 0;
|
|
8981
|
+
if (hasRelationships) {
|
|
8982
|
+
const processedIds = /* @__PURE__ */ new Set();
|
|
8983
|
+
const levelMap = /* @__PURE__ */ new Map();
|
|
8984
|
+
const parentMap = /* @__PURE__ */ new Map();
|
|
8985
|
+
relationships.forEach((rel) => {
|
|
8986
|
+
parentMap.set(rel.target, rel.source);
|
|
8987
|
+
});
|
|
8988
|
+
const queue = [];
|
|
8989
|
+
const rootNodes = skills.filter(
|
|
8990
|
+
(s) => !parentMap.has(s.name)
|
|
8991
|
+
// No parent means it's a root
|
|
8992
|
+
);
|
|
8993
|
+
if (rootNodes.length === 0 && skills.length > 0) {
|
|
8994
|
+
queue.push({ id: skills[0].name, level: 0 });
|
|
8995
|
+
} else {
|
|
8996
|
+
rootNodes.forEach((root) => {
|
|
8997
|
+
queue.push({ id: root.name, level: 0 });
|
|
8998
|
+
});
|
|
8999
|
+
}
|
|
9000
|
+
while (queue.length > 0) {
|
|
9001
|
+
const { id, level } = queue.shift();
|
|
9002
|
+
if (processedIds.has(id)) continue;
|
|
9003
|
+
processedIds.add(id);
|
|
9004
|
+
levelMap.set(id, level);
|
|
9005
|
+
const children = childrenMap.get(id) || [];
|
|
9006
|
+
children.forEach((childId) => {
|
|
9007
|
+
if (!processedIds.has(childId)) {
|
|
9008
|
+
queue.push({ id: childId, level: level + 1 });
|
|
9009
|
+
}
|
|
9010
|
+
});
|
|
9011
|
+
}
|
|
9012
|
+
skills.forEach((skill) => {
|
|
9013
|
+
if (!levelMap.has(skill.name)) {
|
|
9014
|
+
levelMap.set(skill.name, 0);
|
|
9015
|
+
}
|
|
9016
|
+
});
|
|
9017
|
+
const levelGroups = /* @__PURE__ */ new Map();
|
|
9018
|
+
skills.forEach((skill) => {
|
|
9019
|
+
const level = levelMap.get(skill.name) || 0;
|
|
9020
|
+
if (!levelGroups.has(level)) {
|
|
9021
|
+
levelGroups.set(level, []);
|
|
9022
|
+
}
|
|
9023
|
+
levelGroups.get(level).push(skill);
|
|
9024
|
+
});
|
|
9025
|
+
levelGroups.forEach((group, level) => {
|
|
9026
|
+
const y = level * verticalSpacing;
|
|
9027
|
+
const groupWidth = (group.length - 1) * horizontalSpacing;
|
|
9028
|
+
const startX = -groupWidth / 2;
|
|
9029
|
+
group.forEach((skill, index) => {
|
|
9030
|
+
const x = startX + index * horizontalSpacing;
|
|
9031
|
+
initialNodes.push({
|
|
9032
|
+
id: skill.name,
|
|
9033
|
+
type: "skill",
|
|
9034
|
+
data: {
|
|
9035
|
+
skill,
|
|
9036
|
+
onClick: () => onNodeClick?.(skill)
|
|
9037
|
+
},
|
|
9038
|
+
position: { x, y }
|
|
9039
|
+
});
|
|
9040
|
+
});
|
|
9041
|
+
});
|
|
9042
|
+
relationships.forEach((rel) => {
|
|
9043
|
+
if (skillMap.has(rel.source) && skillMap.has(rel.target)) {
|
|
9044
|
+
initialEdges.push({
|
|
9045
|
+
id: `e${rel.source}-${rel.target}`,
|
|
9046
|
+
source: rel.source,
|
|
9047
|
+
target: rel.target,
|
|
9048
|
+
style: { stroke: "#1677ff", strokeWidth: 2 },
|
|
9049
|
+
type: "smoothstep"
|
|
9050
|
+
});
|
|
9051
|
+
}
|
|
9052
|
+
});
|
|
9053
|
+
} else {
|
|
9054
|
+
const nodesPerRow = Math.ceil(Math.sqrt(skills.length));
|
|
9055
|
+
skills.forEach((skill, index) => {
|
|
9056
|
+
const row = Math.floor(index / nodesPerRow);
|
|
9057
|
+
const col = index % nodesPerRow;
|
|
9058
|
+
const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
|
|
9059
|
+
const y = row * verticalSpacing;
|
|
9060
|
+
initialNodes.push({
|
|
9061
|
+
id: skill.name,
|
|
9062
|
+
type: "skill",
|
|
9063
|
+
data: {
|
|
9064
|
+
skill,
|
|
9065
|
+
onClick: () => onNodeClick?.(skill)
|
|
9066
|
+
},
|
|
9067
|
+
position: { x, y }
|
|
9068
|
+
});
|
|
9069
|
+
});
|
|
9070
|
+
}
|
|
9071
|
+
setNodes(initialNodes);
|
|
9072
|
+
setEdges(initialEdges);
|
|
9073
|
+
}, [skills, setNodes, setEdges, onNodeClick]);
|
|
9074
|
+
const handleSkillCreated = async () => {
|
|
9075
|
+
if (onRefresh) {
|
|
9076
|
+
await onRefresh();
|
|
9077
|
+
}
|
|
9078
|
+
};
|
|
9079
|
+
return /* @__PURE__ */ jsxs27("div", { style: { width: "100%", height: "100%", background: "#fafafa", position: "relative" }, children: [
|
|
9080
|
+
/* @__PURE__ */ jsxs27(
|
|
9081
|
+
ReactFlow2,
|
|
9082
|
+
{
|
|
9083
|
+
nodes,
|
|
9084
|
+
edges,
|
|
9085
|
+
onNodesChange,
|
|
9086
|
+
onEdgesChange,
|
|
9087
|
+
nodeTypes,
|
|
9088
|
+
fitView: true,
|
|
9089
|
+
children: [
|
|
9090
|
+
/* @__PURE__ */ jsx47(Background2, { color: "#eee", gap: 20 }),
|
|
9091
|
+
/* @__PURE__ */ jsx47(Controls2, {})
|
|
9092
|
+
]
|
|
9093
|
+
}
|
|
9094
|
+
),
|
|
9095
|
+
/* @__PURE__ */ jsx47(
|
|
9096
|
+
"div",
|
|
9097
|
+
{
|
|
9098
|
+
style: {
|
|
9099
|
+
position: "absolute",
|
|
9100
|
+
bottom: 20,
|
|
9101
|
+
right: 20,
|
|
9102
|
+
zIndex: 10
|
|
9103
|
+
},
|
|
9104
|
+
children: /* @__PURE__ */ jsx47(
|
|
9105
|
+
Button19,
|
|
9106
|
+
{
|
|
9107
|
+
type: "primary",
|
|
9108
|
+
size: "large",
|
|
9109
|
+
icon: /* @__PURE__ */ jsx47(PlusOutlined3, {}),
|
|
9110
|
+
onClick: () => setIsCreateModalOpen(true),
|
|
9111
|
+
style: {
|
|
9112
|
+
height: 48,
|
|
9113
|
+
width: 48,
|
|
9114
|
+
borderRadius: "50%",
|
|
9115
|
+
boxShadow: token.boxShadowTertiary,
|
|
9116
|
+
display: "flex",
|
|
9117
|
+
alignItems: "center",
|
|
9118
|
+
justifyContent: "center",
|
|
9119
|
+
padding: 0
|
|
9120
|
+
}
|
|
9121
|
+
}
|
|
9122
|
+
)
|
|
9123
|
+
}
|
|
9124
|
+
),
|
|
9125
|
+
/* @__PURE__ */ jsx47(
|
|
9126
|
+
CreateSkillModal_default,
|
|
9127
|
+
{
|
|
9128
|
+
open: isCreateModalOpen,
|
|
9129
|
+
onCancel: () => setIsCreateModalOpen(false),
|
|
9130
|
+
onSuccess: handleSkillCreated
|
|
9131
|
+
}
|
|
9132
|
+
)
|
|
9133
|
+
] });
|
|
9134
|
+
};
|
|
9135
|
+
var SkillFlow = (props) => /* @__PURE__ */ jsx47(ReactFlowProvider2, { children: /* @__PURE__ */ jsx47(SkillFlowInner, { ...props }) });
|
|
9136
|
+
var SkillFlow_default = SkillFlow;
|
|
9137
|
+
|
|
9138
|
+
// src/components/Chat/ChatSidebar.tsx
|
|
9139
|
+
import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6427
9140
|
var useStyles4 = createStyles12(({ token, css }) => ({
|
|
6428
9141
|
sidebar: css`
|
|
6429
9142
|
display: flex;
|
|
@@ -6526,6 +9239,22 @@ var useStyles4 = createStyles12(({ token, css }) => ({
|
|
|
6526
9239
|
letter-spacing: 0.5px;
|
|
6527
9240
|
padding: 0 ${token.paddingXS}px;
|
|
6528
9241
|
margin-bottom: ${token.marginSM}px;
|
|
9242
|
+
display: flex;
|
|
9243
|
+
align-items: center;
|
|
9244
|
+
justify-content: space-between;
|
|
9245
|
+
`,
|
|
9246
|
+
sectionTitleButton: css`
|
|
9247
|
+
font-size: ${token.fontSizeSM}px;
|
|
9248
|
+
padding: 0;
|
|
9249
|
+
height: auto;
|
|
9250
|
+
color: ${token.colorTextSecondary};
|
|
9251
|
+
border: none;
|
|
9252
|
+
background: transparent;
|
|
9253
|
+
|
|
9254
|
+
&:hover {
|
|
9255
|
+
color: ${token.colorPrimary};
|
|
9256
|
+
background: transparent;
|
|
9257
|
+
}
|
|
6529
9258
|
`,
|
|
6530
9259
|
footer: css`
|
|
6531
9260
|
display: flex;
|
|
@@ -6631,9 +9360,14 @@ var ChatSidebar = ({
|
|
|
6631
9360
|
}) => {
|
|
6632
9361
|
const { styles } = useStyles4();
|
|
6633
9362
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
6634
|
-
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
6635
|
-
const
|
|
6636
|
-
const [
|
|
9363
|
+
const { setSettingsModalOpen, config } = useLatticeChatShellContext();
|
|
9364
|
+
const { assistants, selectAssistant } = useAssistantContext();
|
|
9365
|
+
const [isHovered, setIsHovered] = useState27(false);
|
|
9366
|
+
const [isFirstCollapse, setIsFirstCollapse] = useState27(false);
|
|
9367
|
+
const [isFlowModalOpen, setIsFlowModalOpen] = useState27(false);
|
|
9368
|
+
const [isSkillFlowModalOpen, setIsSkillFlowModalOpen] = useState27(false);
|
|
9369
|
+
const [skills, setSkills] = useState27([]);
|
|
9370
|
+
const [skillsLoading, setSkillsLoading] = useState27(false);
|
|
6637
9371
|
const prevIsCollapsedRef = useRef13(false);
|
|
6638
9372
|
const handleToggleCollapse = () => {
|
|
6639
9373
|
setMenuCollapsed(!menuCollapsed);
|
|
@@ -6642,8 +9376,37 @@ var ChatSidebar = ({
|
|
|
6642
9376
|
setSettingsModalOpen(true);
|
|
6643
9377
|
onSettingsClick?.();
|
|
6644
9378
|
};
|
|
9379
|
+
const handleSkillFlowClick = async () => {
|
|
9380
|
+
setIsSkillFlowModalOpen(true);
|
|
9381
|
+
if (skills.length === 0 && !skillsLoading) {
|
|
9382
|
+
await fetchSkills();
|
|
9383
|
+
}
|
|
9384
|
+
};
|
|
9385
|
+
const fetchSkills = async () => {
|
|
9386
|
+
setSkillsLoading(true);
|
|
9387
|
+
try {
|
|
9388
|
+
const headers = {};
|
|
9389
|
+
if (config.apiKey) {
|
|
9390
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
9391
|
+
}
|
|
9392
|
+
const response = await fetch(`${config.baseURL}/api/skills`, {
|
|
9393
|
+
headers
|
|
9394
|
+
});
|
|
9395
|
+
if (response.ok) {
|
|
9396
|
+
const data = await response.json();
|
|
9397
|
+
if (data.success && data.data && Array.isArray(data.data.records)) {
|
|
9398
|
+
setSkills(data.data.records);
|
|
9399
|
+
}
|
|
9400
|
+
}
|
|
9401
|
+
} catch (error) {
|
|
9402
|
+
console.error("Failed to fetch skills:", error);
|
|
9403
|
+
setSkills([]);
|
|
9404
|
+
} finally {
|
|
9405
|
+
setSkillsLoading(false);
|
|
9406
|
+
}
|
|
9407
|
+
};
|
|
6645
9408
|
const isCollapsed = menuCollapsed || sideAppVisible;
|
|
6646
|
-
|
|
9409
|
+
useEffect20(() => {
|
|
6647
9410
|
const prevIsCollapsed = prevIsCollapsedRef.current;
|
|
6648
9411
|
if (isCollapsed) {
|
|
6649
9412
|
const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
|
|
@@ -6672,54 +9435,77 @@ var ChatSidebar = ({
|
|
|
6672
9435
|
const handleMouseLeave = () => {
|
|
6673
9436
|
setIsHovered(false);
|
|
6674
9437
|
};
|
|
6675
|
-
return /* @__PURE__ */
|
|
6676
|
-
/* @__PURE__ */
|
|
9438
|
+
return /* @__PURE__ */ jsxs28(Fragment6, { children: [
|
|
9439
|
+
/* @__PURE__ */ jsxs28(
|
|
6677
9440
|
"div",
|
|
6678
9441
|
{
|
|
6679
9442
|
className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
|
|
6680
9443
|
onMouseEnter: handleMouseEnter,
|
|
6681
9444
|
onMouseLeave: handleMouseLeave,
|
|
6682
9445
|
children: [
|
|
6683
|
-
/* @__PURE__ */
|
|
6684
|
-
|
|
9446
|
+
/* @__PURE__ */ jsx48(
|
|
9447
|
+
Tooltip8,
|
|
6685
9448
|
{
|
|
6686
9449
|
title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
|
|
6687
9450
|
open: isFirstCollapse,
|
|
6688
9451
|
placement: "right",
|
|
6689
|
-
children: isFirstCollapse && /* @__PURE__ */
|
|
9452
|
+
children: isFirstCollapse && /* @__PURE__ */ jsx48("div", { style: { marginTop: "400px" } })
|
|
6690
9453
|
}
|
|
6691
9454
|
),
|
|
6692
|
-
!isCollapsed && /* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
6694
|
-
/* @__PURE__ */
|
|
6695
|
-
/* @__PURE__ */
|
|
6696
|
-
|
|
9455
|
+
!isCollapsed && /* @__PURE__ */ jsxs28(Fragment6, { children: [
|
|
9456
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.content, children: [
|
|
9457
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9458
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.sectionTitle, children: [
|
|
9459
|
+
/* @__PURE__ */ jsx48("span", { children: "Assistants" }),
|
|
9460
|
+
/* @__PURE__ */ jsx48(
|
|
9461
|
+
Button20,
|
|
9462
|
+
{
|
|
9463
|
+
type: "text",
|
|
9464
|
+
icon: /* @__PURE__ */ jsx48(ApartmentOutlined, {}),
|
|
9465
|
+
onClick: () => setIsFlowModalOpen(true),
|
|
9466
|
+
className: styles.sectionTitleButton,
|
|
9467
|
+
title: "View Assistant Flow Canvas",
|
|
9468
|
+
size: "small"
|
|
9469
|
+
}
|
|
9470
|
+
)
|
|
9471
|
+
] }),
|
|
9472
|
+
/* @__PURE__ */ jsx48(AssistantList, {})
|
|
6697
9473
|
] }),
|
|
6698
|
-
/* @__PURE__ */
|
|
6699
|
-
/* @__PURE__ */
|
|
6700
|
-
/* @__PURE__ */
|
|
6701
|
-
/* @__PURE__ */
|
|
9474
|
+
/* @__PURE__ */ jsx48(Divider4, { className: styles.divider }),
|
|
9475
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9476
|
+
/* @__PURE__ */ jsx48("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
9477
|
+
/* @__PURE__ */ jsx48(AgentConversations, {})
|
|
6702
9478
|
] })
|
|
6703
9479
|
] }),
|
|
6704
|
-
/* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
9480
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.footer, children: [
|
|
9481
|
+
/* @__PURE__ */ jsx48(
|
|
6706
9482
|
"button",
|
|
6707
9483
|
{
|
|
6708
9484
|
className: styles.actionButton,
|
|
6709
9485
|
onClick: handleToggleCollapse,
|
|
6710
9486
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6711
9487
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6712
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
9488
|
+
children: isCollapsed ? /* @__PURE__ */ jsx48(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx48(MenuFoldOutlined, {})
|
|
6713
9489
|
}
|
|
6714
9490
|
),
|
|
6715
|
-
/* @__PURE__ */
|
|
9491
|
+
/* @__PURE__ */ jsx48(
|
|
9492
|
+
"button",
|
|
9493
|
+
{
|
|
9494
|
+
className: styles.actionButton,
|
|
9495
|
+
onClick: handleSkillFlowClick,
|
|
9496
|
+
title: "Skill Flow Canvas",
|
|
9497
|
+
"aria-label": "Skill Flow Canvas",
|
|
9498
|
+
children: /* @__PURE__ */ jsx48(ThunderboltOutlined2, {})
|
|
9499
|
+
}
|
|
9500
|
+
),
|
|
9501
|
+
/* @__PURE__ */ jsx48(
|
|
6716
9502
|
"button",
|
|
6717
9503
|
{
|
|
6718
9504
|
className: styles.actionButton,
|
|
6719
9505
|
onClick: handleSettingsClick,
|
|
6720
9506
|
title: "Settings",
|
|
6721
9507
|
"aria-label": "Settings",
|
|
6722
|
-
children: /* @__PURE__ */
|
|
9508
|
+
children: /* @__PURE__ */ jsx48(SettingOutlined2, {})
|
|
6723
9509
|
}
|
|
6724
9510
|
)
|
|
6725
9511
|
] })
|
|
@@ -6727,61 +9513,145 @@ var ChatSidebar = ({
|
|
|
6727
9513
|
]
|
|
6728
9514
|
}
|
|
6729
9515
|
),
|
|
6730
|
-
isCollapsed && /* @__PURE__ */
|
|
9516
|
+
isCollapsed && /* @__PURE__ */ jsxs28(
|
|
6731
9517
|
"div",
|
|
6732
9518
|
{
|
|
6733
9519
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
6734
9520
|
onMouseEnter: handleMouseEnter,
|
|
6735
9521
|
onMouseLeave: handleMouseLeave,
|
|
6736
9522
|
children: [
|
|
6737
|
-
/* @__PURE__ */
|
|
6738
|
-
/* @__PURE__ */
|
|
6739
|
-
/* @__PURE__ */
|
|
6740
|
-
|
|
9523
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.hoverContent, children: [
|
|
9524
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9525
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.sectionTitle, children: [
|
|
9526
|
+
/* @__PURE__ */ jsx48("span", { children: "Assistants" }),
|
|
9527
|
+
/* @__PURE__ */ jsx48(
|
|
9528
|
+
Button20,
|
|
9529
|
+
{
|
|
9530
|
+
type: "text",
|
|
9531
|
+
icon: /* @__PURE__ */ jsx48(ApartmentOutlined, {}),
|
|
9532
|
+
onClick: () => setIsFlowModalOpen(true),
|
|
9533
|
+
className: styles.sectionTitleButton,
|
|
9534
|
+
title: "View Assistant Flow Canvas",
|
|
9535
|
+
size: "small"
|
|
9536
|
+
}
|
|
9537
|
+
)
|
|
9538
|
+
] }),
|
|
9539
|
+
/* @__PURE__ */ jsx48(AssistantList, {})
|
|
6741
9540
|
] }),
|
|
6742
|
-
/* @__PURE__ */
|
|
6743
|
-
/* @__PURE__ */
|
|
6744
|
-
/* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
9541
|
+
/* @__PURE__ */ jsx48(Divider4, { className: styles.divider }),
|
|
9542
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9543
|
+
/* @__PURE__ */ jsx48("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
9544
|
+
/* @__PURE__ */ jsx48(AgentConversations, {})
|
|
6746
9545
|
] })
|
|
6747
9546
|
] }),
|
|
6748
|
-
/* @__PURE__ */
|
|
6749
|
-
/* @__PURE__ */
|
|
9547
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.footer, children: [
|
|
9548
|
+
/* @__PURE__ */ jsx48(
|
|
6750
9549
|
"button",
|
|
6751
9550
|
{
|
|
6752
9551
|
className: styles.actionButton,
|
|
6753
9552
|
onClick: handleToggleCollapse,
|
|
6754
9553
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6755
9554
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6756
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
9555
|
+
children: isCollapsed ? /* @__PURE__ */ jsx48(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx48(MenuFoldOutlined, {})
|
|
9556
|
+
}
|
|
9557
|
+
),
|
|
9558
|
+
/* @__PURE__ */ jsx48(
|
|
9559
|
+
"button",
|
|
9560
|
+
{
|
|
9561
|
+
className: styles.actionButton,
|
|
9562
|
+
onClick: handleSkillFlowClick,
|
|
9563
|
+
title: "Skill Flow Canvas",
|
|
9564
|
+
"aria-label": "Skill Flow Canvas",
|
|
9565
|
+
children: /* @__PURE__ */ jsx48(ThunderboltOutlined2, {})
|
|
6757
9566
|
}
|
|
6758
9567
|
),
|
|
6759
|
-
/* @__PURE__ */
|
|
9568
|
+
/* @__PURE__ */ jsx48(
|
|
6760
9569
|
"button",
|
|
6761
9570
|
{
|
|
6762
9571
|
className: styles.actionButton,
|
|
6763
9572
|
onClick: handleSettingsClick,
|
|
6764
9573
|
title: "Settings",
|
|
6765
9574
|
"aria-label": "Settings",
|
|
6766
|
-
children: /* @__PURE__ */
|
|
9575
|
+
children: /* @__PURE__ */ jsx48(SettingOutlined2, {})
|
|
6767
9576
|
}
|
|
6768
9577
|
)
|
|
6769
9578
|
] })
|
|
6770
9579
|
]
|
|
6771
9580
|
}
|
|
9581
|
+
),
|
|
9582
|
+
/* @__PURE__ */ jsx48(
|
|
9583
|
+
Modal3,
|
|
9584
|
+
{
|
|
9585
|
+
title: "Assistant Overview",
|
|
9586
|
+
open: isFlowModalOpen,
|
|
9587
|
+
onCancel: () => setIsFlowModalOpen(false),
|
|
9588
|
+
footer: null,
|
|
9589
|
+
width: "90%",
|
|
9590
|
+
style: { top: 20 },
|
|
9591
|
+
bodyStyle: {
|
|
9592
|
+
height: "calc(100vh - 120px)",
|
|
9593
|
+
padding: 0
|
|
9594
|
+
},
|
|
9595
|
+
children: /* @__PURE__ */ jsx48("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx48(
|
|
9596
|
+
AssistantFlow_default,
|
|
9597
|
+
{
|
|
9598
|
+
assistants,
|
|
9599
|
+
onNodeClick: (assistant) => {
|
|
9600
|
+
selectAssistant(assistant.id);
|
|
9601
|
+
setIsFlowModalOpen(false);
|
|
9602
|
+
}
|
|
9603
|
+
}
|
|
9604
|
+
) })
|
|
9605
|
+
}
|
|
9606
|
+
),
|
|
9607
|
+
/* @__PURE__ */ jsx48(
|
|
9608
|
+
Modal3,
|
|
9609
|
+
{
|
|
9610
|
+
title: "Skill Overview",
|
|
9611
|
+
open: isSkillFlowModalOpen,
|
|
9612
|
+
onCancel: () => setIsSkillFlowModalOpen(false),
|
|
9613
|
+
footer: null,
|
|
9614
|
+
width: "90%",
|
|
9615
|
+
style: { top: 20 },
|
|
9616
|
+
bodyStyle: {
|
|
9617
|
+
height: "calc(100vh - 120px)",
|
|
9618
|
+
padding: 0
|
|
9619
|
+
},
|
|
9620
|
+
children: /* @__PURE__ */ jsx48("div", { style: { width: "100%", height: "100%" }, children: skillsLoading ? /* @__PURE__ */ jsx48(
|
|
9621
|
+
"div",
|
|
9622
|
+
{
|
|
9623
|
+
style: {
|
|
9624
|
+
display: "flex",
|
|
9625
|
+
justifyContent: "center",
|
|
9626
|
+
alignItems: "center",
|
|
9627
|
+
height: "100%"
|
|
9628
|
+
},
|
|
9629
|
+
children: "Loading skills..."
|
|
9630
|
+
}
|
|
9631
|
+
) : /* @__PURE__ */ jsx48(
|
|
9632
|
+
SkillFlow_default,
|
|
9633
|
+
{
|
|
9634
|
+
skills,
|
|
9635
|
+
onNodeClick: (skill) => {
|
|
9636
|
+
console.log("Skill clicked:", skill);
|
|
9637
|
+
},
|
|
9638
|
+
onRefresh: fetchSkills
|
|
9639
|
+
}
|
|
9640
|
+
) })
|
|
9641
|
+
}
|
|
6772
9642
|
)
|
|
6773
9643
|
] });
|
|
6774
9644
|
};
|
|
6775
9645
|
|
|
6776
9646
|
// src/components/Chat/LatticeChatView.tsx
|
|
6777
|
-
import { jsx as
|
|
9647
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6778
9648
|
var LatticeChatView = (props) => {
|
|
6779
9649
|
const { assistantId, thread } = useConversationContext();
|
|
6780
9650
|
const { currentAssistant } = useAssistantContext();
|
|
6781
9651
|
const {
|
|
6782
9652
|
config: { baseURL }
|
|
6783
9653
|
} = useLatticeChatShellContext();
|
|
6784
|
-
return assistantId && thread ? /* @__PURE__ */
|
|
9654
|
+
return assistantId && thread ? /* @__PURE__ */ jsx49(
|
|
6785
9655
|
AxiomLatticeProvider,
|
|
6786
9656
|
{
|
|
6787
9657
|
config: {
|
|
@@ -6790,14 +9660,14 @@ var LatticeChatView = (props) => {
|
|
|
6790
9660
|
assistantId,
|
|
6791
9661
|
transport: "sse"
|
|
6792
9662
|
},
|
|
6793
|
-
children: /* @__PURE__ */
|
|
9663
|
+
children: /* @__PURE__ */ jsx49(
|
|
6794
9664
|
LatticeChat,
|
|
6795
9665
|
{
|
|
6796
9666
|
thread_id: thread?.id,
|
|
6797
9667
|
assistant_id: assistantId,
|
|
6798
9668
|
name: currentAssistant?.name,
|
|
6799
9669
|
description: currentAssistant?.description,
|
|
6800
|
-
menu: /* @__PURE__ */
|
|
9670
|
+
menu: /* @__PURE__ */ jsx49(ChatSidebar, {})
|
|
6801
9671
|
}
|
|
6802
9672
|
)
|
|
6803
9673
|
}
|
|
@@ -6805,17 +9675,17 @@ var LatticeChatView = (props) => {
|
|
|
6805
9675
|
};
|
|
6806
9676
|
|
|
6807
9677
|
// src/components/Chat/SettingsModal.tsx
|
|
6808
|
-
import { useState as
|
|
9678
|
+
import { useState as useState28, useEffect as useEffect21, useRef as useRef14 } from "react";
|
|
6809
9679
|
import {
|
|
6810
|
-
Modal,
|
|
6811
|
-
Input,
|
|
6812
|
-
Button as
|
|
6813
|
-
message as
|
|
6814
|
-
Typography as
|
|
9680
|
+
Modal as Modal4,
|
|
9681
|
+
Input as Input3,
|
|
9682
|
+
Button as Button21,
|
|
9683
|
+
message as message7,
|
|
9684
|
+
Typography as Typography19,
|
|
6815
9685
|
Alert as Alert4,
|
|
6816
9686
|
Select,
|
|
6817
9687
|
Switch,
|
|
6818
|
-
Space as
|
|
9688
|
+
Space as Space18,
|
|
6819
9689
|
Tabs as Tabs2
|
|
6820
9690
|
} from "antd";
|
|
6821
9691
|
import {
|
|
@@ -6823,17 +9693,17 @@ import {
|
|
|
6823
9693
|
EnvironmentOutlined,
|
|
6824
9694
|
ReloadOutlined as ReloadOutlined3,
|
|
6825
9695
|
CheckCircleOutlined as CheckCircleOutlined5,
|
|
6826
|
-
ApiOutlined,
|
|
9696
|
+
ApiOutlined as ApiOutlined2,
|
|
6827
9697
|
LinkOutlined,
|
|
6828
9698
|
CheckCircleFilled,
|
|
6829
9699
|
CloseCircleFilled,
|
|
6830
|
-
PlusOutlined,
|
|
9700
|
+
PlusOutlined as PlusOutlined4,
|
|
6831
9701
|
CloudServerOutlined
|
|
6832
9702
|
} from "@ant-design/icons";
|
|
6833
9703
|
import { createStyles as createStyles13 } from "antd-style";
|
|
6834
|
-
import { Fragment as
|
|
6835
|
-
var { Text:
|
|
6836
|
-
var { TextArea } =
|
|
9704
|
+
import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
9705
|
+
var { Text: Text17, Title: Title3 } = Typography19;
|
|
9706
|
+
var { TextArea: TextArea3 } = Input3;
|
|
6837
9707
|
var useStyles5 = createStyles13(({ token, css }) => ({
|
|
6838
9708
|
// settingsModal: css`
|
|
6839
9709
|
// .ant-modal {
|
|
@@ -7180,12 +10050,12 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
7180
10050
|
{
|
|
7181
10051
|
key: "environment",
|
|
7182
10052
|
label: "Environment Variables",
|
|
7183
|
-
icon: /* @__PURE__ */
|
|
10053
|
+
icon: /* @__PURE__ */ jsx50(EnvironmentOutlined, {})
|
|
7184
10054
|
},
|
|
7185
10055
|
{
|
|
7186
10056
|
key: "models",
|
|
7187
10057
|
label: "Model Configuration",
|
|
7188
|
-
icon: /* @__PURE__ */
|
|
10058
|
+
icon: /* @__PURE__ */ jsx50(ApiOutlined2, {})
|
|
7189
10059
|
}
|
|
7190
10060
|
];
|
|
7191
10061
|
var SettingsModal = ({
|
|
@@ -7194,7 +10064,7 @@ var SettingsModal = ({
|
|
|
7194
10064
|
}) => {
|
|
7195
10065
|
const { styles } = useStyles5();
|
|
7196
10066
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
7197
|
-
const [connections, setConnections] =
|
|
10067
|
+
const [connections, setConnections] = useState28(() => {
|
|
7198
10068
|
if (typeof window !== "undefined") {
|
|
7199
10069
|
try {
|
|
7200
10070
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -7217,21 +10087,21 @@ var SettingsModal = ({
|
|
|
7217
10087
|
}
|
|
7218
10088
|
return [];
|
|
7219
10089
|
});
|
|
7220
|
-
const [serverConfigs, setServerConfigs] =
|
|
10090
|
+
const [serverConfigs, setServerConfigs] = useState28({});
|
|
7221
10091
|
const connectionsRef = useRef14(connections);
|
|
7222
|
-
|
|
10092
|
+
useEffect21(() => {
|
|
7223
10093
|
connectionsRef.current = connections;
|
|
7224
10094
|
}, [connections]);
|
|
7225
|
-
const [activeTabKey, setActiveTabKey] =
|
|
10095
|
+
const [activeTabKey, setActiveTabKey] = useState28(
|
|
7226
10096
|
connections.length > 0 ? connections[0].id : ""
|
|
7227
10097
|
);
|
|
7228
|
-
const [activeMenu, setActiveMenu] =
|
|
7229
|
-
const [loading, setLoading] =
|
|
7230
|
-
const [showAddServerModal, setShowAddServerModal] =
|
|
7231
|
-
const [newServerUrl, setNewServerUrl] =
|
|
7232
|
-
const [newServerName, setNewServerName] =
|
|
7233
|
-
const [newServerApiKey, setNewServerApiKey] =
|
|
7234
|
-
const [addingServer, setAddingServer] =
|
|
10098
|
+
const [activeMenu, setActiveMenu] = useState28("environment");
|
|
10099
|
+
const [loading, setLoading] = useState28(false);
|
|
10100
|
+
const [showAddServerModal, setShowAddServerModal] = useState28(false);
|
|
10101
|
+
const [newServerUrl, setNewServerUrl] = useState28("");
|
|
10102
|
+
const [newServerName, setNewServerName] = useState28("");
|
|
10103
|
+
const [newServerApiKey, setNewServerApiKey] = useState28("");
|
|
10104
|
+
const [addingServer, setAddingServer] = useState28(false);
|
|
7235
10105
|
const saveConnections = (newConnections) => {
|
|
7236
10106
|
setConnections(newConnections);
|
|
7237
10107
|
if (typeof window !== "undefined") {
|
|
@@ -7370,7 +10240,7 @@ var SettingsModal = ({
|
|
|
7370
10240
|
}
|
|
7371
10241
|
} catch (error) {
|
|
7372
10242
|
console.error("Failed to load configuration:", error);
|
|
7373
|
-
|
|
10243
|
+
message7.error("Failed to load current configuration");
|
|
7374
10244
|
}
|
|
7375
10245
|
};
|
|
7376
10246
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -7421,7 +10291,7 @@ var SettingsModal = ({
|
|
|
7421
10291
|
console.error("Failed to load models configuration:", error);
|
|
7422
10292
|
}
|
|
7423
10293
|
};
|
|
7424
|
-
|
|
10294
|
+
useEffect21(() => {
|
|
7425
10295
|
if (open && activeTabKey) {
|
|
7426
10296
|
initializeServerConfig(activeTabKey);
|
|
7427
10297
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -7430,7 +10300,7 @@ var SettingsModal = ({
|
|
|
7430
10300
|
}
|
|
7431
10301
|
}
|
|
7432
10302
|
}, [open, activeTabKey]);
|
|
7433
|
-
|
|
10303
|
+
useEffect21(() => {
|
|
7434
10304
|
if (open && activeTabKey) {
|
|
7435
10305
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
7436
10306
|
if (connection?.connected) {
|
|
@@ -7444,7 +10314,7 @@ var SettingsModal = ({
|
|
|
7444
10314
|
}, [open, activeTabKey, activeMenu]);
|
|
7445
10315
|
const handleAddServer = async () => {
|
|
7446
10316
|
if (!newServerUrl.trim()) {
|
|
7447
|
-
|
|
10317
|
+
message7.error("Please enter a server URL");
|
|
7448
10318
|
return;
|
|
7449
10319
|
}
|
|
7450
10320
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -7470,7 +10340,7 @@ var SettingsModal = ({
|
|
|
7470
10340
|
setNewServerUrl("");
|
|
7471
10341
|
setNewServerName("");
|
|
7472
10342
|
setNewServerApiKey("");
|
|
7473
|
-
|
|
10343
|
+
message7.success("Server added successfully");
|
|
7474
10344
|
};
|
|
7475
10345
|
const handleDeleteServer = (serverId) => {
|
|
7476
10346
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -7487,7 +10357,7 @@ var SettingsModal = ({
|
|
|
7487
10357
|
setActiveTabKey("");
|
|
7488
10358
|
}
|
|
7489
10359
|
}
|
|
7490
|
-
|
|
10360
|
+
message7.success("Server deleted");
|
|
7491
10361
|
};
|
|
7492
10362
|
const handleTabChange = (newTabKey) => {
|
|
7493
10363
|
setConnections(
|
|
@@ -7501,12 +10371,12 @@ var SettingsModal = ({
|
|
|
7501
10371
|
const handleSave = async () => {
|
|
7502
10372
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
7503
10373
|
if (!connection || !connection.connected) {
|
|
7504
|
-
|
|
10374
|
+
message7.error("Please connect to a server first");
|
|
7505
10375
|
return;
|
|
7506
10376
|
}
|
|
7507
10377
|
const url = connection.url;
|
|
7508
10378
|
if (!url) {
|
|
7509
|
-
|
|
10379
|
+
message7.error("Please connect to a server first");
|
|
7510
10380
|
return;
|
|
7511
10381
|
}
|
|
7512
10382
|
try {
|
|
@@ -7570,23 +10440,23 @@ var SettingsModal = ({
|
|
|
7570
10440
|
const data = await response.json();
|
|
7571
10441
|
if (response.ok && data.success) {
|
|
7572
10442
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
7573
|
-
|
|
10443
|
+
message7.warning(
|
|
7574
10444
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
7575
10445
|
", "
|
|
7576
10446
|
)} to take effect.`,
|
|
7577
10447
|
5
|
|
7578
10448
|
);
|
|
7579
10449
|
} else {
|
|
7580
|
-
|
|
10450
|
+
message7.success("Configuration saved and applied successfully");
|
|
7581
10451
|
}
|
|
7582
10452
|
if (data.warnings && data.warnings.length > 0) {
|
|
7583
10453
|
data.warnings.forEach((warning) => {
|
|
7584
|
-
|
|
10454
|
+
message7.warning(warning, 5);
|
|
7585
10455
|
});
|
|
7586
10456
|
}
|
|
7587
10457
|
onClose();
|
|
7588
10458
|
} else {
|
|
7589
|
-
|
|
10459
|
+
message7.error(data.error || "Failed to save configuration");
|
|
7590
10460
|
}
|
|
7591
10461
|
} else if (activeMenu === "models") {
|
|
7592
10462
|
const validModels = config.models.filter(
|
|
@@ -7605,17 +10475,17 @@ var SettingsModal = ({
|
|
|
7605
10475
|
});
|
|
7606
10476
|
const data = await response.json();
|
|
7607
10477
|
if (response.ok && data.success) {
|
|
7608
|
-
|
|
10478
|
+
message7.success(
|
|
7609
10479
|
"Model configuration saved and registered successfully"
|
|
7610
10480
|
);
|
|
7611
10481
|
onClose();
|
|
7612
10482
|
} else {
|
|
7613
|
-
|
|
10483
|
+
message7.error(data.error || "Failed to save model configuration");
|
|
7614
10484
|
}
|
|
7615
10485
|
}
|
|
7616
10486
|
} catch (error) {
|
|
7617
10487
|
console.error("Failed to save configuration:", error);
|
|
7618
|
-
|
|
10488
|
+
message7.error(error.message || "Failed to save configuration");
|
|
7619
10489
|
} finally {
|
|
7620
10490
|
setLoading(false);
|
|
7621
10491
|
}
|
|
@@ -7631,25 +10501,25 @@ var SettingsModal = ({
|
|
|
7631
10501
|
}
|
|
7632
10502
|
}));
|
|
7633
10503
|
};
|
|
7634
|
-
return /* @__PURE__ */
|
|
7635
|
-
/* @__PURE__ */
|
|
10504
|
+
return /* @__PURE__ */ jsxs29("div", { className: styles.formContainer, children: [
|
|
10505
|
+
/* @__PURE__ */ jsx50(
|
|
7636
10506
|
Alert4,
|
|
7637
10507
|
{
|
|
7638
10508
|
message: "Configuration Effect",
|
|
7639
|
-
description: /* @__PURE__ */
|
|
7640
|
-
/* @__PURE__ */
|
|
7641
|
-
/* @__PURE__ */
|
|
10509
|
+
description: /* @__PURE__ */ jsxs29("div", { children: [
|
|
10510
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: 8 }, children: [
|
|
10511
|
+
/* @__PURE__ */ jsx50(
|
|
7642
10512
|
CheckCircleOutlined5,
|
|
7643
10513
|
{
|
|
7644
10514
|
style: { color: "#52c41a", marginRight: 8 }
|
|
7645
10515
|
}
|
|
7646
10516
|
),
|
|
7647
|
-
/* @__PURE__ */
|
|
10517
|
+
/* @__PURE__ */ jsx50("strong", { children: "Immediately effective:" }),
|
|
7648
10518
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
7649
10519
|
] }),
|
|
7650
|
-
/* @__PURE__ */
|
|
7651
|
-
/* @__PURE__ */
|
|
7652
|
-
/* @__PURE__ */
|
|
10520
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10521
|
+
/* @__PURE__ */ jsx50(ReloadOutlined3, { style: { color: "#faad14", marginRight: 8 } }),
|
|
10522
|
+
/* @__PURE__ */ jsx50("strong", { children: "Requires restart:" }),
|
|
7653
10523
|
" PORT (server must be restarted to change port)"
|
|
7654
10524
|
] })
|
|
7655
10525
|
] }),
|
|
@@ -7658,9 +10528,9 @@ var SettingsModal = ({
|
|
|
7658
10528
|
className: styles.alertCard
|
|
7659
10529
|
}
|
|
7660
10530
|
),
|
|
7661
|
-
/* @__PURE__ */
|
|
7662
|
-
/* @__PURE__ */
|
|
7663
|
-
|
|
10531
|
+
/* @__PURE__ */ jsx50("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
|
|
10532
|
+
/* @__PURE__ */ jsx50(
|
|
10533
|
+
TextArea3,
|
|
7664
10534
|
{
|
|
7665
10535
|
value: config.envText,
|
|
7666
10536
|
onChange: (e) => setEnvText(e.target.value),
|
|
@@ -7736,10 +10606,10 @@ QUEUE_NAME=tasks`,
|
|
|
7736
10606
|
}));
|
|
7737
10607
|
}
|
|
7738
10608
|
};
|
|
7739
|
-
return /* @__PURE__ */
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
config.models.map((model, index) => /* @__PURE__ */
|
|
7742
|
-
/* @__PURE__ */
|
|
10609
|
+
return /* @__PURE__ */ jsxs29("div", { className: styles.formContainer, children: [
|
|
10610
|
+
/* @__PURE__ */ jsx50("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
|
|
10611
|
+
config.models.map((model, index) => /* @__PURE__ */ jsxs29("div", { className: styles.card, children: [
|
|
10612
|
+
/* @__PURE__ */ jsxs29(
|
|
7743
10613
|
"div",
|
|
7744
10614
|
{
|
|
7745
10615
|
style: {
|
|
@@ -7751,13 +10621,13 @@ QUEUE_NAME=tasks`,
|
|
|
7751
10621
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
7752
10622
|
},
|
|
7753
10623
|
children: [
|
|
7754
|
-
/* @__PURE__ */
|
|
7755
|
-
/* @__PURE__ */
|
|
10624
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10625
|
+
/* @__PURE__ */ jsxs29(Text17, { strong: true, style: { fontSize: 16 }, children: [
|
|
7756
10626
|
"Model ",
|
|
7757
10627
|
index + 1
|
|
7758
10628
|
] }),
|
|
7759
|
-
model.key && /* @__PURE__ */
|
|
7760
|
-
|
|
10629
|
+
model.key && /* @__PURE__ */ jsxs29(
|
|
10630
|
+
Text17,
|
|
7761
10631
|
{
|
|
7762
10632
|
type: "secondary",
|
|
7763
10633
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -7769,8 +10639,8 @@ QUEUE_NAME=tasks`,
|
|
|
7769
10639
|
}
|
|
7770
10640
|
)
|
|
7771
10641
|
] }),
|
|
7772
|
-
config.models.length > 1 && /* @__PURE__ */
|
|
7773
|
-
|
|
10642
|
+
config.models.length > 1 && /* @__PURE__ */ jsx50(
|
|
10643
|
+
Button21,
|
|
7774
10644
|
{
|
|
7775
10645
|
type: "text",
|
|
7776
10646
|
danger: true,
|
|
@@ -7786,11 +10656,11 @@ QUEUE_NAME=tasks`,
|
|
|
7786
10656
|
]
|
|
7787
10657
|
}
|
|
7788
10658
|
),
|
|
7789
|
-
/* @__PURE__ */
|
|
7790
|
-
/* @__PURE__ */
|
|
7791
|
-
/* @__PURE__ */
|
|
7792
|
-
/* @__PURE__ */
|
|
7793
|
-
|
|
10659
|
+
/* @__PURE__ */ jsxs29(Space18, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
10660
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10661
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Key *" }),
|
|
10662
|
+
/* @__PURE__ */ jsx50(
|
|
10663
|
+
Input3,
|
|
7794
10664
|
{
|
|
7795
10665
|
placeholder: "e.g., default, gpt-4, claude",
|
|
7796
10666
|
value: model.key,
|
|
@@ -7798,11 +10668,11 @@ QUEUE_NAME=tasks`,
|
|
|
7798
10668
|
style: { height: 40 }
|
|
7799
10669
|
}
|
|
7800
10670
|
),
|
|
7801
|
-
/* @__PURE__ */
|
|
10671
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
7802
10672
|
] }),
|
|
7803
|
-
/* @__PURE__ */
|
|
7804
|
-
/* @__PURE__ */
|
|
7805
|
-
/* @__PURE__ */
|
|
10673
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10674
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Provider *" }),
|
|
10675
|
+
/* @__PURE__ */ jsx50(
|
|
7806
10676
|
Select,
|
|
7807
10677
|
{
|
|
7808
10678
|
style: { width: "100%", height: 40 },
|
|
@@ -7818,10 +10688,10 @@ QUEUE_NAME=tasks`,
|
|
|
7818
10688
|
}
|
|
7819
10689
|
)
|
|
7820
10690
|
] }),
|
|
7821
|
-
/* @__PURE__ */
|
|
7822
|
-
/* @__PURE__ */
|
|
7823
|
-
/* @__PURE__ */
|
|
7824
|
-
|
|
10691
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10692
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Model Name *" }),
|
|
10693
|
+
/* @__PURE__ */ jsx50(
|
|
10694
|
+
Input3,
|
|
7825
10695
|
{
|
|
7826
10696
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
7827
10697
|
value: model.model,
|
|
@@ -7830,10 +10700,10 @@ QUEUE_NAME=tasks`,
|
|
|
7830
10700
|
}
|
|
7831
10701
|
)
|
|
7832
10702
|
] }),
|
|
7833
|
-
/* @__PURE__ */
|
|
7834
|
-
/* @__PURE__ */
|
|
7835
|
-
/* @__PURE__ */
|
|
7836
|
-
|
|
10703
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10704
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "API Key" }),
|
|
10705
|
+
/* @__PURE__ */ jsx50(
|
|
10706
|
+
Input3.Password,
|
|
7837
10707
|
{
|
|
7838
10708
|
placeholder: "Enter your API key",
|
|
7839
10709
|
value: model.apiKey,
|
|
@@ -7841,12 +10711,12 @@ QUEUE_NAME=tasks`,
|
|
|
7841
10711
|
style: { height: 40 }
|
|
7842
10712
|
}
|
|
7843
10713
|
),
|
|
7844
|
-
/* @__PURE__ */
|
|
10714
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
7845
10715
|
] }),
|
|
7846
|
-
/* @__PURE__ */
|
|
7847
|
-
/* @__PURE__ */
|
|
7848
|
-
/* @__PURE__ */
|
|
7849
|
-
|
|
10716
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10717
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Base URL" }),
|
|
10718
|
+
/* @__PURE__ */ jsx50(
|
|
10719
|
+
Input3,
|
|
7850
10720
|
{
|
|
7851
10721
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
7852
10722
|
value: model.baseURL,
|
|
@@ -7854,23 +10724,23 @@ QUEUE_NAME=tasks`,
|
|
|
7854
10724
|
style: { height: 40 }
|
|
7855
10725
|
}
|
|
7856
10726
|
),
|
|
7857
|
-
/* @__PURE__ */
|
|
10727
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
7858
10728
|
] }),
|
|
7859
|
-
/* @__PURE__ */
|
|
7860
|
-
/* @__PURE__ */
|
|
10729
|
+
/* @__PURE__ */ jsx50("div", { children: /* @__PURE__ */ jsxs29(Space18, { children: [
|
|
10730
|
+
/* @__PURE__ */ jsx50(
|
|
7861
10731
|
Switch,
|
|
7862
10732
|
{
|
|
7863
10733
|
checked: model.streaming,
|
|
7864
10734
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
7865
10735
|
}
|
|
7866
10736
|
),
|
|
7867
|
-
/* @__PURE__ */
|
|
10737
|
+
/* @__PURE__ */ jsx50(Text17, { children: "Enable Streaming" })
|
|
7868
10738
|
] }) }),
|
|
7869
|
-
/* @__PURE__ */
|
|
7870
|
-
/* @__PURE__ */
|
|
7871
|
-
/* @__PURE__ */
|
|
7872
|
-
/* @__PURE__ */
|
|
7873
|
-
|
|
10739
|
+
/* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: 20 }, children: [
|
|
10740
|
+
/* @__PURE__ */ jsxs29("div", { style: { flex: 1 }, children: [
|
|
10741
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Max Tokens" }),
|
|
10742
|
+
/* @__PURE__ */ jsx50(
|
|
10743
|
+
Input3,
|
|
7874
10744
|
{
|
|
7875
10745
|
type: "number",
|
|
7876
10746
|
placeholder: "e.g., 4096",
|
|
@@ -7884,10 +10754,10 @@ QUEUE_NAME=tasks`,
|
|
|
7884
10754
|
}
|
|
7885
10755
|
)
|
|
7886
10756
|
] }),
|
|
7887
|
-
/* @__PURE__ */
|
|
7888
|
-
/* @__PURE__ */
|
|
7889
|
-
/* @__PURE__ */
|
|
7890
|
-
|
|
10757
|
+
/* @__PURE__ */ jsxs29("div", { style: { flex: 1 }, children: [
|
|
10758
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Temperature" }),
|
|
10759
|
+
/* @__PURE__ */ jsx50(
|
|
10760
|
+
Input3,
|
|
7891
10761
|
{
|
|
7892
10762
|
type: "number",
|
|
7893
10763
|
step: "0.1",
|
|
@@ -7905,8 +10775,8 @@ QUEUE_NAME=tasks`,
|
|
|
7905
10775
|
] })
|
|
7906
10776
|
] })
|
|
7907
10777
|
] }, index)),
|
|
7908
|
-
/* @__PURE__ */
|
|
7909
|
-
|
|
10778
|
+
/* @__PURE__ */ jsx50(
|
|
10779
|
+
Button21,
|
|
7910
10780
|
{
|
|
7911
10781
|
type: "dashed",
|
|
7912
10782
|
onClick: handleAddModel,
|
|
@@ -7933,8 +10803,8 @@ QUEUE_NAME=tasks`,
|
|
|
7933
10803
|
);
|
|
7934
10804
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
7935
10805
|
const renderTabLabel = (connection) => {
|
|
7936
|
-
return /* @__PURE__ */
|
|
7937
|
-
/* @__PURE__ */
|
|
10806
|
+
return /* @__PURE__ */ jsxs29("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
10807
|
+
/* @__PURE__ */ jsx50(
|
|
7938
10808
|
CloudServerOutlined,
|
|
7939
10809
|
{
|
|
7940
10810
|
style: {
|
|
@@ -7943,14 +10813,14 @@ QUEUE_NAME=tasks`,
|
|
|
7943
10813
|
}
|
|
7944
10814
|
}
|
|
7945
10815
|
),
|
|
7946
|
-
/* @__PURE__ */
|
|
7947
|
-
connection.connected && /* @__PURE__ */
|
|
10816
|
+
/* @__PURE__ */ jsx50("span", { children: connection.name }),
|
|
10817
|
+
connection.connected && /* @__PURE__ */ jsx50(
|
|
7948
10818
|
CheckCircleFilled,
|
|
7949
10819
|
{
|
|
7950
10820
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
7951
10821
|
}
|
|
7952
10822
|
),
|
|
7953
|
-
connection.error && !connection.connecting && /* @__PURE__ */
|
|
10823
|
+
connection.error && !connection.connecting && /* @__PURE__ */ jsx50(
|
|
7954
10824
|
CloseCircleFilled,
|
|
7955
10825
|
{
|
|
7956
10826
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
@@ -7961,35 +10831,35 @@ QUEUE_NAME=tasks`,
|
|
|
7961
10831
|
const tabItems = connections.map((connection) => ({
|
|
7962
10832
|
key: connection.id,
|
|
7963
10833
|
label: renderTabLabel(connection),
|
|
7964
|
-
children: /* @__PURE__ */
|
|
7965
|
-
/* @__PURE__ */
|
|
10834
|
+
children: /* @__PURE__ */ jsx50("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx50(Fragment7, { children: /* @__PURE__ */ jsxs29("div", { style: { display: "flex", height: "100%" }, children: [
|
|
10835
|
+
/* @__PURE__ */ jsx50("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs29(
|
|
7966
10836
|
"div",
|
|
7967
10837
|
{
|
|
7968
10838
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
7969
10839
|
onClick: () => setActiveMenu(item.key),
|
|
7970
10840
|
children: [
|
|
7971
|
-
/* @__PURE__ */
|
|
7972
|
-
/* @__PURE__ */
|
|
10841
|
+
/* @__PURE__ */ jsx50("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
10842
|
+
/* @__PURE__ */ jsx50("span", { className: styles.menuItemText, children: item.label })
|
|
7973
10843
|
]
|
|
7974
10844
|
},
|
|
7975
10845
|
item.key
|
|
7976
10846
|
)) }),
|
|
7977
|
-
/* @__PURE__ */
|
|
7978
|
-
/* @__PURE__ */
|
|
7979
|
-
/* @__PURE__ */
|
|
7980
|
-
/* @__PURE__ */
|
|
7981
|
-
/* @__PURE__ */
|
|
10847
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.content, children: [
|
|
10848
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeader, children: [
|
|
10849
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeaderLeft, children: [
|
|
10850
|
+
/* @__PURE__ */ jsx50(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
10851
|
+
/* @__PURE__ */ jsxs29(Text17, { className: styles.contentDescription, children: [
|
|
7982
10852
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
7983
10853
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
7984
10854
|
] })
|
|
7985
10855
|
] }),
|
|
7986
|
-
/* @__PURE__ */
|
|
7987
|
-
/* @__PURE__ */
|
|
7988
|
-
/* @__PURE__ */
|
|
7989
|
-
|
|
10856
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeaderRight, children: [
|
|
10857
|
+
/* @__PURE__ */ jsx50(Button21, { onClick: onClose, children: "Cancel" }),
|
|
10858
|
+
/* @__PURE__ */ jsx50(
|
|
10859
|
+
Button21,
|
|
7990
10860
|
{
|
|
7991
10861
|
type: "primary",
|
|
7992
|
-
icon: /* @__PURE__ */
|
|
10862
|
+
icon: /* @__PURE__ */ jsx50(SaveOutlined, {}),
|
|
7993
10863
|
onClick: handleSave,
|
|
7994
10864
|
loading,
|
|
7995
10865
|
children: "Save Configuration"
|
|
@@ -7997,9 +10867,9 @@ QUEUE_NAME=tasks`,
|
|
|
7997
10867
|
)
|
|
7998
10868
|
] })
|
|
7999
10869
|
] }),
|
|
8000
|
-
/* @__PURE__ */
|
|
10870
|
+
/* @__PURE__ */ jsx50("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
8001
10871
|
] })
|
|
8002
|
-
] }) }) : /* @__PURE__ */
|
|
10872
|
+
] }) }) : /* @__PURE__ */ jsx50(
|
|
8003
10873
|
"div",
|
|
8004
10874
|
{
|
|
8005
10875
|
style: {
|
|
@@ -8011,29 +10881,29 @@ QUEUE_NAME=tasks`,
|
|
|
8011
10881
|
gap: 16,
|
|
8012
10882
|
padding: 48
|
|
8013
10883
|
},
|
|
8014
|
-
children: connection.connecting ? /* @__PURE__ */
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
/* @__PURE__ */
|
|
8017
|
-
/* @__PURE__ */
|
|
10884
|
+
children: connection.connecting ? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10885
|
+
/* @__PURE__ */ jsx50(LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
10886
|
+
/* @__PURE__ */ jsx50(Title3, { level: 4, children: "Connecting..." }),
|
|
10887
|
+
/* @__PURE__ */ jsxs29(Text17, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
8018
10888
|
"Connecting to ",
|
|
8019
10889
|
connection.url
|
|
8020
10890
|
] })
|
|
8021
|
-
] }) : /* @__PURE__ */
|
|
8022
|
-
/* @__PURE__ */
|
|
8023
|
-
/* @__PURE__ */
|
|
8024
|
-
/* @__PURE__ */
|
|
8025
|
-
|
|
10891
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10892
|
+
/* @__PURE__ */ jsx50(LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
10893
|
+
/* @__PURE__ */ jsx50(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
10894
|
+
/* @__PURE__ */ jsx50(
|
|
10895
|
+
Text17,
|
|
8026
10896
|
{
|
|
8027
10897
|
type: "secondary",
|
|
8028
10898
|
style: { textAlign: "center", maxWidth: 400 },
|
|
8029
10899
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
8030
10900
|
}
|
|
8031
10901
|
),
|
|
8032
|
-
/* @__PURE__ */
|
|
8033
|
-
|
|
10902
|
+
/* @__PURE__ */ jsx50(
|
|
10903
|
+
Button21,
|
|
8034
10904
|
{
|
|
8035
10905
|
type: "primary",
|
|
8036
|
-
icon: /* @__PURE__ */
|
|
10906
|
+
icon: /* @__PURE__ */ jsx50(LinkOutlined, {}),
|
|
8037
10907
|
onClick: () => checkConnection(connection.id),
|
|
8038
10908
|
loading: connection.connecting,
|
|
8039
10909
|
style: { marginTop: 16 },
|
|
@@ -8045,9 +10915,9 @@ QUEUE_NAME=tasks`,
|
|
|
8045
10915
|
) }),
|
|
8046
10916
|
closable: connections.length > 1
|
|
8047
10917
|
}));
|
|
8048
|
-
return /* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
8050
|
-
|
|
10918
|
+
return /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10919
|
+
/* @__PURE__ */ jsx50(
|
|
10920
|
+
Modal4,
|
|
8051
10921
|
{
|
|
8052
10922
|
open,
|
|
8053
10923
|
onCancel: onClose,
|
|
@@ -8055,7 +10925,7 @@ QUEUE_NAME=tasks`,
|
|
|
8055
10925
|
width: "80%",
|
|
8056
10926
|
footer: null,
|
|
8057
10927
|
title: "Settings",
|
|
8058
|
-
children: /* @__PURE__ */
|
|
10928
|
+
children: /* @__PURE__ */ jsx50("div", { children: /* @__PURE__ */ jsx50(
|
|
8059
10929
|
Tabs2,
|
|
8060
10930
|
{
|
|
8061
10931
|
activeKey: activeTabKey,
|
|
@@ -8069,7 +10939,7 @@ QUEUE_NAME=tasks`,
|
|
|
8069
10939
|
}
|
|
8070
10940
|
},
|
|
8071
10941
|
items: tabItems,
|
|
8072
|
-
addIcon: /* @__PURE__ */
|
|
10942
|
+
addIcon: /* @__PURE__ */ jsxs29(
|
|
8073
10943
|
"div",
|
|
8074
10944
|
{
|
|
8075
10945
|
style: {
|
|
@@ -8079,8 +10949,8 @@ QUEUE_NAME=tasks`,
|
|
|
8079
10949
|
padding: "4px 8px"
|
|
8080
10950
|
},
|
|
8081
10951
|
children: [
|
|
8082
|
-
/* @__PURE__ */
|
|
8083
|
-
/* @__PURE__ */
|
|
10952
|
+
/* @__PURE__ */ jsx50(PlusOutlined4, {}),
|
|
10953
|
+
/* @__PURE__ */ jsx50("span", { children: "Add Server" })
|
|
8084
10954
|
]
|
|
8085
10955
|
}
|
|
8086
10956
|
)
|
|
@@ -8088,8 +10958,8 @@ QUEUE_NAME=tasks`,
|
|
|
8088
10958
|
) })
|
|
8089
10959
|
}
|
|
8090
10960
|
),
|
|
8091
|
-
/* @__PURE__ */
|
|
8092
|
-
|
|
10961
|
+
/* @__PURE__ */ jsx50(
|
|
10962
|
+
Modal4,
|
|
8093
10963
|
{
|
|
8094
10964
|
title: "Add New Server",
|
|
8095
10965
|
open: showAddServerModal,
|
|
@@ -8102,11 +10972,11 @@ QUEUE_NAME=tasks`,
|
|
|
8102
10972
|
},
|
|
8103
10973
|
confirmLoading: addingServer,
|
|
8104
10974
|
className: styles.addServerModal,
|
|
8105
|
-
children: /* @__PURE__ */
|
|
8106
|
-
/* @__PURE__ */
|
|
8107
|
-
/* @__PURE__ */
|
|
8108
|
-
/* @__PURE__ */
|
|
8109
|
-
|
|
10975
|
+
children: /* @__PURE__ */ jsxs29(Space18, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
10976
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10977
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
10978
|
+
/* @__PURE__ */ jsx50(
|
|
10979
|
+
Input3,
|
|
8110
10980
|
{
|
|
8111
10981
|
placeholder: "e.g., Production Server",
|
|
8112
10982
|
value: newServerName,
|
|
@@ -8114,12 +10984,12 @@ QUEUE_NAME=tasks`,
|
|
|
8114
10984
|
onPressEnter: handleAddServer
|
|
8115
10985
|
}
|
|
8116
10986
|
),
|
|
8117
|
-
/* @__PURE__ */
|
|
10987
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
8118
10988
|
] }),
|
|
8119
|
-
/* @__PURE__ */
|
|
8120
|
-
/* @__PURE__ */
|
|
8121
|
-
/* @__PURE__ */
|
|
8122
|
-
|
|
10989
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10990
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
10991
|
+
/* @__PURE__ */ jsx50(
|
|
10992
|
+
Input3,
|
|
8123
10993
|
{
|
|
8124
10994
|
placeholder: "e.g., http://localhost:4001",
|
|
8125
10995
|
value: newServerUrl,
|
|
@@ -8127,12 +10997,12 @@ QUEUE_NAME=tasks`,
|
|
|
8127
10997
|
onPressEnter: handleAddServer
|
|
8128
10998
|
}
|
|
8129
10999
|
),
|
|
8130
|
-
/* @__PURE__ */
|
|
11000
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
8131
11001
|
] }),
|
|
8132
|
-
/* @__PURE__ */
|
|
8133
|
-
/* @__PURE__ */
|
|
8134
|
-
/* @__PURE__ */
|
|
8135
|
-
|
|
11002
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
11003
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
11004
|
+
/* @__PURE__ */ jsx50(
|
|
11005
|
+
Input3.Password,
|
|
8136
11006
|
{
|
|
8137
11007
|
placeholder: "Optional: Enter API key for authentication",
|
|
8138
11008
|
value: newServerApiKey,
|
|
@@ -8140,7 +11010,7 @@ QUEUE_NAME=tasks`,
|
|
|
8140
11010
|
onPressEnter: handleAddServer
|
|
8141
11011
|
}
|
|
8142
11012
|
),
|
|
8143
|
-
/* @__PURE__ */
|
|
11013
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
8144
11014
|
] })
|
|
8145
11015
|
] })
|
|
8146
11016
|
}
|
|
@@ -8149,10 +11019,10 @@ QUEUE_NAME=tasks`,
|
|
|
8149
11019
|
};
|
|
8150
11020
|
|
|
8151
11021
|
// src/components/Chat/AgentServerSetting.tsx
|
|
8152
|
-
import { jsx as
|
|
11022
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
8153
11023
|
var AgentServerSetting = () => {
|
|
8154
11024
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
8155
|
-
return /* @__PURE__ */
|
|
11025
|
+
return /* @__PURE__ */ jsx51(
|
|
8156
11026
|
SettingsModal,
|
|
8157
11027
|
{
|
|
8158
11028
|
open: settingsModalOpen,
|
|
@@ -8162,11 +11032,11 @@ var AgentServerSetting = () => {
|
|
|
8162
11032
|
};
|
|
8163
11033
|
|
|
8164
11034
|
// src/components/Chat/LatticeChatShell.tsx
|
|
8165
|
-
import { jsx as
|
|
11035
|
+
import { jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8166
11036
|
var LatticeChatShell = (props) => {
|
|
8167
|
-
return /* @__PURE__ */
|
|
8168
|
-
/* @__PURE__ */
|
|
8169
|
-
/* @__PURE__ */
|
|
11037
|
+
return /* @__PURE__ */ jsxs30(LatticeChatShellContextProvider, { ...props, children: [
|
|
11038
|
+
/* @__PURE__ */ jsx52(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ jsx52(ConversationContextProvider, { children: /* @__PURE__ */ jsx52(LatticeChatView, {}) }) }),
|
|
11039
|
+
/* @__PURE__ */ jsx52(AgentServerSetting, {})
|
|
8170
11040
|
] });
|
|
8171
11041
|
};
|
|
8172
11042
|
export {
|
|
@@ -8174,6 +11044,8 @@ export {
|
|
|
8174
11044
|
AgentThreadProvider,
|
|
8175
11045
|
AssistantContext,
|
|
8176
11046
|
AssistantContextProvider,
|
|
11047
|
+
AssistantFlow_default as AssistantFlow,
|
|
11048
|
+
AssistantNode_default as AssistantNode,
|
|
8177
11049
|
AxiomLatticeProvider,
|
|
8178
11050
|
ChatUIContext,
|
|
8179
11051
|
ChatUIContextProvider,
|
|
@@ -8190,6 +11062,8 @@ export {
|
|
|
8190
11062
|
MDViewFormItem,
|
|
8191
11063
|
ScheduleButton,
|
|
8192
11064
|
SideAppViewBrowser,
|
|
11065
|
+
SkillFlow_default as SkillFlow,
|
|
11066
|
+
SkillNode_default as SkillNode,
|
|
8193
11067
|
getElement,
|
|
8194
11068
|
regsiterElement,
|
|
8195
11069
|
useAgentChat,
|