@zero-library/chat-copilot 3.2.1 → 3.2.3
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.cjs.js +409 -627
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +106 -24
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +88 -32
- package/dist/index.d.ts +88 -32
- package/dist/index.esm.js +410 -628
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTranslation, useRefState, useDebounce, createTokenManager, useSyncInput, t, isEmptyObj, markdownToText, RenderWrapper, shouldRender, isFunction, downloadFile, LuyaFilePreview, MarkdownEditor, useDeepEffect, useWebSocket, addBundledResource, isNumber, isObject, isNullOrUnDef, getFileSuffixName, emit, FileIcon, copyText, LazyComponent, isBoolean, UserAvatar, htmlToMarkdown, buildUrlParams, isExternal, transforms, deepCopy, deepMerge, getLang, createRequest, HttpStatus, isArray, isString, isDef, isNull, transform, getWebSocketUrl, safeParseJson } from '@zero-library/common';
|
|
2
|
-
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, ScheduleOutlined, CloseCircleOutlined, BulbOutlined,
|
|
2
|
+
import { CloudUploadOutlined, PaperClipOutlined, createFromIconfontCN, EnterOutlined, DownloadOutlined, CloseOutlined, PlayCircleOutlined, CopyOutlined, DotChartOutlined, ScheduleOutlined, CloseCircleOutlined, BulbOutlined, LoadingOutlined, PlusOutlined, LikeOutlined, DislikeOutlined, CommentOutlined, StarFilled, StarOutlined, ShareAltOutlined, ToolOutlined, MessageOutlined, CheckCircleFilled, ForwardOutlined, CloudSyncOutlined, FileTextOutlined, SettingOutlined, CloseCircleFilled, FlagOutlined, LoginOutlined, DeleteOutlined, RedoOutlined, ClockCircleOutlined, CheckCircleOutlined, FileImageOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FilePptOutlined, FileZipOutlined, FileUnknownOutlined } from '@ant-design/icons';
|
|
3
3
|
import { Attachments, Sender, FileCard, Bubble, Think, XProvider, Mermaid, CodeHighlighter, Welcome, Prompts, Conversations } from '@ant-design/x-v2';
|
|
4
|
-
import { App, Badge, Button, Flex, Typography, Tooltip,
|
|
4
|
+
import { App, Badge, Button, Flex, Typography, Tooltip, Spin, Empty, Tabs, Tag, Splitter, Image as Image$1, Popover, Skeleton, Alert, Dropdown, Select as Select$1, Form, Collapse, Avatar, Space, Drawer, Input, InputNumber, Switch as Switch$1, message, theme, Upload, Popconfirm, List, Card, Table, Progress as Progress$1, Divider as Divider$1 } from 'antd';
|
|
5
5
|
import * as React10 from 'react';
|
|
6
6
|
import React10__default, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, memo, useState, useCallback, useContext, useLayoutEffect } from 'react';
|
|
7
7
|
import { useSnapshot, proxy, subscribe } from 'valtio';
|
|
@@ -18,7 +18,7 @@ import { LexicalTypeaheadMenuPlugin, MenuOption } from '@lexical/react/LexicalTy
|
|
|
18
18
|
import { mergeRegister } from '@lexical/utils';
|
|
19
19
|
import * as ReactDOM from 'react-dom';
|
|
20
20
|
import dayjs from 'dayjs';
|
|
21
|
-
import
|
|
21
|
+
import classNames9 from 'classnames';
|
|
22
22
|
import console2 from 'console';
|
|
23
23
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
24
24
|
import { XCard as XCard$1 } from '@ant-design/x-card';
|
|
@@ -70,8 +70,14 @@ var chatCopilotEnUS = {
|
|
|
70
70
|
summaryAnalysis: "Summary Analysis",
|
|
71
71
|
headerClose: "Close",
|
|
72
72
|
deepThinking: "Deep Thinking",
|
|
73
|
+
resource: "Resources",
|
|
73
74
|
skill: "Skill",
|
|
74
75
|
knowledge: "Knowledge Base",
|
|
76
|
+
datasource: "Datasource",
|
|
77
|
+
mcpServer: "MCP Server",
|
|
78
|
+
subAgent: "Sub-agent",
|
|
79
|
+
tool: "Tool",
|
|
80
|
+
loading: "Loading...",
|
|
75
81
|
supportedExtensions: "Supported extensions: {{types}}",
|
|
76
82
|
empty: "No data",
|
|
77
83
|
selectFile: "Select File",
|
|
@@ -131,8 +137,6 @@ var chatCopilotEnUS = {
|
|
|
131
137
|
previewEdit: "Preview & Edit",
|
|
132
138
|
copy: "Copy",
|
|
133
139
|
continueText: "Continue",
|
|
134
|
-
aggregate: "Aggregate",
|
|
135
|
-
sequence: "Sequence",
|
|
136
140
|
chatTab: "Chat",
|
|
137
141
|
traceTab: "Execution Trace",
|
|
138
142
|
previewTab: "File Preview",
|
|
@@ -145,9 +149,6 @@ var chatCopilotEnUS = {
|
|
|
145
149
|
execItemThinking: "Reasoning",
|
|
146
150
|
execItemFile: "File",
|
|
147
151
|
execItemPlan: "Plan",
|
|
148
|
-
execItemSummaryDone: "{{count}} completed",
|
|
149
|
-
execItemSummaryFailed: "{{count}} failed",
|
|
150
|
-
execItemSummaryRunning: "{{count}} running",
|
|
151
152
|
toolCallFallback: "Tool call",
|
|
152
153
|
viewExecutionDetail: "View execution details",
|
|
153
154
|
executionStart: "Start",
|
|
@@ -264,8 +265,14 @@ var chatCopilotJaJP = {
|
|
|
264
265
|
headerClose: "\u9589\u3058\u308B",
|
|
265
266
|
// ReasonBtn / SkillBtn / KnowledgeBtn
|
|
266
267
|
deepThinking: "\u601D\u8003\u30D7\u30ED\u30BB\u30B9",
|
|
268
|
+
resource: "\u30EA\u30BD\u30FC\u30B9",
|
|
267
269
|
skill: "\u30B9\u30AD\u30EB",
|
|
268
270
|
knowledge: "\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9",
|
|
271
|
+
datasource: "\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9",
|
|
272
|
+
mcpServer: "MCP Server",
|
|
273
|
+
subAgent: "\u30B5\u30D6\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8",
|
|
274
|
+
tool: "\u30C4\u30FC\u30EB",
|
|
275
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D...",
|
|
269
276
|
// Attachments
|
|
270
277
|
supportedExtensions: "\u5BFE\u5FDC\u62E1\u5F35\u5B50\uFF1A{{types}}",
|
|
271
278
|
empty: "\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
@@ -329,8 +336,6 @@ var chatCopilotJaJP = {
|
|
|
329
336
|
previewEdit: "\u30D7\u30EC\u30D3\u30E5\u30FC\uFF06\u7DE8\u96C6",
|
|
330
337
|
copy: "\u30B3\u30D4\u30FC",
|
|
331
338
|
continueText: "\u7D9A\u3051\u308B",
|
|
332
|
-
aggregate: "\u96C6\u7D04",
|
|
333
|
-
sequence: "\u9806\u756A",
|
|
334
339
|
chatTab: "\u4F1A\u8A71",
|
|
335
340
|
traceTab: "\u5B9F\u884C\u30C8\u30EC\u30FC\u30B9",
|
|
336
341
|
previewTab: "\u30D5\u30A1\u30A4\u30EB\u30D7\u30EC\u30D3\u30E5\u30FC",
|
|
@@ -343,9 +348,6 @@ var chatCopilotJaJP = {
|
|
|
343
348
|
execItemThinking: "\u601D\u8003\u30D7\u30ED\u30BB\u30B9",
|
|
344
349
|
execItemFile: "\u30D5\u30A1\u30A4\u30EB",
|
|
345
350
|
execItemPlan: "\u5B9F\u884C\u8A08\u753B",
|
|
346
|
-
execItemSummaryDone: "{{count}}\u4EF6\u5B8C\u4E86",
|
|
347
|
-
execItemSummaryFailed: "{{count}}\u4EF6\u5931\u6557",
|
|
348
|
-
execItemSummaryRunning: "{{count}}\u4EF6\u5B9F\u884C\u4E2D",
|
|
349
351
|
toolCallFallback: "\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057",
|
|
350
352
|
viewExecutionDetail: "\u5B9F\u884C\u8A73\u7D30\u3092\u898B\u308B",
|
|
351
353
|
executionStart: "\u958B\u59CB",
|
|
@@ -467,8 +469,14 @@ var chatCopilotZhCN = {
|
|
|
467
469
|
headerClose: "\u5173\u95ED",
|
|
468
470
|
// ReasonBtn / SkillBtn / KnowledgeBtn
|
|
469
471
|
deepThinking: "\u6DF1\u5EA6\u601D\u8003",
|
|
472
|
+
resource: "\u8D44\u6E90",
|
|
470
473
|
skill: "\u6280\u80FD",
|
|
471
474
|
knowledge: "\u77E5\u8BC6\u5E93",
|
|
475
|
+
datasource: "\u6570\u636E\u6E90",
|
|
476
|
+
mcpServer: "MCP Server",
|
|
477
|
+
subAgent: "\u5B50\u667A\u80FD\u4F53",
|
|
478
|
+
tool: "\u5DE5\u5177",
|
|
479
|
+
loading: "\u52A0\u8F7D\u4E2D...",
|
|
472
480
|
// Attachments
|
|
473
481
|
supportedExtensions: "\u652F\u6301\u6269\u5C55\u540D\uFF1A{{types}}",
|
|
474
482
|
empty: "\u6682\u65E0\u6570\u636E",
|
|
@@ -532,8 +540,6 @@ var chatCopilotZhCN = {
|
|
|
532
540
|
previewEdit: "\u9884\u89C8\u7F16\u8F91",
|
|
533
541
|
copy: "\u590D\u5236",
|
|
534
542
|
continueText: "\u7EE7\u7EED",
|
|
535
|
-
aggregate: "\u805A\u5408",
|
|
536
|
-
sequence: "\u987A\u5E8F",
|
|
537
543
|
chatTab: "\u5BF9\u8BDD",
|
|
538
544
|
traceTab: "\u6267\u884C\u8F68\u8FF9",
|
|
539
545
|
previewTab: "\u6587\u4EF6\u9884\u89C8",
|
|
@@ -546,9 +552,6 @@ var chatCopilotZhCN = {
|
|
|
546
552
|
execItemThinking: "\u601D\u8003\u8FC7\u7A0B",
|
|
547
553
|
execItemFile: "\u6587\u4EF6",
|
|
548
554
|
execItemPlan: "\u6267\u884C\u8BA1\u5212",
|
|
549
|
-
execItemSummaryDone: "{{count}} \u9879\u5B8C\u6210",
|
|
550
|
-
execItemSummaryFailed: "{{count}} \u9879\u5931\u8D25",
|
|
551
|
-
execItemSummaryRunning: "{{count}} \u9879\u6267\u884C\u4E2D",
|
|
552
555
|
toolCallFallback: "\u5DE5\u5177\u8C03\u7528",
|
|
553
556
|
viewExecutionDetail: "\u67E5\u770B\u6267\u884C\u8BE6\u60C5",
|
|
554
557
|
executionStart: "\u5F00\u59CB",
|
|
@@ -1145,7 +1148,7 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1145
1148
|
* 生成节点的纯文本表达,便于发送、存储和重新初始化编辑器内容。
|
|
1146
1149
|
*/
|
|
1147
1150
|
getTextContent() {
|
|
1148
|
-
return
|
|
1151
|
+
return serializeResourceToken(this.__resourceLabel, this.__resourceName, this.__resourceType, this.__resourceId);
|
|
1149
1152
|
}
|
|
1150
1153
|
/**
|
|
1151
1154
|
* 将变量节点渲染为可交互的资源标签组件。
|
|
@@ -1164,6 +1167,61 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1164
1167
|
function $createVariableNode(resourceLabel, resourceName, resourceType, resourceId) {
|
|
1165
1168
|
return new VariableNode(resourceLabel, resourceName, resourceType, resourceId);
|
|
1166
1169
|
}
|
|
1170
|
+
function serializeResourceToken(resourceLabel, resourceName, resourceType, resourceId) {
|
|
1171
|
+
return `${encodeURIComponent(resourceType)}://${encodeURIComponent(resourceId)}?name=${encodeURIComponent(resourceName)}&label=${encodeURIComponent(
|
|
1172
|
+
resourceLabel
|
|
1173
|
+
)}`;
|
|
1174
|
+
}
|
|
1175
|
+
var emptyAgentResources = {
|
|
1176
|
+
skills: [],
|
|
1177
|
+
knowledges: [],
|
|
1178
|
+
datasources: [],
|
|
1179
|
+
mcpServers: [],
|
|
1180
|
+
subAgents: [],
|
|
1181
|
+
tools: []
|
|
1182
|
+
};
|
|
1183
|
+
var resourceTypeConfigMap = {
|
|
1184
|
+
skill: {
|
|
1185
|
+
categoryValue: "skill",
|
|
1186
|
+
labelKey: "skill",
|
|
1187
|
+
getItems: (resources) => resources.skills || [],
|
|
1188
|
+
getLabel: (item) => item.aliasName || item.name
|
|
1189
|
+
},
|
|
1190
|
+
knowledge: {
|
|
1191
|
+
categoryValue: "knowledge",
|
|
1192
|
+
labelKey: "knowledge",
|
|
1193
|
+
getItems: (resources) => resources.knowledges || [],
|
|
1194
|
+
getLabel: (item) => item.name
|
|
1195
|
+
},
|
|
1196
|
+
datasource: {
|
|
1197
|
+
categoryValue: "datasource",
|
|
1198
|
+
labelKey: "datasource",
|
|
1199
|
+
getItems: (resources) => resources.datasources || [],
|
|
1200
|
+
getLabel: (item) => item.name
|
|
1201
|
+
},
|
|
1202
|
+
mcp_server: {
|
|
1203
|
+
categoryValue: "mcpServer",
|
|
1204
|
+
labelKey: "mcpServer",
|
|
1205
|
+
getItems: (resources) => resources.mcpServers || [],
|
|
1206
|
+
getLabel: (item) => item.serverName || item.name
|
|
1207
|
+
},
|
|
1208
|
+
sub_agent: {
|
|
1209
|
+
categoryValue: "subAgent",
|
|
1210
|
+
labelKey: "subAgent",
|
|
1211
|
+
getItems: (resources) => resources.subAgents || [],
|
|
1212
|
+
getLabel: (item) => item.name
|
|
1213
|
+
},
|
|
1214
|
+
tool: {
|
|
1215
|
+
categoryValue: "tool",
|
|
1216
|
+
labelKey: "tool",
|
|
1217
|
+
getItems: (resources) => resources.tools || [],
|
|
1218
|
+
getLabel: (item) => item.name
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
var categoryValueTypeMap = Object.fromEntries(
|
|
1222
|
+
Object.entries(resourceTypeConfigMap).map(([type, config]) => [config.categoryValue, type])
|
|
1223
|
+
);
|
|
1224
|
+
var isHashCommandConfig = (config) => !!config && !Array.isArray(config);
|
|
1167
1225
|
var ResourceOption = class extends MenuOption {
|
|
1168
1226
|
group;
|
|
1169
1227
|
item;
|
|
@@ -1176,10 +1234,37 @@ var ResourceOption = class extends MenuOption {
|
|
|
1176
1234
|
this.item = item;
|
|
1177
1235
|
}
|
|
1178
1236
|
};
|
|
1237
|
+
var getCategoryChildren = (category) => category.children || category.data || [];
|
|
1179
1238
|
function VariablePickerPlugin({ commandConfig = {} }) {
|
|
1180
1239
|
const [editor] = useLexicalComposerContext();
|
|
1181
1240
|
const chatStore = useChatStore();
|
|
1182
|
-
const
|
|
1241
|
+
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
1242
|
+
const slashCommandConfig = commandConfig["/"];
|
|
1243
|
+
const normalizedCommandConfig = useMemo(() => {
|
|
1244
|
+
const entries = Object.entries(commandConfig).reduce((result, [trigger, currentConfig]) => {
|
|
1245
|
+
if (trigger === "/" && Array.isArray(currentConfig)) {
|
|
1246
|
+
result.push([
|
|
1247
|
+
trigger,
|
|
1248
|
+
{
|
|
1249
|
+
component: "",
|
|
1250
|
+
dataSource: currentConfig.map((type) => ({
|
|
1251
|
+
value: resourceTypeConfigMap[type].categoryValue,
|
|
1252
|
+
label: t11(resourceTypeConfigMap[type].labelKey),
|
|
1253
|
+
ext: type,
|
|
1254
|
+
children: []
|
|
1255
|
+
}))
|
|
1256
|
+
}
|
|
1257
|
+
]);
|
|
1258
|
+
return result;
|
|
1259
|
+
}
|
|
1260
|
+
if (isHashCommandConfig(currentConfig)) {
|
|
1261
|
+
result.push([trigger, currentConfig]);
|
|
1262
|
+
}
|
|
1263
|
+
return result;
|
|
1264
|
+
}, []);
|
|
1265
|
+
return Object.fromEntries(entries);
|
|
1266
|
+
}, [commandConfig, t11]);
|
|
1267
|
+
const [commandDataSource, setCommandDataSource] = useState(normalizedCommandConfig);
|
|
1183
1268
|
const [queryString, setQueryString] = useState(null);
|
|
1184
1269
|
const [isEditorFocused, setIsEditorFocused] = useState(false);
|
|
1185
1270
|
const [menuResetKey, setMenuResetKey] = useState(0);
|
|
@@ -1211,61 +1296,48 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1211
1296
|
};
|
|
1212
1297
|
}, [editor]);
|
|
1213
1298
|
useEffect(() => {
|
|
1214
|
-
setCommandDataSource(
|
|
1215
|
-
}, [
|
|
1216
|
-
const commandKeys = useMemo(() => Object.keys(
|
|
1299
|
+
setCommandDataSource(normalizedCommandConfig);
|
|
1300
|
+
}, [normalizedCommandConfig]);
|
|
1301
|
+
const commandKeys = useMemo(() => Object.keys(commandDataSource), [commandDataSource]);
|
|
1217
1302
|
const commandKey = queryString?.[0] || "";
|
|
1218
1303
|
const searchKeyword = queryString?.slice(commandKey.length).trim().toLocaleLowerCase() || "";
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
datasource: {
|
|
1230
|
-
load: () => chatStore.config.services.request.listDataSources(),
|
|
1231
|
-
getLabel: (item) => item.name
|
|
1232
|
-
}
|
|
1233
|
-
}),
|
|
1234
|
-
[chatStore]
|
|
1235
|
-
);
|
|
1236
|
-
const formatDataSource = useCallback(
|
|
1237
|
-
(items, category) => {
|
|
1238
|
-
const currentCategoryConfig = categoryConfig[category.value];
|
|
1239
|
-
if (!items.length) return [];
|
|
1240
|
-
return items.map((item) => ({
|
|
1241
|
-
value: item.id,
|
|
1242
|
-
label: currentCategoryConfig?.getLabel(item) || item.name,
|
|
1243
|
-
children: []
|
|
1244
|
-
}));
|
|
1245
|
-
},
|
|
1246
|
-
[categoryConfig]
|
|
1247
|
-
);
|
|
1304
|
+
const formatDataSource = useCallback((items, category) => {
|
|
1305
|
+
const currentResourceType = category.ext;
|
|
1306
|
+
const currentCategoryConfig = currentResourceType ? resourceTypeConfigMap[currentResourceType] : void 0;
|
|
1307
|
+
if (!items.length) return [];
|
|
1308
|
+
return items.map((item) => ({
|
|
1309
|
+
value: "id" in item ? item.id : item.name,
|
|
1310
|
+
label: currentCategoryConfig?.getLabel(item) || item.name,
|
|
1311
|
+
children: []
|
|
1312
|
+
}));
|
|
1313
|
+
}, []);
|
|
1248
1314
|
useEffect(() => {
|
|
1249
1315
|
let isUnmounted = false;
|
|
1250
1316
|
const initializeCommandDataSource = async () => {
|
|
1251
1317
|
const nextEntries = await Promise.all(
|
|
1252
|
-
Object.entries(
|
|
1318
|
+
Object.entries(normalizedCommandConfig).map(async ([trigger, currentCommandConfig]) => {
|
|
1319
|
+
let availableResources = null;
|
|
1320
|
+
const requestTypes = trigger === "/" && Array.isArray(slashCommandConfig) ? slashCommandConfig : currentCommandConfig.dataSource.map((category) => category.ext || categoryValueTypeMap[category.value]).filter(Boolean);
|
|
1253
1321
|
const nextDataSource = await Promise.all(
|
|
1254
1322
|
(currentCommandConfig.dataSource || []).map(async (category) => {
|
|
1255
|
-
const normalizedChildren = category
|
|
1323
|
+
const normalizedChildren = getCategoryChildren(category);
|
|
1256
1324
|
const nextCategory = {
|
|
1257
1325
|
...category,
|
|
1258
1326
|
children: normalizedChildren
|
|
1259
1327
|
};
|
|
1260
|
-
const
|
|
1328
|
+
const currentResourceType = category.ext || categoryValueTypeMap[category.value];
|
|
1329
|
+
const currentCategoryConfig = currentResourceType ? resourceTypeConfigMap[currentResourceType] : void 0;
|
|
1261
1330
|
if (!currentCategoryConfig) {
|
|
1262
1331
|
return nextCategory;
|
|
1263
1332
|
}
|
|
1264
1333
|
if (normalizedChildren.length) {
|
|
1265
1334
|
return nextCategory;
|
|
1266
1335
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1336
|
+
if (!availableResources) {
|
|
1337
|
+
const response = await chatStore.config.services.request.fetchAvailableResources(requestTypes);
|
|
1338
|
+
availableResources = response.data || emptyAgentResources;
|
|
1339
|
+
}
|
|
1340
|
+
const items = currentCategoryConfig.getItems(availableResources || emptyAgentResources);
|
|
1269
1341
|
return {
|
|
1270
1342
|
...nextCategory,
|
|
1271
1343
|
children: formatDataSource(items, category)
|
|
@@ -1288,11 +1360,11 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1288
1360
|
return () => {
|
|
1289
1361
|
isUnmounted = true;
|
|
1290
1362
|
};
|
|
1291
|
-
}, [
|
|
1363
|
+
}, [chatStore.config.services.request, formatDataSource, normalizedCommandConfig, slashCommandConfig]);
|
|
1292
1364
|
const commandGroups = useMemo(() => {
|
|
1293
1365
|
if (!isEditorFocused) return [];
|
|
1294
1366
|
return (commandDataSource[commandKey]?.dataSource || []).map((group) => {
|
|
1295
|
-
const options = group
|
|
1367
|
+
const options = getCategoryChildren(group);
|
|
1296
1368
|
if (!searchKeyword) return { group, options };
|
|
1297
1369
|
return {
|
|
1298
1370
|
group,
|
|
@@ -1355,14 +1427,16 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1355
1427
|
function InitialStatePlugin({ value }) {
|
|
1356
1428
|
const [editor] = useLexicalComposerContext();
|
|
1357
1429
|
function parseAndAppendNodes(paragraph, value2) {
|
|
1358
|
-
const variableRegex =
|
|
1430
|
+
const variableRegex = /\/?(\w+):\/\/([^?\s]+)\?name=([^&\s]+)&label=([^\s]+)/g;
|
|
1359
1431
|
let lastIndex = 0;
|
|
1360
1432
|
let match;
|
|
1361
1433
|
while ((match = variableRegex.exec(value2)) !== null) {
|
|
1362
1434
|
if (match.index > lastIndex) {
|
|
1363
1435
|
paragraph.append($createTextNode(value2.substring(lastIndex, match.index)));
|
|
1364
1436
|
}
|
|
1365
|
-
paragraph.append(
|
|
1437
|
+
paragraph.append(
|
|
1438
|
+
$createVariableNode(decodeURIComponent(match[4]), decodeURIComponent(match[3]), decodeURIComponent(match[1]), decodeURIComponent(match[2]))
|
|
1439
|
+
);
|
|
1366
1440
|
lastIndex = variableRegex.lastIndex;
|
|
1367
1441
|
}
|
|
1368
1442
|
if (lastIndex < value2.length) {
|
|
@@ -1403,6 +1477,17 @@ function normalizePastedFiles(files) {
|
|
|
1403
1477
|
});
|
|
1404
1478
|
});
|
|
1405
1479
|
}
|
|
1480
|
+
function focusEditableToCursor(target, cursor = "end") {
|
|
1481
|
+
if (!target) return;
|
|
1482
|
+
target.focus();
|
|
1483
|
+
const selection = window.getSelection();
|
|
1484
|
+
if (!selection) return;
|
|
1485
|
+
const range = document.createRange();
|
|
1486
|
+
range.selectNodeContents(target);
|
|
1487
|
+
range.collapse(cursor !== "start");
|
|
1488
|
+
selection.removeAllRanges();
|
|
1489
|
+
selection.addRange(range);
|
|
1490
|
+
}
|
|
1406
1491
|
var ChatInput = React10.forwardRef(
|
|
1407
1492
|
({
|
|
1408
1493
|
value = "",
|
|
@@ -1432,7 +1517,11 @@ var ChatInput = React10.forwardRef(
|
|
|
1432
1517
|
editable: !disabled && !readOnly
|
|
1433
1518
|
};
|
|
1434
1519
|
useImperativeHandle(ref, () => ({
|
|
1435
|
-
focus: () =>
|
|
1520
|
+
focus: (options) => {
|
|
1521
|
+
requestAnimationFrame(() => {
|
|
1522
|
+
focusEditableToCursor(contentEditableRef.current, options?.cursor || "end");
|
|
1523
|
+
});
|
|
1524
|
+
},
|
|
1436
1525
|
blur: () => contentEditableRef.current?.blur(),
|
|
1437
1526
|
nativeElement: contentEditableRef.current
|
|
1438
1527
|
}));
|
|
@@ -1698,6 +1787,9 @@ var createChatService = (request, config) => {
|
|
|
1698
1787
|
const fetchExecutionDebug = (conversationId) => {
|
|
1699
1788
|
return request.get(`/agents/conversations/${conversationId}/executions/debug`);
|
|
1700
1789
|
};
|
|
1790
|
+
const fetchAvailableResources = (types = ["skill", "knowledge", "datasource", "mcp_server"]) => {
|
|
1791
|
+
return request.get(`/agents/resources/available`, { types: Array.isArray(types) ? types.toString() : types });
|
|
1792
|
+
};
|
|
1701
1793
|
return {
|
|
1702
1794
|
fetchModelList,
|
|
1703
1795
|
fetchAgentInfo,
|
|
@@ -1719,7 +1811,8 @@ var createChatService = (request, config) => {
|
|
|
1719
1811
|
getAgentAvatar,
|
|
1720
1812
|
conversationFavorite,
|
|
1721
1813
|
shareConversation,
|
|
1722
|
-
fetchExecutionDebug
|
|
1814
|
+
fetchExecutionDebug,
|
|
1815
|
+
fetchAvailableResources
|
|
1723
1816
|
};
|
|
1724
1817
|
};
|
|
1725
1818
|
|
|
@@ -1747,8 +1840,6 @@ function createChatStore() {
|
|
|
1747
1840
|
/** 钩子函数 */
|
|
1748
1841
|
hooks: {},
|
|
1749
1842
|
layout: {},
|
|
1750
|
-
/** 智能体执行链展示模式(默认聚合模式,可运行时切换) */
|
|
1751
|
-
agentExecMode: "aggregate",
|
|
1752
1843
|
loading: false,
|
|
1753
1844
|
/** 文件预览状态 */
|
|
1754
1845
|
preview: {
|
|
@@ -1837,9 +1928,6 @@ function createChatStore() {
|
|
|
1837
1928
|
const setLayout = (layout) => {
|
|
1838
1929
|
config.layout = deepMerge(defaultLayout, layout);
|
|
1839
1930
|
};
|
|
1840
|
-
const setExecMode = (mode) => {
|
|
1841
|
-
config.agentExecMode = mode;
|
|
1842
|
-
};
|
|
1843
1931
|
const fetchExecutionDebug = (conversationId) => {
|
|
1844
1932
|
return config.services.request.fetchExecutionDebug(conversationId);
|
|
1845
1933
|
};
|
|
@@ -2870,8 +2958,6 @@ function createChatStore() {
|
|
|
2870
2958
|
setParams,
|
|
2871
2959
|
/** 设置布局配置 */
|
|
2872
2960
|
setLayout,
|
|
2873
|
-
/** 设置智能体执行链展示模式(聚合 / 顺序) */
|
|
2874
|
-
setExecMode,
|
|
2875
2961
|
/** 获取会话执行轨迹(debug 模式) */
|
|
2876
2962
|
fetchExecutionDebug,
|
|
2877
2963
|
/** 设置生命周期钩子 */
|
|
@@ -3280,35 +3366,10 @@ var ConversationList_default = ({ onClose }) => {
|
|
|
3280
3366
|
var style_module_default = {
|
|
3281
3367
|
popover: "style_module_popover",
|
|
3282
3368
|
resourceBtn: "style_module_resourceBtn",
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
layout: "style_module_layout",
|
|
3288
|
-
sider: "style_module_sider",
|
|
3289
|
-
categoryName: "style_module_categoryName",
|
|
3290
|
-
siderContent: "style_module_siderContent",
|
|
3291
|
-
categoryItem: "style_module_categoryItem",
|
|
3292
|
-
categoryActive: "style_module_categoryActive",
|
|
3293
|
-
roundCheckbox: "style_module_roundCheckbox",
|
|
3294
|
-
content: "style_module_content",
|
|
3295
|
-
searchInput: "style_module_searchInput",
|
|
3296
|
-
selectedCount: "style_module_selectedCount",
|
|
3297
|
-
tagsArea: "style_module_tagsArea",
|
|
3298
|
-
tagContainer: "style_module_tagContainer",
|
|
3299
|
-
tag: "style_module_tag",
|
|
3300
|
-
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
3301
|
-
expandBtn: "style_module_expandBtn",
|
|
3302
|
-
tagsExpanded: "style_module_tagsExpanded",
|
|
3303
|
-
listArea: "style_module_listArea",
|
|
3304
|
-
listInner: "style_module_listInner",
|
|
3305
|
-
listItem: "style_module_listItem",
|
|
3306
|
-
listItemSelected: "style_module_listItemSelected",
|
|
3307
|
-
itemIconWrapper: "style_module_itemIconWrapper",
|
|
3308
|
-
itemInfo: "style_module_itemInfo",
|
|
3309
|
-
itemDesc: "style_module_itemDesc",
|
|
3310
|
-
footer: "style_module_footer",
|
|
3311
|
-
titleContainer: "style_module_titleContainer"};
|
|
3369
|
+
resourceDropdown: "style_module_resourceDropdown",
|
|
3370
|
+
resourceDropdownMenu: "style_module_resourceDropdownMenu",
|
|
3371
|
+
resourceDropdownSubMenu: "style_module_resourceDropdownSubMenu",
|
|
3372
|
+
resourceBtnActive: "style_module_resourceBtnActive"};
|
|
3312
3373
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
3313
3374
|
const chatStore = useChatStore();
|
|
3314
3375
|
const agentState = useSnapshot(chatStore.agent);
|
|
@@ -3351,7 +3412,7 @@ var ChatHeader_default = ({
|
|
|
3351
3412
|
const conversationState = useSnapshot(chatStore.conversation);
|
|
3352
3413
|
const conversationsState = useSnapshot(chatStore.conversations);
|
|
3353
3414
|
const conversationTitle = String(conversationsState.list.items.find((item) => item.key === conversationState.active.id)?.label || "");
|
|
3354
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className:
|
|
3415
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: classNames9(styles_module_default2.chatHeader, "zero-chat-header"), children: [
|
|
3355
3416
|
/* @__PURE__ */ jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
|
|
3356
3417
|
/* @__PURE__ */ jsx(
|
|
3357
3418
|
RenderWrapper,
|
|
@@ -3405,8 +3466,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3405
3466
|
{
|
|
3406
3467
|
control: title,
|
|
3407
3468
|
DefaultComponent: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
3408
|
-
/* @__PURE__ */ jsx(Text, { strong: true, className:
|
|
3409
|
-
/* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className:
|
|
3469
|
+
/* @__PURE__ */ jsx(Text, { strong: true, className: classNames9("fz-16"), children: agentState.agentInfo.name }),
|
|
3470
|
+
/* @__PURE__ */ jsx(Text, { type: "secondary", ellipsis: true, className: classNames9("fz-12"), children: agentState.agentInfo.description })
|
|
3410
3471
|
] }) })
|
|
3411
3472
|
}
|
|
3412
3473
|
)
|
|
@@ -3421,7 +3482,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3421
3482
|
block: true,
|
|
3422
3483
|
type: "primary",
|
|
3423
3484
|
onClick: () => chatStore.createConversation(),
|
|
3424
|
-
className:
|
|
3485
|
+
className: classNames9(styles_module_default2.createConversationButton),
|
|
3425
3486
|
icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
|
|
3426
3487
|
children: t11("newConversation")
|
|
3427
3488
|
}
|
|
@@ -3431,35 +3492,12 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3431
3492
|
] });
|
|
3432
3493
|
};
|
|
3433
3494
|
var ConversationListPanel = ({ header }) => {
|
|
3434
|
-
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
3495
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
3435
3496
|
/* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
3436
3497
|
/* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
|
|
3437
3498
|
] });
|
|
3438
3499
|
};
|
|
3439
3500
|
var ConversationListPanel_default = ConversationListPanel;
|
|
3440
|
-
|
|
3441
|
-
// src/components/agentExecShared.ts
|
|
3442
|
-
var EXEC_CONTENT_EVENT_TYPES = ["text", "toolCall", "toolResult", "stepError", "runFailed", "files", "plan"];
|
|
3443
|
-
function hasContent(content = [], countAnswer) {
|
|
3444
|
-
return content.some((item) => {
|
|
3445
|
-
const evt = item;
|
|
3446
|
-
if (evt.type === "text") {
|
|
3447
|
-
const t11 = item;
|
|
3448
|
-
return countAnswer ? !!(t11.reasoningContent || t11.messageContent) : !!t11.reasoningContent;
|
|
3449
|
-
}
|
|
3450
|
-
return EXEC_CONTENT_EVENT_TYPES.includes(evt.type);
|
|
3451
|
-
});
|
|
3452
|
-
}
|
|
3453
|
-
function hasExecContent(content = []) {
|
|
3454
|
-
return hasContent(content, true);
|
|
3455
|
-
}
|
|
3456
|
-
function hasExecChain(content = []) {
|
|
3457
|
-
return hasContent(content, false);
|
|
3458
|
-
}
|
|
3459
|
-
function isSubAgentEvent(tool) {
|
|
3460
|
-
if (!tool) return false;
|
|
3461
|
-
return !!tool.hasSubAgent || !!tool.subConversationId || !!tool.metadata?.conversationId || tool.toolName === "agent_spawn";
|
|
3462
|
-
}
|
|
3463
3501
|
var XCard = XCard$1;
|
|
3464
3502
|
var { Text: AText } = Typography;
|
|
3465
3503
|
function getArtifactFallbackTitle(type) {
|
|
@@ -3926,7 +3964,7 @@ var CHART_COMPONENTS = Object.fromEntries(
|
|
|
3926
3964
|
var Charts_default = ({ data, loading }) => {
|
|
3927
3965
|
const { type, config } = data;
|
|
3928
3966
|
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
3929
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
3967
|
+
return /* @__PURE__ */ jsx("div", { className: classNames9(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
3930
3968
|
// Antd 骨架屏
|
|
3931
3969
|
/* @__PURE__ */ jsx(Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsx(DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
3932
3970
|
) : /* @__PURE__ */ jsx(
|
|
@@ -4024,9 +4062,9 @@ var IndexQuote_default = ({ data, loading, message: message3 }) => {
|
|
|
4024
4062
|
setOpen(true);
|
|
4025
4063
|
}
|
|
4026
4064
|
};
|
|
4027
|
-
const
|
|
4065
|
+
const Content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsx("a", { onClick, children: citation?.citationName }) }) });
|
|
4028
4066
|
return /* @__PURE__ */ jsxs("div", { className: "inline-block m-l-8", children: [
|
|
4029
|
-
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content:
|
|
4067
|
+
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content: Content, children: /* @__PURE__ */ jsx(Tag, { variant: "filled", color: "processing", className: "cursor-pointer", children: data?.citationName }) }) }),
|
|
4030
4068
|
open && /* @__PURE__ */ jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
4031
4069
|
] });
|
|
4032
4070
|
};
|
|
@@ -4236,7 +4274,7 @@ var XMarkdown_default = memo(({ message: message3, components = {}, content = ""
|
|
|
4236
4274
|
return /* @__PURE__ */ jsx(
|
|
4237
4275
|
XMarkdown,
|
|
4238
4276
|
{
|
|
4239
|
-
className:
|
|
4277
|
+
className: classNames9("x-markdown-light", styles_module_default4.xMarkdownStyle),
|
|
4240
4278
|
config,
|
|
4241
4279
|
...rest,
|
|
4242
4280
|
content: processedContent,
|
|
@@ -6171,49 +6209,25 @@ var ToolCallItem = ({ item }) => {
|
|
|
6171
6209
|
};
|
|
6172
6210
|
var tool_call_item_default = ToolCallItem;
|
|
6173
6211
|
|
|
6174
|
-
// src/components/
|
|
6175
|
-
var
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
6194
|
-
const [open, setOpen] = useState(false);
|
|
6195
|
-
const hasExpand = !!content;
|
|
6196
|
-
return /* @__PURE__ */ jsxs("div", { className: agentExecList_module_default.execRow, children: [
|
|
6197
|
-
/* @__PURE__ */ jsxs("div", { className: agentExecList_module_default.rowLine, onClick: () => hasExpand && setOpen((o) => !o), children: [
|
|
6198
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.rowIcon, children: icon }),
|
|
6199
|
-
/* @__PURE__ */ jsx("span", { className: `${agentExecList_module_default.rowLabel} ${status === "error" ? agentExecList_module_default.rowLabelError : ""}`, children: label }),
|
|
6200
|
-
/* @__PURE__ */ jsx("span", { className: `${agentExecList_module_default.rowDetail} ${hasExpand ? agentExecList_module_default.rowDetailExpandable : ""}`, title: detail, children: detail || " " }),
|
|
6201
|
-
onDetail && /* @__PURE__ */ jsx(
|
|
6202
|
-
"span",
|
|
6203
|
-
{
|
|
6204
|
-
className: agentExecList_module_default.rowDetailAction,
|
|
6205
|
-
onClick: (e) => {
|
|
6206
|
-
e.stopPropagation();
|
|
6207
|
-
onDetail();
|
|
6208
|
-
},
|
|
6209
|
-
children: t11("viewExecutionDetail")
|
|
6210
|
-
}
|
|
6211
|
-
)
|
|
6212
|
-
] }),
|
|
6213
|
-
open && content && /* @__PURE__ */ jsx("div", { className: agentExecList_module_default.rowBody, children: content })
|
|
6214
|
-
] });
|
|
6215
|
-
});
|
|
6216
|
-
var agentExecRow_default = AgentExecRow;
|
|
6212
|
+
// src/components/agentExecShared.ts
|
|
6213
|
+
var EXEC_CONTENT_EVENT_TYPES = ["text", "toolCall", "toolResult", "stepError", "runFailed", "files", "plan"];
|
|
6214
|
+
function hasContent(content = [], countAnswer) {
|
|
6215
|
+
return content.some((item) => {
|
|
6216
|
+
const evt = item;
|
|
6217
|
+
if (evt.type === "text") {
|
|
6218
|
+
const t11 = item;
|
|
6219
|
+
return !!(t11.reasoningContent || t11.messageContent) ;
|
|
6220
|
+
}
|
|
6221
|
+
return EXEC_CONTENT_EVENT_TYPES.includes(evt.type);
|
|
6222
|
+
});
|
|
6223
|
+
}
|
|
6224
|
+
function hasExecContent(content = []) {
|
|
6225
|
+
return hasContent(content);
|
|
6226
|
+
}
|
|
6227
|
+
function isSubAgentEvent(tool) {
|
|
6228
|
+
if (!tool) return false;
|
|
6229
|
+
return !!tool.hasSubAgent || !!tool.subConversationId || !!tool.metadata?.conversationId || tool.toolName === "agent_spawn";
|
|
6230
|
+
}
|
|
6217
6231
|
var TOOL_LABEL = {
|
|
6218
6232
|
loading: t(`${NS_CHAT_COPILOT}:execItemRunning`),
|
|
6219
6233
|
success: t(`${NS_CHAT_COPILOT}:execItemDone`),
|
|
@@ -6321,70 +6335,48 @@ function buildExecRow(item, index, ctx) {
|
|
|
6321
6335
|
return null;
|
|
6322
6336
|
}
|
|
6323
6337
|
}
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
const
|
|
6337
|
-
const
|
|
6338
|
-
const
|
|
6339
|
-
return
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.count, children: t(`${NS_CHAT_COPILOT}:execItemSummaryDone`, { count: completed }) }),
|
|
6346
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.divider, children: "|" }),
|
|
6347
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.count, children: t(`${NS_CHAT_COPILOT}:execItemSummaryFailed`, { count: failed }) }),
|
|
6348
|
-
loading > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6349
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.divider, children: "|" }),
|
|
6350
|
-
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.count, children: t(`${NS_CHAT_COPILOT}:execItemSummaryRunning`, { count: loading }) })
|
|
6351
|
-
] })
|
|
6352
|
-
] });
|
|
6353
|
-
return /* @__PURE__ */ jsx(
|
|
6354
|
-
Collapse,
|
|
6355
|
-
{
|
|
6356
|
-
ghost: true,
|
|
6357
|
-
size: "small",
|
|
6358
|
-
className: agentExecList_module_default.wrap,
|
|
6359
|
-
defaultActiveKey: defaultActive ? ["agent-exec"] : [],
|
|
6360
|
-
items: [
|
|
6338
|
+
|
|
6339
|
+
// src/components/agentExecList.module.less
|
|
6340
|
+
var agentExecList_module_default = {
|
|
6341
|
+
execRow: "agentExecList_module_execRow",
|
|
6342
|
+
rowLine: "agentExecList_module_rowLine",
|
|
6343
|
+
rowIcon: "agentExecList_module_rowIcon",
|
|
6344
|
+
rowDetail: "agentExecList_module_rowDetail",
|
|
6345
|
+
rowDetailExpandable: "agentExecList_module_rowDetailExpandable",
|
|
6346
|
+
rowDetailAction: "agentExecList_module_rowDetailAction",
|
|
6347
|
+
rowBody: "agentExecList_module_rowBody"
|
|
6348
|
+
};
|
|
6349
|
+
var AgentExecRow = memo(({ icon, detail, status, content, onDetail }) => {
|
|
6350
|
+
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
6351
|
+
const [open, setOpen] = useState(false);
|
|
6352
|
+
const hasExpand = !!content;
|
|
6353
|
+
return /* @__PURE__ */ jsxs("div", { className: agentExecList_module_default.execRow, children: [
|
|
6354
|
+
/* @__PURE__ */ jsxs("div", { className: agentExecList_module_default.rowLine, onClick: () => hasExpand && setOpen((o) => !o), children: [
|
|
6355
|
+
/* @__PURE__ */ jsx("span", { className: agentExecList_module_default.rowIcon, children: icon }),
|
|
6356
|
+
/* @__PURE__ */ jsx("span", { className: `${agentExecList_module_default.rowDetail} ${hasExpand ? agentExecList_module_default.rowDetailExpandable : ""}`, title: detail, children: detail || " " }),
|
|
6357
|
+
onDetail && /* @__PURE__ */ jsx(
|
|
6358
|
+
"span",
|
|
6361
6359
|
{
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
label: item.label,
|
|
6369
|
-
detail: item.detail,
|
|
6370
|
-
status: item.status,
|
|
6371
|
-
content: item.content,
|
|
6372
|
-
onDetail: item.onDetail
|
|
6373
|
-
},
|
|
6374
|
-
item.key
|
|
6375
|
-
)) })
|
|
6360
|
+
className: agentExecList_module_default.rowDetailAction,
|
|
6361
|
+
onClick: (e) => {
|
|
6362
|
+
e.stopPropagation();
|
|
6363
|
+
onDetail();
|
|
6364
|
+
},
|
|
6365
|
+
children: t11("viewExecutionDetail")
|
|
6376
6366
|
}
|
|
6377
|
-
|
|
6378
|
-
}
|
|
6379
|
-
|
|
6380
|
-
}
|
|
6367
|
+
)
|
|
6368
|
+
] }),
|
|
6369
|
+
open && content && /* @__PURE__ */ jsx("div", { className: agentExecList_module_default.rowBody, children: content })
|
|
6370
|
+
] });
|
|
6371
|
+
});
|
|
6372
|
+
var agentExecRow_default = AgentExecRow;
|
|
6381
6373
|
|
|
6382
6374
|
// src/components/agentExecSequence.module.less
|
|
6383
6375
|
var agentExecSequence_module_default = {
|
|
6384
6376
|
seq: "agentExecSequence_module_seq"
|
|
6385
6377
|
};
|
|
6386
6378
|
function renderRow(row, key) {
|
|
6387
|
-
return /* @__PURE__ */ jsx(agentExecRow_default, { icon: row.icon,
|
|
6379
|
+
return /* @__PURE__ */ jsx(agentExecRow_default, { icon: row.icon, detail: row.detail, status: row.status, content: row.content, onDetail: row.onDetail }, key);
|
|
6388
6380
|
}
|
|
6389
6381
|
var AgentExecSequence = memo(({ content, message: message3, customComponents, messageIndex, role, onViewSubAgent }) => {
|
|
6390
6382
|
const ctx = { message: message3, customComponents, onViewSubAgent };
|
|
@@ -6426,33 +6418,8 @@ var AgentExecSequence = memo(({ content, message: message3, customComponents, me
|
|
|
6426
6418
|
var agentExecSequence_default = AgentExecSequence;
|
|
6427
6419
|
var MessageRender_default = React10__default.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
6428
6420
|
const chatStore = useChatStore();
|
|
6429
|
-
const configState = useSnapshot(chatStore.config);
|
|
6430
|
-
const execMode = configState.agentExecMode || "aggregate";
|
|
6431
|
-
const isSequence = execMode === "sequence";
|
|
6432
6421
|
const openSubAgent = useCallback((item) => chatStore.openSubAgent(item), [chatStore]);
|
|
6433
|
-
const {
|
|
6434
|
-
items,
|
|
6435
|
-
completed,
|
|
6436
|
-
failed,
|
|
6437
|
-
loading: runLoading
|
|
6438
|
-
} = useMemo(
|
|
6439
|
-
() => buildAgentExecItems(message3.content || [], {
|
|
6440
|
-
message: message3,
|
|
6441
|
-
customComponents,
|
|
6442
|
-
// 子智能体:打开右侧执行详情抽屉
|
|
6443
|
-
onViewSubAgent: openSubAgent
|
|
6444
|
-
}),
|
|
6445
|
-
[message3, customComponents, openSubAgent]
|
|
6446
|
-
);
|
|
6447
6422
|
const hasSequenceContent = useMemo(() => hasExecContent(message3.content || []), [message3.content]);
|
|
6448
|
-
const finalAnswer = useMemo(() => {
|
|
6449
|
-
const lastText = [...message3.content || []].reverse().find((i) => i.type === "text");
|
|
6450
|
-
if (!lastText) return null;
|
|
6451
|
-
const content = lastText.messageContent || "";
|
|
6452
|
-
if (!String(content).trim()) return null;
|
|
6453
|
-
const answerItem = { ...lastText, reasoningContent: void 0 };
|
|
6454
|
-
return /* @__PURE__ */ jsx(TextNode2, { item: answerItem, role: message3.role, customComponents, message: message3, messageIndex });
|
|
6455
|
-
}, [message3, messageIndex, customComponents]);
|
|
6456
6423
|
const quoteMsg = useMemo(() => {
|
|
6457
6424
|
const quoteMsg2 = {};
|
|
6458
6425
|
if (message3.params) {
|
|
@@ -6468,16 +6435,14 @@ var MessageRender_default = React10__default.memo(({ role, message: message3, me
|
|
|
6468
6435
|
}, [message3.params, message3.quoteMsg]);
|
|
6469
6436
|
const hasToolCall = useMemo(() => (message3.content || []).some((i) => i.type === "toolCall" || i.type === "toolResult"), [message3]);
|
|
6470
6437
|
const lastContentType = message3.content?.[message3.content.length - 1]?.type;
|
|
6471
|
-
const
|
|
6472
|
-
|
|
6473
|
-
if (isSequence ? !hasSequenceContent && !showPending : items.length === 0 && !finalAnswer && !showPending) return null;
|
|
6438
|
+
const showPending = loading && (!hasSequenceContent || lastContentType !== "text");
|
|
6439
|
+
if (!hasSequenceContent && !showPending) return null;
|
|
6474
6440
|
return /* @__PURE__ */ jsxs(Flex, { ref: containerRef, vertical: true, gap: 8, children: [
|
|
6475
|
-
|
|
6441
|
+
hasSequenceContent && /* @__PURE__ */ jsx(
|
|
6476
6442
|
Bubble,
|
|
6477
6443
|
{
|
|
6478
6444
|
role: role.user,
|
|
6479
6445
|
placement: role.placement,
|
|
6480
|
-
variant: "borderless",
|
|
6481
6446
|
className: styles_module_default.bubble,
|
|
6482
6447
|
content: /* @__PURE__ */ jsx(
|
|
6483
6448
|
agentExecSequence_default,
|
|
@@ -6491,18 +6456,8 @@ var MessageRender_default = React10__default.memo(({ role, message: message3, me
|
|
|
6491
6456
|
}
|
|
6492
6457
|
)
|
|
6493
6458
|
}
|
|
6494
|
-
) : items.length > 0 && /* @__PURE__ */ jsx(
|
|
6495
|
-
Bubble,
|
|
6496
|
-
{
|
|
6497
|
-
role: role.user,
|
|
6498
|
-
placement: role.placement,
|
|
6499
|
-
variant: "borderless",
|
|
6500
|
-
className: styles_module_default.bubble,
|
|
6501
|
-
content: /* @__PURE__ */ jsx(AgentExecList, { items, completed, failed, loading: runLoading })
|
|
6502
|
-
}
|
|
6503
6459
|
),
|
|
6504
6460
|
hasToolCall && messageIndex >= 0 && /* @__PURE__ */ jsx(A2uiMessageCards, { messageIndex, message: message3 }),
|
|
6505
|
-
!isSequence && finalAnswer && /* @__PURE__ */ jsx(Bubble, { role: role.user, placement: role.placement, className: styles_module_default.bubble, content: finalAnswer }),
|
|
6506
6461
|
showPending && role.user === "agent" && /* @__PURE__ */ jsx(Bubble, { role: role.user, placement: role.placement, content: /* @__PURE__ */ jsx(RunStartedNode, {}) }),
|
|
6507
6462
|
quoteMsg && /* @__PURE__ */ jsx(QuoteMsgNode, { quoteMsg, role })
|
|
6508
6463
|
] });
|
|
@@ -6521,7 +6476,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
6521
6476
|
/* @__PURE__ */ jsx(
|
|
6522
6477
|
Welcome,
|
|
6523
6478
|
{
|
|
6524
|
-
className:
|
|
6479
|
+
className: classNames9(styles_module_default2.chatWelcome, "p-t-32"),
|
|
6525
6480
|
variant: "borderless",
|
|
6526
6481
|
icon: /* @__PURE__ */ jsx(
|
|
6527
6482
|
RenderWrapper,
|
|
@@ -6547,7 +6502,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
6547
6502
|
DefaultComponent: /* @__PURE__ */ jsx(
|
|
6548
6503
|
Prompts,
|
|
6549
6504
|
{
|
|
6550
|
-
className:
|
|
6505
|
+
className: classNames9("m-t-16", styles_module_default2.promptItem),
|
|
6551
6506
|
wrap: true,
|
|
6552
6507
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
6553
6508
|
items: recommendQuestions
|
|
@@ -6756,264 +6711,13 @@ var BubbleListItems_default = ({
|
|
|
6756
6711
|
autoScroll: false,
|
|
6757
6712
|
ref: listRef,
|
|
6758
6713
|
items: bubbleListItems,
|
|
6759
|
-
className:
|
|
6714
|
+
className: classNames9(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
6760
6715
|
onScroll: handleScroll
|
|
6761
6716
|
},
|
|
6762
6717
|
conversationState.active.id
|
|
6763
6718
|
) }) });
|
|
6764
6719
|
};
|
|
6765
|
-
var {
|
|
6766
|
-
var { Title: Title2, Text: Text4 } = Typography;
|
|
6767
|
-
var ALL_CATEGORY_ID = "all";
|
|
6768
|
-
var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
6769
|
-
const chatStore = useChatStore();
|
|
6770
|
-
const conversationState = useSnapshot(chatStore.conversation);
|
|
6771
|
-
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
6772
|
-
const { token } = theme.useToken();
|
|
6773
|
-
const tagsContainerRef = useRef(null);
|
|
6774
|
-
const isSkill = type === "skill";
|
|
6775
|
-
const [loading, setLoading] = useState(false);
|
|
6776
|
-
const [resources, setResources] = useState([]);
|
|
6777
|
-
const [categories, setCategories] = useState([]);
|
|
6778
|
-
const [selectedCategoryIds, setSelectedCategoryIds] = useState([ALL_CATEGORY_ID]);
|
|
6779
|
-
const [selectedIds, setSelectedIds] = useState([]);
|
|
6780
|
-
const [searchText, setSearchText] = useState("");
|
|
6781
|
-
const [tagsExpanded, setTagsExpanded] = useState(false);
|
|
6782
|
-
const [showExpandBtn, setShowExpandBtn] = useState(false);
|
|
6783
|
-
useEffect(() => {
|
|
6784
|
-
if (!open) {
|
|
6785
|
-
setResources([]);
|
|
6786
|
-
setCategories([]);
|
|
6787
|
-
setSelectedCategoryIds([ALL_CATEGORY_ID]);
|
|
6788
|
-
setSelectedIds([]);
|
|
6789
|
-
setSearchText("");
|
|
6790
|
-
setTagsExpanded(false);
|
|
6791
|
-
setShowExpandBtn(false);
|
|
6792
|
-
return;
|
|
6793
|
-
}
|
|
6794
|
-
let canceled = false;
|
|
6795
|
-
setLoading(true);
|
|
6796
|
-
const fetchData = async () => {
|
|
6797
|
-
try {
|
|
6798
|
-
const tagType = isSkill ? 3 /* SKILL */ : 2 /* KNOWLEDGE */;
|
|
6799
|
-
const [tagsRes, resourcesRes] = await Promise.all([
|
|
6800
|
-
chatStore.config.services.request.listTags({ tagType }),
|
|
6801
|
-
isSkill ? chatStore.config.services.request.listSkills() : chatStore.config.services.request.listLibrarys({ libraryType: 1 /* KNOWLEDGE */ })
|
|
6802
|
-
]);
|
|
6803
|
-
if (canceled) return;
|
|
6804
|
-
const fetchedResources = resourcesRes.data || [];
|
|
6805
|
-
setCategories(tagsRes.data || []);
|
|
6806
|
-
setResources(fetchedResources);
|
|
6807
|
-
const spec = conversationState.active.spec;
|
|
6808
|
-
const initialItems = isSkill ? spec?.skills?.items : spec?.knowledges?.items;
|
|
6809
|
-
const validIds = new Set(fetchedResources.map((r) => r.id));
|
|
6810
|
-
const validSelectedIds = (initialItems || []).map((item) => item.id).filter((id) => validIds.has(id));
|
|
6811
|
-
setSelectedIds(validSelectedIds);
|
|
6812
|
-
if (initialItems && validSelectedIds.length !== initialItems.length) {
|
|
6813
|
-
const currentSpec = chatStore.conversation.active.spec || {};
|
|
6814
|
-
const clonedSpec = JSON.parse(JSON.stringify(currentSpec));
|
|
6815
|
-
chatStore.setConversationSpec(getNextSpec(clonedSpec, validSelectedIds, fetchedResources));
|
|
6816
|
-
}
|
|
6817
|
-
} finally {
|
|
6818
|
-
if (!canceled) setLoading(false);
|
|
6819
|
-
}
|
|
6820
|
-
};
|
|
6821
|
-
fetchData();
|
|
6822
|
-
return () => {
|
|
6823
|
-
canceled = true;
|
|
6824
|
-
};
|
|
6825
|
-
}, [open, isSkill, chatStore, conversationState.active.spec]);
|
|
6826
|
-
useEffect(() => {
|
|
6827
|
-
if (!open) return;
|
|
6828
|
-
const checkHeight = () => {
|
|
6829
|
-
if (tagsContainerRef.current) {
|
|
6830
|
-
setShowExpandBtn(tagsContainerRef.current.scrollHeight > 60);
|
|
6831
|
-
}
|
|
6832
|
-
};
|
|
6833
|
-
setTimeout(checkHeight, 0);
|
|
6834
|
-
const observer = new ResizeObserver(checkHeight);
|
|
6835
|
-
if (tagsContainerRef.current) observer.observe(tagsContainerRef.current);
|
|
6836
|
-
return () => observer.disconnect();
|
|
6837
|
-
}, [open, selectedIds]);
|
|
6838
|
-
const allCategories = useMemo(() => [{ id: ALL_CATEGORY_ID, name: t11("all") }, ...categories], [categories, t11]);
|
|
6839
|
-
const filteredResources = useMemo(() => {
|
|
6840
|
-
return resources.filter((item) => {
|
|
6841
|
-
const matchCategory = selectedCategoryIds.includes(ALL_CATEGORY_ID) || item.tagIds?.some((id) => selectedCategoryIds.includes(id));
|
|
6842
|
-
const searchLower = searchText.trim().toLowerCase();
|
|
6843
|
-
const itemName = item.name?.toLowerCase() || "";
|
|
6844
|
-
const itemAlias = "aliasName" in item ? item.aliasName?.toLowerCase() || "" : "";
|
|
6845
|
-
const matchSearch = !searchLower || itemName.includes(searchLower) || itemAlias.includes(searchLower);
|
|
6846
|
-
return matchCategory && matchSearch;
|
|
6847
|
-
});
|
|
6848
|
-
}, [resources, selectedCategoryIds, searchText]);
|
|
6849
|
-
const getNextSpec = (spec, ids, resourceList) => {
|
|
6850
|
-
const nextSpec = { ...spec };
|
|
6851
|
-
if (isSkill) {
|
|
6852
|
-
nextSpec.skills = {
|
|
6853
|
-
items: ids.map((id) => ({ id }))
|
|
6854
|
-
};
|
|
6855
|
-
} else {
|
|
6856
|
-
nextSpec.knowledges = {
|
|
6857
|
-
items: ids.map((id) => {
|
|
6858
|
-
const resource = resourceList.find((r) => r.id === id);
|
|
6859
|
-
return { id, name: resource?.name || "" };
|
|
6860
|
-
})
|
|
6861
|
-
};
|
|
6862
|
-
}
|
|
6863
|
-
return nextSpec;
|
|
6864
|
-
};
|
|
6865
|
-
const handleCategoryChange = (categoryId, checked) => {
|
|
6866
|
-
if (categoryId === ALL_CATEGORY_ID) {
|
|
6867
|
-
setSelectedCategoryIds(checked ? [ALL_CATEGORY_ID] : []);
|
|
6868
|
-
return;
|
|
6869
|
-
}
|
|
6870
|
-
let nextIds = selectedCategoryIds.filter((id) => id !== ALL_CATEGORY_ID);
|
|
6871
|
-
if (checked) {
|
|
6872
|
-
nextIds.push(categoryId);
|
|
6873
|
-
} else {
|
|
6874
|
-
nextIds = nextIds.filter((id) => id !== categoryId);
|
|
6875
|
-
}
|
|
6876
|
-
setSelectedCategoryIds(nextIds.length ? nextIds : [ALL_CATEGORY_ID]);
|
|
6877
|
-
};
|
|
6878
|
-
const toggleItemSelection = (id) => {
|
|
6879
|
-
setSelectedIds((prev) => prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]);
|
|
6880
|
-
};
|
|
6881
|
-
const handleConfirm = () => {
|
|
6882
|
-
const currentSpec = chatStore.conversation.active.spec || {};
|
|
6883
|
-
const clonedSpec = JSON.parse(JSON.stringify(currentSpec));
|
|
6884
|
-
chatStore.setConversationSpec(getNextSpec(clonedSpec, selectedIds, resources));
|
|
6885
|
-
onCancel?.();
|
|
6886
|
-
};
|
|
6887
|
-
const getDisplayName = (id) => {
|
|
6888
|
-
const item = resources.find((r) => r.id === id);
|
|
6889
|
-
if (!item) return id;
|
|
6890
|
-
return "aliasName" in item && item.aliasName ? item.aliasName : item.name || id;
|
|
6891
|
-
};
|
|
6892
|
-
const title = isSkill ? t11("selectSkill") : t11("selectKnowledge");
|
|
6893
|
-
const iconType = isSkill ? "icon-skill" : "icon-remark";
|
|
6894
|
-
return /* @__PURE__ */ jsx(
|
|
6895
|
-
Modal,
|
|
6896
|
-
{
|
|
6897
|
-
open,
|
|
6898
|
-
className: style_module_default.customModal,
|
|
6899
|
-
onCancel,
|
|
6900
|
-
closeIcon: /* @__PURE__ */ jsx(CloseOutlined, {}),
|
|
6901
|
-
width: 960,
|
|
6902
|
-
centered: true,
|
|
6903
|
-
destroyOnHidden: true,
|
|
6904
|
-
title: /* @__PURE__ */ jsx("div", { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsx(Title2, { level: 5, children: title }) }),
|
|
6905
|
-
footer: /* @__PURE__ */ jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsx(Button, { type: "primary", onClick: handleConfirm, children: t11("confirm") }) }),
|
|
6906
|
-
children: /* @__PURE__ */ jsxs(Layout, { className: style_module_default.layout, children: [
|
|
6907
|
-
/* @__PURE__ */ jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsx(Flex, { gap: 4, vertical: true, children: allCategories.map((cat) => {
|
|
6908
|
-
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
6909
|
-
return /* @__PURE__ */ jsxs(
|
|
6910
|
-
Flex,
|
|
6911
|
-
{
|
|
6912
|
-
className: classNames10(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
6913
|
-
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
6914
|
-
children: [
|
|
6915
|
-
/* @__PURE__ */ jsx(
|
|
6916
|
-
Checkbox,
|
|
6917
|
-
{
|
|
6918
|
-
checked: isChecked,
|
|
6919
|
-
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
6920
|
-
onClick: (e) => e.stopPropagation(),
|
|
6921
|
-
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
6922
|
-
}
|
|
6923
|
-
),
|
|
6924
|
-
/* @__PURE__ */ jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
6925
|
-
]
|
|
6926
|
-
},
|
|
6927
|
-
cat.id
|
|
6928
|
-
);
|
|
6929
|
-
}) }) }) }),
|
|
6930
|
-
/* @__PURE__ */ jsxs(Content, { className: style_module_default.content, children: [
|
|
6931
|
-
/* @__PURE__ */ jsx(Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsx(
|
|
6932
|
-
Input,
|
|
6933
|
-
{
|
|
6934
|
-
className: style_module_default.searchInput,
|
|
6935
|
-
placeholder: isSkill ? t11("searchSkill") : t11("searchKnowledge"),
|
|
6936
|
-
prefix: /* @__PURE__ */ jsx(SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
6937
|
-
value: searchText,
|
|
6938
|
-
onChange: (e) => setSearchText(e.target.value),
|
|
6939
|
-
allowClear: true,
|
|
6940
|
-
autoFocus: true
|
|
6941
|
-
}
|
|
6942
|
-
) }),
|
|
6943
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsx(Text4, { type: "secondary", className: style_module_default.selectedCount, children: t11("selectedCount", { count: selectedIds.length }) }) }),
|
|
6944
|
-
/* @__PURE__ */ jsxs("div", { className: classNames10(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
6945
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
6946
|
-
selectedIds.map((id) => /* @__PURE__ */ jsx(
|
|
6947
|
-
Tag,
|
|
6948
|
-
{
|
|
6949
|
-
closable: true,
|
|
6950
|
-
onClose: (e) => {
|
|
6951
|
-
e.preventDefault();
|
|
6952
|
-
toggleItemSelection(id);
|
|
6953
|
-
},
|
|
6954
|
-
className: style_module_default.tag,
|
|
6955
|
-
children: getDisplayName(id)
|
|
6956
|
-
},
|
|
6957
|
-
id
|
|
6958
|
-
)),
|
|
6959
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
6960
|
-
t11("collapse"),
|
|
6961
|
-
" ",
|
|
6962
|
-
/* @__PURE__ */ jsx(UpOutlined, {})
|
|
6963
|
-
] })
|
|
6964
|
-
] }),
|
|
6965
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxs(Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
|
|
6966
|
-
t11("expand"),
|
|
6967
|
-
" ",
|
|
6968
|
-
/* @__PURE__ */ jsx(DownOutlined, {})
|
|
6969
|
-
] }) })
|
|
6970
|
-
] }),
|
|
6971
|
-
/* @__PURE__ */ jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsx(Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
|
|
6972
|
-
const isSelected = selectedIds.includes(item.id);
|
|
6973
|
-
return /* @__PURE__ */ jsxs(
|
|
6974
|
-
"div",
|
|
6975
|
-
{
|
|
6976
|
-
className: classNames10(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
6977
|
-
onClick: () => toggleItemSelection(item.id),
|
|
6978
|
-
children: [
|
|
6979
|
-
/* @__PURE__ */ jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsx(IconFont_default, { type: iconType }) }),
|
|
6980
|
-
/* @__PURE__ */ jsxs(Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
6981
|
-
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
|
|
6982
|
-
/* @__PURE__ */ jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
6983
|
-
isSelected && /* @__PURE__ */ jsx(Tag, { color: token.colorPrimary, variant: "outlined", children: t11("added") })
|
|
6984
|
-
] }),
|
|
6985
|
-
/* @__PURE__ */ jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || t11("noDescription") })
|
|
6986
|
-
] })
|
|
6987
|
-
]
|
|
6988
|
-
},
|
|
6989
|
-
item.id
|
|
6990
|
-
);
|
|
6991
|
-
}) : /* @__PURE__ */ jsx(Empty, { description: t11("noMatch") }) }) }) }) })
|
|
6992
|
-
] })
|
|
6993
|
-
] })
|
|
6994
|
-
}
|
|
6995
|
-
);
|
|
6996
|
-
};
|
|
6997
|
-
var { Text: Text5 } = Typography;
|
|
6998
|
-
var KnowledgeBtn_default = ({}) => {
|
|
6999
|
-
const chatStore = useChatStore();
|
|
7000
|
-
const conversationState = useSnapshot(chatStore.conversation);
|
|
7001
|
-
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
7002
|
-
const [modalOpen, setModalOpen] = useState(false);
|
|
7003
|
-
const knowledgeCount = conversationState.active.spec?.knowledges?.items?.length ?? 0;
|
|
7004
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7005
|
-
/* @__PURE__ */ jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
7006
|
-
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-remark" }),
|
|
7007
|
-
/* @__PURE__ */ jsx(Text5, { children: t11("knowledge") }),
|
|
7008
|
-
knowledgeCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7009
|
-
/* @__PURE__ */ jsx(Divider$1, { vertical: true, className: style_module_default.divider }),
|
|
7010
|
-
/* @__PURE__ */ jsx(Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
7011
|
-
] })
|
|
7012
|
-
] }),
|
|
7013
|
-
modalOpen && /* @__PURE__ */ jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
7014
|
-
] });
|
|
7015
|
-
};
|
|
7016
|
-
var { Text: Text6 } = Typography;
|
|
6720
|
+
var { Text: Text4 } = Typography;
|
|
7017
6721
|
var getModelIcon = (iconName) => {
|
|
7018
6722
|
if (!iconName) {
|
|
7019
6723
|
return "icon-zhinengti";
|
|
@@ -7074,7 +6778,7 @@ var ModelSelect_default = ({}) => {
|
|
|
7074
6778
|
}
|
|
7075
6779
|
return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
|
|
7076
6780
|
/* @__PURE__ */ jsx(IconFont_default, { type: getModelIcon(model.icon), style: { fontSize: 20, borderRadius: 4 } }),
|
|
7077
|
-
/* @__PURE__ */ jsx(
|
|
6781
|
+
/* @__PURE__ */ jsx(Text4, { children: model.label })
|
|
7078
6782
|
] });
|
|
7079
6783
|
};
|
|
7080
6784
|
useEffect(() => {
|
|
@@ -7097,7 +6801,7 @@ var ModelSelect_default = ({}) => {
|
|
|
7097
6801
|
const data = option.data;
|
|
7098
6802
|
return /* @__PURE__ */ jsxs(Flex, { gap: 12, children: [
|
|
7099
6803
|
/* @__PURE__ */ jsx(IconFont_default, { type: getModelIcon(data?.icon), style: { fontSize: 20 } }),
|
|
7100
|
-
/* @__PURE__ */ jsx(
|
|
6804
|
+
/* @__PURE__ */ jsx(Text4, { children: data?.label })
|
|
7101
6805
|
] });
|
|
7102
6806
|
}
|
|
7103
6807
|
}
|
|
@@ -7121,47 +6825,166 @@ var ReasonBtn_default = () => {
|
|
|
7121
6825
|
};
|
|
7122
6826
|
chatStore.setAgent(nextAgentInfo);
|
|
7123
6827
|
};
|
|
7124
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
6828
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames9(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: currentModel?.reasoning }), onClick: toggleReasoning, children: [
|
|
7125
6829
|
/* @__PURE__ */ jsx(IconFont_default, { type: "icon-reason" }),
|
|
7126
6830
|
/* @__PURE__ */ jsx("span", { children: t11("deepThinking") })
|
|
7127
6831
|
] });
|
|
7128
6832
|
};
|
|
7129
|
-
var
|
|
7130
|
-
var
|
|
6833
|
+
var getResourceKey = (item) => "id" in item ? item.id : item.name;
|
|
6834
|
+
var defaultResourceTypes = ["skill", "knowledge", "datasource", "mcp_server"];
|
|
6835
|
+
var resourceTypeMap = {
|
|
6836
|
+
skill: {
|
|
6837
|
+
responseKey: "skills",
|
|
6838
|
+
nodeType: "skill",
|
|
6839
|
+
labelKey: "skill",
|
|
6840
|
+
getLabel: (item) => item.aliasName || item.name
|
|
6841
|
+
},
|
|
6842
|
+
knowledge: {
|
|
6843
|
+
responseKey: "knowledges",
|
|
6844
|
+
nodeType: "knowledge",
|
|
6845
|
+
labelKey: "knowledge",
|
|
6846
|
+
getLabel: (item) => item.name
|
|
6847
|
+
},
|
|
6848
|
+
datasource: {
|
|
6849
|
+
responseKey: "datasources",
|
|
6850
|
+
nodeType: "datasource",
|
|
6851
|
+
labelKey: "datasource",
|
|
6852
|
+
getLabel: (item) => item.name
|
|
6853
|
+
},
|
|
6854
|
+
mcp_server: {
|
|
6855
|
+
responseKey: "mcpServers",
|
|
6856
|
+
nodeType: "mcpServer",
|
|
6857
|
+
labelKey: "mcpServer",
|
|
6858
|
+
getLabel: (item) => item.serverName || item.name
|
|
6859
|
+
},
|
|
6860
|
+
sub_agent: {
|
|
6861
|
+
responseKey: "subAgents",
|
|
6862
|
+
nodeType: "subAgent",
|
|
6863
|
+
labelKey: "subAgent",
|
|
6864
|
+
getLabel: (item) => item.name
|
|
6865
|
+
},
|
|
6866
|
+
tool: {
|
|
6867
|
+
responseKey: "tools",
|
|
6868
|
+
nodeType: "tool",
|
|
6869
|
+
labelKey: "tool",
|
|
6870
|
+
getLabel: (item) => item.name
|
|
6871
|
+
}
|
|
6872
|
+
};
|
|
6873
|
+
var emptyAgentResources2 = {
|
|
6874
|
+
skills: [],
|
|
6875
|
+
knowledges: [],
|
|
6876
|
+
datasources: [],
|
|
6877
|
+
mcpServers: [],
|
|
6878
|
+
subAgents: [],
|
|
6879
|
+
tools: []
|
|
6880
|
+
};
|
|
6881
|
+
var focusSenderInputToEnd = () => {
|
|
6882
|
+
requestAnimationFrame(() => {
|
|
6883
|
+
requestAnimationFrame(() => {
|
|
6884
|
+
const input = document.querySelector('.zero-chat-sender .ant-sender-input[contenteditable="true"]');
|
|
6885
|
+
if (!input) return;
|
|
6886
|
+
input.focus();
|
|
6887
|
+
const selection = window.getSelection();
|
|
6888
|
+
if (!selection) return;
|
|
6889
|
+
const range = document.createRange();
|
|
6890
|
+
range.selectNodeContents(input);
|
|
6891
|
+
range.collapse(false);
|
|
6892
|
+
selection.removeAllRanges();
|
|
6893
|
+
selection.addRange(range);
|
|
6894
|
+
});
|
|
6895
|
+
});
|
|
6896
|
+
};
|
|
6897
|
+
var appendResourceToken = (content, token) => {
|
|
6898
|
+
if (!content) return token;
|
|
6899
|
+
return /\s$/.test(content) ? `${content}${token}` : `${content} ${token}`;
|
|
6900
|
+
};
|
|
6901
|
+
var ResourceBtn_default = ({ types = defaultResourceTypes }) => {
|
|
7131
6902
|
const chatStore = useChatStore();
|
|
7132
6903
|
const conversationState = useSnapshot(chatStore.conversation);
|
|
7133
6904
|
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
7134
|
-
const [
|
|
7135
|
-
const [
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
const
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
6905
|
+
const [open, setOpen] = useState(false);
|
|
6906
|
+
const [loading, setLoading] = useState(false);
|
|
6907
|
+
const [resources, setResources] = useState(null);
|
|
6908
|
+
const menuItems = useMemo(() => {
|
|
6909
|
+
const buildChildren = (categoryKey, resourceLabel, items2, getLabel) => items2.map((item) => ({
|
|
6910
|
+
key: getResourceKey(item),
|
|
6911
|
+
label: getLabel(item),
|
|
6912
|
+
onClick: () => {
|
|
6913
|
+
const resourceName = getLabel(item);
|
|
6914
|
+
const currentContent = conversationState.messages[conversationState.active.id]?.content || "";
|
|
6915
|
+
const nextContent = appendResourceToken(
|
|
6916
|
+
currentContent,
|
|
6917
|
+
serializeResourceToken(resourceLabel, resourceName, resourceTypeMap[categoryKey].nodeType, getResourceKey(item))
|
|
6918
|
+
);
|
|
6919
|
+
chatStore.setContent(nextContent);
|
|
6920
|
+
setOpen(false);
|
|
6921
|
+
focusSenderInputToEnd();
|
|
7143
6922
|
}
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
]
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
6923
|
+
}));
|
|
6924
|
+
const buildSubMenu = (key, label, items2, getLabel) => ({
|
|
6925
|
+
key,
|
|
6926
|
+
label,
|
|
6927
|
+
popupClassName: style_module_default.resourceDropdownSubMenu,
|
|
6928
|
+
children: buildChildren(key, label, items2, getLabel)
|
|
6929
|
+
});
|
|
6930
|
+
if (loading) {
|
|
6931
|
+
return [
|
|
6932
|
+
{
|
|
6933
|
+
key: "loading",
|
|
6934
|
+
disabled: true,
|
|
6935
|
+
label: /* @__PURE__ */ jsxs("span", { children: [
|
|
6936
|
+
/* @__PURE__ */ jsx(LoadingOutlined, { spin: true, style: { marginRight: 8 } }),
|
|
6937
|
+
t11("loading")
|
|
6938
|
+
] })
|
|
6939
|
+
}
|
|
6940
|
+
];
|
|
6941
|
+
}
|
|
6942
|
+
if (!resources) {
|
|
6943
|
+
return [
|
|
6944
|
+
{
|
|
6945
|
+
key: "empty",
|
|
6946
|
+
disabled: true,
|
|
6947
|
+
label: t11("empty")
|
|
6948
|
+
}
|
|
6949
|
+
];
|
|
6950
|
+
}
|
|
6951
|
+
const items = [];
|
|
6952
|
+
types.forEach((type) => {
|
|
6953
|
+
const currentConfig = resourceTypeMap[type];
|
|
6954
|
+
const currentItems = resources[currentConfig.responseKey];
|
|
6955
|
+
if (!currentItems?.length) return;
|
|
6956
|
+
items.push(buildSubMenu(type, t11(currentConfig.labelKey), currentItems, currentConfig.getLabel));
|
|
6957
|
+
});
|
|
6958
|
+
return items.length ? items : [
|
|
6959
|
+
{
|
|
6960
|
+
key: "empty",
|
|
6961
|
+
disabled: true,
|
|
6962
|
+
label: t11("empty")
|
|
6963
|
+
}
|
|
6964
|
+
];
|
|
6965
|
+
}, [chatStore, conversationState.active.id, conversationState.messages, loading, resources, t11, types]);
|
|
6966
|
+
const handleOpenChange = async (nextOpen) => {
|
|
6967
|
+
setOpen(nextOpen);
|
|
6968
|
+
if (!nextOpen) return;
|
|
6969
|
+
setLoading(true);
|
|
6970
|
+
try {
|
|
6971
|
+
const { data } = await chatStore.config.services.request.fetchAvailableResources(types);
|
|
6972
|
+
setResources(data || emptyAgentResources2);
|
|
6973
|
+
} finally {
|
|
6974
|
+
setLoading(false);
|
|
6975
|
+
}
|
|
6976
|
+
};
|
|
6977
|
+
return /* @__PURE__ */ jsx(
|
|
6978
|
+
Dropdown,
|
|
6979
|
+
{
|
|
6980
|
+
classNames: { root: style_module_default.resourceDropdown },
|
|
6981
|
+
menu: { items: menuItems, className: style_module_default.resourceDropdownMenu },
|
|
6982
|
+
trigger: ["click"],
|
|
6983
|
+
open,
|
|
6984
|
+
onOpenChange: handleOpenChange,
|
|
6985
|
+
children: /* @__PURE__ */ jsx(Button, { type: "text", icon: /* @__PURE__ */ jsx(PlusOutlined, {}) })
|
|
6986
|
+
}
|
|
6987
|
+
);
|
|
7165
6988
|
};
|
|
7166
6989
|
var ChatSender_default2 = forwardRef(
|
|
7167
6990
|
({
|
|
@@ -7171,8 +6994,9 @@ var ChatSender_default2 = forwardRef(
|
|
|
7171
6994
|
sendBtnProps,
|
|
7172
6995
|
footerBelow = false,
|
|
7173
6996
|
reasonBtn = true,
|
|
7174
|
-
|
|
7175
|
-
|
|
6997
|
+
resourceBtn = false,
|
|
6998
|
+
// skillsBtn = false,
|
|
6999
|
+
// knowledgeBtn = false,
|
|
7176
7000
|
modelSelect = false,
|
|
7177
7001
|
commandConfig,
|
|
7178
7002
|
uploadConfig
|
|
@@ -7229,9 +7053,8 @@ var ChatSender_default2 = forwardRef(
|
|
|
7229
7053
|
extraFooterBelow: /* @__PURE__ */ jsx(RenderWrapper, { control: footerBelow }),
|
|
7230
7054
|
extraFooter: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", flex: 1, children: [
|
|
7231
7055
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, children: [
|
|
7056
|
+
/* @__PURE__ */ jsx(RenderWrapper, { control: resourceBtn, DefaultComponent: ResourceBtn_default }),
|
|
7232
7057
|
agentState.agentInfo.agentType === 2 /* AUTONOMOUS */ && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(RenderWrapper, { control: reasonBtn, DefaultComponent: ReasonBtn_default }) }),
|
|
7233
|
-
/* @__PURE__ */ jsx(RenderWrapper, { control: skillsBtn, DefaultComponent: SkillBtn_default }),
|
|
7234
|
-
/* @__PURE__ */ jsx(RenderWrapper, { control: knowledgeBtn, DefaultComponent: KnowledgeBtn_default }),
|
|
7235
7058
|
/* @__PURE__ */ jsx(RenderWrapper, { control: extraBtn })
|
|
7236
7059
|
] }),
|
|
7237
7060
|
agentState.agentInfo.agentType === 2 /* AUTONOMOUS */ && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(RenderWrapper, { control: modelSelect, DefaultComponent: ModelSelect_default }) })
|
|
@@ -7316,7 +7139,7 @@ var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly
|
|
|
7316
7139
|
) });
|
|
7317
7140
|
};
|
|
7318
7141
|
var MonacoEditor_default = MonacoEditor;
|
|
7319
|
-
var { Text:
|
|
7142
|
+
var { Text: Text5 } = Typography;
|
|
7320
7143
|
var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
7321
7144
|
const { token } = theme.useToken();
|
|
7322
7145
|
const fileList = Array.isArray(value) ? value : value ? [value] : [];
|
|
@@ -7388,8 +7211,8 @@ var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
|
7388
7211
|
}
|
|
7389
7212
|
),
|
|
7390
7213
|
/* @__PURE__ */ jsxs("div", { style: { overflow: "hidden", display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
7391
|
-
/* @__PURE__ */ jsx(
|
|
7392
|
-
/* @__PURE__ */ jsxs(
|
|
7214
|
+
/* @__PURE__ */ jsx(Text5, { ellipsis: true, style: { width: "100%", fontSize: 14, fontWeight: 500 }, children: file.name }),
|
|
7215
|
+
/* @__PURE__ */ jsxs(Text5, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
7393
7216
|
(file.extension || getFileSuffixName(file.name)).toUpperCase(),
|
|
7394
7217
|
" \u2022 ",
|
|
7395
7218
|
formatFileSize(file.size)
|
|
@@ -7985,11 +7808,11 @@ function EventRow({ evt, selected, onSelect }) {
|
|
|
7985
7808
|
const { role, lane, preview } = eventSummary(evt);
|
|
7986
7809
|
const isError = evt.eventType === "run_failed" || evt.eventType === "step_error";
|
|
7987
7810
|
const time = tsToTime(evt);
|
|
7988
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
7989
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
7811
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames9(execution_trace_module_default.eventRow, { [execution_trace_module_default.eventRowSelected]: selected }), onClick: () => onSelect(evt), children: [
|
|
7812
|
+
/* @__PURE__ */ jsx("span", { className: classNames9(execution_trace_module_default.eventLane, execution_trace_module_default[`lane_${lane}`]) }),
|
|
7990
7813
|
/* @__PURE__ */ jsx("span", { className: execution_trace_module_default.eventIcon, children: eventIcon(evt.eventType) }),
|
|
7991
7814
|
/* @__PURE__ */ jsx(Tag, { className: execution_trace_module_default.eventRole, color: ROLE_COLOR[role], children: roleLabel(role) }),
|
|
7992
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
7815
|
+
/* @__PURE__ */ jsx("span", { className: classNames9(execution_trace_module_default.eventType, { [execution_trace_module_default.eventTypeError]: isError }), children: evt.eventType }),
|
|
7993
7816
|
/* @__PURE__ */ jsx("span", { className: execution_trace_module_default.eventPreview, title: preview, children: preview || " " }),
|
|
7994
7817
|
time && /* @__PURE__ */ jsx("span", { className: execution_trace_module_default.eventTime, children: time })
|
|
7995
7818
|
] });
|
|
@@ -8038,8 +7861,8 @@ function ExecutionSection({
|
|
|
8038
7861
|
/* @__PURE__ */ jsx("div", { className: execution_trace_module_default.userMessageContent, children: /* @__PURE__ */ jsx(XMarkdown_default, { content: userInput.payloadJson?.event?.message || "" }) })
|
|
8039
7862
|
] }),
|
|
8040
7863
|
/* @__PURE__ */ jsx("div", { className: execution_trace_module_default.turnList, children: turns.map((group, gi) => /* @__PURE__ */ jsxs("div", { className: execution_trace_module_default.turnSection, children: [
|
|
8041
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
8042
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
7864
|
+
/* @__PURE__ */ jsxs("div", { className: classNames9(execution_trace_module_default.turnHeader, group.kind !== "turn" && execution_trace_module_default.turnHeaderMuted), children: [
|
|
7865
|
+
/* @__PURE__ */ jsx("span", { className: classNames9(execution_trace_module_default.turnHeaderDot, group.kind !== "turn" && execution_trace_module_default.turnHeaderDotMuted) }),
|
|
8043
7866
|
/* @__PURE__ */ jsx("span", { className: execution_trace_module_default.turnTitle, children: group.kind === "turn" ? t(`${NS_CHAT_COPILOT}:turnLabel`, { index: group.turnIndex + 1, title: group.title }) : group.title }),
|
|
8044
7867
|
/* @__PURE__ */ jsxs("span", { className: execution_trace_module_default.turnMeta, children: [
|
|
8045
7868
|
group.durationMs != null ? formatDuration(group.durationMs) : "",
|
|
@@ -8119,8 +7942,6 @@ var ExecutionTracePanel_default = ExecutionTracePanel;
|
|
|
8119
7942
|
// src/ui/layouts/components/styles.module.less
|
|
8120
7943
|
var styles_module_default5 = {
|
|
8121
7944
|
bodyWidth: "styles_module_bodyWidth",
|
|
8122
|
-
execModeBar: "styles_module_execModeBar",
|
|
8123
|
-
mainTabs: "styles_module_mainTabs",
|
|
8124
7945
|
inputContainer: "styles_module_inputContainer",
|
|
8125
7946
|
disclaimerNotice: "styles_module_disclaimerNotice",
|
|
8126
7947
|
previewHeader: "styles_module_previewHeader",
|
|
@@ -8130,42 +7951,13 @@ var styles_module_default5 = {
|
|
|
8130
7951
|
subAgentTitle: "styles_module_subAgentTitle",
|
|
8131
7952
|
subAgentMessages: "styles_module_subAgentMessages"
|
|
8132
7953
|
};
|
|
8133
|
-
var ExecModeSwitch = memo(() => {
|
|
8134
|
-
const chatStore = useChatStore();
|
|
8135
|
-
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
8136
|
-
const configState = useSnapshot(chatStore.config);
|
|
8137
|
-
const conversationState = useSnapshot(chatStore.conversation);
|
|
8138
|
-
const activeId = conversationState.active.id;
|
|
8139
|
-
const messages = conversationState.messages[activeId]?.message;
|
|
8140
|
-
const hasAgentExec = useMemo(() => (messages || []).some((m) => m.role === 2 && hasExecChain(m.content || [])), [messages]);
|
|
8141
|
-
const handleExecModeChange = useCallback(
|
|
8142
|
-
(v) => {
|
|
8143
|
-
chatStore.setExecMode(v);
|
|
8144
|
-
},
|
|
8145
|
-
[chatStore]
|
|
8146
|
-
);
|
|
8147
|
-
if (!hasAgentExec) return null;
|
|
8148
|
-
return /* @__PURE__ */ jsx("div", { className: styles_module_default5.execModeBar, children: /* @__PURE__ */ jsx(
|
|
8149
|
-
Segmented,
|
|
8150
|
-
{
|
|
8151
|
-
size: "small",
|
|
8152
|
-
value: configState.agentExecMode,
|
|
8153
|
-
onChange: handleExecModeChange,
|
|
8154
|
-
options: [
|
|
8155
|
-
{ label: t11("aggregate"), value: "aggregate" },
|
|
8156
|
-
{ label: t11("sequence"), value: "sequence" }
|
|
8157
|
-
]
|
|
8158
|
-
}
|
|
8159
|
-
) });
|
|
8160
|
-
});
|
|
8161
7954
|
var ChatContent = memo(({ senderRef }) => {
|
|
8162
7955
|
const chatStore = useChatStore();
|
|
8163
7956
|
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
8164
7957
|
const configState = useSnapshot(chatStore.config);
|
|
8165
7958
|
const agentState = useSnapshot(chatStore.agent);
|
|
8166
|
-
return /* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className:
|
|
7959
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", vertical: true, gap: 24, className: classNames9(styles_module_default5.bodyWidth, "height-full"), children: [
|
|
8167
7960
|
shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
|
|
8168
|
-
/* @__PURE__ */ jsx(ExecModeSwitch, {}),
|
|
8169
7961
|
shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
8170
7962
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsx(ChatSenderHeader_default, {}) }),
|
|
8171
7963
|
/* @__PURE__ */ jsxs(Flex, { className: styles_module_default5.inputContainer, vertical: true, gap: 8, children: [
|
|
@@ -8182,7 +7974,7 @@ var ChatContent = memo(({ senderRef }) => {
|
|
|
8182
7974
|
] });
|
|
8183
7975
|
});
|
|
8184
7976
|
var ChatMainPanel = memo(
|
|
8185
|
-
forwardRef(({
|
|
7977
|
+
forwardRef(({ showDebugLog = false }, ref) => {
|
|
8186
7978
|
const chatStore = useChatStore();
|
|
8187
7979
|
const senderRef = useRef(null);
|
|
8188
7980
|
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
@@ -8196,12 +7988,12 @@ var ChatMainPanel = memo(
|
|
|
8196
7988
|
[]
|
|
8197
7989
|
);
|
|
8198
7990
|
const configState = useSnapshot(chatStore.config);
|
|
8199
|
-
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className:
|
|
7991
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full"), children: [
|
|
8200
7992
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
8201
|
-
|
|
7993
|
+
showDebugLog ? /* @__PURE__ */ jsx(
|
|
8202
7994
|
Tabs,
|
|
8203
7995
|
{
|
|
8204
|
-
className:
|
|
7996
|
+
className: "full-tabs",
|
|
8205
7997
|
defaultActiveKey: "chat",
|
|
8206
7998
|
items: [
|
|
8207
7999
|
{ key: "chat", label: t11("chatTab"), children: /* @__PURE__ */ jsx(ChatContent, { senderRef }) },
|
|
@@ -8228,7 +8020,7 @@ var ChatPreviewPanel = memo(({ file }) => {
|
|
|
8228
8020
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8229
8021
|
file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
|
|
8230
8022
|
/* @__PURE__ */ jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
8231
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
8023
|
+
/* @__PURE__ */ jsx("div", { className: classNames9(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
8232
8024
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
8233
8025
|
/* @__PURE__ */ jsx(
|
|
8234
8026
|
Button,
|
|
@@ -8266,7 +8058,7 @@ var ChatPreviewPanel = memo(({ file }) => {
|
|
|
8266
8058
|
] });
|
|
8267
8059
|
});
|
|
8268
8060
|
var ChatPreviewPanel_default = ChatPreviewPanel;
|
|
8269
|
-
var { Text:
|
|
8061
|
+
var { Text: Text6 } = Typography;
|
|
8270
8062
|
function roleForMessage(role) {
|
|
8271
8063
|
if (role === 1) {
|
|
8272
8064
|
return { user: "user", role: 1, placement: "end" };
|
|
@@ -8325,7 +8117,7 @@ var ChatSubAgentPanel = memo(() => {
|
|
|
8325
8117
|
const subAgentName = active.agentName || active.toolName || t11("subAgentExecutionDetail");
|
|
8326
8118
|
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
|
|
8327
8119
|
/* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", gap: 8, className: styles_module_default5.subAgentHeader, children: [
|
|
8328
|
-
/* @__PURE__ */ jsx(
|
|
8120
|
+
/* @__PURE__ */ jsx(Text6, { strong: true, className: styles_module_default5.subAgentTitle, title: subAgentName, children: subAgentName }),
|
|
8329
8121
|
/* @__PURE__ */ jsx(
|
|
8330
8122
|
Button,
|
|
8331
8123
|
{
|
|
@@ -8337,7 +8129,7 @@ var ChatSubAgentPanel = memo(() => {
|
|
|
8337
8129
|
}
|
|
8338
8130
|
)
|
|
8339
8131
|
] }),
|
|
8340
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
8132
|
+
/* @__PURE__ */ jsx("div", { className: classNames9("full-scroll", styles_module_default5.subAgentMessages), children: loading ? /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", style: { height: 120 }, children: /* @__PURE__ */ jsx(Spin, { size: "small" }) }) : /* @__PURE__ */ jsx(Bubble.List, { ref: listRef, autoScroll: false, items, onScroll: handleScroll, className: "height-full" }) })
|
|
8341
8133
|
] });
|
|
8342
8134
|
});
|
|
8343
8135
|
var ChatSubAgentPanel_default = ChatSubAgentPanel;
|
|
@@ -8349,17 +8141,7 @@ var index_module_default3 = {
|
|
|
8349
8141
|
hideSplitterBar: "index_module_hideSplitterBar",
|
|
8350
8142
|
rightTabs: "index_module_rightTabs"
|
|
8351
8143
|
};
|
|
8352
|
-
|
|
8353
|
-
try {
|
|
8354
|
-
return new URLSearchParams(target.location.search).get("mode") === "debug";
|
|
8355
|
-
} catch {
|
|
8356
|
-
return false;
|
|
8357
|
-
}
|
|
8358
|
-
}
|
|
8359
|
-
function resolveDebugMode() {
|
|
8360
|
-
return readModeDebug(window) || window.top !== window && readModeDebug(window.top);
|
|
8361
|
-
}
|
|
8362
|
-
var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config, services }, _ref) => {
|
|
8144
|
+
var layouts_default = forwardRef(({ theme: theme3, params, hooks, layout, config, services }, _ref) => {
|
|
8363
8145
|
const { t: t11 } = useTranslation(NS_CHAT_COPILOT);
|
|
8364
8146
|
const chatStore = useMemo(() => createChatStore(), []);
|
|
8365
8147
|
const senderRef = useRef(null);
|
|
@@ -8414,7 +8196,7 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
|
|
|
8414
8196
|
const hasPreView = useMemo(() => {
|
|
8415
8197
|
return shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
|
|
8416
8198
|
}, [configState.layout.preview, configState.preview.file]);
|
|
8417
|
-
const
|
|
8199
|
+
const showDebugLog = !!config.showDebugLog;
|
|
8418
8200
|
const hasSubAgentPanel = !!subAgentState.active;
|
|
8419
8201
|
const subAgentTrigger = subAgentState.active?.toolCallId ?? subAgentState.active?.toolName ?? subAgentState.active?.subConversationId;
|
|
8420
8202
|
const previewTrigger = configState.preview.file?.fileUrl || configState.preview.file?.content;
|
|
@@ -8483,7 +8265,7 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
|
|
|
8483
8265
|
useEffect(() => {
|
|
8484
8266
|
hooks?.onBeforeInit?.();
|
|
8485
8267
|
}, []);
|
|
8486
|
-
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...
|
|
8268
|
+
return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: {}, ...theme3 }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
8487
8269
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
8488
8270
|
/* @__PURE__ */ jsxs(Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
8489
8271
|
/* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
|
|
@@ -8491,14 +8273,14 @@ var layouts_default = forwardRef(({ theme: theme4, params, hooks, layout, config
|
|
|
8491
8273
|
/* @__PURE__ */ jsxs(
|
|
8492
8274
|
Splitter,
|
|
8493
8275
|
{
|
|
8494
|
-
className:
|
|
8276
|
+
className: classNames9("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasRightPanel }),
|
|
8495
8277
|
onResize: (p) => setSizes(p),
|
|
8496
8278
|
children: [
|
|
8497
|
-
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[0], children: /* @__PURE__ */ jsx(ChatMainPanel_default, { ref: senderRef,
|
|
8279
|
+
/* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[0], children: /* @__PURE__ */ jsx(ChatMainPanel_default, { ref: senderRef, showDebugLog }) }),
|
|
8498
8280
|
hasRightPanel && /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 360, size: sizes[1], children: /* @__PURE__ */ jsx(
|
|
8499
8281
|
Tabs,
|
|
8500
8282
|
{
|
|
8501
|
-
className:
|
|
8283
|
+
className: classNames9("height-full", index_module_default3.rightTabs),
|
|
8502
8284
|
activeKey: effectiveRightTab,
|
|
8503
8285
|
onChange: (k) => setActiveRightTab(k),
|
|
8504
8286
|
tabBarStyle: { marginBottom: 0 },
|