@axiom-lattice/react-sdk 2.1.23 → 2.1.25
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 +75 -2
- package/dist/index.d.ts +75 -2
- package/dist/index.js +3135 -266
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3150 -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 useState28, 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,2802 @@ 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, useState as useState24 } 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 = ({ onNodeClick }) => {
|
|
7219
|
+
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
7220
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
7221
|
+
const [assistants, setAssistants] = useState24([]);
|
|
7222
|
+
const [assistantsLoading, setAssistantsLoading] = useState24(false);
|
|
7223
|
+
const { config } = useLatticeChatShellContext();
|
|
7224
|
+
const nodeTypes = useMemo10(
|
|
7225
|
+
() => ({
|
|
7226
|
+
assistant: AssistantNode_default
|
|
7227
|
+
}),
|
|
7228
|
+
[]
|
|
7229
|
+
);
|
|
7230
|
+
const fetchAssistants = async () => {
|
|
7231
|
+
setAssistantsLoading(true);
|
|
7232
|
+
try {
|
|
7233
|
+
const headers = {};
|
|
7234
|
+
if (config.apiKey) {
|
|
7235
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
7236
|
+
}
|
|
7237
|
+
const response = await fetch(`${config.baseURL}/api/assistants`, {
|
|
7238
|
+
headers
|
|
7239
|
+
});
|
|
7240
|
+
if (response.ok) {
|
|
7241
|
+
const data = await response.json();
|
|
7242
|
+
if (data.success && data.data && Array.isArray(data.data.records)) {
|
|
7243
|
+
setAssistants(data.data.records);
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
} catch (error) {
|
|
7247
|
+
console.error("Failed to fetch assistants:", error);
|
|
7248
|
+
setAssistants([]);
|
|
7249
|
+
} finally {
|
|
7250
|
+
setAssistantsLoading(false);
|
|
7251
|
+
}
|
|
7252
|
+
};
|
|
7253
|
+
useEffect17(() => {
|
|
7254
|
+
fetchAssistants();
|
|
7255
|
+
}, []);
|
|
7256
|
+
useEffect17(() => {
|
|
7257
|
+
if (!assistants || assistants.length === 0) {
|
|
7258
|
+
setNodes([]);
|
|
7259
|
+
setEdges([]);
|
|
7260
|
+
return;
|
|
7261
|
+
}
|
|
7262
|
+
const initialNodes = [];
|
|
7263
|
+
const initialEdges = [];
|
|
7264
|
+
const nodeWidth = 280;
|
|
7265
|
+
const nodeHeight = 200;
|
|
7266
|
+
const horizontalSpacing = 320;
|
|
7267
|
+
const verticalSpacing = 300;
|
|
7268
|
+
const nodesPerRow = Math.ceil(Math.sqrt(assistants.length));
|
|
7269
|
+
const assistantMap = /* @__PURE__ */ new Map();
|
|
7270
|
+
const relationships = [];
|
|
7271
|
+
assistants.forEach((assistant) => {
|
|
7272
|
+
assistantMap.set(assistant.id, assistant);
|
|
7273
|
+
});
|
|
7274
|
+
assistants.forEach((assistant) => {
|
|
7275
|
+
if (assistant.graphDefinition) {
|
|
7276
|
+
try {
|
|
7277
|
+
const graphDef = typeof assistant.graphDefinition === "string" ? JSON.parse(assistant.graphDefinition) : assistant.graphDefinition;
|
|
7278
|
+
if (graphDef.subAgents && Array.isArray(graphDef.subAgents)) {
|
|
7279
|
+
graphDef.subAgents.forEach((subAgentKey) => {
|
|
7280
|
+
const subAssistant = assistants.find(
|
|
7281
|
+
(a) => a.id === subAgentKey || a.id === String(subAgentKey)
|
|
7282
|
+
);
|
|
7283
|
+
if (subAssistant && subAssistant.id !== assistant.id) {
|
|
7284
|
+
relationships.push({
|
|
7285
|
+
source: assistant.id,
|
|
7286
|
+
target: subAssistant.id
|
|
7287
|
+
});
|
|
7288
|
+
}
|
|
7289
|
+
});
|
|
7290
|
+
}
|
|
7291
|
+
if (graphDef.internalSubAgents && Array.isArray(graphDef.internalSubAgents)) {
|
|
7292
|
+
graphDef.internalSubAgents.forEach((internalSubAgent) => {
|
|
7293
|
+
if (internalSubAgent.key) {
|
|
7294
|
+
const subAssistant = assistants.find(
|
|
7295
|
+
(a) => a.id === internalSubAgent.key || a.id === String(internalSubAgent.key)
|
|
7296
|
+
);
|
|
7297
|
+
if (subAssistant && subAssistant.id !== assistant.id) {
|
|
7298
|
+
relationships.push({
|
|
7299
|
+
source: assistant.id,
|
|
7300
|
+
target: subAssistant.id
|
|
7301
|
+
});
|
|
7302
|
+
}
|
|
7303
|
+
}
|
|
7304
|
+
});
|
|
7305
|
+
}
|
|
7306
|
+
if (graphDef.nodes && Array.isArray(graphDef.nodes)) {
|
|
7307
|
+
graphDef.nodes.forEach((node) => {
|
|
7308
|
+
if (node.assistantId && node.assistantId !== assistant.id) {
|
|
7309
|
+
const targetAssistant = assistants.find(
|
|
7310
|
+
(a) => a.id === node.assistantId || a.id === String(node.assistantId)
|
|
7311
|
+
);
|
|
7312
|
+
if (targetAssistant) {
|
|
7313
|
+
relationships.push({
|
|
7314
|
+
source: assistant.id,
|
|
7315
|
+
target: targetAssistant.id
|
|
7316
|
+
});
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
});
|
|
7320
|
+
}
|
|
7321
|
+
if (graphDef.edges && Array.isArray(graphDef.edges)) {
|
|
7322
|
+
graphDef.edges.forEach((edge) => {
|
|
7323
|
+
if (edge.source && edge.target) {
|
|
7324
|
+
const sourceId = typeof edge.source === "string" ? edge.source : edge.source.id || edge.source.assistantId;
|
|
7325
|
+
const targetId = typeof edge.target === "string" ? edge.target : edge.target.id || edge.target.assistantId;
|
|
7326
|
+
const sourceAssistant = assistants.find(
|
|
7327
|
+
(a) => a.id === sourceId || a.id === String(sourceId)
|
|
7328
|
+
);
|
|
7329
|
+
const targetAssistant = assistants.find(
|
|
7330
|
+
(a) => a.id === targetId || a.id === String(targetId)
|
|
7331
|
+
);
|
|
7332
|
+
if (sourceAssistant && targetAssistant) {
|
|
7333
|
+
relationships.push({
|
|
7334
|
+
source: sourceAssistant.id,
|
|
7335
|
+
target: targetAssistant.id
|
|
7336
|
+
});
|
|
7337
|
+
}
|
|
7338
|
+
}
|
|
7339
|
+
});
|
|
7340
|
+
}
|
|
7341
|
+
} catch (error) {
|
|
7342
|
+
console.warn(
|
|
7343
|
+
`Failed to parse graphDefinition for assistant ${assistant.id}:`,
|
|
7344
|
+
error
|
|
7345
|
+
);
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
});
|
|
7349
|
+
const hasRelationships = relationships.length > 0;
|
|
7350
|
+
if (hasRelationships) {
|
|
7351
|
+
const processedIds = /* @__PURE__ */ new Set();
|
|
7352
|
+
const levelMap = /* @__PURE__ */ new Map();
|
|
7353
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
7354
|
+
relationships.forEach((rel) => {
|
|
7355
|
+
if (!childrenMap.has(rel.source)) {
|
|
7356
|
+
childrenMap.set(rel.source, []);
|
|
7357
|
+
}
|
|
7358
|
+
childrenMap.get(rel.source).push(rel.target);
|
|
7359
|
+
});
|
|
7360
|
+
const queue = [];
|
|
7361
|
+
const rootNodes = assistants.filter(
|
|
7362
|
+
(a) => !relationships.some((r) => r.target === a.id)
|
|
7363
|
+
);
|
|
7364
|
+
if (rootNodes.length === 0 && assistants.length > 0) {
|
|
7365
|
+
queue.push({ id: assistants[0].id, level: 0 });
|
|
7366
|
+
} else {
|
|
7367
|
+
rootNodes.forEach((root) => {
|
|
7368
|
+
queue.push({ id: root.id, level: 0 });
|
|
7369
|
+
});
|
|
7370
|
+
}
|
|
7371
|
+
while (queue.length > 0) {
|
|
7372
|
+
const { id, level } = queue.shift();
|
|
7373
|
+
if (processedIds.has(id)) continue;
|
|
7374
|
+
processedIds.add(id);
|
|
7375
|
+
levelMap.set(id, level);
|
|
7376
|
+
const children = childrenMap.get(id) || [];
|
|
7377
|
+
children.forEach((childId) => {
|
|
7378
|
+
if (!processedIds.has(childId)) {
|
|
7379
|
+
queue.push({ id: childId, level: level + 1 });
|
|
7380
|
+
}
|
|
7381
|
+
});
|
|
7382
|
+
}
|
|
7383
|
+
assistants.forEach((assistant) => {
|
|
7384
|
+
if (!levelMap.has(assistant.id)) {
|
|
7385
|
+
levelMap.set(assistant.id, 0);
|
|
7386
|
+
}
|
|
7387
|
+
});
|
|
7388
|
+
const levelGroups = /* @__PURE__ */ new Map();
|
|
7389
|
+
assistants.forEach((assistant) => {
|
|
7390
|
+
const level = levelMap.get(assistant.id) || 0;
|
|
7391
|
+
if (!levelGroups.has(level)) {
|
|
7392
|
+
levelGroups.set(level, []);
|
|
7393
|
+
}
|
|
7394
|
+
levelGroups.get(level).push(assistant);
|
|
7395
|
+
});
|
|
7396
|
+
levelGroups.forEach((group, level) => {
|
|
7397
|
+
const y = level * verticalSpacing;
|
|
7398
|
+
const groupWidth = (group.length - 1) * horizontalSpacing;
|
|
7399
|
+
const startX = -groupWidth / 2;
|
|
7400
|
+
group.forEach((assistant, index) => {
|
|
7401
|
+
const x = startX + index * horizontalSpacing;
|
|
7402
|
+
initialNodes.push({
|
|
7403
|
+
id: assistant.id,
|
|
7404
|
+
type: "assistant",
|
|
7405
|
+
data: {
|
|
7406
|
+
assistant,
|
|
7407
|
+
onClick: () => onNodeClick?.(assistant)
|
|
7408
|
+
},
|
|
7409
|
+
position: { x, y }
|
|
7410
|
+
});
|
|
7411
|
+
});
|
|
7412
|
+
});
|
|
7413
|
+
relationships.forEach((rel) => {
|
|
7414
|
+
if (assistantMap.has(rel.source) && assistantMap.has(rel.target)) {
|
|
7415
|
+
initialEdges.push({
|
|
7416
|
+
id: `e${rel.source}-${rel.target}`,
|
|
7417
|
+
source: rel.source,
|
|
7418
|
+
target: rel.target,
|
|
7419
|
+
animated: true,
|
|
7420
|
+
style: { stroke: "#1677ff" },
|
|
7421
|
+
type: "smoothstep"
|
|
7422
|
+
});
|
|
7423
|
+
}
|
|
7424
|
+
});
|
|
7425
|
+
} else {
|
|
7426
|
+
assistants.forEach((assistant, index) => {
|
|
7427
|
+
const row = Math.floor(index / nodesPerRow);
|
|
7428
|
+
const col = index % nodesPerRow;
|
|
7429
|
+
const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
|
|
7430
|
+
const y = row * verticalSpacing;
|
|
7431
|
+
initialNodes.push({
|
|
7432
|
+
id: assistant.id,
|
|
7433
|
+
type: "assistant",
|
|
7434
|
+
data: {
|
|
7435
|
+
assistant,
|
|
7436
|
+
onClick: () => onNodeClick?.(assistant)
|
|
7437
|
+
},
|
|
7438
|
+
position: { x, y }
|
|
7439
|
+
});
|
|
7440
|
+
});
|
|
7441
|
+
}
|
|
7442
|
+
setNodes(initialNodes);
|
|
7443
|
+
setEdges(initialEdges);
|
|
7444
|
+
}, [assistants, setNodes, setEdges, onNodeClick]);
|
|
7445
|
+
if (assistantsLoading) {
|
|
7446
|
+
return /* @__PURE__ */ jsx44(
|
|
7447
|
+
"div",
|
|
7448
|
+
{
|
|
7449
|
+
style: {
|
|
7450
|
+
width: "100%",
|
|
7451
|
+
height: "100%",
|
|
7452
|
+
display: "flex",
|
|
7453
|
+
justifyContent: "center",
|
|
7454
|
+
alignItems: "center",
|
|
7455
|
+
background: "#fafafa"
|
|
7456
|
+
},
|
|
7457
|
+
children: "Loading assistants..."
|
|
7458
|
+
}
|
|
7459
|
+
);
|
|
7460
|
+
}
|
|
7461
|
+
return /* @__PURE__ */ jsx44("div", { style: { width: "100%", height: "100%", background: "#fafafa" }, children: /* @__PURE__ */ jsxs24(
|
|
7462
|
+
ReactFlow,
|
|
7463
|
+
{
|
|
7464
|
+
nodes,
|
|
7465
|
+
edges,
|
|
7466
|
+
onNodesChange,
|
|
7467
|
+
onEdgesChange,
|
|
7468
|
+
nodeTypes,
|
|
7469
|
+
fitView: true,
|
|
7470
|
+
children: [
|
|
7471
|
+
/* @__PURE__ */ jsx44(Background, { color: "#eee", gap: 20 }),
|
|
7472
|
+
/* @__PURE__ */ jsx44(Controls, {})
|
|
7473
|
+
]
|
|
7474
|
+
}
|
|
7475
|
+
) });
|
|
7476
|
+
};
|
|
7477
|
+
var AssistantFlow = (props) => /* @__PURE__ */ jsx44(ReactFlowProvider, { children: /* @__PURE__ */ jsx44(AssistantFlowInner, { ...props }) });
|
|
7478
|
+
var AssistantFlow_default = AssistantFlow;
|
|
7479
|
+
|
|
7480
|
+
// src/components/Chat/SkillFlow.tsx
|
|
7481
|
+
import { useMemo as useMemo12, useEffect as useEffect19, useState as useState27 } from "react";
|
|
7482
|
+
import {
|
|
7483
|
+
ReactFlow as ReactFlow2,
|
|
7484
|
+
Background as Background2,
|
|
7485
|
+
Controls as Controls2,
|
|
7486
|
+
useNodesState as useNodesState2,
|
|
7487
|
+
useEdgesState as useEdgesState2,
|
|
7488
|
+
ReactFlowProvider as ReactFlowProvider2
|
|
7489
|
+
} from "@xyflow/react";
|
|
7490
|
+
import "@xyflow/react/dist/style.css";
|
|
7491
|
+
import { Button as Button19, theme as theme6 } from "antd";
|
|
7492
|
+
import { PlusOutlined as PlusOutlined3 } from "@ant-design/icons";
|
|
7493
|
+
|
|
7494
|
+
// src/components/Chat/SkillNode.tsx
|
|
7495
|
+
import { useEffect as useEffect18, useMemo as useMemo11, useState as useState25 } from "react";
|
|
7496
|
+
import { Handle as Handle2, Position as Position2 } from "@xyflow/react";
|
|
7497
|
+
import {
|
|
7498
|
+
Avatar as Avatar6,
|
|
7499
|
+
Typography as Typography17,
|
|
7500
|
+
theme as theme4,
|
|
7501
|
+
Tag as Tag7,
|
|
7502
|
+
Tooltip as Tooltip7,
|
|
7503
|
+
Space as Space16,
|
|
7504
|
+
Button as Button17,
|
|
7505
|
+
Divider as Divider3,
|
|
7506
|
+
Input,
|
|
7507
|
+
Modal,
|
|
7508
|
+
message as message5
|
|
7509
|
+
} from "antd";
|
|
7510
|
+
import {
|
|
7511
|
+
BookOutlined,
|
|
7512
|
+
BranchesOutlined as BranchesOutlined2,
|
|
7513
|
+
CopyrightOutlined,
|
|
7514
|
+
InfoCircleOutlined as InfoCircleOutlined3,
|
|
7515
|
+
FileTextOutlined as FileTextOutlined5,
|
|
7516
|
+
CopyOutlined as CopyOutlined3,
|
|
7517
|
+
PlusOutlined
|
|
7518
|
+
} from "@ant-design/icons";
|
|
7519
|
+
import { Client as Client4 } from "@axiom-lattice/client-sdk";
|
|
7520
|
+
import { Fragment as Fragment5, jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7521
|
+
var { Text: Text15 } = Typography17;
|
|
7522
|
+
var { TextArea } = Input;
|
|
7523
|
+
var getBadgeColor2 = (name) => {
|
|
7524
|
+
const colors = [
|
|
7525
|
+
"#1890ff",
|
|
7526
|
+
// Blue
|
|
7527
|
+
"#52c41a",
|
|
7528
|
+
// Green
|
|
7529
|
+
"#faad14",
|
|
7530
|
+
// Orange
|
|
7531
|
+
"#f5222d",
|
|
7532
|
+
// Red
|
|
7533
|
+
"#722ed1",
|
|
7534
|
+
// Purple
|
|
7535
|
+
"#13c2c2",
|
|
7536
|
+
// Cyan
|
|
7537
|
+
"#eb2f96",
|
|
7538
|
+
// Magenta
|
|
7539
|
+
"#fa8c16"
|
|
7540
|
+
// Orange Red
|
|
7541
|
+
];
|
|
7542
|
+
let hash = 0;
|
|
7543
|
+
for (let i = 0; i < name.length; i++) {
|
|
7544
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
7545
|
+
}
|
|
7546
|
+
return colors[Math.abs(hash) % colors.length];
|
|
7547
|
+
};
|
|
7548
|
+
var SkillNode = ({ data }) => {
|
|
7549
|
+
const { token } = theme4.useToken();
|
|
7550
|
+
const { config } = useLatticeChatShellContext();
|
|
7551
|
+
const client = useMemo11(
|
|
7552
|
+
() => new Client4({
|
|
7553
|
+
baseURL: config.baseURL,
|
|
7554
|
+
apiKey: config.apiKey || "",
|
|
7555
|
+
assistantId: "",
|
|
7556
|
+
// Not needed for skills
|
|
7557
|
+
transport: "sse"
|
|
7558
|
+
}),
|
|
7559
|
+
[config.baseURL, config.apiKey]
|
|
7560
|
+
);
|
|
7561
|
+
if (!data) {
|
|
7562
|
+
return null;
|
|
7563
|
+
}
|
|
7564
|
+
const { skill, onClick, onDelete } = data;
|
|
7565
|
+
if (!skill) {
|
|
7566
|
+
return null;
|
|
7567
|
+
}
|
|
7568
|
+
const [currentSkill, setCurrentSkill] = useState25(skill);
|
|
7569
|
+
const badgeColor = getBadgeColor2(currentSkill.name);
|
|
7570
|
+
const initials = currentSkill.name?.split("-").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "SK";
|
|
7571
|
+
const hasSubSkills = currentSkill.subSkills && currentSkill.subSkills.length > 0;
|
|
7572
|
+
const category = currentSkill.metadata && currentSkill.metadata.category || "global";
|
|
7573
|
+
const metadataEntries = useMemo11(
|
|
7574
|
+
() => currentSkill.metadata ? Object.entries(
|
|
7575
|
+
currentSkill.metadata
|
|
7576
|
+
).filter(
|
|
7577
|
+
([key, value]) => key && value
|
|
7578
|
+
) : [],
|
|
7579
|
+
[currentSkill.metadata]
|
|
7580
|
+
);
|
|
7581
|
+
const formatDate = (value) => {
|
|
7582
|
+
if (!value) return "";
|
|
7583
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
7584
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
7585
|
+
return date.toLocaleString();
|
|
7586
|
+
};
|
|
7587
|
+
const handleCopy = (text) => {
|
|
7588
|
+
navigator.clipboard.writeText(text);
|
|
7589
|
+
};
|
|
7590
|
+
const [isEditing, setIsEditing] = useState25(false);
|
|
7591
|
+
const [draftSkill, setDraftSkill] = useState25({
|
|
7592
|
+
...skill,
|
|
7593
|
+
id: skill.name
|
|
7594
|
+
});
|
|
7595
|
+
const [metadataRows, setMetadataRows] = useState25(
|
|
7596
|
+
metadataEntries.map(([key, value]) => ({
|
|
7597
|
+
key,
|
|
7598
|
+
value
|
|
7599
|
+
}))
|
|
7600
|
+
);
|
|
7601
|
+
const [isModalOpen, setIsModalOpen] = useState25(false);
|
|
7602
|
+
const [saving, setSaving] = useState25(false);
|
|
7603
|
+
useEffect18(() => {
|
|
7604
|
+
setIsEditing(false);
|
|
7605
|
+
setCurrentSkill(skill);
|
|
7606
|
+
setDraftSkill({ ...skill, id: skill.name });
|
|
7607
|
+
setMetadataRows(
|
|
7608
|
+
Object.entries(
|
|
7609
|
+
skill.metadata || {}
|
|
7610
|
+
).map(([key, value]) => ({ key, value }))
|
|
7611
|
+
);
|
|
7612
|
+
}, [skill]);
|
|
7613
|
+
const handleFieldChange = (field, value) => {
|
|
7614
|
+
if (field === "name") {
|
|
7615
|
+
setDraftSkill((prev) => ({
|
|
7616
|
+
...prev,
|
|
7617
|
+
name: value,
|
|
7618
|
+
id: value
|
|
7619
|
+
// keep id and name identical
|
|
7620
|
+
}));
|
|
7621
|
+
return;
|
|
7622
|
+
}
|
|
7623
|
+
setDraftSkill((prev) => ({
|
|
7624
|
+
...prev,
|
|
7625
|
+
[field]: value
|
|
7626
|
+
}));
|
|
7627
|
+
};
|
|
7628
|
+
const handleDelete = async (e) => {
|
|
7629
|
+
e?.stopPropagation();
|
|
7630
|
+
e?.preventDefault();
|
|
7631
|
+
try {
|
|
7632
|
+
const skillId = currentSkill.id || currentSkill.name;
|
|
7633
|
+
if (!skillId) {
|
|
7634
|
+
message5.error("Skill ID is missing");
|
|
7635
|
+
return;
|
|
7636
|
+
}
|
|
7637
|
+
await client.skills.delete(skillId);
|
|
7638
|
+
message5.success("Skill deleted successfully");
|
|
7639
|
+
setIsModalOpen(false);
|
|
7640
|
+
if (onDelete) {
|
|
7641
|
+
await onDelete();
|
|
7642
|
+
}
|
|
7643
|
+
} catch (error) {
|
|
7644
|
+
message5.error(
|
|
7645
|
+
error?.message || "An error occurred while deleting the skill"
|
|
7646
|
+
);
|
|
7647
|
+
}
|
|
7648
|
+
};
|
|
7649
|
+
const syncMetadataRows = (rows) => {
|
|
7650
|
+
setMetadataRows(rows);
|
|
7651
|
+
const metadataObject = rows.reduce((acc, curr) => {
|
|
7652
|
+
if (curr.key) {
|
|
7653
|
+
acc[curr.key] = curr.value;
|
|
7654
|
+
}
|
|
7655
|
+
return acc;
|
|
7656
|
+
}, {});
|
|
7657
|
+
setDraftSkill((prev) => ({
|
|
7658
|
+
...prev,
|
|
7659
|
+
metadata: metadataObject
|
|
7660
|
+
}));
|
|
7661
|
+
};
|
|
7662
|
+
const handleMetadataChange = (index, field, value) => {
|
|
7663
|
+
const next = [...metadataRows];
|
|
7664
|
+
next[index] = {
|
|
7665
|
+
...next[index],
|
|
7666
|
+
[field]: value
|
|
7667
|
+
};
|
|
7668
|
+
syncMetadataRows(next);
|
|
7669
|
+
};
|
|
7670
|
+
const handleAddMetadataRow = () => {
|
|
7671
|
+
syncMetadataRows([...metadataRows, { key: "", value: "" }]);
|
|
7672
|
+
};
|
|
7673
|
+
const handleSave = async () => {
|
|
7674
|
+
try {
|
|
7675
|
+
setSaving(true);
|
|
7676
|
+
const headers = {
|
|
7677
|
+
"Content-Type": "application/json"
|
|
7678
|
+
};
|
|
7679
|
+
if (config.apiKey) {
|
|
7680
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
7681
|
+
}
|
|
7682
|
+
const requestBody = {
|
|
7683
|
+
name: draftSkill.name,
|
|
7684
|
+
description: draftSkill.description,
|
|
7685
|
+
license: draftSkill.license || void 0,
|
|
7686
|
+
compatibility: draftSkill.compatibility || void 0,
|
|
7687
|
+
metadata: draftSkill.metadata || void 0,
|
|
7688
|
+
content: draftSkill.content || void 0,
|
|
7689
|
+
subSkills: draftSkill.subSkills || void 0
|
|
7690
|
+
};
|
|
7691
|
+
const response = await fetch(
|
|
7692
|
+
`${config.baseURL}/api/skills/${currentSkill.id}`,
|
|
7693
|
+
{
|
|
7694
|
+
method: "PUT",
|
|
7695
|
+
headers,
|
|
7696
|
+
body: JSON.stringify(requestBody)
|
|
7697
|
+
}
|
|
7698
|
+
);
|
|
7699
|
+
const data2 = await response.json();
|
|
7700
|
+
if (response.ok && data2.success) {
|
|
7701
|
+
message5.success("Skill updated successfully");
|
|
7702
|
+
const updatedSkill = data2.data || draftSkill;
|
|
7703
|
+
setCurrentSkill(updatedSkill);
|
|
7704
|
+
setDraftSkill({ ...updatedSkill, id: updatedSkill.name });
|
|
7705
|
+
setMetadataRows(
|
|
7706
|
+
Object.entries(
|
|
7707
|
+
updatedSkill.metadata || {}
|
|
7708
|
+
).map(([key, value]) => ({ key, value }))
|
|
7709
|
+
);
|
|
7710
|
+
setIsEditing(false);
|
|
7711
|
+
onClick?.(updatedSkill);
|
|
7712
|
+
} else {
|
|
7713
|
+
message5.error(data2.message || "Failed to update skill");
|
|
7714
|
+
}
|
|
7715
|
+
} catch (error) {
|
|
7716
|
+
message5.error(
|
|
7717
|
+
error.message || "An error occurred while updating the skill"
|
|
7718
|
+
);
|
|
7719
|
+
} finally {
|
|
7720
|
+
setSaving(false);
|
|
7721
|
+
}
|
|
7722
|
+
};
|
|
7723
|
+
const editingView = /* @__PURE__ */ jsxs25(
|
|
7724
|
+
"div",
|
|
7725
|
+
{
|
|
7726
|
+
style: {
|
|
7727
|
+
display: "flex",
|
|
7728
|
+
flexDirection: "column",
|
|
7729
|
+
gap: 12
|
|
7730
|
+
},
|
|
7731
|
+
children: [
|
|
7732
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7733
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
|
|
7734
|
+
/* @__PURE__ */ jsx45(
|
|
7735
|
+
TextArea,
|
|
7736
|
+
{
|
|
7737
|
+
value: draftSkill.description,
|
|
7738
|
+
onChange: (e) => handleFieldChange("description", e.target.value),
|
|
7739
|
+
placeholder: "Description",
|
|
7740
|
+
autoSize: { minRows: 2, maxRows: 4 }
|
|
7741
|
+
}
|
|
7742
|
+
)
|
|
7743
|
+
] }),
|
|
7744
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7745
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
|
|
7746
|
+
/* @__PURE__ */ jsx45(
|
|
7747
|
+
Input,
|
|
7748
|
+
{
|
|
7749
|
+
value: draftSkill.license,
|
|
7750
|
+
onChange: (e) => handleFieldChange("license", e.target.value),
|
|
7751
|
+
placeholder: "License"
|
|
7752
|
+
}
|
|
7753
|
+
)
|
|
7754
|
+
] }),
|
|
7755
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7756
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
|
|
7757
|
+
/* @__PURE__ */ jsx45(
|
|
7758
|
+
Input,
|
|
7759
|
+
{
|
|
7760
|
+
value: draftSkill.compatibility,
|
|
7761
|
+
onChange: (e) => handleFieldChange("compatibility", e.target.value),
|
|
7762
|
+
placeholder: "Compatibility"
|
|
7763
|
+
}
|
|
7764
|
+
)
|
|
7765
|
+
] }),
|
|
7766
|
+
/* @__PURE__ */ jsxs25(
|
|
7767
|
+
"div",
|
|
7768
|
+
{
|
|
7769
|
+
style: {
|
|
7770
|
+
display: "flex",
|
|
7771
|
+
alignItems: "center",
|
|
7772
|
+
justifyContent: "space-between",
|
|
7773
|
+
gap: 8
|
|
7774
|
+
},
|
|
7775
|
+
children: [
|
|
7776
|
+
/* @__PURE__ */ jsx45(
|
|
7777
|
+
Text15,
|
|
7778
|
+
{
|
|
7779
|
+
style: {
|
|
7780
|
+
fontSize: 12,
|
|
7781
|
+
color: token.colorTextSecondary,
|
|
7782
|
+
fontWeight: 500
|
|
7783
|
+
},
|
|
7784
|
+
children: "Metadata"
|
|
7785
|
+
}
|
|
7786
|
+
),
|
|
7787
|
+
/* @__PURE__ */ jsx45(
|
|
7788
|
+
Button17,
|
|
7789
|
+
{
|
|
7790
|
+
size: "small",
|
|
7791
|
+
icon: /* @__PURE__ */ jsx45(PlusOutlined, {}),
|
|
7792
|
+
onClick: handleAddMetadataRow,
|
|
7793
|
+
children: "Add"
|
|
7794
|
+
}
|
|
7795
|
+
)
|
|
7796
|
+
]
|
|
7797
|
+
}
|
|
7798
|
+
),
|
|
7799
|
+
/* @__PURE__ */ jsxs25(Space16, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
|
|
7800
|
+
metadataRows.length === 0 && /* @__PURE__ */ jsx45(
|
|
7801
|
+
Text15,
|
|
7802
|
+
{
|
|
7803
|
+
style: {
|
|
7804
|
+
fontSize: 11,
|
|
7805
|
+
color: token.colorTextTertiary
|
|
7806
|
+
},
|
|
7807
|
+
children: "No metadata yet. Use Add to create one."
|
|
7808
|
+
}
|
|
7809
|
+
),
|
|
7810
|
+
metadataRows.map((row, index) => /* @__PURE__ */ jsxs25(
|
|
7811
|
+
"div",
|
|
7812
|
+
{
|
|
7813
|
+
style: {
|
|
7814
|
+
display: "flex",
|
|
7815
|
+
flexDirection: "column",
|
|
7816
|
+
gap: 4,
|
|
7817
|
+
width: "100%"
|
|
7818
|
+
},
|
|
7819
|
+
children: [
|
|
7820
|
+
/* @__PURE__ */ jsxs25(Text15, { style: { fontSize: 11, color: token.colorTextSecondary }, children: [
|
|
7821
|
+
"Meta ",
|
|
7822
|
+
index + 1
|
|
7823
|
+
] }),
|
|
7824
|
+
/* @__PURE__ */ jsxs25(Space16, { style: { width: "100%" }, size: 8, wrap: true, children: [
|
|
7825
|
+
/* @__PURE__ */ jsx45(
|
|
7826
|
+
Input,
|
|
7827
|
+
{
|
|
7828
|
+
value: row.key,
|
|
7829
|
+
placeholder: "Key",
|
|
7830
|
+
style: { width: 140 },
|
|
7831
|
+
onChange: (e) => handleMetadataChange(index, "key", e.target.value)
|
|
7832
|
+
}
|
|
7833
|
+
),
|
|
7834
|
+
/* @__PURE__ */ jsx45(
|
|
7835
|
+
Input,
|
|
7836
|
+
{
|
|
7837
|
+
value: row.value,
|
|
7838
|
+
placeholder: "Value",
|
|
7839
|
+
style: { flex: 1, minWidth: 200 },
|
|
7840
|
+
onChange: (e) => handleMetadataChange(index, "value", e.target.value)
|
|
7841
|
+
}
|
|
7842
|
+
)
|
|
7843
|
+
] })
|
|
7844
|
+
]
|
|
7845
|
+
},
|
|
7846
|
+
index
|
|
7847
|
+
))
|
|
7848
|
+
] }),
|
|
7849
|
+
/* @__PURE__ */ jsxs25("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
7850
|
+
/* @__PURE__ */ jsx45(Text15, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
|
|
7851
|
+
/* @__PURE__ */ jsx45(
|
|
7852
|
+
TextArea,
|
|
7853
|
+
{
|
|
7854
|
+
value: draftSkill.content,
|
|
7855
|
+
onChange: (e) => handleFieldChange("content", e.target.value),
|
|
7856
|
+
placeholder: "Content",
|
|
7857
|
+
autoSize: { minRows: 4, maxRows: 8 }
|
|
7858
|
+
}
|
|
7859
|
+
)
|
|
7860
|
+
] })
|
|
7861
|
+
]
|
|
7862
|
+
}
|
|
7863
|
+
);
|
|
7864
|
+
const detailCardContent = /* @__PURE__ */ jsxs25(
|
|
7865
|
+
"div",
|
|
7866
|
+
{
|
|
7867
|
+
style: {
|
|
7868
|
+
width: 480,
|
|
7869
|
+
maxHeight: "80vh",
|
|
7870
|
+
overflowY: "auto",
|
|
7871
|
+
padding: 16
|
|
7872
|
+
},
|
|
7873
|
+
children: [
|
|
7874
|
+
/* @__PURE__ */ jsx45(
|
|
7875
|
+
"div",
|
|
7876
|
+
{
|
|
7877
|
+
style: {
|
|
7878
|
+
display: "flex",
|
|
7879
|
+
alignItems: "flex-start",
|
|
7880
|
+
justifyContent: "space-between",
|
|
7881
|
+
marginBottom: 16
|
|
7882
|
+
},
|
|
7883
|
+
children: /* @__PURE__ */ jsxs25("div", { style: { flex: 1 }, children: [
|
|
7884
|
+
/* @__PURE__ */ jsxs25(
|
|
7885
|
+
"div",
|
|
7886
|
+
{
|
|
7887
|
+
style: {
|
|
7888
|
+
display: "flex",
|
|
7889
|
+
alignItems: "center",
|
|
7890
|
+
gap: 8,
|
|
7891
|
+
marginBottom: 8
|
|
7892
|
+
},
|
|
7893
|
+
children: [
|
|
7894
|
+
/* @__PURE__ */ jsx45(
|
|
7895
|
+
Text15,
|
|
7896
|
+
{
|
|
7897
|
+
strong: true,
|
|
7898
|
+
style: {
|
|
7899
|
+
fontSize: 18,
|
|
7900
|
+
fontWeight: 600,
|
|
7901
|
+
color: token.colorText
|
|
7902
|
+
},
|
|
7903
|
+
children: currentSkill.name
|
|
7904
|
+
}
|
|
7905
|
+
),
|
|
7906
|
+
/* @__PURE__ */ jsx45(
|
|
7907
|
+
Tag7,
|
|
7908
|
+
{
|
|
7909
|
+
style: {
|
|
7910
|
+
margin: 0,
|
|
7911
|
+
fontSize: 10,
|
|
7912
|
+
padding: "2px 8px",
|
|
7913
|
+
fontWeight: 600
|
|
7914
|
+
},
|
|
7915
|
+
color: "geekblue",
|
|
7916
|
+
children: category.toUpperCase()
|
|
7917
|
+
}
|
|
7918
|
+
)
|
|
7919
|
+
]
|
|
7920
|
+
}
|
|
7921
|
+
),
|
|
7922
|
+
/* @__PURE__ */ jsx45(
|
|
7923
|
+
"div",
|
|
7924
|
+
{
|
|
7925
|
+
style: {
|
|
7926
|
+
display: "flex",
|
|
7927
|
+
alignItems: "center",
|
|
7928
|
+
gap: 6
|
|
7929
|
+
},
|
|
7930
|
+
children: /* @__PURE__ */ jsx45(
|
|
7931
|
+
Text15,
|
|
7932
|
+
{
|
|
7933
|
+
style: {
|
|
7934
|
+
fontSize: 11,
|
|
7935
|
+
color: token.colorTextTertiary,
|
|
7936
|
+
fontFamily: "monospace"
|
|
7937
|
+
},
|
|
7938
|
+
children: `>_ ${currentSkill.id}`
|
|
7939
|
+
}
|
|
7940
|
+
)
|
|
7941
|
+
}
|
|
7942
|
+
)
|
|
7943
|
+
] })
|
|
7944
|
+
}
|
|
7945
|
+
),
|
|
7946
|
+
isEditing ? editingView : /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
7947
|
+
currentSkill.description && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(
|
|
7948
|
+
Text15,
|
|
7949
|
+
{
|
|
7950
|
+
style: {
|
|
7951
|
+
fontSize: 12,
|
|
7952
|
+
color: token.colorText,
|
|
7953
|
+
lineHeight: 1.6,
|
|
7954
|
+
fontStyle: "italic"
|
|
7955
|
+
},
|
|
7956
|
+
children: [
|
|
7957
|
+
'"',
|
|
7958
|
+
currentSkill.description,
|
|
7959
|
+
'"'
|
|
7960
|
+
]
|
|
7961
|
+
}
|
|
7962
|
+
) }),
|
|
7963
|
+
metadataEntries.length > 0 && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 16 }, children: [
|
|
7964
|
+
/* @__PURE__ */ jsxs25(
|
|
7965
|
+
"div",
|
|
7966
|
+
{
|
|
7967
|
+
style: {
|
|
7968
|
+
display: "flex",
|
|
7969
|
+
alignItems: "center",
|
|
7970
|
+
gap: 8,
|
|
7971
|
+
marginBottom: 8
|
|
7972
|
+
},
|
|
7973
|
+
children: [
|
|
7974
|
+
/* @__PURE__ */ jsx45(
|
|
7975
|
+
InfoCircleOutlined3,
|
|
7976
|
+
{
|
|
7977
|
+
style: {
|
|
7978
|
+
fontSize: 14,
|
|
7979
|
+
color: token.colorTextSecondary
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
),
|
|
7983
|
+
/* @__PURE__ */ jsxs25(
|
|
7984
|
+
Text15,
|
|
7985
|
+
{
|
|
7986
|
+
style: {
|
|
7987
|
+
fontSize: 12,
|
|
7988
|
+
color: token.colorTextSecondary,
|
|
7989
|
+
fontWeight: 500
|
|
7990
|
+
},
|
|
7991
|
+
children: [
|
|
7992
|
+
"Metadata (",
|
|
7993
|
+
metadataEntries.length,
|
|
7994
|
+
")"
|
|
7995
|
+
]
|
|
7996
|
+
}
|
|
7997
|
+
)
|
|
7998
|
+
]
|
|
7999
|
+
}
|
|
8000
|
+
),
|
|
8001
|
+
/* @__PURE__ */ jsx45(
|
|
8002
|
+
"div",
|
|
8003
|
+
{
|
|
8004
|
+
style: {
|
|
8005
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
8006
|
+
borderRadius: 6,
|
|
8007
|
+
overflow: "hidden"
|
|
8008
|
+
},
|
|
8009
|
+
children: metadataEntries.map(([key, value], index) => /* @__PURE__ */ jsxs25(
|
|
8010
|
+
"div",
|
|
8011
|
+
{
|
|
8012
|
+
style: {
|
|
8013
|
+
display: "flex",
|
|
8014
|
+
alignItems: "stretch",
|
|
8015
|
+
borderBottom: index === metadataEntries.length - 1 ? "none" : `1px solid ${token.colorBorderSecondary}`
|
|
8016
|
+
},
|
|
8017
|
+
children: [
|
|
8018
|
+
/* @__PURE__ */ jsx45(
|
|
8019
|
+
"div",
|
|
8020
|
+
{
|
|
8021
|
+
style: {
|
|
8022
|
+
width: 140,
|
|
8023
|
+
padding: "8px 10px",
|
|
8024
|
+
background: token.colorFillTertiary,
|
|
8025
|
+
borderRight: `1px solid ${token.colorBorderSecondary}`,
|
|
8026
|
+
fontSize: 11,
|
|
8027
|
+
color: token.colorTextSecondary,
|
|
8028
|
+
fontWeight: 600,
|
|
8029
|
+
textTransform: "capitalize"
|
|
8030
|
+
},
|
|
8031
|
+
children: key
|
|
8032
|
+
}
|
|
8033
|
+
),
|
|
8034
|
+
/* @__PURE__ */ jsx45(
|
|
8035
|
+
"div",
|
|
8036
|
+
{
|
|
8037
|
+
style: {
|
|
8038
|
+
flex: 1,
|
|
8039
|
+
padding: "8px 10px",
|
|
8040
|
+
fontSize: 11,
|
|
8041
|
+
color: token.colorText,
|
|
8042
|
+
wordBreak: "break-word"
|
|
8043
|
+
},
|
|
8044
|
+
children: value
|
|
8045
|
+
}
|
|
8046
|
+
)
|
|
8047
|
+
]
|
|
8048
|
+
},
|
|
8049
|
+
key
|
|
8050
|
+
))
|
|
8051
|
+
}
|
|
8052
|
+
)
|
|
8053
|
+
] }),
|
|
8054
|
+
hasSubSkills && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 16 }, children: [
|
|
8055
|
+
/* @__PURE__ */ jsxs25(
|
|
8056
|
+
"div",
|
|
8057
|
+
{
|
|
8058
|
+
style: {
|
|
8059
|
+
display: "flex",
|
|
8060
|
+
alignItems: "center",
|
|
8061
|
+
gap: 8,
|
|
8062
|
+
marginBottom: 8
|
|
8063
|
+
},
|
|
8064
|
+
children: [
|
|
8065
|
+
/* @__PURE__ */ jsx45(
|
|
8066
|
+
BranchesOutlined2,
|
|
8067
|
+
{
|
|
8068
|
+
style: {
|
|
8069
|
+
fontSize: 14,
|
|
8070
|
+
color: token.colorTextSecondary
|
|
8071
|
+
}
|
|
8072
|
+
}
|
|
8073
|
+
),
|
|
8074
|
+
/* @__PURE__ */ jsxs25(
|
|
8075
|
+
Text15,
|
|
8076
|
+
{
|
|
8077
|
+
style: {
|
|
8078
|
+
fontSize: 12,
|
|
8079
|
+
color: token.colorTextSecondary,
|
|
8080
|
+
fontWeight: 500
|
|
8081
|
+
},
|
|
8082
|
+
children: [
|
|
8083
|
+
"Sub-Skills (",
|
|
8084
|
+
currentSkill.subSkills.length,
|
|
8085
|
+
")"
|
|
8086
|
+
]
|
|
8087
|
+
}
|
|
8088
|
+
)
|
|
8089
|
+
]
|
|
8090
|
+
}
|
|
8091
|
+
),
|
|
8092
|
+
/* @__PURE__ */ jsx45(Space16, { size: [8, 8], wrap: true, children: currentSkill.subSkills.map(
|
|
8093
|
+
(subSkill, index) => /* @__PURE__ */ jsx45(
|
|
8094
|
+
Tag7,
|
|
8095
|
+
{
|
|
8096
|
+
style: {
|
|
8097
|
+
fontSize: 11,
|
|
8098
|
+
padding: "4px 12px",
|
|
8099
|
+
backgroundColor: token.colorFillTertiary,
|
|
8100
|
+
color: token.colorText,
|
|
8101
|
+
border: `1px solid ${token.colorBorderSecondary}`
|
|
8102
|
+
},
|
|
8103
|
+
children: subSkill
|
|
8104
|
+
},
|
|
8105
|
+
index
|
|
8106
|
+
)
|
|
8107
|
+
) })
|
|
8108
|
+
] }),
|
|
8109
|
+
(currentSkill.license || currentSkill.compatibility) && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(Space16, { size: [8, 8], wrap: true, children: [
|
|
8110
|
+
currentSkill.license && /* @__PURE__ */ jsx45(
|
|
8111
|
+
Tag7,
|
|
8112
|
+
{
|
|
8113
|
+
icon: /* @__PURE__ */ jsx45(CopyrightOutlined, {}),
|
|
8114
|
+
style: {
|
|
8115
|
+
margin: 0,
|
|
8116
|
+
fontSize: 11,
|
|
8117
|
+
padding: "4px 12px",
|
|
8118
|
+
borderRadius: 6,
|
|
8119
|
+
backgroundColor: token.colorInfoBg,
|
|
8120
|
+
color: token.colorInfo,
|
|
8121
|
+
border: `1px solid ${token.colorInfoBorder}`,
|
|
8122
|
+
fontWeight: 500,
|
|
8123
|
+
lineHeight: "16px"
|
|
8124
|
+
},
|
|
8125
|
+
children: currentSkill.license
|
|
8126
|
+
}
|
|
8127
|
+
),
|
|
8128
|
+
currentSkill.compatibility && /* @__PURE__ */ jsx45(
|
|
8129
|
+
Tag7,
|
|
8130
|
+
{
|
|
8131
|
+
style: {
|
|
8132
|
+
margin: 0,
|
|
8133
|
+
fontSize: 11,
|
|
8134
|
+
padding: "4px 12px",
|
|
8135
|
+
borderRadius: 6,
|
|
8136
|
+
backgroundColor: token.colorSuccessBg,
|
|
8137
|
+
color: token.colorSuccess,
|
|
8138
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8139
|
+
fontWeight: 500,
|
|
8140
|
+
lineHeight: "16px",
|
|
8141
|
+
display: "inline-flex",
|
|
8142
|
+
alignItems: "center",
|
|
8143
|
+
gap: 4
|
|
8144
|
+
},
|
|
8145
|
+
children: currentSkill.compatibility
|
|
8146
|
+
}
|
|
8147
|
+
)
|
|
8148
|
+
] }) }),
|
|
8149
|
+
(currentSkill.createdAt || currentSkill.updatedAt) && /* @__PURE__ */ jsx45("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxs25(Space16, { direction: "vertical", size: 4, children: [
|
|
8150
|
+
currentSkill.createdAt && /* @__PURE__ */ jsxs25(
|
|
8151
|
+
Text15,
|
|
8152
|
+
{
|
|
8153
|
+
style: {
|
|
8154
|
+
fontSize: 11,
|
|
8155
|
+
color: token.colorTextTertiary,
|
|
8156
|
+
fontFamily: "monospace"
|
|
8157
|
+
},
|
|
8158
|
+
children: [
|
|
8159
|
+
"Created: ",
|
|
8160
|
+
formatDate(currentSkill.createdAt)
|
|
8161
|
+
]
|
|
8162
|
+
}
|
|
8163
|
+
),
|
|
8164
|
+
currentSkill.updatedAt && /* @__PURE__ */ jsxs25(
|
|
8165
|
+
Text15,
|
|
8166
|
+
{
|
|
8167
|
+
style: {
|
|
8168
|
+
fontSize: 11,
|
|
8169
|
+
color: token.colorTextTertiary,
|
|
8170
|
+
fontFamily: "monospace"
|
|
8171
|
+
},
|
|
8172
|
+
children: [
|
|
8173
|
+
"Updated: ",
|
|
8174
|
+
formatDate(currentSkill.updatedAt)
|
|
8175
|
+
]
|
|
8176
|
+
}
|
|
8177
|
+
)
|
|
8178
|
+
] }) }),
|
|
8179
|
+
currentSkill.content && /* @__PURE__ */ jsxs25("div", { style: { marginBottom: 0 }, children: [
|
|
8180
|
+
/* @__PURE__ */ jsxs25(
|
|
8181
|
+
"div",
|
|
8182
|
+
{
|
|
8183
|
+
style: {
|
|
8184
|
+
display: "flex",
|
|
8185
|
+
alignItems: "center",
|
|
8186
|
+
gap: 8,
|
|
8187
|
+
marginBottom: 8
|
|
8188
|
+
},
|
|
8189
|
+
children: [
|
|
8190
|
+
/* @__PURE__ */ jsx45(
|
|
8191
|
+
FileTextOutlined5,
|
|
8192
|
+
{
|
|
8193
|
+
style: {
|
|
8194
|
+
fontSize: 14,
|
|
8195
|
+
color: token.colorTextSecondary
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
),
|
|
8199
|
+
/* @__PURE__ */ jsx45(
|
|
8200
|
+
Text15,
|
|
8201
|
+
{
|
|
8202
|
+
style: {
|
|
8203
|
+
fontSize: 12,
|
|
8204
|
+
color: token.colorTextSecondary,
|
|
8205
|
+
fontWeight: 600,
|
|
8206
|
+
letterSpacing: 0.5
|
|
8207
|
+
},
|
|
8208
|
+
children: "CONTENT"
|
|
8209
|
+
}
|
|
8210
|
+
)
|
|
8211
|
+
]
|
|
8212
|
+
}
|
|
8213
|
+
),
|
|
8214
|
+
/* @__PURE__ */ jsx45(
|
|
8215
|
+
"div",
|
|
8216
|
+
{
|
|
8217
|
+
style: {
|
|
8218
|
+
padding: 12,
|
|
8219
|
+
background: token.colorFillTertiary,
|
|
8220
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
8221
|
+
borderRadius: 4,
|
|
8222
|
+
maxHeight: 200,
|
|
8223
|
+
overflowY: "auto"
|
|
8224
|
+
},
|
|
8225
|
+
children: /* @__PURE__ */ jsx45(
|
|
8226
|
+
Text15,
|
|
8227
|
+
{
|
|
8228
|
+
style: {
|
|
8229
|
+
fontSize: 11,
|
|
8230
|
+
color: token.colorText,
|
|
8231
|
+
lineHeight: 1.6,
|
|
8232
|
+
whiteSpace: "pre-wrap"
|
|
8233
|
+
},
|
|
8234
|
+
children: currentSkill.content
|
|
8235
|
+
}
|
|
8236
|
+
)
|
|
8237
|
+
}
|
|
8238
|
+
)
|
|
8239
|
+
] })
|
|
8240
|
+
] }),
|
|
8241
|
+
/* @__PURE__ */ jsx45(Divider3, { style: { margin: "16px 0" } }),
|
|
8242
|
+
/* @__PURE__ */ jsx45(
|
|
8243
|
+
"div",
|
|
8244
|
+
{
|
|
8245
|
+
style: {
|
|
8246
|
+
display: "flex",
|
|
8247
|
+
alignItems: "center",
|
|
8248
|
+
justifyContent: "space-between",
|
|
8249
|
+
gap: 8
|
|
8250
|
+
},
|
|
8251
|
+
children: isEditing ? /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
8252
|
+
/* @__PURE__ */ jsx45(
|
|
8253
|
+
Button17,
|
|
8254
|
+
{
|
|
8255
|
+
block: true,
|
|
8256
|
+
onClick: () => {
|
|
8257
|
+
setIsEditing(false);
|
|
8258
|
+
setDraftSkill(skill);
|
|
8259
|
+
},
|
|
8260
|
+
style: {
|
|
8261
|
+
flex: 1
|
|
8262
|
+
},
|
|
8263
|
+
children: "Cancel"
|
|
8264
|
+
}
|
|
8265
|
+
),
|
|
8266
|
+
/* @__PURE__ */ jsx45(
|
|
8267
|
+
Button17,
|
|
8268
|
+
{
|
|
8269
|
+
type: "primary",
|
|
8270
|
+
block: true,
|
|
8271
|
+
onClick: handleSave,
|
|
8272
|
+
loading: saving,
|
|
8273
|
+
style: {
|
|
8274
|
+
flex: 1
|
|
8275
|
+
},
|
|
8276
|
+
children: "Save"
|
|
8277
|
+
}
|
|
8278
|
+
)
|
|
8279
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
8280
|
+
/* @__PURE__ */ jsx45(
|
|
8281
|
+
Button17,
|
|
8282
|
+
{
|
|
8283
|
+
type: "primary",
|
|
8284
|
+
block: true,
|
|
8285
|
+
onClick: () => setIsEditing(true),
|
|
8286
|
+
style: {
|
|
8287
|
+
flex: 1
|
|
8288
|
+
},
|
|
8289
|
+
children: "Edit Skill"
|
|
8290
|
+
}
|
|
8291
|
+
),
|
|
8292
|
+
/* @__PURE__ */ jsx45(
|
|
8293
|
+
Button17,
|
|
8294
|
+
{
|
|
8295
|
+
danger: true,
|
|
8296
|
+
onClick: (e) => {
|
|
8297
|
+
e.stopPropagation();
|
|
8298
|
+
handleDelete(e);
|
|
8299
|
+
},
|
|
8300
|
+
children: "Delete"
|
|
8301
|
+
}
|
|
8302
|
+
),
|
|
8303
|
+
/* @__PURE__ */ jsx45(
|
|
8304
|
+
Button17,
|
|
8305
|
+
{
|
|
8306
|
+
icon: /* @__PURE__ */ jsx45(CopyOutlined3, {}),
|
|
8307
|
+
onClick: () => handleCopy(currentSkill.id),
|
|
8308
|
+
title: "Copy ID"
|
|
8309
|
+
}
|
|
8310
|
+
)
|
|
8311
|
+
] })
|
|
8312
|
+
}
|
|
8313
|
+
)
|
|
8314
|
+
]
|
|
8315
|
+
}
|
|
8316
|
+
);
|
|
8317
|
+
const hiddenHandleStyle = {
|
|
8318
|
+
opacity: 0,
|
|
8319
|
+
background: "transparent",
|
|
8320
|
+
border: "none",
|
|
8321
|
+
width: 0,
|
|
8322
|
+
height: 0,
|
|
8323
|
+
pointerEvents: "none"
|
|
8324
|
+
};
|
|
8325
|
+
return /* @__PURE__ */ jsxs25(
|
|
8326
|
+
"div",
|
|
8327
|
+
{
|
|
8328
|
+
style: {
|
|
8329
|
+
padding: 4
|
|
8330
|
+
},
|
|
8331
|
+
children: [
|
|
8332
|
+
/* @__PURE__ */ jsx45(
|
|
8333
|
+
Handle2,
|
|
8334
|
+
{
|
|
8335
|
+
type: "target",
|
|
8336
|
+
position: Position2.Top,
|
|
8337
|
+
style: hiddenHandleStyle,
|
|
8338
|
+
isConnectable: false
|
|
8339
|
+
}
|
|
8340
|
+
),
|
|
8341
|
+
/* @__PURE__ */ jsx45(
|
|
8342
|
+
"div",
|
|
8343
|
+
{
|
|
8344
|
+
onClick: () => {
|
|
8345
|
+
setIsModalOpen(true);
|
|
8346
|
+
},
|
|
8347
|
+
style: {
|
|
8348
|
+
width: 280,
|
|
8349
|
+
minHeight: 200,
|
|
8350
|
+
background: token.colorBgContainer,
|
|
8351
|
+
borderRadius: 8,
|
|
8352
|
+
boxShadow: `0 1px 6px rgba(0, 0, 0, 0.08)`,
|
|
8353
|
+
cursor: onClick ? "pointer" : "default",
|
|
8354
|
+
overflow: "hidden",
|
|
8355
|
+
transition: "all 0.2s ease",
|
|
8356
|
+
position: "relative",
|
|
8357
|
+
border: `1px solid ${token.colorBorder}`,
|
|
8358
|
+
display: "flex",
|
|
8359
|
+
flexDirection: "column"
|
|
8360
|
+
},
|
|
8361
|
+
onMouseEnter: (e) => {
|
|
8362
|
+
if (onClick) {
|
|
8363
|
+
e.currentTarget.style.transform = "translateY(-2px)";
|
|
8364
|
+
e.currentTarget.style.boxShadow = `0 2px 8px rgba(0, 0, 0, 0.12)`;
|
|
8365
|
+
}
|
|
8366
|
+
},
|
|
8367
|
+
onMouseLeave: (e) => {
|
|
8368
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
8369
|
+
e.currentTarget.style.boxShadow = `0 1px 4px rgba(0, 0, 0, 0.08)`;
|
|
8370
|
+
},
|
|
8371
|
+
children: /* @__PURE__ */ jsxs25(
|
|
8372
|
+
"div",
|
|
8373
|
+
{
|
|
8374
|
+
style: {
|
|
8375
|
+
padding: 12,
|
|
8376
|
+
display: "flex",
|
|
8377
|
+
flexDirection: "column",
|
|
8378
|
+
gap: 10
|
|
8379
|
+
},
|
|
8380
|
+
children: [
|
|
8381
|
+
/* @__PURE__ */ jsxs25(
|
|
8382
|
+
"div",
|
|
8383
|
+
{
|
|
8384
|
+
style: {
|
|
8385
|
+
display: "flex",
|
|
8386
|
+
alignItems: "flex-start",
|
|
8387
|
+
gap: 10
|
|
8388
|
+
},
|
|
8389
|
+
children: [
|
|
8390
|
+
/* @__PURE__ */ jsxs25(
|
|
8391
|
+
"div",
|
|
8392
|
+
{
|
|
8393
|
+
style: {
|
|
8394
|
+
position: "relative",
|
|
8395
|
+
flexShrink: 0
|
|
8396
|
+
},
|
|
8397
|
+
children: [
|
|
8398
|
+
/* @__PURE__ */ jsx45(
|
|
8399
|
+
Avatar6,
|
|
8400
|
+
{
|
|
8401
|
+
size: 44,
|
|
8402
|
+
icon: /* @__PURE__ */ jsx45(BookOutlined, {}),
|
|
8403
|
+
style: {
|
|
8404
|
+
backgroundColor: badgeColor,
|
|
8405
|
+
color: "#fff",
|
|
8406
|
+
fontSize: 16,
|
|
8407
|
+
fontWeight: 600
|
|
8408
|
+
},
|
|
8409
|
+
children: initials
|
|
8410
|
+
}
|
|
8411
|
+
),
|
|
8412
|
+
hasSubSkills && /* @__PURE__ */ jsx45(
|
|
8413
|
+
"div",
|
|
8414
|
+
{
|
|
8415
|
+
style: {
|
|
8416
|
+
position: "absolute",
|
|
8417
|
+
bottom: -2,
|
|
8418
|
+
right: -2,
|
|
8419
|
+
width: 18,
|
|
8420
|
+
height: 18,
|
|
8421
|
+
borderRadius: "50%",
|
|
8422
|
+
background: token.colorPrimary,
|
|
8423
|
+
border: `2px solid ${token.colorBgContainer}`,
|
|
8424
|
+
display: "flex",
|
|
8425
|
+
alignItems: "center",
|
|
8426
|
+
justifyContent: "center"
|
|
8427
|
+
},
|
|
8428
|
+
children: /* @__PURE__ */ jsx45(
|
|
8429
|
+
BranchesOutlined2,
|
|
8430
|
+
{
|
|
8431
|
+
style: {
|
|
8432
|
+
fontSize: 10,
|
|
8433
|
+
color: "#fff"
|
|
8434
|
+
}
|
|
8435
|
+
}
|
|
8436
|
+
)
|
|
8437
|
+
}
|
|
8438
|
+
)
|
|
8439
|
+
]
|
|
8440
|
+
}
|
|
8441
|
+
),
|
|
8442
|
+
/* @__PURE__ */ jsxs25(
|
|
8443
|
+
"div",
|
|
8444
|
+
{
|
|
8445
|
+
style: {
|
|
8446
|
+
flex: 1,
|
|
8447
|
+
minWidth: 0
|
|
8448
|
+
},
|
|
8449
|
+
children: [
|
|
8450
|
+
/* @__PURE__ */ jsx45(
|
|
8451
|
+
Text15,
|
|
8452
|
+
{
|
|
8453
|
+
strong: true,
|
|
8454
|
+
style: {
|
|
8455
|
+
fontSize: 14,
|
|
8456
|
+
fontWeight: 600,
|
|
8457
|
+
display: "block",
|
|
8458
|
+
marginBottom: 3,
|
|
8459
|
+
color: token.colorText,
|
|
8460
|
+
lineHeight: 1.3
|
|
8461
|
+
},
|
|
8462
|
+
ellipsis: { tooltip: currentSkill.name },
|
|
8463
|
+
children: currentSkill.name
|
|
8464
|
+
}
|
|
8465
|
+
),
|
|
8466
|
+
/* @__PURE__ */ jsxs25(
|
|
8467
|
+
"div",
|
|
8468
|
+
{
|
|
8469
|
+
style: {
|
|
8470
|
+
display: "flex",
|
|
8471
|
+
alignItems: "center",
|
|
8472
|
+
gap: 4
|
|
8473
|
+
},
|
|
8474
|
+
children: [
|
|
8475
|
+
/* @__PURE__ */ jsx45(
|
|
8476
|
+
FileTextOutlined5,
|
|
8477
|
+
{
|
|
8478
|
+
style: {
|
|
8479
|
+
fontSize: 9,
|
|
8480
|
+
color: token.colorTextTertiary
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
),
|
|
8484
|
+
/* @__PURE__ */ jsx45(
|
|
8485
|
+
Text15,
|
|
8486
|
+
{
|
|
8487
|
+
style: {
|
|
8488
|
+
fontSize: 9,
|
|
8489
|
+
color: token.colorTextTertiary
|
|
8490
|
+
},
|
|
8491
|
+
ellipsis: { tooltip: currentSkill.id },
|
|
8492
|
+
children: currentSkill.id
|
|
8493
|
+
}
|
|
8494
|
+
)
|
|
8495
|
+
]
|
|
8496
|
+
}
|
|
8497
|
+
)
|
|
8498
|
+
]
|
|
8499
|
+
}
|
|
8500
|
+
)
|
|
8501
|
+
]
|
|
8502
|
+
}
|
|
8503
|
+
),
|
|
8504
|
+
currentSkill.description && /* @__PURE__ */ jsx45(
|
|
8505
|
+
"div",
|
|
8506
|
+
{
|
|
8507
|
+
style: {
|
|
8508
|
+
padding: 8,
|
|
8509
|
+
background: token.colorFillTertiary,
|
|
8510
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
8511
|
+
borderRadius: 4,
|
|
8512
|
+
borderLeft: `2px solid ${badgeColor}`
|
|
8513
|
+
},
|
|
8514
|
+
children: /* @__PURE__ */ jsx45(
|
|
8515
|
+
Tooltip7,
|
|
8516
|
+
{
|
|
8517
|
+
title: currentSkill.description.length > 150 ? currentSkill.description : void 0,
|
|
8518
|
+
placement: "top",
|
|
8519
|
+
children: /* @__PURE__ */ jsxs25(
|
|
8520
|
+
"div",
|
|
8521
|
+
{
|
|
8522
|
+
style: {
|
|
8523
|
+
fontSize: 10,
|
|
8524
|
+
color: token.colorText,
|
|
8525
|
+
lineHeight: 1.5,
|
|
8526
|
+
fontStyle: "italic",
|
|
8527
|
+
display: "-webkit-box",
|
|
8528
|
+
WebkitLineClamp: 3,
|
|
8529
|
+
WebkitBoxOrient: "vertical",
|
|
8530
|
+
overflow: "hidden",
|
|
8531
|
+
textOverflow: "ellipsis",
|
|
8532
|
+
cursor: currentSkill.description.length > 150 ? "help" : "default"
|
|
8533
|
+
},
|
|
8534
|
+
children: [
|
|
8535
|
+
'"',
|
|
8536
|
+
currentSkill.description,
|
|
8537
|
+
'"'
|
|
8538
|
+
]
|
|
8539
|
+
}
|
|
8540
|
+
)
|
|
8541
|
+
}
|
|
8542
|
+
)
|
|
8543
|
+
}
|
|
8544
|
+
),
|
|
8545
|
+
/* @__PURE__ */ jsxs25(
|
|
8546
|
+
"div",
|
|
8547
|
+
{
|
|
8548
|
+
style: {
|
|
8549
|
+
display: "flex",
|
|
8550
|
+
flexWrap: "wrap",
|
|
8551
|
+
gap: 4,
|
|
8552
|
+
padding: "4px 0",
|
|
8553
|
+
marginTop: "auto"
|
|
8554
|
+
},
|
|
8555
|
+
children: [
|
|
8556
|
+
/* @__PURE__ */ jsx45(
|
|
8557
|
+
Tag7,
|
|
8558
|
+
{
|
|
8559
|
+
style: {
|
|
8560
|
+
margin: 0,
|
|
8561
|
+
fontSize: 8,
|
|
8562
|
+
padding: "2px 6px",
|
|
8563
|
+
borderRadius: 6,
|
|
8564
|
+
backgroundColor: token.colorPrimaryBg,
|
|
8565
|
+
color: token.colorPrimary,
|
|
8566
|
+
border: `1px solid ${token.colorPrimaryBorder}`,
|
|
8567
|
+
fontWeight: 600,
|
|
8568
|
+
lineHeight: "14px",
|
|
8569
|
+
textTransform: "capitalize"
|
|
8570
|
+
},
|
|
8571
|
+
children: category.toUpperCase()
|
|
8572
|
+
}
|
|
8573
|
+
),
|
|
8574
|
+
hasSubSkills && /* @__PURE__ */ jsxs25(
|
|
8575
|
+
Tag7,
|
|
8576
|
+
{
|
|
8577
|
+
style: {
|
|
8578
|
+
margin: 0,
|
|
8579
|
+
fontSize: 8,
|
|
8580
|
+
padding: "2px 6px",
|
|
8581
|
+
borderRadius: 6,
|
|
8582
|
+
backgroundColor: token.colorSuccessBg,
|
|
8583
|
+
color: token.colorSuccess,
|
|
8584
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8585
|
+
fontWeight: 500,
|
|
8586
|
+
lineHeight: "14px",
|
|
8587
|
+
display: "inline-flex",
|
|
8588
|
+
alignItems: "center"
|
|
8589
|
+
},
|
|
8590
|
+
children: [
|
|
8591
|
+
"SUB-SKILLS (",
|
|
8592
|
+
currentSkill.subSkills.length,
|
|
8593
|
+
")"
|
|
8594
|
+
]
|
|
8595
|
+
}
|
|
8596
|
+
),
|
|
8597
|
+
currentSkill.license && /* @__PURE__ */ jsx45(
|
|
8598
|
+
Tag7,
|
|
8599
|
+
{
|
|
8600
|
+
style: {
|
|
8601
|
+
margin: 0,
|
|
8602
|
+
fontSize: 7,
|
|
8603
|
+
padding: "2px 6px",
|
|
8604
|
+
borderRadius: 6,
|
|
8605
|
+
backgroundColor: token.colorInfoBg,
|
|
8606
|
+
color: token.colorInfo,
|
|
8607
|
+
border: `1px solid ${token.colorInfoBorder}`,
|
|
8608
|
+
fontWeight: 500,
|
|
8609
|
+
lineHeight: "14px"
|
|
8610
|
+
},
|
|
8611
|
+
icon: /* @__PURE__ */ jsx45(CopyrightOutlined, {}),
|
|
8612
|
+
children: currentSkill.license
|
|
8613
|
+
}
|
|
8614
|
+
),
|
|
8615
|
+
currentSkill.compatibility && /* @__PURE__ */ jsx45(
|
|
8616
|
+
Tag7,
|
|
8617
|
+
{
|
|
8618
|
+
style: {
|
|
8619
|
+
margin: 0,
|
|
8620
|
+
fontSize: 7,
|
|
8621
|
+
padding: "2px 6px",
|
|
8622
|
+
borderRadius: 6,
|
|
8623
|
+
backgroundColor: token.colorSuccessBg,
|
|
8624
|
+
color: token.colorSuccess,
|
|
8625
|
+
border: `1px solid ${token.colorSuccessBorder}`,
|
|
8626
|
+
fontWeight: 500,
|
|
8627
|
+
lineHeight: "14px"
|
|
8628
|
+
},
|
|
8629
|
+
icon: /* @__PURE__ */ jsx45(InfoCircleOutlined3, {}),
|
|
8630
|
+
children: currentSkill.compatibility
|
|
8631
|
+
}
|
|
8632
|
+
)
|
|
8633
|
+
]
|
|
8634
|
+
}
|
|
8635
|
+
)
|
|
8636
|
+
]
|
|
8637
|
+
}
|
|
8638
|
+
)
|
|
8639
|
+
}
|
|
8640
|
+
),
|
|
8641
|
+
/* @__PURE__ */ jsx45(
|
|
8642
|
+
Modal,
|
|
8643
|
+
{
|
|
8644
|
+
open: isModalOpen,
|
|
8645
|
+
onCancel: () => {
|
|
8646
|
+
setIsModalOpen(false);
|
|
8647
|
+
setIsEditing(false);
|
|
8648
|
+
setDraftSkill({ ...currentSkill, id: currentSkill.name });
|
|
8649
|
+
},
|
|
8650
|
+
footer: null,
|
|
8651
|
+
width: 520,
|
|
8652
|
+
destroyOnClose: true,
|
|
8653
|
+
title: null,
|
|
8654
|
+
styles: {
|
|
8655
|
+
body: { padding: 0 }
|
|
8656
|
+
},
|
|
8657
|
+
children: detailCardContent
|
|
8658
|
+
}
|
|
8659
|
+
),
|
|
8660
|
+
/* @__PURE__ */ jsx45(
|
|
8661
|
+
Handle2,
|
|
8662
|
+
{
|
|
8663
|
+
type: "source",
|
|
8664
|
+
position: Position2.Bottom,
|
|
8665
|
+
style: hiddenHandleStyle,
|
|
8666
|
+
isConnectable: false
|
|
8667
|
+
}
|
|
8668
|
+
)
|
|
8669
|
+
]
|
|
8670
|
+
}
|
|
8671
|
+
);
|
|
8672
|
+
};
|
|
8673
|
+
var SkillNode_default = SkillNode;
|
|
8674
|
+
|
|
8675
|
+
// src/components/Chat/CreateSkillModal.tsx
|
|
8676
|
+
import { useState as useState26 } from "react";
|
|
8677
|
+
import {
|
|
8678
|
+
Modal as Modal2,
|
|
8679
|
+
Form,
|
|
8680
|
+
Input as Input2,
|
|
8681
|
+
Button as Button18,
|
|
8682
|
+
message as message6,
|
|
8683
|
+
Space as Space17,
|
|
8684
|
+
Typography as Typography18
|
|
8685
|
+
} from "antd";
|
|
8686
|
+
import { PlusOutlined as PlusOutlined2 } from "@ant-design/icons";
|
|
8687
|
+
import { theme as theme5 } from "antd";
|
|
8688
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8689
|
+
var { TextArea: TextArea2 } = Input2;
|
|
8690
|
+
var { Text: Text16 } = Typography18;
|
|
8691
|
+
var CreateSkillModal = ({
|
|
8692
|
+
open,
|
|
8693
|
+
onCancel,
|
|
8694
|
+
onSuccess
|
|
8695
|
+
}) => {
|
|
8696
|
+
const [form] = Form.useForm();
|
|
8697
|
+
const [loading, setLoading] = useState26(false);
|
|
8698
|
+
const { config } = useLatticeChatShellContext();
|
|
8699
|
+
const { token } = theme5.useToken();
|
|
8700
|
+
const defaultMetadataRows = [{ key: "category", value: "global" }];
|
|
8701
|
+
const [metadataRows, setMetadataRows] = useState26(defaultMetadataRows);
|
|
8702
|
+
const handleSubmit = async () => {
|
|
8703
|
+
try {
|
|
8704
|
+
const values = await form.validateFields();
|
|
8705
|
+
setLoading(true);
|
|
8706
|
+
const headers = {
|
|
8707
|
+
"Content-Type": "application/json"
|
|
8708
|
+
};
|
|
8709
|
+
if (config.apiKey) {
|
|
8710
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
8711
|
+
}
|
|
8712
|
+
const metadataObject = metadataRows.length > 0 ? metadataRows.reduce((acc, curr) => {
|
|
8713
|
+
if (curr.key) {
|
|
8714
|
+
acc[curr.key] = curr.value;
|
|
8715
|
+
}
|
|
8716
|
+
return acc;
|
|
8717
|
+
}, {}) : void 0;
|
|
8718
|
+
const requestBody = {
|
|
8719
|
+
id: values.name,
|
|
8720
|
+
// id must equal name
|
|
8721
|
+
name: values.name,
|
|
8722
|
+
description: values.description,
|
|
8723
|
+
license: values.license || void 0,
|
|
8724
|
+
compatibility: values.compatibility || void 0,
|
|
8725
|
+
metadata: metadataObject,
|
|
8726
|
+
content: values.content || void 0,
|
|
8727
|
+
subSkills: void 0
|
|
8728
|
+
// subSkills not in create form
|
|
8729
|
+
};
|
|
8730
|
+
const response = await fetch(`${config.baseURL}/api/skills`, {
|
|
8731
|
+
method: "POST",
|
|
8732
|
+
headers,
|
|
8733
|
+
body: JSON.stringify(requestBody)
|
|
8734
|
+
});
|
|
8735
|
+
const data = await response.json();
|
|
8736
|
+
if (response.ok && data.success) {
|
|
8737
|
+
message6.success("Skill created successfully");
|
|
8738
|
+
form.resetFields();
|
|
8739
|
+
setMetadataRows(defaultMetadataRows);
|
|
8740
|
+
onSuccess?.();
|
|
8741
|
+
onCancel();
|
|
8742
|
+
} else {
|
|
8743
|
+
message6.error(data.message || "Failed to create skill");
|
|
8744
|
+
}
|
|
8745
|
+
} catch (error) {
|
|
8746
|
+
if (error.errorFields) {
|
|
8747
|
+
return;
|
|
8748
|
+
}
|
|
8749
|
+
message6.error(
|
|
8750
|
+
error.message || "An error occurred while creating the skill"
|
|
8751
|
+
);
|
|
8752
|
+
} finally {
|
|
8753
|
+
setLoading(false);
|
|
8754
|
+
}
|
|
8755
|
+
};
|
|
8756
|
+
const handleCancel = () => {
|
|
8757
|
+
form.resetFields();
|
|
8758
|
+
setMetadataRows(defaultMetadataRows);
|
|
8759
|
+
onCancel();
|
|
8760
|
+
};
|
|
8761
|
+
const handleMetadataChange = (index, field, value) => {
|
|
8762
|
+
const next = [...metadataRows];
|
|
8763
|
+
next[index] = {
|
|
8764
|
+
...next[index],
|
|
8765
|
+
[field]: value
|
|
8766
|
+
};
|
|
8767
|
+
setMetadataRows(next);
|
|
8768
|
+
};
|
|
8769
|
+
const handleAddMetadataRow = () => {
|
|
8770
|
+
setMetadataRows([...metadataRows, { key: "", value: "" }]);
|
|
8771
|
+
};
|
|
8772
|
+
return /* @__PURE__ */ jsx46(
|
|
8773
|
+
Modal2,
|
|
8774
|
+
{
|
|
8775
|
+
title: "Create New Skill",
|
|
8776
|
+
open,
|
|
8777
|
+
onCancel: handleCancel,
|
|
8778
|
+
footer: null,
|
|
8779
|
+
width: 520,
|
|
8780
|
+
destroyOnClose: true,
|
|
8781
|
+
styles: {
|
|
8782
|
+
body: { padding: 16 }
|
|
8783
|
+
},
|
|
8784
|
+
children: /* @__PURE__ */ jsx46(
|
|
8785
|
+
Form,
|
|
8786
|
+
{
|
|
8787
|
+
form,
|
|
8788
|
+
layout: "vertical",
|
|
8789
|
+
onFinish: handleSubmit,
|
|
8790
|
+
autoComplete: "off",
|
|
8791
|
+
children: /* @__PURE__ */ jsxs26(
|
|
8792
|
+
"div",
|
|
8793
|
+
{
|
|
8794
|
+
style: {
|
|
8795
|
+
display: "flex",
|
|
8796
|
+
flexDirection: "column",
|
|
8797
|
+
gap: 12
|
|
8798
|
+
},
|
|
8799
|
+
children: [
|
|
8800
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8801
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Name" }),
|
|
8802
|
+
/* @__PURE__ */ jsx46(
|
|
8803
|
+
Form.Item,
|
|
8804
|
+
{
|
|
8805
|
+
name: "name",
|
|
8806
|
+
rules: [
|
|
8807
|
+
{ required: true, message: "Please enter skill name" },
|
|
8808
|
+
{
|
|
8809
|
+
pattern: /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
8810
|
+
message: "Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"
|
|
8811
|
+
},
|
|
8812
|
+
{ min: 1, max: 64, message: "Name must be 1-64 characters" }
|
|
8813
|
+
],
|
|
8814
|
+
style: { marginBottom: 0 },
|
|
8815
|
+
children: /* @__PURE__ */ jsx46(Input2, { placeholder: "e.g., data-analysis" })
|
|
8816
|
+
}
|
|
8817
|
+
)
|
|
8818
|
+
] }),
|
|
8819
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8820
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Description" }),
|
|
8821
|
+
/* @__PURE__ */ jsx46(
|
|
8822
|
+
Form.Item,
|
|
8823
|
+
{
|
|
8824
|
+
name: "description",
|
|
8825
|
+
rules: [
|
|
8826
|
+
{ required: true, message: "Please enter skill description" }
|
|
8827
|
+
],
|
|
8828
|
+
style: { marginBottom: 0 },
|
|
8829
|
+
children: /* @__PURE__ */ jsx46(
|
|
8830
|
+
TextArea2,
|
|
8831
|
+
{
|
|
8832
|
+
placeholder: "Description",
|
|
8833
|
+
autoSize: { minRows: 2, maxRows: 4 }
|
|
8834
|
+
}
|
|
8835
|
+
)
|
|
8836
|
+
}
|
|
8837
|
+
)
|
|
8838
|
+
] }),
|
|
8839
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8840
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "License" }),
|
|
8841
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "license", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(Input2, { placeholder: "License" }) })
|
|
8842
|
+
] }),
|
|
8843
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8844
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Compatibility" }),
|
|
8845
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "compatibility", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(Input2, { placeholder: "Compatibility" }) })
|
|
8846
|
+
] }),
|
|
8847
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8848
|
+
/* @__PURE__ */ jsxs26(
|
|
8849
|
+
"div",
|
|
8850
|
+
{
|
|
8851
|
+
style: {
|
|
8852
|
+
display: "flex",
|
|
8853
|
+
alignItems: "center",
|
|
8854
|
+
justifyContent: "space-between",
|
|
8855
|
+
gap: 8
|
|
8856
|
+
},
|
|
8857
|
+
children: [
|
|
8858
|
+
/* @__PURE__ */ jsx46(
|
|
8859
|
+
Text16,
|
|
8860
|
+
{
|
|
8861
|
+
style: {
|
|
8862
|
+
fontSize: 12,
|
|
8863
|
+
color: token.colorTextSecondary,
|
|
8864
|
+
fontWeight: 500
|
|
8865
|
+
},
|
|
8866
|
+
children: "Metadata"
|
|
8867
|
+
}
|
|
8868
|
+
),
|
|
8869
|
+
/* @__PURE__ */ jsx46(
|
|
8870
|
+
Button18,
|
|
8871
|
+
{
|
|
8872
|
+
size: "small",
|
|
8873
|
+
icon: /* @__PURE__ */ jsx46(PlusOutlined2, {}),
|
|
8874
|
+
onClick: handleAddMetadataRow,
|
|
8875
|
+
children: "Add"
|
|
8876
|
+
}
|
|
8877
|
+
)
|
|
8878
|
+
]
|
|
8879
|
+
}
|
|
8880
|
+
),
|
|
8881
|
+
/* @__PURE__ */ jsxs26(Space17, { direction: "vertical", size: 8, style: { width: "100%" }, children: [
|
|
8882
|
+
metadataRows.length === 0 && /* @__PURE__ */ jsx46(
|
|
8883
|
+
Text16,
|
|
8884
|
+
{
|
|
8885
|
+
style: {
|
|
8886
|
+
fontSize: 11,
|
|
8887
|
+
color: token.colorTextTertiary
|
|
8888
|
+
},
|
|
8889
|
+
children: "No metadata yet. Use Add to create one."
|
|
8890
|
+
}
|
|
8891
|
+
),
|
|
8892
|
+
metadataRows.map((row, index) => /* @__PURE__ */ jsxs26(
|
|
8893
|
+
"div",
|
|
8894
|
+
{
|
|
8895
|
+
style: {
|
|
8896
|
+
display: "flex",
|
|
8897
|
+
flexDirection: "column",
|
|
8898
|
+
gap: 4,
|
|
8899
|
+
width: "100%"
|
|
8900
|
+
},
|
|
8901
|
+
children: [
|
|
8902
|
+
/* @__PURE__ */ jsxs26(
|
|
8903
|
+
Text16,
|
|
8904
|
+
{
|
|
8905
|
+
style: { fontSize: 11, color: token.colorTextSecondary },
|
|
8906
|
+
children: [
|
|
8907
|
+
"Meta ",
|
|
8908
|
+
index + 1
|
|
8909
|
+
]
|
|
8910
|
+
}
|
|
8911
|
+
),
|
|
8912
|
+
/* @__PURE__ */ jsxs26(Space17, { style: { width: "100%" }, size: 8, wrap: true, children: [
|
|
8913
|
+
/* @__PURE__ */ jsx46(
|
|
8914
|
+
Input2,
|
|
8915
|
+
{
|
|
8916
|
+
value: row.key,
|
|
8917
|
+
placeholder: "Key",
|
|
8918
|
+
style: { width: 140 },
|
|
8919
|
+
onChange: (e) => handleMetadataChange(index, "key", e.target.value)
|
|
8920
|
+
}
|
|
8921
|
+
),
|
|
8922
|
+
/* @__PURE__ */ jsx46(
|
|
8923
|
+
Input2,
|
|
8924
|
+
{
|
|
8925
|
+
value: row.value,
|
|
8926
|
+
placeholder: "Value",
|
|
8927
|
+
style: { flex: 1, minWidth: 200 },
|
|
8928
|
+
onChange: (e) => handleMetadataChange(index, "value", e.target.value)
|
|
8929
|
+
}
|
|
8930
|
+
)
|
|
8931
|
+
] })
|
|
8932
|
+
]
|
|
8933
|
+
},
|
|
8934
|
+
index
|
|
8935
|
+
))
|
|
8936
|
+
] })
|
|
8937
|
+
] }),
|
|
8938
|
+
/* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
8939
|
+
/* @__PURE__ */ jsx46(Text16, { style: { fontSize: 12, color: token.colorTextSecondary }, children: "Content" }),
|
|
8940
|
+
/* @__PURE__ */ jsx46(Form.Item, { name: "content", style: { marginBottom: 0 }, children: /* @__PURE__ */ jsx46(
|
|
8941
|
+
TextArea2,
|
|
8942
|
+
{
|
|
8943
|
+
placeholder: "Content",
|
|
8944
|
+
autoSize: { minRows: 4, maxRows: 8 }
|
|
8945
|
+
}
|
|
8946
|
+
) })
|
|
8947
|
+
] }),
|
|
8948
|
+
/* @__PURE__ */ jsxs26(
|
|
8949
|
+
"div",
|
|
8950
|
+
{
|
|
8951
|
+
style: {
|
|
8952
|
+
display: "flex",
|
|
8953
|
+
alignItems: "center",
|
|
8954
|
+
justifyContent: "flex-end",
|
|
8955
|
+
gap: 8,
|
|
8956
|
+
marginTop: 8
|
|
8957
|
+
},
|
|
8958
|
+
children: [
|
|
8959
|
+
/* @__PURE__ */ jsx46(Button18, { onClick: handleCancel, children: "Cancel" }),
|
|
8960
|
+
/* @__PURE__ */ jsx46(Button18, { type: "primary", htmlType: "submit", loading, children: "Create Skill" })
|
|
8961
|
+
]
|
|
8962
|
+
}
|
|
8963
|
+
)
|
|
8964
|
+
]
|
|
8965
|
+
}
|
|
8966
|
+
)
|
|
8967
|
+
}
|
|
8968
|
+
)
|
|
8969
|
+
}
|
|
8970
|
+
);
|
|
8971
|
+
};
|
|
8972
|
+
var CreateSkillModal_default = CreateSkillModal;
|
|
8973
|
+
|
|
8974
|
+
// src/components/Chat/SkillFlow.tsx
|
|
8975
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8976
|
+
var SkillFlowInner = ({ onNodeClick }) => {
|
|
8977
|
+
const [nodes, setNodes, onNodesChange] = useNodesState2([]);
|
|
8978
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState2([]);
|
|
8979
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = useState27(false);
|
|
8980
|
+
const [skills, setSkills] = useState27([]);
|
|
8981
|
+
const [skillsLoading, setSkillsLoading] = useState27(false);
|
|
8982
|
+
const { token } = theme6.useToken();
|
|
8983
|
+
const { config } = useLatticeChatShellContext();
|
|
8984
|
+
const nodeTypes = useMemo12(
|
|
8985
|
+
() => ({
|
|
8986
|
+
skill: SkillNode_default
|
|
8987
|
+
}),
|
|
8988
|
+
[]
|
|
8989
|
+
);
|
|
8990
|
+
const fetchSkills = async () => {
|
|
8991
|
+
setSkillsLoading(true);
|
|
8992
|
+
try {
|
|
8993
|
+
const headers = {};
|
|
8994
|
+
if (config.apiKey) {
|
|
8995
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
8996
|
+
}
|
|
8997
|
+
const response = await fetch(`${config.baseURL}/api/skills`, {
|
|
8998
|
+
headers
|
|
8999
|
+
});
|
|
9000
|
+
if (response.ok) {
|
|
9001
|
+
const data = await response.json();
|
|
9002
|
+
if (data.success && data.data && Array.isArray(data.data.records)) {
|
|
9003
|
+
setSkills(data.data.records);
|
|
9004
|
+
}
|
|
9005
|
+
}
|
|
9006
|
+
} catch (error) {
|
|
9007
|
+
console.error("Failed to fetch skills:", error);
|
|
9008
|
+
setSkills([]);
|
|
9009
|
+
} finally {
|
|
9010
|
+
setSkillsLoading(false);
|
|
9011
|
+
}
|
|
9012
|
+
};
|
|
9013
|
+
useEffect19(() => {
|
|
9014
|
+
fetchSkills();
|
|
9015
|
+
}, []);
|
|
9016
|
+
useEffect19(() => {
|
|
9017
|
+
if (!skills || skills.length === 0) {
|
|
9018
|
+
setNodes([]);
|
|
9019
|
+
setEdges([]);
|
|
9020
|
+
return;
|
|
9021
|
+
}
|
|
9022
|
+
const initialNodes = [];
|
|
9023
|
+
const initialEdges = [];
|
|
9024
|
+
const nodeWidth = 280;
|
|
9025
|
+
const nodeHeight = 220;
|
|
9026
|
+
const horizontalSpacing = 320;
|
|
9027
|
+
const verticalSpacing = 300;
|
|
9028
|
+
const skillMap = /* @__PURE__ */ new Map();
|
|
9029
|
+
const relationships = [];
|
|
9030
|
+
const childrenMap = /* @__PURE__ */ new Map();
|
|
9031
|
+
skills.forEach((skill) => {
|
|
9032
|
+
skillMap.set(skill.name, skill);
|
|
9033
|
+
if (skill.subSkills && skill.subSkills.length > 0) {
|
|
9034
|
+
if (!childrenMap.has(skill.name)) {
|
|
9035
|
+
childrenMap.set(skill.name, []);
|
|
9036
|
+
}
|
|
9037
|
+
skill.subSkills.forEach((subSkillName) => {
|
|
9038
|
+
const subSkill = skills.find((s) => s.name === subSkillName);
|
|
9039
|
+
if (subSkill) {
|
|
9040
|
+
relationships.push({
|
|
9041
|
+
source: skill.name,
|
|
9042
|
+
target: subSkillName
|
|
9043
|
+
});
|
|
9044
|
+
childrenMap.get(skill.name).push(subSkillName);
|
|
9045
|
+
}
|
|
9046
|
+
});
|
|
9047
|
+
}
|
|
9048
|
+
});
|
|
9049
|
+
const hasRelationships = relationships.length > 0;
|
|
9050
|
+
if (hasRelationships) {
|
|
9051
|
+
const processedIds = /* @__PURE__ */ new Set();
|
|
9052
|
+
const levelMap = /* @__PURE__ */ new Map();
|
|
9053
|
+
const parentMap = /* @__PURE__ */ new Map();
|
|
9054
|
+
relationships.forEach((rel) => {
|
|
9055
|
+
parentMap.set(rel.target, rel.source);
|
|
9056
|
+
});
|
|
9057
|
+
const queue = [];
|
|
9058
|
+
const rootNodes = skills.filter(
|
|
9059
|
+
(s) => !parentMap.has(s.name)
|
|
9060
|
+
// No parent means it's a root
|
|
9061
|
+
);
|
|
9062
|
+
if (rootNodes.length === 0 && skills.length > 0) {
|
|
9063
|
+
queue.push({ id: skills[0].name, level: 0 });
|
|
9064
|
+
} else {
|
|
9065
|
+
rootNodes.forEach((root) => {
|
|
9066
|
+
queue.push({ id: root.name, level: 0 });
|
|
9067
|
+
});
|
|
9068
|
+
}
|
|
9069
|
+
while (queue.length > 0) {
|
|
9070
|
+
const { id, level } = queue.shift();
|
|
9071
|
+
if (processedIds.has(id)) continue;
|
|
9072
|
+
processedIds.add(id);
|
|
9073
|
+
levelMap.set(id, level);
|
|
9074
|
+
const children = childrenMap.get(id) || [];
|
|
9075
|
+
children.forEach((childId) => {
|
|
9076
|
+
if (!processedIds.has(childId)) {
|
|
9077
|
+
queue.push({ id: childId, level: level + 1 });
|
|
9078
|
+
}
|
|
9079
|
+
});
|
|
9080
|
+
}
|
|
9081
|
+
skills.forEach((skill) => {
|
|
9082
|
+
if (!levelMap.has(skill.name)) {
|
|
9083
|
+
levelMap.set(skill.name, 0);
|
|
9084
|
+
}
|
|
9085
|
+
});
|
|
9086
|
+
const levelGroups = /* @__PURE__ */ new Map();
|
|
9087
|
+
skills.forEach((skill) => {
|
|
9088
|
+
const level = levelMap.get(skill.name) || 0;
|
|
9089
|
+
if (!levelGroups.has(level)) {
|
|
9090
|
+
levelGroups.set(level, []);
|
|
9091
|
+
}
|
|
9092
|
+
levelGroups.get(level).push(skill);
|
|
9093
|
+
});
|
|
9094
|
+
levelGroups.forEach((group, level) => {
|
|
9095
|
+
const y = level * verticalSpacing;
|
|
9096
|
+
const groupWidth = (group.length - 1) * horizontalSpacing;
|
|
9097
|
+
const startX = -groupWidth / 2;
|
|
9098
|
+
group.forEach((skill, index) => {
|
|
9099
|
+
const x = startX + index * horizontalSpacing;
|
|
9100
|
+
initialNodes.push({
|
|
9101
|
+
id: skill.name,
|
|
9102
|
+
type: "skill",
|
|
9103
|
+
data: {
|
|
9104
|
+
skill,
|
|
9105
|
+
onClick: () => onNodeClick?.(skill),
|
|
9106
|
+
onDelete: fetchSkills
|
|
9107
|
+
},
|
|
9108
|
+
position: { x, y }
|
|
9109
|
+
});
|
|
9110
|
+
});
|
|
9111
|
+
});
|
|
9112
|
+
relationships.forEach((rel) => {
|
|
9113
|
+
if (skillMap.has(rel.source) && skillMap.has(rel.target)) {
|
|
9114
|
+
initialEdges.push({
|
|
9115
|
+
id: `e${rel.source}-${rel.target}`,
|
|
9116
|
+
source: rel.source,
|
|
9117
|
+
target: rel.target,
|
|
9118
|
+
style: { stroke: "#1677ff", strokeWidth: 2 },
|
|
9119
|
+
type: "smoothstep"
|
|
9120
|
+
});
|
|
9121
|
+
}
|
|
9122
|
+
});
|
|
9123
|
+
} else {
|
|
9124
|
+
const nodesPerRow = Math.ceil(Math.sqrt(skills.length));
|
|
9125
|
+
skills.forEach((skill, index) => {
|
|
9126
|
+
const row = Math.floor(index / nodesPerRow);
|
|
9127
|
+
const col = index % nodesPerRow;
|
|
9128
|
+
const x = col * horizontalSpacing - (nodesPerRow - 1) * horizontalSpacing / 2;
|
|
9129
|
+
const y = row * verticalSpacing;
|
|
9130
|
+
initialNodes.push({
|
|
9131
|
+
id: skill.name,
|
|
9132
|
+
type: "skill",
|
|
9133
|
+
data: {
|
|
9134
|
+
skill,
|
|
9135
|
+
onClick: () => onNodeClick?.(skill)
|
|
9136
|
+
},
|
|
9137
|
+
position: { x, y }
|
|
9138
|
+
});
|
|
9139
|
+
});
|
|
9140
|
+
}
|
|
9141
|
+
setNodes(initialNodes);
|
|
9142
|
+
setEdges(initialEdges);
|
|
9143
|
+
}, [skills, setNodes, setEdges, onNodeClick]);
|
|
9144
|
+
const handleSkillCreated = async () => {
|
|
9145
|
+
await fetchSkills();
|
|
9146
|
+
};
|
|
9147
|
+
if (skillsLoading) {
|
|
9148
|
+
return /* @__PURE__ */ jsx47(
|
|
9149
|
+
"div",
|
|
9150
|
+
{
|
|
9151
|
+
style: {
|
|
9152
|
+
width: "100%",
|
|
9153
|
+
height: "100%",
|
|
9154
|
+
display: "flex",
|
|
9155
|
+
justifyContent: "center",
|
|
9156
|
+
alignItems: "center",
|
|
9157
|
+
background: "#fafafa"
|
|
9158
|
+
},
|
|
9159
|
+
children: "Loading skills..."
|
|
9160
|
+
}
|
|
9161
|
+
);
|
|
9162
|
+
}
|
|
9163
|
+
return /* @__PURE__ */ jsxs27("div", { style: { width: "100%", height: "100%", background: "#fafafa", position: "relative" }, children: [
|
|
9164
|
+
/* @__PURE__ */ jsxs27(
|
|
9165
|
+
ReactFlow2,
|
|
9166
|
+
{
|
|
9167
|
+
nodes,
|
|
9168
|
+
edges,
|
|
9169
|
+
onNodesChange,
|
|
9170
|
+
onEdgesChange,
|
|
9171
|
+
nodeTypes,
|
|
9172
|
+
fitView: true,
|
|
9173
|
+
children: [
|
|
9174
|
+
/* @__PURE__ */ jsx47(Background2, { color: "#eee", gap: 20 }),
|
|
9175
|
+
/* @__PURE__ */ jsx47(Controls2, {})
|
|
9176
|
+
]
|
|
9177
|
+
}
|
|
9178
|
+
),
|
|
9179
|
+
/* @__PURE__ */ jsx47(
|
|
9180
|
+
"div",
|
|
9181
|
+
{
|
|
9182
|
+
style: {
|
|
9183
|
+
position: "absolute",
|
|
9184
|
+
top: 20,
|
|
9185
|
+
right: 20,
|
|
9186
|
+
zIndex: 10
|
|
9187
|
+
},
|
|
9188
|
+
children: /* @__PURE__ */ jsx47(
|
|
9189
|
+
Button19,
|
|
9190
|
+
{
|
|
9191
|
+
type: "primary",
|
|
9192
|
+
size: "large",
|
|
9193
|
+
icon: /* @__PURE__ */ jsx47(PlusOutlined3, {}),
|
|
9194
|
+
onClick: () => setIsCreateModalOpen(true),
|
|
9195
|
+
style: {
|
|
9196
|
+
height: 48,
|
|
9197
|
+
width: 48,
|
|
9198
|
+
borderRadius: "50%",
|
|
9199
|
+
boxShadow: token.boxShadowTertiary,
|
|
9200
|
+
display: "flex",
|
|
9201
|
+
alignItems: "center",
|
|
9202
|
+
justifyContent: "center",
|
|
9203
|
+
padding: 0
|
|
9204
|
+
}
|
|
9205
|
+
}
|
|
9206
|
+
)
|
|
9207
|
+
}
|
|
9208
|
+
),
|
|
9209
|
+
/* @__PURE__ */ jsx47(
|
|
9210
|
+
CreateSkillModal_default,
|
|
9211
|
+
{
|
|
9212
|
+
open: isCreateModalOpen,
|
|
9213
|
+
onCancel: () => setIsCreateModalOpen(false),
|
|
9214
|
+
onSuccess: handleSkillCreated
|
|
9215
|
+
}
|
|
9216
|
+
)
|
|
9217
|
+
] });
|
|
9218
|
+
};
|
|
9219
|
+
var SkillFlow = (props) => /* @__PURE__ */ jsx47(ReactFlowProvider2, { children: /* @__PURE__ */ jsx47(SkillFlowInner, { ...props }) });
|
|
9220
|
+
var SkillFlow_default = SkillFlow;
|
|
9221
|
+
|
|
9222
|
+
// src/components/Chat/ChatSidebar.tsx
|
|
9223
|
+
import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6427
9224
|
var useStyles4 = createStyles12(({ token, css }) => ({
|
|
6428
9225
|
sidebar: css`
|
|
6429
9226
|
display: flex;
|
|
@@ -6526,6 +9323,22 @@ var useStyles4 = createStyles12(({ token, css }) => ({
|
|
|
6526
9323
|
letter-spacing: 0.5px;
|
|
6527
9324
|
padding: 0 ${token.paddingXS}px;
|
|
6528
9325
|
margin-bottom: ${token.marginSM}px;
|
|
9326
|
+
display: flex;
|
|
9327
|
+
align-items: center;
|
|
9328
|
+
justify-content: space-between;
|
|
9329
|
+
`,
|
|
9330
|
+
sectionTitleButton: css`
|
|
9331
|
+
font-size: ${token.fontSizeSM}px;
|
|
9332
|
+
padding: 0;
|
|
9333
|
+
height: auto;
|
|
9334
|
+
color: ${token.colorTextSecondary};
|
|
9335
|
+
border: none;
|
|
9336
|
+
background: transparent;
|
|
9337
|
+
|
|
9338
|
+
&:hover {
|
|
9339
|
+
color: ${token.colorPrimary};
|
|
9340
|
+
background: transparent;
|
|
9341
|
+
}
|
|
6529
9342
|
`,
|
|
6530
9343
|
footer: css`
|
|
6531
9344
|
display: flex;
|
|
@@ -6631,9 +9444,12 @@ var ChatSidebar = ({
|
|
|
6631
9444
|
}) => {
|
|
6632
9445
|
const { styles } = useStyles4();
|
|
6633
9446
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
6634
|
-
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
6635
|
-
const
|
|
6636
|
-
const [
|
|
9447
|
+
const { setSettingsModalOpen, config } = useLatticeChatShellContext();
|
|
9448
|
+
const { selectAssistant } = useAssistantContext();
|
|
9449
|
+
const [isHovered, setIsHovered] = useState28(false);
|
|
9450
|
+
const [isFirstCollapse, setIsFirstCollapse] = useState28(false);
|
|
9451
|
+
const [isFlowModalOpen, setIsFlowModalOpen] = useState28(false);
|
|
9452
|
+
const [isSkillFlowModalOpen, setIsSkillFlowModalOpen] = useState28(false);
|
|
6637
9453
|
const prevIsCollapsedRef = useRef13(false);
|
|
6638
9454
|
const handleToggleCollapse = () => {
|
|
6639
9455
|
setMenuCollapsed(!menuCollapsed);
|
|
@@ -6642,8 +9458,11 @@ var ChatSidebar = ({
|
|
|
6642
9458
|
setSettingsModalOpen(true);
|
|
6643
9459
|
onSettingsClick?.();
|
|
6644
9460
|
};
|
|
9461
|
+
const handleSkillFlowClick = () => {
|
|
9462
|
+
setIsSkillFlowModalOpen(true);
|
|
9463
|
+
};
|
|
6645
9464
|
const isCollapsed = menuCollapsed || sideAppVisible;
|
|
6646
|
-
|
|
9465
|
+
useEffect20(() => {
|
|
6647
9466
|
const prevIsCollapsed = prevIsCollapsedRef.current;
|
|
6648
9467
|
if (isCollapsed) {
|
|
6649
9468
|
const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
|
|
@@ -6672,54 +9491,77 @@ var ChatSidebar = ({
|
|
|
6672
9491
|
const handleMouseLeave = () => {
|
|
6673
9492
|
setIsHovered(false);
|
|
6674
9493
|
};
|
|
6675
|
-
return /* @__PURE__ */
|
|
6676
|
-
/* @__PURE__ */
|
|
9494
|
+
return /* @__PURE__ */ jsxs28(Fragment6, { children: [
|
|
9495
|
+
/* @__PURE__ */ jsxs28(
|
|
6677
9496
|
"div",
|
|
6678
9497
|
{
|
|
6679
9498
|
className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
|
|
6680
9499
|
onMouseEnter: handleMouseEnter,
|
|
6681
9500
|
onMouseLeave: handleMouseLeave,
|
|
6682
9501
|
children: [
|
|
6683
|
-
/* @__PURE__ */
|
|
6684
|
-
|
|
9502
|
+
/* @__PURE__ */ jsx48(
|
|
9503
|
+
Tooltip8,
|
|
6685
9504
|
{
|
|
6686
9505
|
title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
|
|
6687
9506
|
open: isFirstCollapse,
|
|
6688
9507
|
placement: "right",
|
|
6689
|
-
children: isFirstCollapse && /* @__PURE__ */
|
|
9508
|
+
children: isFirstCollapse && /* @__PURE__ */ jsx48("div", { style: { marginTop: "400px" } })
|
|
6690
9509
|
}
|
|
6691
9510
|
),
|
|
6692
|
-
!isCollapsed && /* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
6694
|
-
/* @__PURE__ */
|
|
6695
|
-
/* @__PURE__ */
|
|
6696
|
-
|
|
9511
|
+
!isCollapsed && /* @__PURE__ */ jsxs28(Fragment6, { children: [
|
|
9512
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.content, children: [
|
|
9513
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9514
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.sectionTitle, children: [
|
|
9515
|
+
/* @__PURE__ */ jsx48("span", { children: "Assistants" }),
|
|
9516
|
+
/* @__PURE__ */ jsx48(
|
|
9517
|
+
Button20,
|
|
9518
|
+
{
|
|
9519
|
+
type: "text",
|
|
9520
|
+
icon: /* @__PURE__ */ jsx48(ApartmentOutlined, {}),
|
|
9521
|
+
onClick: () => setIsFlowModalOpen(true),
|
|
9522
|
+
className: styles.sectionTitleButton,
|
|
9523
|
+
title: "View Assistant Flow Canvas",
|
|
9524
|
+
size: "small"
|
|
9525
|
+
}
|
|
9526
|
+
)
|
|
9527
|
+
] }),
|
|
9528
|
+
/* @__PURE__ */ jsx48(AssistantList, {})
|
|
6697
9529
|
] }),
|
|
6698
|
-
/* @__PURE__ */
|
|
6699
|
-
/* @__PURE__ */
|
|
6700
|
-
/* @__PURE__ */
|
|
6701
|
-
/* @__PURE__ */
|
|
9530
|
+
/* @__PURE__ */ jsx48(Divider4, { className: styles.divider }),
|
|
9531
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9532
|
+
/* @__PURE__ */ jsx48("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
9533
|
+
/* @__PURE__ */ jsx48(AgentConversations, {})
|
|
6702
9534
|
] })
|
|
6703
9535
|
] }),
|
|
6704
|
-
/* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
9536
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.footer, children: [
|
|
9537
|
+
/* @__PURE__ */ jsx48(
|
|
6706
9538
|
"button",
|
|
6707
9539
|
{
|
|
6708
9540
|
className: styles.actionButton,
|
|
6709
9541
|
onClick: handleToggleCollapse,
|
|
6710
9542
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6711
9543
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6712
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
9544
|
+
children: isCollapsed ? /* @__PURE__ */ jsx48(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx48(MenuFoldOutlined, {})
|
|
6713
9545
|
}
|
|
6714
9546
|
),
|
|
6715
|
-
/* @__PURE__ */
|
|
9547
|
+
/* @__PURE__ */ jsx48(
|
|
9548
|
+
"button",
|
|
9549
|
+
{
|
|
9550
|
+
className: styles.actionButton,
|
|
9551
|
+
onClick: handleSkillFlowClick,
|
|
9552
|
+
title: "Skill Flow Canvas",
|
|
9553
|
+
"aria-label": "Skill Flow Canvas",
|
|
9554
|
+
children: /* @__PURE__ */ jsx48(ThunderboltOutlined2, {})
|
|
9555
|
+
}
|
|
9556
|
+
),
|
|
9557
|
+
/* @__PURE__ */ jsx48(
|
|
6716
9558
|
"button",
|
|
6717
9559
|
{
|
|
6718
9560
|
className: styles.actionButton,
|
|
6719
9561
|
onClick: handleSettingsClick,
|
|
6720
9562
|
title: "Settings",
|
|
6721
9563
|
"aria-label": "Settings",
|
|
6722
|
-
children: /* @__PURE__ */
|
|
9564
|
+
children: /* @__PURE__ */ jsx48(SettingOutlined2, {})
|
|
6723
9565
|
}
|
|
6724
9566
|
)
|
|
6725
9567
|
] })
|
|
@@ -6727,61 +9569,133 @@ var ChatSidebar = ({
|
|
|
6727
9569
|
]
|
|
6728
9570
|
}
|
|
6729
9571
|
),
|
|
6730
|
-
isCollapsed && /* @__PURE__ */
|
|
9572
|
+
isCollapsed && /* @__PURE__ */ jsxs28(
|
|
6731
9573
|
"div",
|
|
6732
9574
|
{
|
|
6733
9575
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
6734
9576
|
onMouseEnter: handleMouseEnter,
|
|
6735
9577
|
onMouseLeave: handleMouseLeave,
|
|
6736
9578
|
children: [
|
|
6737
|
-
/* @__PURE__ */
|
|
6738
|
-
/* @__PURE__ */
|
|
6739
|
-
/* @__PURE__ */
|
|
6740
|
-
|
|
9579
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.hoverContent, children: [
|
|
9580
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9581
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.sectionTitle, children: [
|
|
9582
|
+
/* @__PURE__ */ jsx48("span", { children: "Assistants" }),
|
|
9583
|
+
/* @__PURE__ */ jsx48(
|
|
9584
|
+
Button20,
|
|
9585
|
+
{
|
|
9586
|
+
type: "text",
|
|
9587
|
+
icon: /* @__PURE__ */ jsx48(ApartmentOutlined, {}),
|
|
9588
|
+
onClick: () => setIsFlowModalOpen(true),
|
|
9589
|
+
className: styles.sectionTitleButton,
|
|
9590
|
+
title: "View Assistant Flow Canvas",
|
|
9591
|
+
size: "small"
|
|
9592
|
+
}
|
|
9593
|
+
)
|
|
9594
|
+
] }),
|
|
9595
|
+
/* @__PURE__ */ jsx48(AssistantList, {})
|
|
6741
9596
|
] }),
|
|
6742
|
-
/* @__PURE__ */
|
|
6743
|
-
/* @__PURE__ */
|
|
6744
|
-
/* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
9597
|
+
/* @__PURE__ */ jsx48(Divider4, { className: styles.divider }),
|
|
9598
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.section, children: [
|
|
9599
|
+
/* @__PURE__ */ jsx48("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
9600
|
+
/* @__PURE__ */ jsx48(AgentConversations, {})
|
|
6746
9601
|
] })
|
|
6747
9602
|
] }),
|
|
6748
|
-
/* @__PURE__ */
|
|
6749
|
-
/* @__PURE__ */
|
|
9603
|
+
/* @__PURE__ */ jsxs28("div", { className: styles.footer, children: [
|
|
9604
|
+
/* @__PURE__ */ jsx48(
|
|
6750
9605
|
"button",
|
|
6751
9606
|
{
|
|
6752
9607
|
className: styles.actionButton,
|
|
6753
9608
|
onClick: handleToggleCollapse,
|
|
6754
9609
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6755
9610
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
6756
|
-
children: isCollapsed ? /* @__PURE__ */
|
|
9611
|
+
children: isCollapsed ? /* @__PURE__ */ jsx48(MenuUnfoldOutlined, {}) : /* @__PURE__ */ jsx48(MenuFoldOutlined, {})
|
|
9612
|
+
}
|
|
9613
|
+
),
|
|
9614
|
+
/* @__PURE__ */ jsx48(
|
|
9615
|
+
"button",
|
|
9616
|
+
{
|
|
9617
|
+
className: styles.actionButton,
|
|
9618
|
+
onClick: handleSkillFlowClick,
|
|
9619
|
+
title: "Skill Flow Canvas",
|
|
9620
|
+
"aria-label": "Skill Flow Canvas",
|
|
9621
|
+
children: /* @__PURE__ */ jsx48(ThunderboltOutlined2, {})
|
|
6757
9622
|
}
|
|
6758
9623
|
),
|
|
6759
|
-
/* @__PURE__ */
|
|
9624
|
+
/* @__PURE__ */ jsx48(
|
|
6760
9625
|
"button",
|
|
6761
9626
|
{
|
|
6762
9627
|
className: styles.actionButton,
|
|
6763
9628
|
onClick: handleSettingsClick,
|
|
6764
9629
|
title: "Settings",
|
|
6765
9630
|
"aria-label": "Settings",
|
|
6766
|
-
children: /* @__PURE__ */
|
|
9631
|
+
children: /* @__PURE__ */ jsx48(SettingOutlined2, {})
|
|
6767
9632
|
}
|
|
6768
9633
|
)
|
|
6769
9634
|
] })
|
|
6770
9635
|
]
|
|
6771
9636
|
}
|
|
9637
|
+
),
|
|
9638
|
+
/* @__PURE__ */ jsx48(
|
|
9639
|
+
Modal3,
|
|
9640
|
+
{
|
|
9641
|
+
destroyOnHidden: true,
|
|
9642
|
+
title: "Assistant Overview",
|
|
9643
|
+
open: isFlowModalOpen,
|
|
9644
|
+
onCancel: () => setIsFlowModalOpen(false),
|
|
9645
|
+
footer: null,
|
|
9646
|
+
width: "90%",
|
|
9647
|
+
style: { top: 20 },
|
|
9648
|
+
bodyStyle: {
|
|
9649
|
+
height: "calc(100vh - 120px)",
|
|
9650
|
+
padding: 0
|
|
9651
|
+
},
|
|
9652
|
+
children: /* @__PURE__ */ jsx48("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx48(
|
|
9653
|
+
AssistantFlow_default,
|
|
9654
|
+
{
|
|
9655
|
+
onNodeClick: (assistant) => {
|
|
9656
|
+
selectAssistant(assistant.id);
|
|
9657
|
+
setIsFlowModalOpen(false);
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
|
+
) })
|
|
9661
|
+
}
|
|
9662
|
+
),
|
|
9663
|
+
/* @__PURE__ */ jsx48(
|
|
9664
|
+
Modal3,
|
|
9665
|
+
{
|
|
9666
|
+
destroyOnHidden: true,
|
|
9667
|
+
title: "Skill Overview",
|
|
9668
|
+
open: isSkillFlowModalOpen,
|
|
9669
|
+
onCancel: () => setIsSkillFlowModalOpen(false),
|
|
9670
|
+
footer: null,
|
|
9671
|
+
width: "90%",
|
|
9672
|
+
style: { top: 20 },
|
|
9673
|
+
bodyStyle: {
|
|
9674
|
+
height: "calc(100vh - 120px)",
|
|
9675
|
+
padding: 0
|
|
9676
|
+
},
|
|
9677
|
+
children: /* @__PURE__ */ jsx48("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx48(
|
|
9678
|
+
SkillFlow_default,
|
|
9679
|
+
{
|
|
9680
|
+
onNodeClick: (skill) => {
|
|
9681
|
+
console.log("Skill clicked:", skill);
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9684
|
+
) })
|
|
9685
|
+
}
|
|
6772
9686
|
)
|
|
6773
9687
|
] });
|
|
6774
9688
|
};
|
|
6775
9689
|
|
|
6776
9690
|
// src/components/Chat/LatticeChatView.tsx
|
|
6777
|
-
import { jsx as
|
|
9691
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6778
9692
|
var LatticeChatView = (props) => {
|
|
6779
9693
|
const { assistantId, thread } = useConversationContext();
|
|
6780
9694
|
const { currentAssistant } = useAssistantContext();
|
|
6781
9695
|
const {
|
|
6782
9696
|
config: { baseURL }
|
|
6783
9697
|
} = useLatticeChatShellContext();
|
|
6784
|
-
return assistantId && thread ? /* @__PURE__ */
|
|
9698
|
+
return assistantId && thread ? /* @__PURE__ */ jsx49(
|
|
6785
9699
|
AxiomLatticeProvider,
|
|
6786
9700
|
{
|
|
6787
9701
|
config: {
|
|
@@ -6790,14 +9704,14 @@ var LatticeChatView = (props) => {
|
|
|
6790
9704
|
assistantId,
|
|
6791
9705
|
transport: "sse"
|
|
6792
9706
|
},
|
|
6793
|
-
children: /* @__PURE__ */
|
|
9707
|
+
children: /* @__PURE__ */ jsx49(
|
|
6794
9708
|
LatticeChat,
|
|
6795
9709
|
{
|
|
6796
9710
|
thread_id: thread?.id,
|
|
6797
9711
|
assistant_id: assistantId,
|
|
6798
9712
|
name: currentAssistant?.name,
|
|
6799
9713
|
description: currentAssistant?.description,
|
|
6800
|
-
menu: /* @__PURE__ */
|
|
9714
|
+
menu: /* @__PURE__ */ jsx49(ChatSidebar, {})
|
|
6801
9715
|
}
|
|
6802
9716
|
)
|
|
6803
9717
|
}
|
|
@@ -6805,17 +9719,17 @@ var LatticeChatView = (props) => {
|
|
|
6805
9719
|
};
|
|
6806
9720
|
|
|
6807
9721
|
// src/components/Chat/SettingsModal.tsx
|
|
6808
|
-
import { useState as
|
|
9722
|
+
import { useState as useState29, useEffect as useEffect21, useRef as useRef14 } from "react";
|
|
6809
9723
|
import {
|
|
6810
|
-
Modal,
|
|
6811
|
-
Input,
|
|
6812
|
-
Button as
|
|
6813
|
-
message as
|
|
6814
|
-
Typography as
|
|
9724
|
+
Modal as Modal4,
|
|
9725
|
+
Input as Input3,
|
|
9726
|
+
Button as Button21,
|
|
9727
|
+
message as message7,
|
|
9728
|
+
Typography as Typography19,
|
|
6815
9729
|
Alert as Alert4,
|
|
6816
9730
|
Select,
|
|
6817
9731
|
Switch,
|
|
6818
|
-
Space as
|
|
9732
|
+
Space as Space18,
|
|
6819
9733
|
Tabs as Tabs2
|
|
6820
9734
|
} from "antd";
|
|
6821
9735
|
import {
|
|
@@ -6823,17 +9737,17 @@ import {
|
|
|
6823
9737
|
EnvironmentOutlined,
|
|
6824
9738
|
ReloadOutlined as ReloadOutlined3,
|
|
6825
9739
|
CheckCircleOutlined as CheckCircleOutlined5,
|
|
6826
|
-
ApiOutlined,
|
|
9740
|
+
ApiOutlined as ApiOutlined2,
|
|
6827
9741
|
LinkOutlined,
|
|
6828
9742
|
CheckCircleFilled,
|
|
6829
9743
|
CloseCircleFilled,
|
|
6830
|
-
PlusOutlined,
|
|
9744
|
+
PlusOutlined as PlusOutlined4,
|
|
6831
9745
|
CloudServerOutlined
|
|
6832
9746
|
} from "@ant-design/icons";
|
|
6833
9747
|
import { createStyles as createStyles13 } from "antd-style";
|
|
6834
|
-
import { Fragment as
|
|
6835
|
-
var { Text:
|
|
6836
|
-
var { TextArea } =
|
|
9748
|
+
import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
9749
|
+
var { Text: Text17, Title: Title3 } = Typography19;
|
|
9750
|
+
var { TextArea: TextArea3 } = Input3;
|
|
6837
9751
|
var useStyles5 = createStyles13(({ token, css }) => ({
|
|
6838
9752
|
// settingsModal: css`
|
|
6839
9753
|
// .ant-modal {
|
|
@@ -7180,12 +10094,12 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
7180
10094
|
{
|
|
7181
10095
|
key: "environment",
|
|
7182
10096
|
label: "Environment Variables",
|
|
7183
|
-
icon: /* @__PURE__ */
|
|
10097
|
+
icon: /* @__PURE__ */ jsx50(EnvironmentOutlined, {})
|
|
7184
10098
|
},
|
|
7185
10099
|
{
|
|
7186
10100
|
key: "models",
|
|
7187
10101
|
label: "Model Configuration",
|
|
7188
|
-
icon: /* @__PURE__ */
|
|
10102
|
+
icon: /* @__PURE__ */ jsx50(ApiOutlined2, {})
|
|
7189
10103
|
}
|
|
7190
10104
|
];
|
|
7191
10105
|
var SettingsModal = ({
|
|
@@ -7194,7 +10108,7 @@ var SettingsModal = ({
|
|
|
7194
10108
|
}) => {
|
|
7195
10109
|
const { styles } = useStyles5();
|
|
7196
10110
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
7197
|
-
const [connections, setConnections] =
|
|
10111
|
+
const [connections, setConnections] = useState29(() => {
|
|
7198
10112
|
if (typeof window !== "undefined") {
|
|
7199
10113
|
try {
|
|
7200
10114
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -7217,21 +10131,21 @@ var SettingsModal = ({
|
|
|
7217
10131
|
}
|
|
7218
10132
|
return [];
|
|
7219
10133
|
});
|
|
7220
|
-
const [serverConfigs, setServerConfigs] =
|
|
10134
|
+
const [serverConfigs, setServerConfigs] = useState29({});
|
|
7221
10135
|
const connectionsRef = useRef14(connections);
|
|
7222
|
-
|
|
10136
|
+
useEffect21(() => {
|
|
7223
10137
|
connectionsRef.current = connections;
|
|
7224
10138
|
}, [connections]);
|
|
7225
|
-
const [activeTabKey, setActiveTabKey] =
|
|
10139
|
+
const [activeTabKey, setActiveTabKey] = useState29(
|
|
7226
10140
|
connections.length > 0 ? connections[0].id : ""
|
|
7227
10141
|
);
|
|
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] =
|
|
10142
|
+
const [activeMenu, setActiveMenu] = useState29("environment");
|
|
10143
|
+
const [loading, setLoading] = useState29(false);
|
|
10144
|
+
const [showAddServerModal, setShowAddServerModal] = useState29(false);
|
|
10145
|
+
const [newServerUrl, setNewServerUrl] = useState29("");
|
|
10146
|
+
const [newServerName, setNewServerName] = useState29("");
|
|
10147
|
+
const [newServerApiKey, setNewServerApiKey] = useState29("");
|
|
10148
|
+
const [addingServer, setAddingServer] = useState29(false);
|
|
7235
10149
|
const saveConnections = (newConnections) => {
|
|
7236
10150
|
setConnections(newConnections);
|
|
7237
10151
|
if (typeof window !== "undefined") {
|
|
@@ -7370,7 +10284,7 @@ var SettingsModal = ({
|
|
|
7370
10284
|
}
|
|
7371
10285
|
} catch (error) {
|
|
7372
10286
|
console.error("Failed to load configuration:", error);
|
|
7373
|
-
|
|
10287
|
+
message7.error("Failed to load current configuration");
|
|
7374
10288
|
}
|
|
7375
10289
|
};
|
|
7376
10290
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -7421,7 +10335,7 @@ var SettingsModal = ({
|
|
|
7421
10335
|
console.error("Failed to load models configuration:", error);
|
|
7422
10336
|
}
|
|
7423
10337
|
};
|
|
7424
|
-
|
|
10338
|
+
useEffect21(() => {
|
|
7425
10339
|
if (open && activeTabKey) {
|
|
7426
10340
|
initializeServerConfig(activeTabKey);
|
|
7427
10341
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -7430,7 +10344,7 @@ var SettingsModal = ({
|
|
|
7430
10344
|
}
|
|
7431
10345
|
}
|
|
7432
10346
|
}, [open, activeTabKey]);
|
|
7433
|
-
|
|
10347
|
+
useEffect21(() => {
|
|
7434
10348
|
if (open && activeTabKey) {
|
|
7435
10349
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
7436
10350
|
if (connection?.connected) {
|
|
@@ -7444,7 +10358,7 @@ var SettingsModal = ({
|
|
|
7444
10358
|
}, [open, activeTabKey, activeMenu]);
|
|
7445
10359
|
const handleAddServer = async () => {
|
|
7446
10360
|
if (!newServerUrl.trim()) {
|
|
7447
|
-
|
|
10361
|
+
message7.error("Please enter a server URL");
|
|
7448
10362
|
return;
|
|
7449
10363
|
}
|
|
7450
10364
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -7470,7 +10384,7 @@ var SettingsModal = ({
|
|
|
7470
10384
|
setNewServerUrl("");
|
|
7471
10385
|
setNewServerName("");
|
|
7472
10386
|
setNewServerApiKey("");
|
|
7473
|
-
|
|
10387
|
+
message7.success("Server added successfully");
|
|
7474
10388
|
};
|
|
7475
10389
|
const handleDeleteServer = (serverId) => {
|
|
7476
10390
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -7487,7 +10401,7 @@ var SettingsModal = ({
|
|
|
7487
10401
|
setActiveTabKey("");
|
|
7488
10402
|
}
|
|
7489
10403
|
}
|
|
7490
|
-
|
|
10404
|
+
message7.success("Server deleted");
|
|
7491
10405
|
};
|
|
7492
10406
|
const handleTabChange = (newTabKey) => {
|
|
7493
10407
|
setConnections(
|
|
@@ -7501,12 +10415,12 @@ var SettingsModal = ({
|
|
|
7501
10415
|
const handleSave = async () => {
|
|
7502
10416
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
7503
10417
|
if (!connection || !connection.connected) {
|
|
7504
|
-
|
|
10418
|
+
message7.error("Please connect to a server first");
|
|
7505
10419
|
return;
|
|
7506
10420
|
}
|
|
7507
10421
|
const url = connection.url;
|
|
7508
10422
|
if (!url) {
|
|
7509
|
-
|
|
10423
|
+
message7.error("Please connect to a server first");
|
|
7510
10424
|
return;
|
|
7511
10425
|
}
|
|
7512
10426
|
try {
|
|
@@ -7570,23 +10484,23 @@ var SettingsModal = ({
|
|
|
7570
10484
|
const data = await response.json();
|
|
7571
10485
|
if (response.ok && data.success) {
|
|
7572
10486
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
7573
|
-
|
|
10487
|
+
message7.warning(
|
|
7574
10488
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
7575
10489
|
", "
|
|
7576
10490
|
)} to take effect.`,
|
|
7577
10491
|
5
|
|
7578
10492
|
);
|
|
7579
10493
|
} else {
|
|
7580
|
-
|
|
10494
|
+
message7.success("Configuration saved and applied successfully");
|
|
7581
10495
|
}
|
|
7582
10496
|
if (data.warnings && data.warnings.length > 0) {
|
|
7583
10497
|
data.warnings.forEach((warning) => {
|
|
7584
|
-
|
|
10498
|
+
message7.warning(warning, 5);
|
|
7585
10499
|
});
|
|
7586
10500
|
}
|
|
7587
10501
|
onClose();
|
|
7588
10502
|
} else {
|
|
7589
|
-
|
|
10503
|
+
message7.error(data.error || "Failed to save configuration");
|
|
7590
10504
|
}
|
|
7591
10505
|
} else if (activeMenu === "models") {
|
|
7592
10506
|
const validModels = config.models.filter(
|
|
@@ -7605,17 +10519,17 @@ var SettingsModal = ({
|
|
|
7605
10519
|
});
|
|
7606
10520
|
const data = await response.json();
|
|
7607
10521
|
if (response.ok && data.success) {
|
|
7608
|
-
|
|
10522
|
+
message7.success(
|
|
7609
10523
|
"Model configuration saved and registered successfully"
|
|
7610
10524
|
);
|
|
7611
10525
|
onClose();
|
|
7612
10526
|
} else {
|
|
7613
|
-
|
|
10527
|
+
message7.error(data.error || "Failed to save model configuration");
|
|
7614
10528
|
}
|
|
7615
10529
|
}
|
|
7616
10530
|
} catch (error) {
|
|
7617
10531
|
console.error("Failed to save configuration:", error);
|
|
7618
|
-
|
|
10532
|
+
message7.error(error.message || "Failed to save configuration");
|
|
7619
10533
|
} finally {
|
|
7620
10534
|
setLoading(false);
|
|
7621
10535
|
}
|
|
@@ -7631,25 +10545,25 @@ var SettingsModal = ({
|
|
|
7631
10545
|
}
|
|
7632
10546
|
}));
|
|
7633
10547
|
};
|
|
7634
|
-
return /* @__PURE__ */
|
|
7635
|
-
/* @__PURE__ */
|
|
10548
|
+
return /* @__PURE__ */ jsxs29("div", { className: styles.formContainer, children: [
|
|
10549
|
+
/* @__PURE__ */ jsx50(
|
|
7636
10550
|
Alert4,
|
|
7637
10551
|
{
|
|
7638
10552
|
message: "Configuration Effect",
|
|
7639
|
-
description: /* @__PURE__ */
|
|
7640
|
-
/* @__PURE__ */
|
|
7641
|
-
/* @__PURE__ */
|
|
10553
|
+
description: /* @__PURE__ */ jsxs29("div", { children: [
|
|
10554
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: 8 }, children: [
|
|
10555
|
+
/* @__PURE__ */ jsx50(
|
|
7642
10556
|
CheckCircleOutlined5,
|
|
7643
10557
|
{
|
|
7644
10558
|
style: { color: "#52c41a", marginRight: 8 }
|
|
7645
10559
|
}
|
|
7646
10560
|
),
|
|
7647
|
-
/* @__PURE__ */
|
|
10561
|
+
/* @__PURE__ */ jsx50("strong", { children: "Immediately effective:" }),
|
|
7648
10562
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
7649
10563
|
] }),
|
|
7650
|
-
/* @__PURE__ */
|
|
7651
|
-
/* @__PURE__ */
|
|
7652
|
-
/* @__PURE__ */
|
|
10564
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10565
|
+
/* @__PURE__ */ jsx50(ReloadOutlined3, { style: { color: "#faad14", marginRight: 8 } }),
|
|
10566
|
+
/* @__PURE__ */ jsx50("strong", { children: "Requires restart:" }),
|
|
7653
10567
|
" PORT (server must be restarted to change port)"
|
|
7654
10568
|
] })
|
|
7655
10569
|
] }),
|
|
@@ -7658,9 +10572,9 @@ var SettingsModal = ({
|
|
|
7658
10572
|
className: styles.alertCard
|
|
7659
10573
|
}
|
|
7660
10574
|
),
|
|
7661
|
-
/* @__PURE__ */
|
|
7662
|
-
/* @__PURE__ */
|
|
7663
|
-
|
|
10575
|
+
/* @__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." }) }),
|
|
10576
|
+
/* @__PURE__ */ jsx50(
|
|
10577
|
+
TextArea3,
|
|
7664
10578
|
{
|
|
7665
10579
|
value: config.envText,
|
|
7666
10580
|
onChange: (e) => setEnvText(e.target.value),
|
|
@@ -7736,10 +10650,10 @@ QUEUE_NAME=tasks`,
|
|
|
7736
10650
|
}));
|
|
7737
10651
|
}
|
|
7738
10652
|
};
|
|
7739
|
-
return /* @__PURE__ */
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
config.models.map((model, index) => /* @__PURE__ */
|
|
7742
|
-
/* @__PURE__ */
|
|
10653
|
+
return /* @__PURE__ */ jsxs29("div", { className: styles.formContainer, children: [
|
|
10654
|
+
/* @__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." }) }),
|
|
10655
|
+
config.models.map((model, index) => /* @__PURE__ */ jsxs29("div", { className: styles.card, children: [
|
|
10656
|
+
/* @__PURE__ */ jsxs29(
|
|
7743
10657
|
"div",
|
|
7744
10658
|
{
|
|
7745
10659
|
style: {
|
|
@@ -7751,13 +10665,13 @@ QUEUE_NAME=tasks`,
|
|
|
7751
10665
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
7752
10666
|
},
|
|
7753
10667
|
children: [
|
|
7754
|
-
/* @__PURE__ */
|
|
7755
|
-
/* @__PURE__ */
|
|
10668
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10669
|
+
/* @__PURE__ */ jsxs29(Text17, { strong: true, style: { fontSize: 16 }, children: [
|
|
7756
10670
|
"Model ",
|
|
7757
10671
|
index + 1
|
|
7758
10672
|
] }),
|
|
7759
|
-
model.key && /* @__PURE__ */
|
|
7760
|
-
|
|
10673
|
+
model.key && /* @__PURE__ */ jsxs29(
|
|
10674
|
+
Text17,
|
|
7761
10675
|
{
|
|
7762
10676
|
type: "secondary",
|
|
7763
10677
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -7769,8 +10683,8 @@ QUEUE_NAME=tasks`,
|
|
|
7769
10683
|
}
|
|
7770
10684
|
)
|
|
7771
10685
|
] }),
|
|
7772
|
-
config.models.length > 1 && /* @__PURE__ */
|
|
7773
|
-
|
|
10686
|
+
config.models.length > 1 && /* @__PURE__ */ jsx50(
|
|
10687
|
+
Button21,
|
|
7774
10688
|
{
|
|
7775
10689
|
type: "text",
|
|
7776
10690
|
danger: true,
|
|
@@ -7786,11 +10700,11 @@ QUEUE_NAME=tasks`,
|
|
|
7786
10700
|
]
|
|
7787
10701
|
}
|
|
7788
10702
|
),
|
|
7789
|
-
/* @__PURE__ */
|
|
7790
|
-
/* @__PURE__ */
|
|
7791
|
-
/* @__PURE__ */
|
|
7792
|
-
/* @__PURE__ */
|
|
7793
|
-
|
|
10703
|
+
/* @__PURE__ */ jsxs29(Space18, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
10704
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10705
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Key *" }),
|
|
10706
|
+
/* @__PURE__ */ jsx50(
|
|
10707
|
+
Input3,
|
|
7794
10708
|
{
|
|
7795
10709
|
placeholder: "e.g., default, gpt-4, claude",
|
|
7796
10710
|
value: model.key,
|
|
@@ -7798,11 +10712,11 @@ QUEUE_NAME=tasks`,
|
|
|
7798
10712
|
style: { height: 40 }
|
|
7799
10713
|
}
|
|
7800
10714
|
),
|
|
7801
|
-
/* @__PURE__ */
|
|
10715
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
7802
10716
|
] }),
|
|
7803
|
-
/* @__PURE__ */
|
|
7804
|
-
/* @__PURE__ */
|
|
7805
|
-
/* @__PURE__ */
|
|
10717
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10718
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Provider *" }),
|
|
10719
|
+
/* @__PURE__ */ jsx50(
|
|
7806
10720
|
Select,
|
|
7807
10721
|
{
|
|
7808
10722
|
style: { width: "100%", height: 40 },
|
|
@@ -7818,10 +10732,10 @@ QUEUE_NAME=tasks`,
|
|
|
7818
10732
|
}
|
|
7819
10733
|
)
|
|
7820
10734
|
] }),
|
|
7821
|
-
/* @__PURE__ */
|
|
7822
|
-
/* @__PURE__ */
|
|
7823
|
-
/* @__PURE__ */
|
|
7824
|
-
|
|
10735
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10736
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Model Name *" }),
|
|
10737
|
+
/* @__PURE__ */ jsx50(
|
|
10738
|
+
Input3,
|
|
7825
10739
|
{
|
|
7826
10740
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
7827
10741
|
value: model.model,
|
|
@@ -7830,10 +10744,10 @@ QUEUE_NAME=tasks`,
|
|
|
7830
10744
|
}
|
|
7831
10745
|
)
|
|
7832
10746
|
] }),
|
|
7833
|
-
/* @__PURE__ */
|
|
7834
|
-
/* @__PURE__ */
|
|
7835
|
-
/* @__PURE__ */
|
|
7836
|
-
|
|
10747
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10748
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "API Key" }),
|
|
10749
|
+
/* @__PURE__ */ jsx50(
|
|
10750
|
+
Input3.Password,
|
|
7837
10751
|
{
|
|
7838
10752
|
placeholder: "Enter your API key",
|
|
7839
10753
|
value: model.apiKey,
|
|
@@ -7841,12 +10755,12 @@ QUEUE_NAME=tasks`,
|
|
|
7841
10755
|
style: { height: 40 }
|
|
7842
10756
|
}
|
|
7843
10757
|
),
|
|
7844
|
-
/* @__PURE__ */
|
|
10758
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
7845
10759
|
] }),
|
|
7846
|
-
/* @__PURE__ */
|
|
7847
|
-
/* @__PURE__ */
|
|
7848
|
-
/* @__PURE__ */
|
|
7849
|
-
|
|
10760
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
10761
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Base URL" }),
|
|
10762
|
+
/* @__PURE__ */ jsx50(
|
|
10763
|
+
Input3,
|
|
7850
10764
|
{
|
|
7851
10765
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
7852
10766
|
value: model.baseURL,
|
|
@@ -7854,23 +10768,23 @@ QUEUE_NAME=tasks`,
|
|
|
7854
10768
|
style: { height: 40 }
|
|
7855
10769
|
}
|
|
7856
10770
|
),
|
|
7857
|
-
/* @__PURE__ */
|
|
10771
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
7858
10772
|
] }),
|
|
7859
|
-
/* @__PURE__ */
|
|
7860
|
-
/* @__PURE__ */
|
|
10773
|
+
/* @__PURE__ */ jsx50("div", { children: /* @__PURE__ */ jsxs29(Space18, { children: [
|
|
10774
|
+
/* @__PURE__ */ jsx50(
|
|
7861
10775
|
Switch,
|
|
7862
10776
|
{
|
|
7863
10777
|
checked: model.streaming,
|
|
7864
10778
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
7865
10779
|
}
|
|
7866
10780
|
),
|
|
7867
|
-
/* @__PURE__ */
|
|
10781
|
+
/* @__PURE__ */ jsx50(Text17, { children: "Enable Streaming" })
|
|
7868
10782
|
] }) }),
|
|
7869
|
-
/* @__PURE__ */
|
|
7870
|
-
/* @__PURE__ */
|
|
7871
|
-
/* @__PURE__ */
|
|
7872
|
-
/* @__PURE__ */
|
|
7873
|
-
|
|
10783
|
+
/* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: 20 }, children: [
|
|
10784
|
+
/* @__PURE__ */ jsxs29("div", { style: { flex: 1 }, children: [
|
|
10785
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Max Tokens" }),
|
|
10786
|
+
/* @__PURE__ */ jsx50(
|
|
10787
|
+
Input3,
|
|
7874
10788
|
{
|
|
7875
10789
|
type: "number",
|
|
7876
10790
|
placeholder: "e.g., 4096",
|
|
@@ -7884,10 +10798,10 @@ QUEUE_NAME=tasks`,
|
|
|
7884
10798
|
}
|
|
7885
10799
|
)
|
|
7886
10800
|
] }),
|
|
7887
|
-
/* @__PURE__ */
|
|
7888
|
-
/* @__PURE__ */
|
|
7889
|
-
/* @__PURE__ */
|
|
7890
|
-
|
|
10801
|
+
/* @__PURE__ */ jsxs29("div", { style: { flex: 1 }, children: [
|
|
10802
|
+
/* @__PURE__ */ jsx50(Text17, { className: styles.formLabel, children: "Temperature" }),
|
|
10803
|
+
/* @__PURE__ */ jsx50(
|
|
10804
|
+
Input3,
|
|
7891
10805
|
{
|
|
7892
10806
|
type: "number",
|
|
7893
10807
|
step: "0.1",
|
|
@@ -7905,8 +10819,8 @@ QUEUE_NAME=tasks`,
|
|
|
7905
10819
|
] })
|
|
7906
10820
|
] })
|
|
7907
10821
|
] }, index)),
|
|
7908
|
-
/* @__PURE__ */
|
|
7909
|
-
|
|
10822
|
+
/* @__PURE__ */ jsx50(
|
|
10823
|
+
Button21,
|
|
7910
10824
|
{
|
|
7911
10825
|
type: "dashed",
|
|
7912
10826
|
onClick: handleAddModel,
|
|
@@ -7933,8 +10847,8 @@ QUEUE_NAME=tasks`,
|
|
|
7933
10847
|
);
|
|
7934
10848
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
7935
10849
|
const renderTabLabel = (connection) => {
|
|
7936
|
-
return /* @__PURE__ */
|
|
7937
|
-
/* @__PURE__ */
|
|
10850
|
+
return /* @__PURE__ */ jsxs29("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
10851
|
+
/* @__PURE__ */ jsx50(
|
|
7938
10852
|
CloudServerOutlined,
|
|
7939
10853
|
{
|
|
7940
10854
|
style: {
|
|
@@ -7943,14 +10857,14 @@ QUEUE_NAME=tasks`,
|
|
|
7943
10857
|
}
|
|
7944
10858
|
}
|
|
7945
10859
|
),
|
|
7946
|
-
/* @__PURE__ */
|
|
7947
|
-
connection.connected && /* @__PURE__ */
|
|
10860
|
+
/* @__PURE__ */ jsx50("span", { children: connection.name }),
|
|
10861
|
+
connection.connected && /* @__PURE__ */ jsx50(
|
|
7948
10862
|
CheckCircleFilled,
|
|
7949
10863
|
{
|
|
7950
10864
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
7951
10865
|
}
|
|
7952
10866
|
),
|
|
7953
|
-
connection.error && !connection.connecting && /* @__PURE__ */
|
|
10867
|
+
connection.error && !connection.connecting && /* @__PURE__ */ jsx50(
|
|
7954
10868
|
CloseCircleFilled,
|
|
7955
10869
|
{
|
|
7956
10870
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
@@ -7961,35 +10875,35 @@ QUEUE_NAME=tasks`,
|
|
|
7961
10875
|
const tabItems = connections.map((connection) => ({
|
|
7962
10876
|
key: connection.id,
|
|
7963
10877
|
label: renderTabLabel(connection),
|
|
7964
|
-
children: /* @__PURE__ */
|
|
7965
|
-
/* @__PURE__ */
|
|
10878
|
+
children: /* @__PURE__ */ jsx50("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx50(Fragment7, { children: /* @__PURE__ */ jsxs29("div", { style: { display: "flex", height: "100%" }, children: [
|
|
10879
|
+
/* @__PURE__ */ jsx50("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs29(
|
|
7966
10880
|
"div",
|
|
7967
10881
|
{
|
|
7968
10882
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
7969
10883
|
onClick: () => setActiveMenu(item.key),
|
|
7970
10884
|
children: [
|
|
7971
|
-
/* @__PURE__ */
|
|
7972
|
-
/* @__PURE__ */
|
|
10885
|
+
/* @__PURE__ */ jsx50("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
10886
|
+
/* @__PURE__ */ jsx50("span", { className: styles.menuItemText, children: item.label })
|
|
7973
10887
|
]
|
|
7974
10888
|
},
|
|
7975
10889
|
item.key
|
|
7976
10890
|
)) }),
|
|
7977
|
-
/* @__PURE__ */
|
|
7978
|
-
/* @__PURE__ */
|
|
7979
|
-
/* @__PURE__ */
|
|
7980
|
-
/* @__PURE__ */
|
|
7981
|
-
/* @__PURE__ */
|
|
10891
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.content, children: [
|
|
10892
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeader, children: [
|
|
10893
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeaderLeft, children: [
|
|
10894
|
+
/* @__PURE__ */ jsx50(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
10895
|
+
/* @__PURE__ */ jsxs29(Text17, { className: styles.contentDescription, children: [
|
|
7982
10896
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
7983
10897
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
7984
10898
|
] })
|
|
7985
10899
|
] }),
|
|
7986
|
-
/* @__PURE__ */
|
|
7987
|
-
/* @__PURE__ */
|
|
7988
|
-
/* @__PURE__ */
|
|
7989
|
-
|
|
10900
|
+
/* @__PURE__ */ jsxs29("div", { className: styles.contentHeaderRight, children: [
|
|
10901
|
+
/* @__PURE__ */ jsx50(Button21, { onClick: onClose, children: "Cancel" }),
|
|
10902
|
+
/* @__PURE__ */ jsx50(
|
|
10903
|
+
Button21,
|
|
7990
10904
|
{
|
|
7991
10905
|
type: "primary",
|
|
7992
|
-
icon: /* @__PURE__ */
|
|
10906
|
+
icon: /* @__PURE__ */ jsx50(SaveOutlined, {}),
|
|
7993
10907
|
onClick: handleSave,
|
|
7994
10908
|
loading,
|
|
7995
10909
|
children: "Save Configuration"
|
|
@@ -7997,9 +10911,9 @@ QUEUE_NAME=tasks`,
|
|
|
7997
10911
|
)
|
|
7998
10912
|
] })
|
|
7999
10913
|
] }),
|
|
8000
|
-
/* @__PURE__ */
|
|
10914
|
+
/* @__PURE__ */ jsx50("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
8001
10915
|
] })
|
|
8002
|
-
] }) }) : /* @__PURE__ */
|
|
10916
|
+
] }) }) : /* @__PURE__ */ jsx50(
|
|
8003
10917
|
"div",
|
|
8004
10918
|
{
|
|
8005
10919
|
style: {
|
|
@@ -8011,29 +10925,29 @@ QUEUE_NAME=tasks`,
|
|
|
8011
10925
|
gap: 16,
|
|
8012
10926
|
padding: 48
|
|
8013
10927
|
},
|
|
8014
|
-
children: connection.connecting ? /* @__PURE__ */
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
/* @__PURE__ */
|
|
8017
|
-
/* @__PURE__ */
|
|
10928
|
+
children: connection.connecting ? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10929
|
+
/* @__PURE__ */ jsx50(LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
10930
|
+
/* @__PURE__ */ jsx50(Title3, { level: 4, children: "Connecting..." }),
|
|
10931
|
+
/* @__PURE__ */ jsxs29(Text17, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
8018
10932
|
"Connecting to ",
|
|
8019
10933
|
connection.url
|
|
8020
10934
|
] })
|
|
8021
|
-
] }) : /* @__PURE__ */
|
|
8022
|
-
/* @__PURE__ */
|
|
8023
|
-
/* @__PURE__ */
|
|
8024
|
-
/* @__PURE__ */
|
|
8025
|
-
|
|
10935
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10936
|
+
/* @__PURE__ */ jsx50(LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
10937
|
+
/* @__PURE__ */ jsx50(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
10938
|
+
/* @__PURE__ */ jsx50(
|
|
10939
|
+
Text17,
|
|
8026
10940
|
{
|
|
8027
10941
|
type: "secondary",
|
|
8028
10942
|
style: { textAlign: "center", maxWidth: 400 },
|
|
8029
10943
|
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
10944
|
}
|
|
8031
10945
|
),
|
|
8032
|
-
/* @__PURE__ */
|
|
8033
|
-
|
|
10946
|
+
/* @__PURE__ */ jsx50(
|
|
10947
|
+
Button21,
|
|
8034
10948
|
{
|
|
8035
10949
|
type: "primary",
|
|
8036
|
-
icon: /* @__PURE__ */
|
|
10950
|
+
icon: /* @__PURE__ */ jsx50(LinkOutlined, {}),
|
|
8037
10951
|
onClick: () => checkConnection(connection.id),
|
|
8038
10952
|
loading: connection.connecting,
|
|
8039
10953
|
style: { marginTop: 16 },
|
|
@@ -8045,9 +10959,9 @@ QUEUE_NAME=tasks`,
|
|
|
8045
10959
|
) }),
|
|
8046
10960
|
closable: connections.length > 1
|
|
8047
10961
|
}));
|
|
8048
|
-
return /* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
8050
|
-
|
|
10962
|
+
return /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
10963
|
+
/* @__PURE__ */ jsx50(
|
|
10964
|
+
Modal4,
|
|
8051
10965
|
{
|
|
8052
10966
|
open,
|
|
8053
10967
|
onCancel: onClose,
|
|
@@ -8055,7 +10969,7 @@ QUEUE_NAME=tasks`,
|
|
|
8055
10969
|
width: "80%",
|
|
8056
10970
|
footer: null,
|
|
8057
10971
|
title: "Settings",
|
|
8058
|
-
children: /* @__PURE__ */
|
|
10972
|
+
children: /* @__PURE__ */ jsx50("div", { children: /* @__PURE__ */ jsx50(
|
|
8059
10973
|
Tabs2,
|
|
8060
10974
|
{
|
|
8061
10975
|
activeKey: activeTabKey,
|
|
@@ -8069,7 +10983,7 @@ QUEUE_NAME=tasks`,
|
|
|
8069
10983
|
}
|
|
8070
10984
|
},
|
|
8071
10985
|
items: tabItems,
|
|
8072
|
-
addIcon: /* @__PURE__ */
|
|
10986
|
+
addIcon: /* @__PURE__ */ jsxs29(
|
|
8073
10987
|
"div",
|
|
8074
10988
|
{
|
|
8075
10989
|
style: {
|
|
@@ -8079,8 +10993,8 @@ QUEUE_NAME=tasks`,
|
|
|
8079
10993
|
padding: "4px 8px"
|
|
8080
10994
|
},
|
|
8081
10995
|
children: [
|
|
8082
|
-
/* @__PURE__ */
|
|
8083
|
-
/* @__PURE__ */
|
|
10996
|
+
/* @__PURE__ */ jsx50(PlusOutlined4, {}),
|
|
10997
|
+
/* @__PURE__ */ jsx50("span", { children: "Add Server" })
|
|
8084
10998
|
]
|
|
8085
10999
|
}
|
|
8086
11000
|
)
|
|
@@ -8088,8 +11002,8 @@ QUEUE_NAME=tasks`,
|
|
|
8088
11002
|
) })
|
|
8089
11003
|
}
|
|
8090
11004
|
),
|
|
8091
|
-
/* @__PURE__ */
|
|
8092
|
-
|
|
11005
|
+
/* @__PURE__ */ jsx50(
|
|
11006
|
+
Modal4,
|
|
8093
11007
|
{
|
|
8094
11008
|
title: "Add New Server",
|
|
8095
11009
|
open: showAddServerModal,
|
|
@@ -8102,11 +11016,11 @@ QUEUE_NAME=tasks`,
|
|
|
8102
11016
|
},
|
|
8103
11017
|
confirmLoading: addingServer,
|
|
8104
11018
|
className: styles.addServerModal,
|
|
8105
|
-
children: /* @__PURE__ */
|
|
8106
|
-
/* @__PURE__ */
|
|
8107
|
-
/* @__PURE__ */
|
|
8108
|
-
/* @__PURE__ */
|
|
8109
|
-
|
|
11019
|
+
children: /* @__PURE__ */ jsxs29(Space18, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
11020
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
11021
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
11022
|
+
/* @__PURE__ */ jsx50(
|
|
11023
|
+
Input3,
|
|
8110
11024
|
{
|
|
8111
11025
|
placeholder: "e.g., Production Server",
|
|
8112
11026
|
value: newServerName,
|
|
@@ -8114,12 +11028,12 @@ QUEUE_NAME=tasks`,
|
|
|
8114
11028
|
onPressEnter: handleAddServer
|
|
8115
11029
|
}
|
|
8116
11030
|
),
|
|
8117
|
-
/* @__PURE__ */
|
|
11031
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
8118
11032
|
] }),
|
|
8119
|
-
/* @__PURE__ */
|
|
8120
|
-
/* @__PURE__ */
|
|
8121
|
-
/* @__PURE__ */
|
|
8122
|
-
|
|
11033
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
11034
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
11035
|
+
/* @__PURE__ */ jsx50(
|
|
11036
|
+
Input3,
|
|
8123
11037
|
{
|
|
8124
11038
|
placeholder: "e.g., http://localhost:4001",
|
|
8125
11039
|
value: newServerUrl,
|
|
@@ -8127,12 +11041,12 @@ QUEUE_NAME=tasks`,
|
|
|
8127
11041
|
onPressEnter: handleAddServer
|
|
8128
11042
|
}
|
|
8129
11043
|
),
|
|
8130
|
-
/* @__PURE__ */
|
|
11044
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
8131
11045
|
] }),
|
|
8132
|
-
/* @__PURE__ */
|
|
8133
|
-
/* @__PURE__ */
|
|
8134
|
-
/* @__PURE__ */
|
|
8135
|
-
|
|
11046
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
11047
|
+
/* @__PURE__ */ jsx50(Text17, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
11048
|
+
/* @__PURE__ */ jsx50(
|
|
11049
|
+
Input3.Password,
|
|
8136
11050
|
{
|
|
8137
11051
|
placeholder: "Optional: Enter API key for authentication",
|
|
8138
11052
|
value: newServerApiKey,
|
|
@@ -8140,7 +11054,7 @@ QUEUE_NAME=tasks`,
|
|
|
8140
11054
|
onPressEnter: handleAddServer
|
|
8141
11055
|
}
|
|
8142
11056
|
),
|
|
8143
|
-
/* @__PURE__ */
|
|
11057
|
+
/* @__PURE__ */ jsx50(Text17, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
8144
11058
|
] })
|
|
8145
11059
|
] })
|
|
8146
11060
|
}
|
|
@@ -8149,10 +11063,10 @@ QUEUE_NAME=tasks`,
|
|
|
8149
11063
|
};
|
|
8150
11064
|
|
|
8151
11065
|
// src/components/Chat/AgentServerSetting.tsx
|
|
8152
|
-
import { jsx as
|
|
11066
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
8153
11067
|
var AgentServerSetting = () => {
|
|
8154
11068
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
8155
|
-
return /* @__PURE__ */
|
|
11069
|
+
return /* @__PURE__ */ jsx51(
|
|
8156
11070
|
SettingsModal,
|
|
8157
11071
|
{
|
|
8158
11072
|
open: settingsModalOpen,
|
|
@@ -8162,11 +11076,11 @@ var AgentServerSetting = () => {
|
|
|
8162
11076
|
};
|
|
8163
11077
|
|
|
8164
11078
|
// src/components/Chat/LatticeChatShell.tsx
|
|
8165
|
-
import { jsx as
|
|
11079
|
+
import { jsx as jsx52, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8166
11080
|
var LatticeChatShell = (props) => {
|
|
8167
|
-
return /* @__PURE__ */
|
|
8168
|
-
/* @__PURE__ */
|
|
8169
|
-
/* @__PURE__ */
|
|
11081
|
+
return /* @__PURE__ */ jsxs30(LatticeChatShellContextProvider, { ...props, children: [
|
|
11082
|
+
/* @__PURE__ */ jsx52(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ jsx52(ConversationContextProvider, { children: /* @__PURE__ */ jsx52(LatticeChatView, {}) }) }),
|
|
11083
|
+
/* @__PURE__ */ jsx52(AgentServerSetting, {})
|
|
8170
11084
|
] });
|
|
8171
11085
|
};
|
|
8172
11086
|
export {
|
|
@@ -8174,6 +11088,8 @@ export {
|
|
|
8174
11088
|
AgentThreadProvider,
|
|
8175
11089
|
AssistantContext,
|
|
8176
11090
|
AssistantContextProvider,
|
|
11091
|
+
AssistantFlow_default as AssistantFlow,
|
|
11092
|
+
AssistantNode_default as AssistantNode,
|
|
8177
11093
|
AxiomLatticeProvider,
|
|
8178
11094
|
ChatUIContext,
|
|
8179
11095
|
ChatUIContextProvider,
|
|
@@ -8190,6 +11106,8 @@ export {
|
|
|
8190
11106
|
MDViewFormItem,
|
|
8191
11107
|
ScheduleButton,
|
|
8192
11108
|
SideAppViewBrowser,
|
|
11109
|
+
SkillFlow_default as SkillFlow,
|
|
11110
|
+
SkillNode_default as SkillNode,
|
|
8193
11111
|
getElement,
|
|
8194
11112
|
regsiterElement,
|
|
8195
11113
|
useAgentChat,
|