@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.cjs.js
CHANGED
|
@@ -19,7 +19,7 @@ var LexicalTypeaheadMenuPlugin = require('@lexical/react/LexicalTypeaheadMenuPlu
|
|
|
19
19
|
var utils = require('@lexical/utils');
|
|
20
20
|
var ReactDOM = require('react-dom');
|
|
21
21
|
var dayjs = require('dayjs');
|
|
22
|
-
var
|
|
22
|
+
var classNames9 = require('classnames');
|
|
23
23
|
var console2 = require('console');
|
|
24
24
|
var InfiniteScroll = require('react-infinite-scroll-component');
|
|
25
25
|
var xCard = require('@ant-design/x-card');
|
|
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
|
|
|
50
50
|
var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
|
|
51
51
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
52
52
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
53
|
-
var
|
|
53
|
+
var classNames9__default = /*#__PURE__*/_interopDefault(classNames9);
|
|
54
54
|
var console2__default = /*#__PURE__*/_interopDefault(console2);
|
|
55
55
|
var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
|
|
56
56
|
var XMarkdown__default = /*#__PURE__*/_interopDefault(XMarkdown);
|
|
@@ -100,8 +100,14 @@ var chatCopilotEnUS = {
|
|
|
100
100
|
summaryAnalysis: "Summary Analysis",
|
|
101
101
|
headerClose: "Close",
|
|
102
102
|
deepThinking: "Deep Thinking",
|
|
103
|
+
resource: "Resources",
|
|
103
104
|
skill: "Skill",
|
|
104
105
|
knowledge: "Knowledge Base",
|
|
106
|
+
datasource: "Datasource",
|
|
107
|
+
mcpServer: "MCP Server",
|
|
108
|
+
subAgent: "Sub-agent",
|
|
109
|
+
tool: "Tool",
|
|
110
|
+
loading: "Loading...",
|
|
105
111
|
supportedExtensions: "Supported extensions: {{types}}",
|
|
106
112
|
empty: "No data",
|
|
107
113
|
selectFile: "Select File",
|
|
@@ -161,8 +167,6 @@ var chatCopilotEnUS = {
|
|
|
161
167
|
previewEdit: "Preview & Edit",
|
|
162
168
|
copy: "Copy",
|
|
163
169
|
continueText: "Continue",
|
|
164
|
-
aggregate: "Aggregate",
|
|
165
|
-
sequence: "Sequence",
|
|
166
170
|
chatTab: "Chat",
|
|
167
171
|
traceTab: "Execution Trace",
|
|
168
172
|
previewTab: "File Preview",
|
|
@@ -175,9 +179,6 @@ var chatCopilotEnUS = {
|
|
|
175
179
|
execItemThinking: "Reasoning",
|
|
176
180
|
execItemFile: "File",
|
|
177
181
|
execItemPlan: "Plan",
|
|
178
|
-
execItemSummaryDone: "{{count}} completed",
|
|
179
|
-
execItemSummaryFailed: "{{count}} failed",
|
|
180
|
-
execItemSummaryRunning: "{{count}} running",
|
|
181
182
|
toolCallFallback: "Tool call",
|
|
182
183
|
viewExecutionDetail: "View execution details",
|
|
183
184
|
executionStart: "Start",
|
|
@@ -294,8 +295,14 @@ var chatCopilotJaJP = {
|
|
|
294
295
|
headerClose: "\u9589\u3058\u308B",
|
|
295
296
|
// ReasonBtn / SkillBtn / KnowledgeBtn
|
|
296
297
|
deepThinking: "\u601D\u8003\u30D7\u30ED\u30BB\u30B9",
|
|
298
|
+
resource: "\u30EA\u30BD\u30FC\u30B9",
|
|
297
299
|
skill: "\u30B9\u30AD\u30EB",
|
|
298
300
|
knowledge: "\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9",
|
|
301
|
+
datasource: "\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9",
|
|
302
|
+
mcpServer: "MCP Server",
|
|
303
|
+
subAgent: "\u30B5\u30D6\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8",
|
|
304
|
+
tool: "\u30C4\u30FC\u30EB",
|
|
305
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D...",
|
|
299
306
|
// Attachments
|
|
300
307
|
supportedExtensions: "\u5BFE\u5FDC\u62E1\u5F35\u5B50\uFF1A{{types}}",
|
|
301
308
|
empty: "\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
@@ -359,8 +366,6 @@ var chatCopilotJaJP = {
|
|
|
359
366
|
previewEdit: "\u30D7\u30EC\u30D3\u30E5\u30FC\uFF06\u7DE8\u96C6",
|
|
360
367
|
copy: "\u30B3\u30D4\u30FC",
|
|
361
368
|
continueText: "\u7D9A\u3051\u308B",
|
|
362
|
-
aggregate: "\u96C6\u7D04",
|
|
363
|
-
sequence: "\u9806\u756A",
|
|
364
369
|
chatTab: "\u4F1A\u8A71",
|
|
365
370
|
traceTab: "\u5B9F\u884C\u30C8\u30EC\u30FC\u30B9",
|
|
366
371
|
previewTab: "\u30D5\u30A1\u30A4\u30EB\u30D7\u30EC\u30D3\u30E5\u30FC",
|
|
@@ -373,9 +378,6 @@ var chatCopilotJaJP = {
|
|
|
373
378
|
execItemThinking: "\u601D\u8003\u30D7\u30ED\u30BB\u30B9",
|
|
374
379
|
execItemFile: "\u30D5\u30A1\u30A4\u30EB",
|
|
375
380
|
execItemPlan: "\u5B9F\u884C\u8A08\u753B",
|
|
376
|
-
execItemSummaryDone: "{{count}}\u4EF6\u5B8C\u4E86",
|
|
377
|
-
execItemSummaryFailed: "{{count}}\u4EF6\u5931\u6557",
|
|
378
|
-
execItemSummaryRunning: "{{count}}\u4EF6\u5B9F\u884C\u4E2D",
|
|
379
381
|
toolCallFallback: "\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057",
|
|
380
382
|
viewExecutionDetail: "\u5B9F\u884C\u8A73\u7D30\u3092\u898B\u308B",
|
|
381
383
|
executionStart: "\u958B\u59CB",
|
|
@@ -497,8 +499,14 @@ var chatCopilotZhCN = {
|
|
|
497
499
|
headerClose: "\u5173\u95ED",
|
|
498
500
|
// ReasonBtn / SkillBtn / KnowledgeBtn
|
|
499
501
|
deepThinking: "\u6DF1\u5EA6\u601D\u8003",
|
|
502
|
+
resource: "\u8D44\u6E90",
|
|
500
503
|
skill: "\u6280\u80FD",
|
|
501
504
|
knowledge: "\u77E5\u8BC6\u5E93",
|
|
505
|
+
datasource: "\u6570\u636E\u6E90",
|
|
506
|
+
mcpServer: "MCP Server",
|
|
507
|
+
subAgent: "\u5B50\u667A\u80FD\u4F53",
|
|
508
|
+
tool: "\u5DE5\u5177",
|
|
509
|
+
loading: "\u52A0\u8F7D\u4E2D...",
|
|
502
510
|
// Attachments
|
|
503
511
|
supportedExtensions: "\u652F\u6301\u6269\u5C55\u540D\uFF1A{{types}}",
|
|
504
512
|
empty: "\u6682\u65E0\u6570\u636E",
|
|
@@ -562,8 +570,6 @@ var chatCopilotZhCN = {
|
|
|
562
570
|
previewEdit: "\u9884\u89C8\u7F16\u8F91",
|
|
563
571
|
copy: "\u590D\u5236",
|
|
564
572
|
continueText: "\u7EE7\u7EED",
|
|
565
|
-
aggregate: "\u805A\u5408",
|
|
566
|
-
sequence: "\u987A\u5E8F",
|
|
567
573
|
chatTab: "\u5BF9\u8BDD",
|
|
568
574
|
traceTab: "\u6267\u884C\u8F68\u8FF9",
|
|
569
575
|
previewTab: "\u6587\u4EF6\u9884\u89C8",
|
|
@@ -576,9 +582,6 @@ var chatCopilotZhCN = {
|
|
|
576
582
|
execItemThinking: "\u601D\u8003\u8FC7\u7A0B",
|
|
577
583
|
execItemFile: "\u6587\u4EF6",
|
|
578
584
|
execItemPlan: "\u6267\u884C\u8BA1\u5212",
|
|
579
|
-
execItemSummaryDone: "{{count}} \u9879\u5B8C\u6210",
|
|
580
|
-
execItemSummaryFailed: "{{count}} \u9879\u5931\u8D25",
|
|
581
|
-
execItemSummaryRunning: "{{count}} \u9879\u6267\u884C\u4E2D",
|
|
582
585
|
toolCallFallback: "\u5DE5\u5177\u8C03\u7528",
|
|
583
586
|
viewExecutionDetail: "\u67E5\u770B\u6267\u884C\u8BE6\u60C5",
|
|
584
587
|
executionStart: "\u5F00\u59CB",
|
|
@@ -1175,7 +1178,7 @@ var VariableNode = class _VariableNode extends lexical.DecoratorNode {
|
|
|
1175
1178
|
* 生成节点的纯文本表达,便于发送、存储和重新初始化编辑器内容。
|
|
1176
1179
|
*/
|
|
1177
1180
|
getTextContent() {
|
|
1178
|
-
return
|
|
1181
|
+
return serializeResourceToken(this.__resourceLabel, this.__resourceName, this.__resourceType, this.__resourceId);
|
|
1179
1182
|
}
|
|
1180
1183
|
/**
|
|
1181
1184
|
* 将变量节点渲染为可交互的资源标签组件。
|
|
@@ -1194,6 +1197,61 @@ var VariableNode = class _VariableNode extends lexical.DecoratorNode {
|
|
|
1194
1197
|
function $createVariableNode(resourceLabel, resourceName, resourceType, resourceId) {
|
|
1195
1198
|
return new VariableNode(resourceLabel, resourceName, resourceType, resourceId);
|
|
1196
1199
|
}
|
|
1200
|
+
function serializeResourceToken(resourceLabel, resourceName, resourceType, resourceId) {
|
|
1201
|
+
return `${encodeURIComponent(resourceType)}://${encodeURIComponent(resourceId)}?name=${encodeURIComponent(resourceName)}&label=${encodeURIComponent(
|
|
1202
|
+
resourceLabel
|
|
1203
|
+
)}`;
|
|
1204
|
+
}
|
|
1205
|
+
var emptyAgentResources = {
|
|
1206
|
+
skills: [],
|
|
1207
|
+
knowledges: [],
|
|
1208
|
+
datasources: [],
|
|
1209
|
+
mcpServers: [],
|
|
1210
|
+
subAgents: [],
|
|
1211
|
+
tools: []
|
|
1212
|
+
};
|
|
1213
|
+
var resourceTypeConfigMap = {
|
|
1214
|
+
skill: {
|
|
1215
|
+
categoryValue: "skill",
|
|
1216
|
+
labelKey: "skill",
|
|
1217
|
+
getItems: (resources) => resources.skills || [],
|
|
1218
|
+
getLabel: (item) => item.aliasName || item.name
|
|
1219
|
+
},
|
|
1220
|
+
knowledge: {
|
|
1221
|
+
categoryValue: "knowledge",
|
|
1222
|
+
labelKey: "knowledge",
|
|
1223
|
+
getItems: (resources) => resources.knowledges || [],
|
|
1224
|
+
getLabel: (item) => item.name
|
|
1225
|
+
},
|
|
1226
|
+
datasource: {
|
|
1227
|
+
categoryValue: "datasource",
|
|
1228
|
+
labelKey: "datasource",
|
|
1229
|
+
getItems: (resources) => resources.datasources || [],
|
|
1230
|
+
getLabel: (item) => item.name
|
|
1231
|
+
},
|
|
1232
|
+
mcp_server: {
|
|
1233
|
+
categoryValue: "mcpServer",
|
|
1234
|
+
labelKey: "mcpServer",
|
|
1235
|
+
getItems: (resources) => resources.mcpServers || [],
|
|
1236
|
+
getLabel: (item) => item.serverName || item.name
|
|
1237
|
+
},
|
|
1238
|
+
sub_agent: {
|
|
1239
|
+
categoryValue: "subAgent",
|
|
1240
|
+
labelKey: "subAgent",
|
|
1241
|
+
getItems: (resources) => resources.subAgents || [],
|
|
1242
|
+
getLabel: (item) => item.name
|
|
1243
|
+
},
|
|
1244
|
+
tool: {
|
|
1245
|
+
categoryValue: "tool",
|
|
1246
|
+
labelKey: "tool",
|
|
1247
|
+
getItems: (resources) => resources.tools || [],
|
|
1248
|
+
getLabel: (item) => item.name
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
var categoryValueTypeMap = Object.fromEntries(
|
|
1252
|
+
Object.entries(resourceTypeConfigMap).map(([type, config]) => [config.categoryValue, type])
|
|
1253
|
+
);
|
|
1254
|
+
var isHashCommandConfig = (config) => !!config && !Array.isArray(config);
|
|
1197
1255
|
var ResourceOption = class extends LexicalTypeaheadMenuPlugin.MenuOption {
|
|
1198
1256
|
group;
|
|
1199
1257
|
item;
|
|
@@ -1206,10 +1264,37 @@ var ResourceOption = class extends LexicalTypeaheadMenuPlugin.MenuOption {
|
|
|
1206
1264
|
this.item = item;
|
|
1207
1265
|
}
|
|
1208
1266
|
};
|
|
1267
|
+
var getCategoryChildren = (category) => category.children || category.data || [];
|
|
1209
1268
|
function VariablePickerPlugin({ commandConfig = {} }) {
|
|
1210
1269
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
1211
1270
|
const chatStore = useChatStore();
|
|
1212
|
-
const
|
|
1271
|
+
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
1272
|
+
const slashCommandConfig = commandConfig["/"];
|
|
1273
|
+
const normalizedCommandConfig = React10.useMemo(() => {
|
|
1274
|
+
const entries = Object.entries(commandConfig).reduce((result, [trigger, currentConfig]) => {
|
|
1275
|
+
if (trigger === "/" && Array.isArray(currentConfig)) {
|
|
1276
|
+
result.push([
|
|
1277
|
+
trigger,
|
|
1278
|
+
{
|
|
1279
|
+
component: "",
|
|
1280
|
+
dataSource: currentConfig.map((type) => ({
|
|
1281
|
+
value: resourceTypeConfigMap[type].categoryValue,
|
|
1282
|
+
label: t11(resourceTypeConfigMap[type].labelKey),
|
|
1283
|
+
ext: type,
|
|
1284
|
+
children: []
|
|
1285
|
+
}))
|
|
1286
|
+
}
|
|
1287
|
+
]);
|
|
1288
|
+
return result;
|
|
1289
|
+
}
|
|
1290
|
+
if (isHashCommandConfig(currentConfig)) {
|
|
1291
|
+
result.push([trigger, currentConfig]);
|
|
1292
|
+
}
|
|
1293
|
+
return result;
|
|
1294
|
+
}, []);
|
|
1295
|
+
return Object.fromEntries(entries);
|
|
1296
|
+
}, [commandConfig, t11]);
|
|
1297
|
+
const [commandDataSource, setCommandDataSource] = React10.useState(normalizedCommandConfig);
|
|
1213
1298
|
const [queryString, setQueryString] = React10.useState(null);
|
|
1214
1299
|
const [isEditorFocused, setIsEditorFocused] = React10.useState(false);
|
|
1215
1300
|
const [menuResetKey, setMenuResetKey] = React10.useState(0);
|
|
@@ -1241,61 +1326,48 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1241
1326
|
};
|
|
1242
1327
|
}, [editor]);
|
|
1243
1328
|
React10.useEffect(() => {
|
|
1244
|
-
setCommandDataSource(
|
|
1245
|
-
}, [
|
|
1246
|
-
const commandKeys = React10.useMemo(() => Object.keys(
|
|
1329
|
+
setCommandDataSource(normalizedCommandConfig);
|
|
1330
|
+
}, [normalizedCommandConfig]);
|
|
1331
|
+
const commandKeys = React10.useMemo(() => Object.keys(commandDataSource), [commandDataSource]);
|
|
1247
1332
|
const commandKey = queryString?.[0] || "";
|
|
1248
1333
|
const searchKeyword = queryString?.slice(commandKey.length).trim().toLocaleLowerCase() || "";
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
datasource: {
|
|
1260
|
-
load: () => chatStore.config.services.request.listDataSources(),
|
|
1261
|
-
getLabel: (item) => item.name
|
|
1262
|
-
}
|
|
1263
|
-
}),
|
|
1264
|
-
[chatStore]
|
|
1265
|
-
);
|
|
1266
|
-
const formatDataSource = React10.useCallback(
|
|
1267
|
-
(items, category) => {
|
|
1268
|
-
const currentCategoryConfig = categoryConfig[category.value];
|
|
1269
|
-
if (!items.length) return [];
|
|
1270
|
-
return items.map((item) => ({
|
|
1271
|
-
value: item.id,
|
|
1272
|
-
label: currentCategoryConfig?.getLabel(item) || item.name,
|
|
1273
|
-
children: []
|
|
1274
|
-
}));
|
|
1275
|
-
},
|
|
1276
|
-
[categoryConfig]
|
|
1277
|
-
);
|
|
1334
|
+
const formatDataSource = React10.useCallback((items, category) => {
|
|
1335
|
+
const currentResourceType = category.ext;
|
|
1336
|
+
const currentCategoryConfig = currentResourceType ? resourceTypeConfigMap[currentResourceType] : void 0;
|
|
1337
|
+
if (!items.length) return [];
|
|
1338
|
+
return items.map((item) => ({
|
|
1339
|
+
value: "id" in item ? item.id : item.name,
|
|
1340
|
+
label: currentCategoryConfig?.getLabel(item) || item.name,
|
|
1341
|
+
children: []
|
|
1342
|
+
}));
|
|
1343
|
+
}, []);
|
|
1278
1344
|
React10.useEffect(() => {
|
|
1279
1345
|
let isUnmounted = false;
|
|
1280
1346
|
const initializeCommandDataSource = async () => {
|
|
1281
1347
|
const nextEntries = await Promise.all(
|
|
1282
|
-
Object.entries(
|
|
1348
|
+
Object.entries(normalizedCommandConfig).map(async ([trigger, currentCommandConfig]) => {
|
|
1349
|
+
let availableResources = null;
|
|
1350
|
+
const requestTypes = trigger === "/" && Array.isArray(slashCommandConfig) ? slashCommandConfig : currentCommandConfig.dataSource.map((category) => category.ext || categoryValueTypeMap[category.value]).filter(Boolean);
|
|
1283
1351
|
const nextDataSource = await Promise.all(
|
|
1284
1352
|
(currentCommandConfig.dataSource || []).map(async (category) => {
|
|
1285
|
-
const normalizedChildren = category
|
|
1353
|
+
const normalizedChildren = getCategoryChildren(category);
|
|
1286
1354
|
const nextCategory = {
|
|
1287
1355
|
...category,
|
|
1288
1356
|
children: normalizedChildren
|
|
1289
1357
|
};
|
|
1290
|
-
const
|
|
1358
|
+
const currentResourceType = category.ext || categoryValueTypeMap[category.value];
|
|
1359
|
+
const currentCategoryConfig = currentResourceType ? resourceTypeConfigMap[currentResourceType] : void 0;
|
|
1291
1360
|
if (!currentCategoryConfig) {
|
|
1292
1361
|
return nextCategory;
|
|
1293
1362
|
}
|
|
1294
1363
|
if (normalizedChildren.length) {
|
|
1295
1364
|
return nextCategory;
|
|
1296
1365
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1366
|
+
if (!availableResources) {
|
|
1367
|
+
const response = await chatStore.config.services.request.fetchAvailableResources(requestTypes);
|
|
1368
|
+
availableResources = response.data || emptyAgentResources;
|
|
1369
|
+
}
|
|
1370
|
+
const items = currentCategoryConfig.getItems(availableResources || emptyAgentResources);
|
|
1299
1371
|
return {
|
|
1300
1372
|
...nextCategory,
|
|
1301
1373
|
children: formatDataSource(items, category)
|
|
@@ -1318,11 +1390,11 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1318
1390
|
return () => {
|
|
1319
1391
|
isUnmounted = true;
|
|
1320
1392
|
};
|
|
1321
|
-
}, [
|
|
1393
|
+
}, [chatStore.config.services.request, formatDataSource, normalizedCommandConfig, slashCommandConfig]);
|
|
1322
1394
|
const commandGroups = React10.useMemo(() => {
|
|
1323
1395
|
if (!isEditorFocused) return [];
|
|
1324
1396
|
return (commandDataSource[commandKey]?.dataSource || []).map((group) => {
|
|
1325
|
-
const options = group
|
|
1397
|
+
const options = getCategoryChildren(group);
|
|
1326
1398
|
if (!searchKeyword) return { group, options };
|
|
1327
1399
|
return {
|
|
1328
1400
|
group,
|
|
@@ -1385,14 +1457,16 @@ function VariablePickerPlugin({ commandConfig = {} }) {
|
|
|
1385
1457
|
function InitialStatePlugin({ value }) {
|
|
1386
1458
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
1387
1459
|
function parseAndAppendNodes(paragraph, value2) {
|
|
1388
|
-
const variableRegex =
|
|
1460
|
+
const variableRegex = /\/?(\w+):\/\/([^?\s]+)\?name=([^&\s]+)&label=([^\s]+)/g;
|
|
1389
1461
|
let lastIndex = 0;
|
|
1390
1462
|
let match;
|
|
1391
1463
|
while ((match = variableRegex.exec(value2)) !== null) {
|
|
1392
1464
|
if (match.index > lastIndex) {
|
|
1393
1465
|
paragraph.append(lexical.$createTextNode(value2.substring(lastIndex, match.index)));
|
|
1394
1466
|
}
|
|
1395
|
-
paragraph.append(
|
|
1467
|
+
paragraph.append(
|
|
1468
|
+
$createVariableNode(decodeURIComponent(match[4]), decodeURIComponent(match[3]), decodeURIComponent(match[1]), decodeURIComponent(match[2]))
|
|
1469
|
+
);
|
|
1396
1470
|
lastIndex = variableRegex.lastIndex;
|
|
1397
1471
|
}
|
|
1398
1472
|
if (lastIndex < value2.length) {
|
|
@@ -1433,6 +1507,17 @@ function normalizePastedFiles(files) {
|
|
|
1433
1507
|
});
|
|
1434
1508
|
});
|
|
1435
1509
|
}
|
|
1510
|
+
function focusEditableToCursor(target, cursor = "end") {
|
|
1511
|
+
if (!target) return;
|
|
1512
|
+
target.focus();
|
|
1513
|
+
const selection = window.getSelection();
|
|
1514
|
+
if (!selection) return;
|
|
1515
|
+
const range = document.createRange();
|
|
1516
|
+
range.selectNodeContents(target);
|
|
1517
|
+
range.collapse(cursor !== "start");
|
|
1518
|
+
selection.removeAllRanges();
|
|
1519
|
+
selection.addRange(range);
|
|
1520
|
+
}
|
|
1436
1521
|
var ChatInput = React10__namespace.forwardRef(
|
|
1437
1522
|
({
|
|
1438
1523
|
value = "",
|
|
@@ -1462,7 +1547,11 @@ var ChatInput = React10__namespace.forwardRef(
|
|
|
1462
1547
|
editable: !disabled && !readOnly
|
|
1463
1548
|
};
|
|
1464
1549
|
React10.useImperativeHandle(ref, () => ({
|
|
1465
|
-
focus: () =>
|
|
1550
|
+
focus: (options) => {
|
|
1551
|
+
requestAnimationFrame(() => {
|
|
1552
|
+
focusEditableToCursor(contentEditableRef.current, options?.cursor || "end");
|
|
1553
|
+
});
|
|
1554
|
+
},
|
|
1466
1555
|
blur: () => contentEditableRef.current?.blur(),
|
|
1467
1556
|
nativeElement: contentEditableRef.current
|
|
1468
1557
|
}));
|
|
@@ -1728,6 +1817,9 @@ var createChatService = (request, config) => {
|
|
|
1728
1817
|
const fetchExecutionDebug = (conversationId) => {
|
|
1729
1818
|
return request.get(`/agents/conversations/${conversationId}/executions/debug`);
|
|
1730
1819
|
};
|
|
1820
|
+
const fetchAvailableResources = (types = ["skill", "knowledge", "datasource", "mcp_server"]) => {
|
|
1821
|
+
return request.get(`/agents/resources/available`, { types: Array.isArray(types) ? types.toString() : types });
|
|
1822
|
+
};
|
|
1731
1823
|
return {
|
|
1732
1824
|
fetchModelList,
|
|
1733
1825
|
fetchAgentInfo,
|
|
@@ -1749,7 +1841,8 @@ var createChatService = (request, config) => {
|
|
|
1749
1841
|
getAgentAvatar,
|
|
1750
1842
|
conversationFavorite,
|
|
1751
1843
|
shareConversation,
|
|
1752
|
-
fetchExecutionDebug
|
|
1844
|
+
fetchExecutionDebug,
|
|
1845
|
+
fetchAvailableResources
|
|
1753
1846
|
};
|
|
1754
1847
|
};
|
|
1755
1848
|
|
|
@@ -1777,8 +1870,6 @@ function createChatStore() {
|
|
|
1777
1870
|
/** 钩子函数 */
|
|
1778
1871
|
hooks: {},
|
|
1779
1872
|
layout: {},
|
|
1780
|
-
/** 智能体执行链展示模式(默认聚合模式,可运行时切换) */
|
|
1781
|
-
agentExecMode: "aggregate",
|
|
1782
1873
|
loading: false,
|
|
1783
1874
|
/** 文件预览状态 */
|
|
1784
1875
|
preview: {
|
|
@@ -1867,9 +1958,6 @@ function createChatStore() {
|
|
|
1867
1958
|
const setLayout = (layout) => {
|
|
1868
1959
|
config.layout = common.deepMerge(defaultLayout, layout);
|
|
1869
1960
|
};
|
|
1870
|
-
const setExecMode = (mode) => {
|
|
1871
|
-
config.agentExecMode = mode;
|
|
1872
|
-
};
|
|
1873
1961
|
const fetchExecutionDebug = (conversationId) => {
|
|
1874
1962
|
return config.services.request.fetchExecutionDebug(conversationId);
|
|
1875
1963
|
};
|
|
@@ -2900,8 +2988,6 @@ function createChatStore() {
|
|
|
2900
2988
|
setParams,
|
|
2901
2989
|
/** 设置布局配置 */
|
|
2902
2990
|
setLayout,
|
|
2903
|
-
/** 设置智能体执行链展示模式(聚合 / 顺序) */
|
|
2904
|
-
setExecMode,
|
|
2905
2991
|
/** 获取会话执行轨迹(debug 模式) */
|
|
2906
2992
|
fetchExecutionDebug,
|
|
2907
2993
|
/** 设置生命周期钩子 */
|
|
@@ -3310,35 +3396,10 @@ var ConversationList_default = ({ onClose }) => {
|
|
|
3310
3396
|
var style_module_default = {
|
|
3311
3397
|
popover: "style_module_popover",
|
|
3312
3398
|
resourceBtn: "style_module_resourceBtn",
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
layout: "style_module_layout",
|
|
3318
|
-
sider: "style_module_sider",
|
|
3319
|
-
categoryName: "style_module_categoryName",
|
|
3320
|
-
siderContent: "style_module_siderContent",
|
|
3321
|
-
categoryItem: "style_module_categoryItem",
|
|
3322
|
-
categoryActive: "style_module_categoryActive",
|
|
3323
|
-
roundCheckbox: "style_module_roundCheckbox",
|
|
3324
|
-
content: "style_module_content",
|
|
3325
|
-
searchInput: "style_module_searchInput",
|
|
3326
|
-
selectedCount: "style_module_selectedCount",
|
|
3327
|
-
tagsArea: "style_module_tagsArea",
|
|
3328
|
-
tagContainer: "style_module_tagContainer",
|
|
3329
|
-
tag: "style_module_tag",
|
|
3330
|
-
expandBtnWrapper: "style_module_expandBtnWrapper",
|
|
3331
|
-
expandBtn: "style_module_expandBtn",
|
|
3332
|
-
tagsExpanded: "style_module_tagsExpanded",
|
|
3333
|
-
listArea: "style_module_listArea",
|
|
3334
|
-
listInner: "style_module_listInner",
|
|
3335
|
-
listItem: "style_module_listItem",
|
|
3336
|
-
listItemSelected: "style_module_listItemSelected",
|
|
3337
|
-
itemIconWrapper: "style_module_itemIconWrapper",
|
|
3338
|
-
itemInfo: "style_module_itemInfo",
|
|
3339
|
-
itemDesc: "style_module_itemDesc",
|
|
3340
|
-
footer: "style_module_footer",
|
|
3341
|
-
titleContainer: "style_module_titleContainer"};
|
|
3399
|
+
resourceDropdown: "style_module_resourceDropdown",
|
|
3400
|
+
resourceDropdownMenu: "style_module_resourceDropdownMenu",
|
|
3401
|
+
resourceDropdownSubMenu: "style_module_resourceDropdownSubMenu",
|
|
3402
|
+
resourceBtnActive: "style_module_resourceBtnActive"};
|
|
3342
3403
|
var HistoryBtn_default = ({ icon, ...rest }) => {
|
|
3343
3404
|
const chatStore = useChatStore();
|
|
3344
3405
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
@@ -3381,7 +3442,7 @@ var ChatHeader_default = ({
|
|
|
3381
3442
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
3382
3443
|
const conversationsState = valtio.useSnapshot(chatStore.conversations);
|
|
3383
3444
|
const conversationTitle = String(conversationsState.list.items.find((item) => item.key === conversationState.active.id)?.label || "");
|
|
3384
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
3445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames9__default.default(styles_module_default2.chatHeader, "zero-chat-header"), children: [
|
|
3385
3446
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.chatHeaderContent, children: [
|
|
3386
3447
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3387
3448
|
common.RenderWrapper,
|
|
@@ -3435,8 +3496,8 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3435
3496
|
{
|
|
3436
3497
|
control: title,
|
|
3437
3498
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 4, flex: 1, style: { minWidth: 0 }, children: [
|
|
3438
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className:
|
|
3439
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className:
|
|
3499
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, className: classNames9__default.default("fz-16"), children: agentState.agentInfo.name }),
|
|
3500
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", ellipsis: true, className: classNames9__default.default("fz-12"), children: agentState.agentInfo.description })
|
|
3440
3501
|
] }) })
|
|
3441
3502
|
}
|
|
3442
3503
|
)
|
|
@@ -3451,7 +3512,7 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3451
3512
|
block: true,
|
|
3452
3513
|
type: "primary",
|
|
3453
3514
|
onClick: () => chatStore.createConversation(),
|
|
3454
|
-
className:
|
|
3515
|
+
className: classNames9__default.default(styles_module_default2.createConversationButton),
|
|
3455
3516
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
3456
3517
|
children: t11("newConversation")
|
|
3457
3518
|
}
|
|
@@ -3461,35 +3522,12 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
|
|
|
3461
3522
|
] });
|
|
3462
3523
|
};
|
|
3463
3524
|
var ConversationListPanel = ({ header }) => {
|
|
3464
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
3525
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
|
|
3465
3526
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
|
|
3466
3527
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
|
|
3467
3528
|
] });
|
|
3468
3529
|
};
|
|
3469
3530
|
var ConversationListPanel_default = ConversationListPanel;
|
|
3470
|
-
|
|
3471
|
-
// src/components/agentExecShared.ts
|
|
3472
|
-
var EXEC_CONTENT_EVENT_TYPES = ["text", "toolCall", "toolResult", "stepError", "runFailed", "files", "plan"];
|
|
3473
|
-
function hasContent(content = [], countAnswer) {
|
|
3474
|
-
return content.some((item) => {
|
|
3475
|
-
const evt = item;
|
|
3476
|
-
if (evt.type === "text") {
|
|
3477
|
-
const t11 = item;
|
|
3478
|
-
return countAnswer ? !!(t11.reasoningContent || t11.messageContent) : !!t11.reasoningContent;
|
|
3479
|
-
}
|
|
3480
|
-
return EXEC_CONTENT_EVENT_TYPES.includes(evt.type);
|
|
3481
|
-
});
|
|
3482
|
-
}
|
|
3483
|
-
function hasExecContent(content = []) {
|
|
3484
|
-
return hasContent(content, true);
|
|
3485
|
-
}
|
|
3486
|
-
function hasExecChain(content = []) {
|
|
3487
|
-
return hasContent(content, false);
|
|
3488
|
-
}
|
|
3489
|
-
function isSubAgentEvent(tool) {
|
|
3490
|
-
if (!tool) return false;
|
|
3491
|
-
return !!tool.hasSubAgent || !!tool.subConversationId || !!tool.metadata?.conversationId || tool.toolName === "agent_spawn";
|
|
3492
|
-
}
|
|
3493
3531
|
var XCard = xCard.XCard;
|
|
3494
3532
|
var { Text: AText } = antd.Typography;
|
|
3495
3533
|
function getArtifactFallbackTitle(type) {
|
|
@@ -3956,7 +3994,7 @@ var CHART_COMPONENTS = Object.fromEntries(
|
|
|
3956
3994
|
var Charts_default = ({ data, loading }) => {
|
|
3957
3995
|
const { type, config } = data;
|
|
3958
3996
|
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
3959
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
3997
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames9__default.default(styles_module_default3.chart, "scroll-fade-in"), children: loading ? (
|
|
3960
3998
|
// Antd 骨架屏
|
|
3961
3999
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default3.chartSkeleton, children: /* @__PURE__ */ jsxRuntime.jsx(icons.DotChartOutlined, { className: styles_module_default3.chartSkeletonIcon }) })
|
|
3962
4000
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4054,9 +4092,9 @@ var IndexQuote_default = ({ data, loading, message: message3 }) => {
|
|
|
4054
4092
|
setOpen(true);
|
|
4055
4093
|
}
|
|
4056
4094
|
};
|
|
4057
|
-
const
|
|
4095
|
+
const Content = /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx("a", { onClick, children: citation?.citationName }) }) });
|
|
4058
4096
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block m-l-8", children: [
|
|
4059
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content:
|
|
4097
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content: Content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { variant: "filled", color: "processing", className: "cursor-pointer", children: data?.citationName }) }) }),
|
|
4060
4098
|
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
4061
4099
|
] });
|
|
4062
4100
|
};
|
|
@@ -4266,7 +4304,7 @@ var XMarkdown_default = React10.memo(({ message: message3, components = {}, cont
|
|
|
4266
4304
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4267
4305
|
XMarkdown__default.default,
|
|
4268
4306
|
{
|
|
4269
|
-
className:
|
|
4307
|
+
className: classNames9__default.default("x-markdown-light", styles_module_default4.xMarkdownStyle),
|
|
4270
4308
|
config,
|
|
4271
4309
|
...rest,
|
|
4272
4310
|
content: processedContent,
|
|
@@ -6201,49 +6239,25 @@ var ToolCallItem = ({ item }) => {
|
|
|
6201
6239
|
};
|
|
6202
6240
|
var tool_call_item_default = ToolCallItem;
|
|
6203
6241
|
|
|
6204
|
-
// src/components/
|
|
6205
|
-
var
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
6224
|
-
const [open, setOpen] = React10.useState(false);
|
|
6225
|
-
const hasExpand = !!content;
|
|
6226
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: agentExecList_module_default.execRow, children: [
|
|
6227
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: agentExecList_module_default.rowLine, onClick: () => hasExpand && setOpen((o) => !o), children: [
|
|
6228
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.rowIcon, children: icon }),
|
|
6229
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${agentExecList_module_default.rowLabel} ${status === "error" ? agentExecList_module_default.rowLabelError : ""}`, children: label }),
|
|
6230
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${agentExecList_module_default.rowDetail} ${hasExpand ? agentExecList_module_default.rowDetailExpandable : ""}`, title: detail, children: detail || " " }),
|
|
6231
|
-
onDetail && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6232
|
-
"span",
|
|
6233
|
-
{
|
|
6234
|
-
className: agentExecList_module_default.rowDetailAction,
|
|
6235
|
-
onClick: (e) => {
|
|
6236
|
-
e.stopPropagation();
|
|
6237
|
-
onDetail();
|
|
6238
|
-
},
|
|
6239
|
-
children: t11("viewExecutionDetail")
|
|
6240
|
-
}
|
|
6241
|
-
)
|
|
6242
|
-
] }),
|
|
6243
|
-
open && content && /* @__PURE__ */ jsxRuntime.jsx("div", { className: agentExecList_module_default.rowBody, children: content })
|
|
6244
|
-
] });
|
|
6245
|
-
});
|
|
6246
|
-
var agentExecRow_default = AgentExecRow;
|
|
6242
|
+
// src/components/agentExecShared.ts
|
|
6243
|
+
var EXEC_CONTENT_EVENT_TYPES = ["text", "toolCall", "toolResult", "stepError", "runFailed", "files", "plan"];
|
|
6244
|
+
function hasContent(content = [], countAnswer) {
|
|
6245
|
+
return content.some((item) => {
|
|
6246
|
+
const evt = item;
|
|
6247
|
+
if (evt.type === "text") {
|
|
6248
|
+
const t11 = item;
|
|
6249
|
+
return !!(t11.reasoningContent || t11.messageContent) ;
|
|
6250
|
+
}
|
|
6251
|
+
return EXEC_CONTENT_EVENT_TYPES.includes(evt.type);
|
|
6252
|
+
});
|
|
6253
|
+
}
|
|
6254
|
+
function hasExecContent(content = []) {
|
|
6255
|
+
return hasContent(content);
|
|
6256
|
+
}
|
|
6257
|
+
function isSubAgentEvent(tool) {
|
|
6258
|
+
if (!tool) return false;
|
|
6259
|
+
return !!tool.hasSubAgent || !!tool.subConversationId || !!tool.metadata?.conversationId || tool.toolName === "agent_spawn";
|
|
6260
|
+
}
|
|
6247
6261
|
var TOOL_LABEL = {
|
|
6248
6262
|
loading: common.t(`${NS_CHAT_COPILOT}:execItemRunning`),
|
|
6249
6263
|
success: common.t(`${NS_CHAT_COPILOT}:execItemDone`),
|
|
@@ -6351,70 +6365,48 @@ function buildExecRow(item, index, ctx) {
|
|
|
6351
6365
|
return null;
|
|
6352
6366
|
}
|
|
6353
6367
|
}
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
const
|
|
6367
|
-
const
|
|
6368
|
-
const
|
|
6369
|
-
return
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.count, children: common.t(`${NS_CHAT_COPILOT}:execItemSummaryDone`, { count: completed }) }),
|
|
6376
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.divider, children: "|" }),
|
|
6377
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.count, children: common.t(`${NS_CHAT_COPILOT}:execItemSummaryFailed`, { count: failed }) }),
|
|
6378
|
-
loading > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6379
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.divider, children: "|" }),
|
|
6380
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.count, children: common.t(`${NS_CHAT_COPILOT}:execItemSummaryRunning`, { count: loading }) })
|
|
6381
|
-
] })
|
|
6382
|
-
] });
|
|
6383
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6384
|
-
antd.Collapse,
|
|
6385
|
-
{
|
|
6386
|
-
ghost: true,
|
|
6387
|
-
size: "small",
|
|
6388
|
-
className: agentExecList_module_default.wrap,
|
|
6389
|
-
defaultActiveKey: defaultActive ? ["agent-exec"] : [],
|
|
6390
|
-
items: [
|
|
6368
|
+
|
|
6369
|
+
// src/components/agentExecList.module.less
|
|
6370
|
+
var agentExecList_module_default = {
|
|
6371
|
+
execRow: "agentExecList_module_execRow",
|
|
6372
|
+
rowLine: "agentExecList_module_rowLine",
|
|
6373
|
+
rowIcon: "agentExecList_module_rowIcon",
|
|
6374
|
+
rowDetail: "agentExecList_module_rowDetail",
|
|
6375
|
+
rowDetailExpandable: "agentExecList_module_rowDetailExpandable",
|
|
6376
|
+
rowDetailAction: "agentExecList_module_rowDetailAction",
|
|
6377
|
+
rowBody: "agentExecList_module_rowBody"
|
|
6378
|
+
};
|
|
6379
|
+
var AgentExecRow = React10.memo(({ icon, detail, status, content, onDetail }) => {
|
|
6380
|
+
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
6381
|
+
const [open, setOpen] = React10.useState(false);
|
|
6382
|
+
const hasExpand = !!content;
|
|
6383
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: agentExecList_module_default.execRow, children: [
|
|
6384
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: agentExecList_module_default.rowLine, onClick: () => hasExpand && setOpen((o) => !o), children: [
|
|
6385
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: agentExecList_module_default.rowIcon, children: icon }),
|
|
6386
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${agentExecList_module_default.rowDetail} ${hasExpand ? agentExecList_module_default.rowDetailExpandable : ""}`, title: detail, children: detail || " " }),
|
|
6387
|
+
onDetail && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6388
|
+
"span",
|
|
6391
6389
|
{
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
label: item.label,
|
|
6399
|
-
detail: item.detail,
|
|
6400
|
-
status: item.status,
|
|
6401
|
-
content: item.content,
|
|
6402
|
-
onDetail: item.onDetail
|
|
6403
|
-
},
|
|
6404
|
-
item.key
|
|
6405
|
-
)) })
|
|
6390
|
+
className: agentExecList_module_default.rowDetailAction,
|
|
6391
|
+
onClick: (e) => {
|
|
6392
|
+
e.stopPropagation();
|
|
6393
|
+
onDetail();
|
|
6394
|
+
},
|
|
6395
|
+
children: t11("viewExecutionDetail")
|
|
6406
6396
|
}
|
|
6407
|
-
|
|
6408
|
-
}
|
|
6409
|
-
|
|
6410
|
-
}
|
|
6397
|
+
)
|
|
6398
|
+
] }),
|
|
6399
|
+
open && content && /* @__PURE__ */ jsxRuntime.jsx("div", { className: agentExecList_module_default.rowBody, children: content })
|
|
6400
|
+
] });
|
|
6401
|
+
});
|
|
6402
|
+
var agentExecRow_default = AgentExecRow;
|
|
6411
6403
|
|
|
6412
6404
|
// src/components/agentExecSequence.module.less
|
|
6413
6405
|
var agentExecSequence_module_default = {
|
|
6414
6406
|
seq: "agentExecSequence_module_seq"
|
|
6415
6407
|
};
|
|
6416
6408
|
function renderRow(row, key) {
|
|
6417
|
-
return /* @__PURE__ */ jsxRuntime.jsx(agentExecRow_default, { icon: row.icon,
|
|
6409
|
+
return /* @__PURE__ */ jsxRuntime.jsx(agentExecRow_default, { icon: row.icon, detail: row.detail, status: row.status, content: row.content, onDetail: row.onDetail }, key);
|
|
6418
6410
|
}
|
|
6419
6411
|
var AgentExecSequence = React10.memo(({ content, message: message3, customComponents, messageIndex, role, onViewSubAgent }) => {
|
|
6420
6412
|
const ctx = { message: message3, customComponents, onViewSubAgent };
|
|
@@ -6456,33 +6448,8 @@ var AgentExecSequence = React10.memo(({ content, message: message3, customCompon
|
|
|
6456
6448
|
var agentExecSequence_default = AgentExecSequence;
|
|
6457
6449
|
var MessageRender_default = React10__namespace.default.memo(({ role, message: message3, messageIndex = -1, loading, containerRef, customComponents }) => {
|
|
6458
6450
|
const chatStore = useChatStore();
|
|
6459
|
-
const configState = valtio.useSnapshot(chatStore.config);
|
|
6460
|
-
const execMode = configState.agentExecMode || "aggregate";
|
|
6461
|
-
const isSequence = execMode === "sequence";
|
|
6462
6451
|
const openSubAgent = React10.useCallback((item) => chatStore.openSubAgent(item), [chatStore]);
|
|
6463
|
-
const {
|
|
6464
|
-
items,
|
|
6465
|
-
completed,
|
|
6466
|
-
failed,
|
|
6467
|
-
loading: runLoading
|
|
6468
|
-
} = React10.useMemo(
|
|
6469
|
-
() => buildAgentExecItems(message3.content || [], {
|
|
6470
|
-
message: message3,
|
|
6471
|
-
customComponents,
|
|
6472
|
-
// 子智能体:打开右侧执行详情抽屉
|
|
6473
|
-
onViewSubAgent: openSubAgent
|
|
6474
|
-
}),
|
|
6475
|
-
[message3, customComponents, openSubAgent]
|
|
6476
|
-
);
|
|
6477
6452
|
const hasSequenceContent = React10.useMemo(() => hasExecContent(message3.content || []), [message3.content]);
|
|
6478
|
-
const finalAnswer = React10.useMemo(() => {
|
|
6479
|
-
const lastText = [...message3.content || []].reverse().find((i) => i.type === "text");
|
|
6480
|
-
if (!lastText) return null;
|
|
6481
|
-
const content = lastText.messageContent || "";
|
|
6482
|
-
if (!String(content).trim()) return null;
|
|
6483
|
-
const answerItem = { ...lastText, reasoningContent: void 0 };
|
|
6484
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TextNode2, { item: answerItem, role: message3.role, customComponents, message: message3, messageIndex });
|
|
6485
|
-
}, [message3, messageIndex, customComponents]);
|
|
6486
6453
|
const quoteMsg = React10.useMemo(() => {
|
|
6487
6454
|
const quoteMsg2 = {};
|
|
6488
6455
|
if (message3.params) {
|
|
@@ -6498,16 +6465,14 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
6498
6465
|
}, [message3.params, message3.quoteMsg]);
|
|
6499
6466
|
const hasToolCall = React10.useMemo(() => (message3.content || []).some((i) => i.type === "toolCall" || i.type === "toolResult"), [message3]);
|
|
6500
6467
|
const lastContentType = message3.content?.[message3.content.length - 1]?.type;
|
|
6501
|
-
const
|
|
6502
|
-
|
|
6503
|
-
if (isSequence ? !hasSequenceContent && !showPending : items.length === 0 && !finalAnswer && !showPending) return null;
|
|
6468
|
+
const showPending = loading && (!hasSequenceContent || lastContentType !== "text");
|
|
6469
|
+
if (!hasSequenceContent && !showPending) return null;
|
|
6504
6470
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, vertical: true, gap: 8, children: [
|
|
6505
|
-
|
|
6471
|
+
hasSequenceContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6506
6472
|
xV2.Bubble,
|
|
6507
6473
|
{
|
|
6508
6474
|
role: role.user,
|
|
6509
6475
|
placement: role.placement,
|
|
6510
|
-
variant: "borderless",
|
|
6511
6476
|
className: styles_module_default.bubble,
|
|
6512
6477
|
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6513
6478
|
agentExecSequence_default,
|
|
@@ -6521,18 +6486,8 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
|
|
|
6521
6486
|
}
|
|
6522
6487
|
)
|
|
6523
6488
|
}
|
|
6524
|
-
) : items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6525
|
-
xV2.Bubble,
|
|
6526
|
-
{
|
|
6527
|
-
role: role.user,
|
|
6528
|
-
placement: role.placement,
|
|
6529
|
-
variant: "borderless",
|
|
6530
|
-
className: styles_module_default.bubble,
|
|
6531
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(AgentExecList, { items, completed, failed, loading: runLoading })
|
|
6532
|
-
}
|
|
6533
6489
|
),
|
|
6534
6490
|
hasToolCall && messageIndex >= 0 && /* @__PURE__ */ jsxRuntime.jsx(A2uiMessageCards, { messageIndex, message: message3 }),
|
|
6535
|
-
!isSequence && finalAnswer && /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble, { role: role.user, placement: role.placement, className: styles_module_default.bubble, content: finalAnswer }),
|
|
6536
6491
|
showPending && role.user === "agent" && /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble, { role: role.user, placement: role.placement, content: /* @__PURE__ */ jsxRuntime.jsx(RunStartedNode, {}) }),
|
|
6537
6492
|
quoteMsg && /* @__PURE__ */ jsxRuntime.jsx(QuoteMsgNode, { quoteMsg, role })
|
|
6538
6493
|
] });
|
|
@@ -6551,7 +6506,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
6551
6506
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6552
6507
|
xV2.Welcome,
|
|
6553
6508
|
{
|
|
6554
|
-
className:
|
|
6509
|
+
className: classNames9__default.default(styles_module_default2.chatWelcome, "p-t-32"),
|
|
6555
6510
|
variant: "borderless",
|
|
6556
6511
|
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6557
6512
|
common.RenderWrapper,
|
|
@@ -6577,7 +6532,7 @@ var WelcomeItem_default = ({ icon = true, title = true, description = true, prom
|
|
|
6577
6532
|
DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6578
6533
|
xV2.Prompts,
|
|
6579
6534
|
{
|
|
6580
|
-
className:
|
|
6535
|
+
className: classNames9__default.default("m-t-16", styles_module_default2.promptItem),
|
|
6581
6536
|
wrap: true,
|
|
6582
6537
|
onItemClick: (info) => chatStore.sendMessage(info.data.description),
|
|
6583
6538
|
items: recommendQuestions
|
|
@@ -6786,264 +6741,13 @@ var BubbleListItems_default = ({
|
|
|
6786
6741
|
autoScroll: false,
|
|
6787
6742
|
ref: listRef,
|
|
6788
6743
|
items: bubbleListItems,
|
|
6789
|
-
className:
|
|
6744
|
+
className: classNames9__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
6790
6745
|
onScroll: handleScroll
|
|
6791
6746
|
},
|
|
6792
6747
|
conversationState.active.id
|
|
6793
6748
|
) }) });
|
|
6794
6749
|
};
|
|
6795
|
-
var {
|
|
6796
|
-
var { Title: Title2, Text: Text4 } = antd.Typography;
|
|
6797
|
-
var ALL_CATEGORY_ID = "all";
|
|
6798
|
-
var ResourceSelectorModal_default = ({ open, type, onCancel }) => {
|
|
6799
|
-
const chatStore = useChatStore();
|
|
6800
|
-
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
6801
|
-
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
6802
|
-
const { token } = antd.theme.useToken();
|
|
6803
|
-
const tagsContainerRef = React10.useRef(null);
|
|
6804
|
-
const isSkill = type === "skill";
|
|
6805
|
-
const [loading, setLoading] = React10.useState(false);
|
|
6806
|
-
const [resources, setResources] = React10.useState([]);
|
|
6807
|
-
const [categories, setCategories] = React10.useState([]);
|
|
6808
|
-
const [selectedCategoryIds, setSelectedCategoryIds] = React10.useState([ALL_CATEGORY_ID]);
|
|
6809
|
-
const [selectedIds, setSelectedIds] = React10.useState([]);
|
|
6810
|
-
const [searchText, setSearchText] = React10.useState("");
|
|
6811
|
-
const [tagsExpanded, setTagsExpanded] = React10.useState(false);
|
|
6812
|
-
const [showExpandBtn, setShowExpandBtn] = React10.useState(false);
|
|
6813
|
-
React10.useEffect(() => {
|
|
6814
|
-
if (!open) {
|
|
6815
|
-
setResources([]);
|
|
6816
|
-
setCategories([]);
|
|
6817
|
-
setSelectedCategoryIds([ALL_CATEGORY_ID]);
|
|
6818
|
-
setSelectedIds([]);
|
|
6819
|
-
setSearchText("");
|
|
6820
|
-
setTagsExpanded(false);
|
|
6821
|
-
setShowExpandBtn(false);
|
|
6822
|
-
return;
|
|
6823
|
-
}
|
|
6824
|
-
let canceled = false;
|
|
6825
|
-
setLoading(true);
|
|
6826
|
-
const fetchData = async () => {
|
|
6827
|
-
try {
|
|
6828
|
-
const tagType = isSkill ? 3 /* SKILL */ : 2 /* KNOWLEDGE */;
|
|
6829
|
-
const [tagsRes, resourcesRes] = await Promise.all([
|
|
6830
|
-
chatStore.config.services.request.listTags({ tagType }),
|
|
6831
|
-
isSkill ? chatStore.config.services.request.listSkills() : chatStore.config.services.request.listLibrarys({ libraryType: 1 /* KNOWLEDGE */ })
|
|
6832
|
-
]);
|
|
6833
|
-
if (canceled) return;
|
|
6834
|
-
const fetchedResources = resourcesRes.data || [];
|
|
6835
|
-
setCategories(tagsRes.data || []);
|
|
6836
|
-
setResources(fetchedResources);
|
|
6837
|
-
const spec = conversationState.active.spec;
|
|
6838
|
-
const initialItems = isSkill ? spec?.skills?.items : spec?.knowledges?.items;
|
|
6839
|
-
const validIds = new Set(fetchedResources.map((r) => r.id));
|
|
6840
|
-
const validSelectedIds = (initialItems || []).map((item) => item.id).filter((id) => validIds.has(id));
|
|
6841
|
-
setSelectedIds(validSelectedIds);
|
|
6842
|
-
if (initialItems && validSelectedIds.length !== initialItems.length) {
|
|
6843
|
-
const currentSpec = chatStore.conversation.active.spec || {};
|
|
6844
|
-
const clonedSpec = JSON.parse(JSON.stringify(currentSpec));
|
|
6845
|
-
chatStore.setConversationSpec(getNextSpec(clonedSpec, validSelectedIds, fetchedResources));
|
|
6846
|
-
}
|
|
6847
|
-
} finally {
|
|
6848
|
-
if (!canceled) setLoading(false);
|
|
6849
|
-
}
|
|
6850
|
-
};
|
|
6851
|
-
fetchData();
|
|
6852
|
-
return () => {
|
|
6853
|
-
canceled = true;
|
|
6854
|
-
};
|
|
6855
|
-
}, [open, isSkill, chatStore, conversationState.active.spec]);
|
|
6856
|
-
React10.useEffect(() => {
|
|
6857
|
-
if (!open) return;
|
|
6858
|
-
const checkHeight = () => {
|
|
6859
|
-
if (tagsContainerRef.current) {
|
|
6860
|
-
setShowExpandBtn(tagsContainerRef.current.scrollHeight > 60);
|
|
6861
|
-
}
|
|
6862
|
-
};
|
|
6863
|
-
setTimeout(checkHeight, 0);
|
|
6864
|
-
const observer = new ResizeObserver(checkHeight);
|
|
6865
|
-
if (tagsContainerRef.current) observer.observe(tagsContainerRef.current);
|
|
6866
|
-
return () => observer.disconnect();
|
|
6867
|
-
}, [open, selectedIds]);
|
|
6868
|
-
const allCategories = React10.useMemo(() => [{ id: ALL_CATEGORY_ID, name: t11("all") }, ...categories], [categories, t11]);
|
|
6869
|
-
const filteredResources = React10.useMemo(() => {
|
|
6870
|
-
return resources.filter((item) => {
|
|
6871
|
-
const matchCategory = selectedCategoryIds.includes(ALL_CATEGORY_ID) || item.tagIds?.some((id) => selectedCategoryIds.includes(id));
|
|
6872
|
-
const searchLower = searchText.trim().toLowerCase();
|
|
6873
|
-
const itemName = item.name?.toLowerCase() || "";
|
|
6874
|
-
const itemAlias = "aliasName" in item ? item.aliasName?.toLowerCase() || "" : "";
|
|
6875
|
-
const matchSearch = !searchLower || itemName.includes(searchLower) || itemAlias.includes(searchLower);
|
|
6876
|
-
return matchCategory && matchSearch;
|
|
6877
|
-
});
|
|
6878
|
-
}, [resources, selectedCategoryIds, searchText]);
|
|
6879
|
-
const getNextSpec = (spec, ids, resourceList) => {
|
|
6880
|
-
const nextSpec = { ...spec };
|
|
6881
|
-
if (isSkill) {
|
|
6882
|
-
nextSpec.skills = {
|
|
6883
|
-
items: ids.map((id) => ({ id }))
|
|
6884
|
-
};
|
|
6885
|
-
} else {
|
|
6886
|
-
nextSpec.knowledges = {
|
|
6887
|
-
items: ids.map((id) => {
|
|
6888
|
-
const resource = resourceList.find((r) => r.id === id);
|
|
6889
|
-
return { id, name: resource?.name || "" };
|
|
6890
|
-
})
|
|
6891
|
-
};
|
|
6892
|
-
}
|
|
6893
|
-
return nextSpec;
|
|
6894
|
-
};
|
|
6895
|
-
const handleCategoryChange = (categoryId, checked) => {
|
|
6896
|
-
if (categoryId === ALL_CATEGORY_ID) {
|
|
6897
|
-
setSelectedCategoryIds(checked ? [ALL_CATEGORY_ID] : []);
|
|
6898
|
-
return;
|
|
6899
|
-
}
|
|
6900
|
-
let nextIds = selectedCategoryIds.filter((id) => id !== ALL_CATEGORY_ID);
|
|
6901
|
-
if (checked) {
|
|
6902
|
-
nextIds.push(categoryId);
|
|
6903
|
-
} else {
|
|
6904
|
-
nextIds = nextIds.filter((id) => id !== categoryId);
|
|
6905
|
-
}
|
|
6906
|
-
setSelectedCategoryIds(nextIds.length ? nextIds : [ALL_CATEGORY_ID]);
|
|
6907
|
-
};
|
|
6908
|
-
const toggleItemSelection = (id) => {
|
|
6909
|
-
setSelectedIds((prev) => prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]);
|
|
6910
|
-
};
|
|
6911
|
-
const handleConfirm = () => {
|
|
6912
|
-
const currentSpec = chatStore.conversation.active.spec || {};
|
|
6913
|
-
const clonedSpec = JSON.parse(JSON.stringify(currentSpec));
|
|
6914
|
-
chatStore.setConversationSpec(getNextSpec(clonedSpec, selectedIds, resources));
|
|
6915
|
-
onCancel?.();
|
|
6916
|
-
};
|
|
6917
|
-
const getDisplayName = (id) => {
|
|
6918
|
-
const item = resources.find((r) => r.id === id);
|
|
6919
|
-
if (!item) return id;
|
|
6920
|
-
return "aliasName" in item && item.aliasName ? item.aliasName : item.name || id;
|
|
6921
|
-
};
|
|
6922
|
-
const title = isSkill ? t11("selectSkill") : t11("selectKnowledge");
|
|
6923
|
-
const iconType = isSkill ? "icon-skill" : "icon-remark";
|
|
6924
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6925
|
-
antd.Modal,
|
|
6926
|
-
{
|
|
6927
|
-
open,
|
|
6928
|
-
className: style_module_default.customModal,
|
|
6929
|
-
onCancel,
|
|
6930
|
-
closeIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}),
|
|
6931
|
-
width: 960,
|
|
6932
|
-
centered: true,
|
|
6933
|
-
destroyOnHidden: true,
|
|
6934
|
-
title: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.titleContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Title2, { level: 5, children: title }) }),
|
|
6935
|
-
footer: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", onClick: handleConfirm, children: t11("confirm") }) }),
|
|
6936
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Layout, { className: style_module_default.layout, children: [
|
|
6937
|
-
/* @__PURE__ */ jsxRuntime.jsx(Sider, { width: 220, className: style_module_default.sider, theme: "light", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.siderContent, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 4, vertical: true, children: allCategories.map((cat) => {
|
|
6938
|
-
const isChecked = selectedCategoryIds.includes(cat.id);
|
|
6939
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6940
|
-
antd.Flex,
|
|
6941
|
-
{
|
|
6942
|
-
className: classNames10__default.default(style_module_default.categoryItem, { [style_module_default.categoryActive]: isChecked }),
|
|
6943
|
-
onClick: () => handleCategoryChange(cat.id, !isChecked),
|
|
6944
|
-
children: [
|
|
6945
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6946
|
-
antd.Checkbox,
|
|
6947
|
-
{
|
|
6948
|
-
checked: isChecked,
|
|
6949
|
-
className: cat.id === ALL_CATEGORY_ID ? style_module_default.roundCheckbox : "",
|
|
6950
|
-
onClick: (e) => e.stopPropagation(),
|
|
6951
|
-
onChange: (e) => handleCategoryChange(cat.id, e.target.checked)
|
|
6952
|
-
}
|
|
6953
|
-
),
|
|
6954
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: style_module_default.categoryName, children: cat.name })
|
|
6955
|
-
]
|
|
6956
|
-
},
|
|
6957
|
-
cat.id
|
|
6958
|
-
);
|
|
6959
|
-
}) }) }) }),
|
|
6960
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Content, { className: style_module_default.content, children: [
|
|
6961
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", justify: "space-between", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6962
|
-
antd.Input,
|
|
6963
|
-
{
|
|
6964
|
-
className: style_module_default.searchInput,
|
|
6965
|
-
placeholder: isSkill ? t11("searchSkill") : t11("searchKnowledge"),
|
|
6966
|
-
prefix: /* @__PURE__ */ jsxRuntime.jsx(icons.SearchOutlined, { style: { color: token.colorTextQuaternary } }),
|
|
6967
|
-
value: searchText,
|
|
6968
|
-
onChange: (e) => setSearchText(e.target.value),
|
|
6969
|
-
allowClear: true,
|
|
6970
|
-
autoFocus: true
|
|
6971
|
-
}
|
|
6972
|
-
) }),
|
|
6973
|
-
selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: style_module_default.selectedCount, children: t11("selectedCount", { count: selectedIds.length }) }) }),
|
|
6974
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames10__default.default(style_module_default.tagsArea, { [style_module_default.tagsExpanded]: tagsExpanded }), children: [
|
|
6975
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, className: style_module_default.tagContainer, wrap: true, ref: tagsContainerRef, children: [
|
|
6976
|
-
selectedIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6977
|
-
antd.Tag,
|
|
6978
|
-
{
|
|
6979
|
-
closable: true,
|
|
6980
|
-
onClose: (e) => {
|
|
6981
|
-
e.preventDefault();
|
|
6982
|
-
toggleItemSelection(id);
|
|
6983
|
-
},
|
|
6984
|
-
className: style_module_default.tag,
|
|
6985
|
-
children: getDisplayName(id)
|
|
6986
|
-
},
|
|
6987
|
-
id
|
|
6988
|
-
)),
|
|
6989
|
-
showExpandBtn && tagsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(false), children: [
|
|
6990
|
-
t11("collapse"),
|
|
6991
|
-
" ",
|
|
6992
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.UpOutlined, {})
|
|
6993
|
-
] })
|
|
6994
|
-
] }),
|
|
6995
|
-
showExpandBtn && !tagsExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.expandBtnWrapper, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { size: "small", className: style_module_default.expandBtn, onClick: () => setTagsExpanded(true), children: [
|
|
6996
|
-
t11("expand"),
|
|
6997
|
-
" ",
|
|
6998
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.DownOutlined, {})
|
|
6999
|
-
] }) })
|
|
7000
|
-
] }),
|
|
7001
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listArea, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.listInner, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, vertical: true, children: filteredResources.length > 0 ? filteredResources.map((item) => {
|
|
7002
|
-
const isSelected = selectedIds.includes(item.id);
|
|
7003
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7004
|
-
"div",
|
|
7005
|
-
{
|
|
7006
|
-
className: classNames10__default.default(style_module_default.listItem, { [style_module_default.listItemSelected]: isSelected }),
|
|
7007
|
-
onClick: () => toggleItemSelection(item.id),
|
|
7008
|
-
children: [
|
|
7009
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: style_module_default.itemIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: iconType }) }),
|
|
7010
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: style_module_default.itemInfo, children: [
|
|
7011
|
-
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", children: [
|
|
7012
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text4, { strong: true, children: getDisplayName(item.id) }),
|
|
7013
|
-
isSelected && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color: token.colorPrimary, variant: "outlined", children: t11("added") })
|
|
7014
|
-
] }),
|
|
7015
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text4, { type: "secondary", className: style_module_default.itemDesc, children: item.description || t11("noDescription") })
|
|
7016
|
-
] })
|
|
7017
|
-
]
|
|
7018
|
-
},
|
|
7019
|
-
item.id
|
|
7020
|
-
);
|
|
7021
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: t11("noMatch") }) }) }) }) })
|
|
7022
|
-
] })
|
|
7023
|
-
] })
|
|
7024
|
-
}
|
|
7025
|
-
);
|
|
7026
|
-
};
|
|
7027
|
-
var { Text: Text5 } = antd.Typography;
|
|
7028
|
-
var KnowledgeBtn_default = ({}) => {
|
|
7029
|
-
const chatStore = useChatStore();
|
|
7030
|
-
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
7031
|
-
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
7032
|
-
const [modalOpen, setModalOpen] = React10.useState(false);
|
|
7033
|
-
const knowledgeCount = conversationState.active.spec?.knowledges?.items?.length ?? 0;
|
|
7034
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7035
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: style_module_default.resourceBtn, onClick: () => setModalOpen(true), children: [
|
|
7036
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-remark" }),
|
|
7037
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text5, { children: t11("knowledge") }),
|
|
7038
|
-
knowledgeCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7039
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { vertical: true, className: style_module_default.divider }),
|
|
7040
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: style_module_default.count, children: knowledgeCount })
|
|
7041
|
-
] })
|
|
7042
|
-
] }),
|
|
7043
|
-
modalOpen && /* @__PURE__ */ jsxRuntime.jsx(ResourceSelectorModal_default, { open: modalOpen, type: "knowledge", onCancel: () => setModalOpen(false) })
|
|
7044
|
-
] });
|
|
7045
|
-
};
|
|
7046
|
-
var { Text: Text6 } = antd.Typography;
|
|
6750
|
+
var { Text: Text4 } = antd.Typography;
|
|
7047
6751
|
var getModelIcon = (iconName) => {
|
|
7048
6752
|
if (!iconName) {
|
|
7049
6753
|
return "icon-zhinengti";
|
|
@@ -7104,7 +6808,7 @@ var ModelSelect_default = ({}) => {
|
|
|
7104
6808
|
}
|
|
7105
6809
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
7106
6810
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: getModelIcon(model.icon), style: { fontSize: 20, borderRadius: 4 } }),
|
|
7107
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6811
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text4, { children: model.label })
|
|
7108
6812
|
] });
|
|
7109
6813
|
};
|
|
7110
6814
|
React10.useEffect(() => {
|
|
@@ -7127,7 +6831,7 @@ var ModelSelect_default = ({}) => {
|
|
|
7127
6831
|
const data = option.data;
|
|
7128
6832
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 12, children: [
|
|
7129
6833
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: getModelIcon(data?.icon), style: { fontSize: 20 } }),
|
|
7130
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6834
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text4, { children: data?.label })
|
|
7131
6835
|
] });
|
|
7132
6836
|
}
|
|
7133
6837
|
}
|
|
@@ -7151,47 +6855,166 @@ var ReasonBtn_default = () => {
|
|
|
7151
6855
|
};
|
|
7152
6856
|
chatStore.setAgent(nextAgentInfo);
|
|
7153
6857
|
};
|
|
7154
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
6858
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames9__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: currentModel?.reasoning }), onClick: toggleReasoning, children: [
|
|
7155
6859
|
/* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
|
|
7156
6860
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t11("deepThinking") })
|
|
7157
6861
|
] });
|
|
7158
6862
|
};
|
|
7159
|
-
var
|
|
7160
|
-
var
|
|
6863
|
+
var getResourceKey = (item) => "id" in item ? item.id : item.name;
|
|
6864
|
+
var defaultResourceTypes = ["skill", "knowledge", "datasource", "mcp_server"];
|
|
6865
|
+
var resourceTypeMap = {
|
|
6866
|
+
skill: {
|
|
6867
|
+
responseKey: "skills",
|
|
6868
|
+
nodeType: "skill",
|
|
6869
|
+
labelKey: "skill",
|
|
6870
|
+
getLabel: (item) => item.aliasName || item.name
|
|
6871
|
+
},
|
|
6872
|
+
knowledge: {
|
|
6873
|
+
responseKey: "knowledges",
|
|
6874
|
+
nodeType: "knowledge",
|
|
6875
|
+
labelKey: "knowledge",
|
|
6876
|
+
getLabel: (item) => item.name
|
|
6877
|
+
},
|
|
6878
|
+
datasource: {
|
|
6879
|
+
responseKey: "datasources",
|
|
6880
|
+
nodeType: "datasource",
|
|
6881
|
+
labelKey: "datasource",
|
|
6882
|
+
getLabel: (item) => item.name
|
|
6883
|
+
},
|
|
6884
|
+
mcp_server: {
|
|
6885
|
+
responseKey: "mcpServers",
|
|
6886
|
+
nodeType: "mcpServer",
|
|
6887
|
+
labelKey: "mcpServer",
|
|
6888
|
+
getLabel: (item) => item.serverName || item.name
|
|
6889
|
+
},
|
|
6890
|
+
sub_agent: {
|
|
6891
|
+
responseKey: "subAgents",
|
|
6892
|
+
nodeType: "subAgent",
|
|
6893
|
+
labelKey: "subAgent",
|
|
6894
|
+
getLabel: (item) => item.name
|
|
6895
|
+
},
|
|
6896
|
+
tool: {
|
|
6897
|
+
responseKey: "tools",
|
|
6898
|
+
nodeType: "tool",
|
|
6899
|
+
labelKey: "tool",
|
|
6900
|
+
getLabel: (item) => item.name
|
|
6901
|
+
}
|
|
6902
|
+
};
|
|
6903
|
+
var emptyAgentResources2 = {
|
|
6904
|
+
skills: [],
|
|
6905
|
+
knowledges: [],
|
|
6906
|
+
datasources: [],
|
|
6907
|
+
mcpServers: [],
|
|
6908
|
+
subAgents: [],
|
|
6909
|
+
tools: []
|
|
6910
|
+
};
|
|
6911
|
+
var focusSenderInputToEnd = () => {
|
|
6912
|
+
requestAnimationFrame(() => {
|
|
6913
|
+
requestAnimationFrame(() => {
|
|
6914
|
+
const input = document.querySelector('.zero-chat-sender .ant-sender-input[contenteditable="true"]');
|
|
6915
|
+
if (!input) return;
|
|
6916
|
+
input.focus();
|
|
6917
|
+
const selection = window.getSelection();
|
|
6918
|
+
if (!selection) return;
|
|
6919
|
+
const range = document.createRange();
|
|
6920
|
+
range.selectNodeContents(input);
|
|
6921
|
+
range.collapse(false);
|
|
6922
|
+
selection.removeAllRanges();
|
|
6923
|
+
selection.addRange(range);
|
|
6924
|
+
});
|
|
6925
|
+
});
|
|
6926
|
+
};
|
|
6927
|
+
var appendResourceToken = (content, token) => {
|
|
6928
|
+
if (!content) return token;
|
|
6929
|
+
return /\s$/.test(content) ? `${content}${token}` : `${content} ${token}`;
|
|
6930
|
+
};
|
|
6931
|
+
var ResourceBtn_default = ({ types = defaultResourceTypes }) => {
|
|
7161
6932
|
const chatStore = useChatStore();
|
|
7162
6933
|
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
7163
6934
|
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
7164
|
-
const [
|
|
7165
|
-
const [
|
|
7166
|
-
React10.
|
|
7167
|
-
|
|
7168
|
-
const
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
6935
|
+
const [open, setOpen] = React10.useState(false);
|
|
6936
|
+
const [loading, setLoading] = React10.useState(false);
|
|
6937
|
+
const [resources, setResources] = React10.useState(null);
|
|
6938
|
+
const menuItems = React10.useMemo(() => {
|
|
6939
|
+
const buildChildren = (categoryKey, resourceLabel, items2, getLabel) => items2.map((item) => ({
|
|
6940
|
+
key: getResourceKey(item),
|
|
6941
|
+
label: getLabel(item),
|
|
6942
|
+
onClick: () => {
|
|
6943
|
+
const resourceName = getLabel(item);
|
|
6944
|
+
const currentContent = conversationState.messages[conversationState.active.id]?.content || "";
|
|
6945
|
+
const nextContent = appendResourceToken(
|
|
6946
|
+
currentContent,
|
|
6947
|
+
serializeResourceToken(resourceLabel, resourceName, resourceTypeMap[categoryKey].nodeType, getResourceKey(item))
|
|
6948
|
+
);
|
|
6949
|
+
chatStore.setContent(nextContent);
|
|
6950
|
+
setOpen(false);
|
|
6951
|
+
focusSenderInputToEnd();
|
|
7173
6952
|
}
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
]
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
6953
|
+
}));
|
|
6954
|
+
const buildSubMenu = (key, label, items2, getLabel) => ({
|
|
6955
|
+
key,
|
|
6956
|
+
label,
|
|
6957
|
+
popupClassName: style_module_default.resourceDropdownSubMenu,
|
|
6958
|
+
children: buildChildren(key, label, items2, getLabel)
|
|
6959
|
+
});
|
|
6960
|
+
if (loading) {
|
|
6961
|
+
return [
|
|
6962
|
+
{
|
|
6963
|
+
key: "loading",
|
|
6964
|
+
disabled: true,
|
|
6965
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6966
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.LoadingOutlined, { spin: true, style: { marginRight: 8 } }),
|
|
6967
|
+
t11("loading")
|
|
6968
|
+
] })
|
|
6969
|
+
}
|
|
6970
|
+
];
|
|
6971
|
+
}
|
|
6972
|
+
if (!resources) {
|
|
6973
|
+
return [
|
|
6974
|
+
{
|
|
6975
|
+
key: "empty",
|
|
6976
|
+
disabled: true,
|
|
6977
|
+
label: t11("empty")
|
|
6978
|
+
}
|
|
6979
|
+
];
|
|
6980
|
+
}
|
|
6981
|
+
const items = [];
|
|
6982
|
+
types.forEach((type) => {
|
|
6983
|
+
const currentConfig = resourceTypeMap[type];
|
|
6984
|
+
const currentItems = resources[currentConfig.responseKey];
|
|
6985
|
+
if (!currentItems?.length) return;
|
|
6986
|
+
items.push(buildSubMenu(type, t11(currentConfig.labelKey), currentItems, currentConfig.getLabel));
|
|
6987
|
+
});
|
|
6988
|
+
return items.length ? items : [
|
|
6989
|
+
{
|
|
6990
|
+
key: "empty",
|
|
6991
|
+
disabled: true,
|
|
6992
|
+
label: t11("empty")
|
|
6993
|
+
}
|
|
6994
|
+
];
|
|
6995
|
+
}, [chatStore, conversationState.active.id, conversationState.messages, loading, resources, t11, types]);
|
|
6996
|
+
const handleOpenChange = async (nextOpen) => {
|
|
6997
|
+
setOpen(nextOpen);
|
|
6998
|
+
if (!nextOpen) return;
|
|
6999
|
+
setLoading(true);
|
|
7000
|
+
try {
|
|
7001
|
+
const { data } = await chatStore.config.services.request.fetchAvailableResources(types);
|
|
7002
|
+
setResources(data || emptyAgentResources2);
|
|
7003
|
+
} finally {
|
|
7004
|
+
setLoading(false);
|
|
7005
|
+
}
|
|
7006
|
+
};
|
|
7007
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7008
|
+
antd.Dropdown,
|
|
7009
|
+
{
|
|
7010
|
+
classNames: { root: style_module_default.resourceDropdown },
|
|
7011
|
+
menu: { items: menuItems, className: style_module_default.resourceDropdownMenu },
|
|
7012
|
+
trigger: ["click"],
|
|
7013
|
+
open,
|
|
7014
|
+
onOpenChange: handleOpenChange,
|
|
7015
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}) })
|
|
7016
|
+
}
|
|
7017
|
+
);
|
|
7195
7018
|
};
|
|
7196
7019
|
var ChatSender_default2 = React10.forwardRef(
|
|
7197
7020
|
({
|
|
@@ -7201,8 +7024,9 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
7201
7024
|
sendBtnProps,
|
|
7202
7025
|
footerBelow = false,
|
|
7203
7026
|
reasonBtn = true,
|
|
7204
|
-
|
|
7205
|
-
|
|
7027
|
+
resourceBtn = false,
|
|
7028
|
+
// skillsBtn = false,
|
|
7029
|
+
// knowledgeBtn = false,
|
|
7206
7030
|
modelSelect = false,
|
|
7207
7031
|
commandConfig,
|
|
7208
7032
|
uploadConfig
|
|
@@ -7259,9 +7083,8 @@ var ChatSender_default2 = React10.forwardRef(
|
|
|
7259
7083
|
extraFooterBelow: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: footerBelow }),
|
|
7260
7084
|
extraFooter: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", flex: 1, children: [
|
|
7261
7085
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, children: [
|
|
7086
|
+
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: resourceBtn, DefaultComponent: ResourceBtn_default }),
|
|
7262
7087
|
agentState.agentInfo.agentType === 2 /* AUTONOMOUS */ && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: reasonBtn, DefaultComponent: ReasonBtn_default }) }),
|
|
7263
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: skillsBtn, DefaultComponent: SkillBtn_default }),
|
|
7264
|
-
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: knowledgeBtn, DefaultComponent: KnowledgeBtn_default }),
|
|
7265
7088
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
|
|
7266
7089
|
] }),
|
|
7267
7090
|
agentState.agentInfo.agentType === 2 /* AUTONOMOUS */ && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: modelSelect, DefaultComponent: ModelSelect_default }) })
|
|
@@ -7346,7 +7169,7 @@ var MonacoEditor = ({ value = "", onChange, placeholder, height = 200, readOnly
|
|
|
7346
7169
|
) });
|
|
7347
7170
|
};
|
|
7348
7171
|
var MonacoEditor_default = MonacoEditor;
|
|
7349
|
-
var { Text:
|
|
7172
|
+
var { Text: Text5 } = antd.Typography;
|
|
7350
7173
|
var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
7351
7174
|
const { token } = antd.theme.useToken();
|
|
7352
7175
|
const fileList = Array.isArray(value) ? value : value ? [value] : [];
|
|
@@ -7418,8 +7241,8 @@ var FormFileUpload = ({ value, onChange, multiple = false }) => {
|
|
|
7418
7241
|
}
|
|
7419
7242
|
),
|
|
7420
7243
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { overflow: "hidden", display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
7421
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7422
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7244
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text5, { ellipsis: true, style: { width: "100%", fontSize: 14, fontWeight: 500 }, children: file.name }),
|
|
7245
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Text5, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
7423
7246
|
(file.extension || common.getFileSuffixName(file.name)).toUpperCase(),
|
|
7424
7247
|
" \u2022 ",
|
|
7425
7248
|
formatFileSize(file.size)
|
|
@@ -8015,11 +7838,11 @@ function EventRow({ evt, selected, onSelect }) {
|
|
|
8015
7838
|
const { role, lane, preview } = eventSummary(evt);
|
|
8016
7839
|
const isError = evt.eventType === "run_failed" || evt.eventType === "step_error";
|
|
8017
7840
|
const time = tsToTime(evt);
|
|
8018
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
8019
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
7841
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames9__default.default(execution_trace_module_default.eventRow, { [execution_trace_module_default.eventRowSelected]: selected }), onClick: () => onSelect(evt), children: [
|
|
7842
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames9__default.default(execution_trace_module_default.eventLane, execution_trace_module_default[`lane_${lane}`]) }),
|
|
8020
7843
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: execution_trace_module_default.eventIcon, children: eventIcon(evt.eventType) }),
|
|
8021
7844
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { className: execution_trace_module_default.eventRole, color: ROLE_COLOR[role], children: roleLabel(role) }),
|
|
8022
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
7845
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames9__default.default(execution_trace_module_default.eventType, { [execution_trace_module_default.eventTypeError]: isError }), children: evt.eventType }),
|
|
8023
7846
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: execution_trace_module_default.eventPreview, title: preview, children: preview || " " }),
|
|
8024
7847
|
time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: execution_trace_module_default.eventTime, children: time })
|
|
8025
7848
|
] });
|
|
@@ -8068,8 +7891,8 @@ function ExecutionSection({
|
|
|
8068
7891
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: execution_trace_module_default.userMessageContent, children: /* @__PURE__ */ jsxRuntime.jsx(XMarkdown_default, { content: userInput.payloadJson?.event?.message || "" }) })
|
|
8069
7892
|
] }),
|
|
8070
7893
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: execution_trace_module_default.turnList, children: turns.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: execution_trace_module_default.turnSection, children: [
|
|
8071
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
8072
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
7894
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames9__default.default(execution_trace_module_default.turnHeader, group.kind !== "turn" && execution_trace_module_default.turnHeaderMuted), children: [
|
|
7895
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: classNames9__default.default(execution_trace_module_default.turnHeaderDot, group.kind !== "turn" && execution_trace_module_default.turnHeaderDotMuted) }),
|
|
8073
7896
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: execution_trace_module_default.turnTitle, children: group.kind === "turn" ? common.t(`${NS_CHAT_COPILOT}:turnLabel`, { index: group.turnIndex + 1, title: group.title }) : group.title }),
|
|
8074
7897
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: execution_trace_module_default.turnMeta, children: [
|
|
8075
7898
|
group.durationMs != null ? formatDuration(group.durationMs) : "",
|
|
@@ -8149,8 +7972,6 @@ var ExecutionTracePanel_default = ExecutionTracePanel;
|
|
|
8149
7972
|
// src/ui/layouts/components/styles.module.less
|
|
8150
7973
|
var styles_module_default5 = {
|
|
8151
7974
|
bodyWidth: "styles_module_bodyWidth",
|
|
8152
|
-
execModeBar: "styles_module_execModeBar",
|
|
8153
|
-
mainTabs: "styles_module_mainTabs",
|
|
8154
7975
|
inputContainer: "styles_module_inputContainer",
|
|
8155
7976
|
disclaimerNotice: "styles_module_disclaimerNotice",
|
|
8156
7977
|
previewHeader: "styles_module_previewHeader",
|
|
@@ -8160,42 +7981,13 @@ var styles_module_default5 = {
|
|
|
8160
7981
|
subAgentTitle: "styles_module_subAgentTitle",
|
|
8161
7982
|
subAgentMessages: "styles_module_subAgentMessages"
|
|
8162
7983
|
};
|
|
8163
|
-
var ExecModeSwitch = React10.memo(() => {
|
|
8164
|
-
const chatStore = useChatStore();
|
|
8165
|
-
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
8166
|
-
const configState = valtio.useSnapshot(chatStore.config);
|
|
8167
|
-
const conversationState = valtio.useSnapshot(chatStore.conversation);
|
|
8168
|
-
const activeId = conversationState.active.id;
|
|
8169
|
-
const messages = conversationState.messages[activeId]?.message;
|
|
8170
|
-
const hasAgentExec = React10.useMemo(() => (messages || []).some((m) => m.role === 2 && hasExecChain(m.content || [])), [messages]);
|
|
8171
|
-
const handleExecModeChange = React10.useCallback(
|
|
8172
|
-
(v) => {
|
|
8173
|
-
chatStore.setExecMode(v);
|
|
8174
|
-
},
|
|
8175
|
-
[chatStore]
|
|
8176
|
-
);
|
|
8177
|
-
if (!hasAgentExec) return null;
|
|
8178
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default5.execModeBar, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8179
|
-
antd.Segmented,
|
|
8180
|
-
{
|
|
8181
|
-
size: "small",
|
|
8182
|
-
value: configState.agentExecMode,
|
|
8183
|
-
onChange: handleExecModeChange,
|
|
8184
|
-
options: [
|
|
8185
|
-
{ label: t11("aggregate"), value: "aggregate" },
|
|
8186
|
-
{ label: t11("sequence"), value: "sequence" }
|
|
8187
|
-
]
|
|
8188
|
-
}
|
|
8189
|
-
) });
|
|
8190
|
-
});
|
|
8191
7984
|
var ChatContent = React10.memo(({ senderRef }) => {
|
|
8192
7985
|
const chatStore = useChatStore();
|
|
8193
7986
|
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
8194
7987
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
8195
7988
|
const agentState = valtio.useSnapshot(chatStore.agent);
|
|
8196
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className:
|
|
7989
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", vertical: true, gap: 24, className: classNames9__default.default(styles_module_default5.bodyWidth, "height-full"), children: [
|
|
8197
7990
|
common.shouldRender(agentState.agentInfo.userInput && agentState.agentInfo.userInput.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.userInput, DefaultComponent: UserInputPanel_default }),
|
|
8198
|
-
/* @__PURE__ */ jsxRuntime.jsx(ExecModeSwitch, {}),
|
|
8199
7991
|
common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
|
|
8200
7992
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderHeader, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(ChatSenderHeader_default, {}) }),
|
|
8201
7993
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: styles_module_default5.inputContainer, vertical: true, gap: 8, children: [
|
|
@@ -8212,7 +8004,7 @@ var ChatContent = React10.memo(({ senderRef }) => {
|
|
|
8212
8004
|
] });
|
|
8213
8005
|
});
|
|
8214
8006
|
var ChatMainPanel = React10.memo(
|
|
8215
|
-
React10.forwardRef(({
|
|
8007
|
+
React10.forwardRef(({ showDebugLog = false }, ref) => {
|
|
8216
8008
|
const chatStore = useChatStore();
|
|
8217
8009
|
const senderRef = React10.useRef(null);
|
|
8218
8010
|
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
@@ -8226,12 +8018,12 @@ var ChatMainPanel = React10.memo(
|
|
|
8226
8018
|
[]
|
|
8227
8019
|
);
|
|
8228
8020
|
const configState = valtio.useSnapshot(chatStore.config);
|
|
8229
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className:
|
|
8021
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full"), children: [
|
|
8230
8022
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
|
|
8231
|
-
|
|
8023
|
+
showDebugLog ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8232
8024
|
antd.Tabs,
|
|
8233
8025
|
{
|
|
8234
|
-
className:
|
|
8026
|
+
className: "full-tabs",
|
|
8235
8027
|
defaultActiveKey: "chat",
|
|
8236
8028
|
items: [
|
|
8237
8029
|
{ key: "chat", label: t11("chatTab"), children: /* @__PURE__ */ jsxRuntime.jsx(ChatContent, { senderRef }) },
|
|
@@ -8258,7 +8050,7 @@ var ChatPreviewPanel = React10.memo(({ file }) => {
|
|
|
8258
8050
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8259
8051
|
file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
8260
8052
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default5.previewHeader, children: [
|
|
8261
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
8053
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames9__default.default(styles_module_default5.previewHeaderTitle, "text-ellipsis"), title: file.fileName, children: file.fileName }),
|
|
8262
8054
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
|
|
8263
8055
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8264
8056
|
antd.Button,
|
|
@@ -8296,7 +8088,7 @@ var ChatPreviewPanel = React10.memo(({ file }) => {
|
|
|
8296
8088
|
] });
|
|
8297
8089
|
});
|
|
8298
8090
|
var ChatPreviewPanel_default = ChatPreviewPanel;
|
|
8299
|
-
var { Text:
|
|
8091
|
+
var { Text: Text6 } = antd.Typography;
|
|
8300
8092
|
function roleForMessage(role) {
|
|
8301
8093
|
if (role === 1) {
|
|
8302
8094
|
return { user: "user", role: 1, placement: "end" };
|
|
@@ -8355,7 +8147,7 @@ var ChatSubAgentPanel = React10.memo(() => {
|
|
|
8355
8147
|
const subAgentName = active.agentName || active.toolName || t11("subAgentExecutionDetail");
|
|
8356
8148
|
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
|
|
8357
8149
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", justify: "space-between", gap: 8, className: styles_module_default5.subAgentHeader, children: [
|
|
8358
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8150
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text6, { strong: true, className: styles_module_default5.subAgentTitle, title: subAgentName, children: subAgentName }),
|
|
8359
8151
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8360
8152
|
antd.Button,
|
|
8361
8153
|
{
|
|
@@ -8367,7 +8159,7 @@ var ChatSubAgentPanel = React10.memo(() => {
|
|
|
8367
8159
|
}
|
|
8368
8160
|
)
|
|
8369
8161
|
] }),
|
|
8370
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
8162
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames9__default.default("full-scroll", styles_module_default5.subAgentMessages), children: loading ? /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", style: { height: 120 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: "small" }) }) : /* @__PURE__ */ jsxRuntime.jsx(xV2.Bubble.List, { ref: listRef, autoScroll: false, items, onScroll: handleScroll, className: "height-full" }) })
|
|
8371
8163
|
] });
|
|
8372
8164
|
});
|
|
8373
8165
|
var ChatSubAgentPanel_default = ChatSubAgentPanel;
|
|
@@ -8379,17 +8171,7 @@ var index_module_default3 = {
|
|
|
8379
8171
|
hideSplitterBar: "index_module_hideSplitterBar",
|
|
8380
8172
|
rightTabs: "index_module_rightTabs"
|
|
8381
8173
|
};
|
|
8382
|
-
|
|
8383
|
-
try {
|
|
8384
|
-
return new URLSearchParams(target.location.search).get("mode") === "debug";
|
|
8385
|
-
} catch {
|
|
8386
|
-
return false;
|
|
8387
|
-
}
|
|
8388
|
-
}
|
|
8389
|
-
function resolveDebugMode() {
|
|
8390
|
-
return readModeDebug(window) || window.top !== window && readModeDebug(window.top);
|
|
8391
|
-
}
|
|
8392
|
-
var layouts_default = React10.forwardRef(({ theme: theme4, params, hooks, layout, config, services }, _ref) => {
|
|
8174
|
+
var layouts_default = React10.forwardRef(({ theme: theme3, params, hooks, layout, config, services }, _ref) => {
|
|
8393
8175
|
const { t: t11 } = common.useTranslation(NS_CHAT_COPILOT);
|
|
8394
8176
|
const chatStore = React10.useMemo(() => createChatStore(), []);
|
|
8395
8177
|
const senderRef = React10.useRef(null);
|
|
@@ -8444,7 +8226,7 @@ var layouts_default = React10.forwardRef(({ theme: theme4, params, hooks, layout
|
|
|
8444
8226
|
const hasPreView = React10.useMemo(() => {
|
|
8445
8227
|
return common.shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
|
|
8446
8228
|
}, [configState.layout.preview, configState.preview.file]);
|
|
8447
|
-
const
|
|
8229
|
+
const showDebugLog = !!config.showDebugLog;
|
|
8448
8230
|
const hasSubAgentPanel = !!subAgentState.active;
|
|
8449
8231
|
const subAgentTrigger = subAgentState.active?.toolCallId ?? subAgentState.active?.toolName ?? subAgentState.active?.subConversationId;
|
|
8450
8232
|
const previewTrigger = configState.preview.file?.fileUrl || configState.preview.file?.content;
|
|
@@ -8513,7 +8295,7 @@ var layouts_default = React10.forwardRef(({ theme: theme4, params, hooks, layout
|
|
|
8513
8295
|
React10.useEffect(() => {
|
|
8514
8296
|
hooks?.onBeforeInit?.();
|
|
8515
8297
|
}, []);
|
|
8516
|
-
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...
|
|
8298
|
+
return /* @__PURE__ */ jsxRuntime.jsx(xV2.XProvider, { theme: { cssVar: {}, ...theme3 }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: configState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default(index_module_default3.chatLayout, "zero-chat-layout", "height-full"), children: [
|
|
8517
8299
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
|
|
8518
8300
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { ref: containerRef, className: "full-scroll", children: [
|
|
8519
8301
|
/* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
|
|
@@ -8521,14 +8303,14 @@ var layouts_default = React10.forwardRef(({ theme: theme4, params, hooks, layout
|
|
|
8521
8303
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8522
8304
|
antd.Splitter,
|
|
8523
8305
|
{
|
|
8524
|
-
className:
|
|
8306
|
+
className: classNames9__default.default("flex-1", index_module_default3.animatedSplitter, { [index_module_default3.hideSplitterBar]: !hasRightPanel }),
|
|
8525
8307
|
onResize: (p) => setSizes(p),
|
|
8526
8308
|
children: [
|
|
8527
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef,
|
|
8309
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[0], children: /* @__PURE__ */ jsxRuntime.jsx(ChatMainPanel_default, { ref: senderRef, showDebugLog }) }),
|
|
8528
8310
|
hasRightPanel && /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 360, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8529
8311
|
antd.Tabs,
|
|
8530
8312
|
{
|
|
8531
|
-
className:
|
|
8313
|
+
className: classNames9__default.default("height-full", index_module_default3.rightTabs),
|
|
8532
8314
|
activeKey: effectiveRightTab,
|
|
8533
8315
|
onChange: (k) => setActiveRightTab(k),
|
|
8534
8316
|
tabBarStyle: { marginBottom: 0 },
|