@ai-group/chat-sdk 3.7.1-alpha3 → 3.7.1-alpha5

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.
Files changed (82) hide show
  1. package/dist/cjs/components/FileGallery/styles.js +21 -1
  2. package/dist/cjs/components/FileGallery/styles.js.map +2 -2
  3. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/index.d.ts +9 -1
  4. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/index.js +102 -22
  5. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/index.js.map +2 -2
  6. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/styles.d.ts +3 -0
  7. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/styles.js +39 -0
  8. package/dist/cjs/components/XAdkChatbot/components/MarkdownRender/styles.js.map +2 -2
  9. package/dist/cjs/components/XAdkChatbot/index.js +42 -5
  10. package/dist/cjs/components/XAdkChatbot/index.js.map +2 -2
  11. package/dist/cjs/components/XAdkChatbot/styles.js +1 -1
  12. package/dist/cjs/components/XAdkChatbot/styles.js.map +1 -1
  13. package/dist/cjs/components/XAdkSender/InlineTagInput.d.ts +11 -5
  14. package/dist/cjs/components/XAdkSender/InlineTagInput.js +119 -77
  15. package/dist/cjs/components/XAdkSender/InlineTagInput.js.map +2 -2
  16. package/dist/cjs/components/XAdkSender/InputTags.d.ts +2 -2
  17. package/dist/cjs/components/XAdkSender/InputTags.js +8 -8
  18. package/dist/cjs/components/XAdkSender/InputTags.js.map +2 -2
  19. package/dist/cjs/components/XAdkSender/index.js +73 -45
  20. package/dist/cjs/components/XAdkSender/index.js.map +2 -2
  21. package/dist/cjs/index.d.ts +2 -1
  22. package/dist/cjs/index.js +7 -0
  23. package/dist/cjs/index.js.map +2 -2
  24. package/dist/cjs/presets/xgroup/preset.js +2 -1
  25. package/dist/cjs/presets/xgroup/preset.js.map +2 -2
  26. package/dist/cjs/presets/xgroup/strategies.d.ts +5 -1
  27. package/dist/cjs/presets/xgroup/strategies.js +16 -1
  28. package/dist/cjs/presets/xgroup/strategies.js.map +3 -3
  29. package/dist/cjs/types/ChatStrategies.d.ts +5 -0
  30. package/dist/cjs/types/ChatStrategies.js.map +1 -1
  31. package/dist/cjs/types/XAdkChatbot.d.ts +15 -0
  32. package/dist/cjs/types/XAdkChatbot.js.map +1 -1
  33. package/dist/cjs/types/XAdkSender.d.ts +62 -24
  34. package/dist/cjs/types/XAdkSender.js.map +1 -1
  35. package/dist/cjs/utils/index.d.ts +1 -0
  36. package/dist/cjs/utils/index.js +3 -1
  37. package/dist/cjs/utils/index.js.map +2 -2
  38. package/dist/cjs/utils/markdownResource.d.ts +11 -0
  39. package/dist/cjs/utils/markdownResource.js +79 -0
  40. package/dist/cjs/utils/markdownResource.js.map +7 -0
  41. package/dist/esm/components/FileGallery/styles.js +2 -2
  42. package/dist/esm/components/FileGallery/styles.js.map +1 -1
  43. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/index.d.ts +9 -1
  44. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/index.js +64 -7
  45. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/index.js.map +1 -1
  46. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/styles.d.ts +3 -0
  47. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/styles.js +5 -2
  48. package/dist/esm/components/XAdkChatbot/components/MarkdownRender/styles.js.map +1 -1
  49. package/dist/esm/components/XAdkChatbot/index.js +25 -6
  50. package/dist/esm/components/XAdkChatbot/index.js.map +1 -1
  51. package/dist/esm/components/XAdkChatbot/styles.js +1 -1
  52. package/dist/esm/components/XAdkChatbot/styles.js.map +1 -1
  53. package/dist/esm/components/XAdkSender/InlineTagInput.d.ts +11 -5
  54. package/dist/esm/components/XAdkSender/InlineTagInput.js +125 -97
  55. package/dist/esm/components/XAdkSender/InlineTagInput.js.map +1 -1
  56. package/dist/esm/components/XAdkSender/InputTags.d.ts +2 -2
  57. package/dist/esm/components/XAdkSender/InputTags.js +9 -9
  58. package/dist/esm/components/XAdkSender/InputTags.js.map +1 -1
  59. package/dist/esm/components/XAdkSender/index.js +97 -71
  60. package/dist/esm/components/XAdkSender/index.js.map +1 -1
  61. package/dist/esm/index.d.ts +2 -1
  62. package/dist/esm/index.js +2 -1
  63. package/dist/esm/index.js.map +1 -1
  64. package/dist/esm/presets/xgroup/preset.js +3 -2
  65. package/dist/esm/presets/xgroup/preset.js.map +1 -1
  66. package/dist/esm/presets/xgroup/strategies.d.ts +5 -1
  67. package/dist/esm/presets/xgroup/strategies.js +12 -1
  68. package/dist/esm/presets/xgroup/strategies.js.map +1 -1
  69. package/dist/esm/types/ChatStrategies.d.ts +5 -0
  70. package/dist/esm/types/ChatStrategies.js.map +1 -1
  71. package/dist/esm/types/XAdkChatbot.d.ts +15 -0
  72. package/dist/esm/types/XAdkChatbot.js.map +1 -1
  73. package/dist/esm/types/XAdkSender.d.ts +62 -24
  74. package/dist/esm/types/XAdkSender.js.map +1 -1
  75. package/dist/esm/utils/index.d.ts +1 -0
  76. package/dist/esm/utils/index.js +1 -0
  77. package/dist/esm/utils/index.js.map +1 -1
  78. package/dist/esm/utils/markdownResource.d.ts +11 -0
  79. package/dist/esm/utils/markdownResource.js +36 -0
  80. package/dist/esm/utils/markdownResource.js.map +1 -0
  81. package/dist/umd/chat-sdk.min.js +1 -1
  82. package/package.json +1 -1
@@ -59,14 +59,20 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
59
59
  quickKeys = _ref$quickKeys === void 0 ? [] : _ref$quickKeys,
60
60
  _ref$inlineTags = _ref.inlineTags,
61
61
  inlineTags = _ref$inlineTags === void 0 ? false : _ref$inlineTags,
62
+ renderMention = _ref.renderMention,
62
63
  renderTag = _ref.renderTag,
64
+ controlledMentions = _ref.mentions,
63
65
  controlledTags = _ref.tags,
66
+ defaultMentions = _ref.defaultMentions,
64
67
  _ref$defaultTags = _ref.defaultTags,
65
68
  defaultTags = _ref$defaultTags === void 0 ? [] : _ref$defaultTags,
69
+ defaultInputParts = _ref.defaultInputParts,
70
+ onMentionsChange = _ref.onMentionsChange,
66
71
  onTagsChange = _ref.onTagsChange,
67
72
  onQuickKeyTrigger = _ref.onQuickKeyTrigger,
68
73
  _ref$submitFormat = _ref.submitFormat,
69
74
  submitFormat = _ref$submitFormat === void 0 ? "text" : _ref$submitFormat,
75
+ formatMention = _ref.formatMention,
70
76
  formatTag = _ref.formatTag,
71
77
  transformSubmitData = _ref.transformSubmitData;
72
78
  var styles = useStyles();
@@ -83,18 +89,21 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
83
89
  onChange === null || onChange === void 0 || onChange(newValue);
84
90
  };
85
91
 
86
- // tags 支持受控/非受控两种模式;inlineTags 打开时会和输入内容混排。
87
- var isTagsControlled = controlledTags !== undefined;
88
- var _useState3 = useState(defaultTags),
92
+ // mentions 支持受控/非受控两种模式;inlineTags 打开时会和输入内容混排。
93
+ var resolvedControlledMentions = controlledMentions !== null && controlledMentions !== void 0 ? controlledMentions : controlledTags;
94
+ var initialMentions = defaultMentions !== null && defaultMentions !== void 0 ? defaultMentions : defaultTags;
95
+ var isMentionsControlled = resolvedControlledMentions !== undefined;
96
+ var _useState3 = useState(initialMentions),
89
97
  _useState4 = _slicedToArray(_useState3, 2),
90
- internalTags = _useState4[0],
91
- setInternalTags = _useState4[1];
92
- var tags = isTagsControlled ? controlledTags : internalTags;
93
- var setTags = function setTags(newTags) {
94
- if (!isTagsControlled) {
95
- setInternalTags(newTags);
98
+ internalMentions = _useState4[0],
99
+ setInternalMentions = _useState4[1];
100
+ var mentions = isMentionsControlled ? resolvedControlledMentions : internalMentions;
101
+ var setMentions = function setMentions(newMentions) {
102
+ if (!isMentionsControlled) {
103
+ setInternalMentions(newMentions);
96
104
  }
97
- onTagsChange === null || onTagsChange === void 0 || onTagsChange(newTags);
105
+ onMentionsChange === null || onMentionsChange === void 0 || onMentionsChange(newMentions);
106
+ onTagsChange === null || onTagsChange === void 0 || onTagsChange(newMentions);
98
107
  };
99
108
  var _useState5 = useState([]),
100
109
  _useState6 = _slicedToArray(_useState5, 2),
@@ -143,26 +152,30 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
143
152
  var escapeMarkdownLabel = function escapeMarkdownLabel(text) {
144
153
  return text.replace(/\\/g, "\\\\").replace(/\]/g, "\\]");
145
154
  };
146
- var getTagSubmitValue = function getTagSubmitValue(tag) {
147
- var _ref3, _ref4, _ref5, _tag$value, _tag$data, _tag$data2;
148
- return String((_ref3 = (_ref4 = (_ref5 = (_tag$value = tag.value) !== null && _tag$value !== void 0 ? _tag$value : (_tag$data = tag.data) === null || _tag$data === void 0 ? void 0 : _tag$data.value) !== null && _ref5 !== void 0 ? _ref5 : (_tag$data2 = tag.data) === null || _tag$data2 === void 0 ? void 0 : _tag$data2.name) !== null && _ref4 !== void 0 ? _ref4 : tag.label) !== null && _ref3 !== void 0 ? _ref3 : "");
155
+ var getMentionSubmitValue = function getMentionSubmitValue(mention) {
156
+ var _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _mention$value, _mention$data, _mention$data2, _mention$data3;
157
+ return String((_ref3 = (_ref4 = (_ref5 = (_ref6 = (_ref7 = (_ref8 = (_ref9 = (_mention$value = mention.value) !== null && _mention$value !== void 0 ? _mention$value : mention.uri) !== null && _ref9 !== void 0 ? _ref9 : (_mention$data = mention.data) === null || _mention$data === void 0 ? void 0 : _mention$data.uri) !== null && _ref8 !== void 0 ? _ref8 : (_mention$data2 = mention.data) === null || _mention$data2 === void 0 ? void 0 : _mention$data2.value) !== null && _ref7 !== void 0 ? _ref7 : (_mention$data3 = mention.data) === null || _mention$data3 === void 0 ? void 0 : _mention$data3.name) !== null && _ref6 !== void 0 ? _ref6 : mention.targetId) !== null && _ref5 !== void 0 ? _ref5 : mention.displayName) !== null && _ref4 !== void 0 ? _ref4 : mention.label) !== null && _ref3 !== void 0 ? _ref3 : "");
149
158
  };
150
- var defaultFormatTag = function defaultFormatTag(tag, format, index) {
151
- var value = getTagSubmitValue(tag);
159
+ var defaultFormatMention = function defaultFormatMention(mention, format, index) {
160
+ var value = getMentionSubmitValue(mention);
152
161
  if (format === "xml") {
153
- return "<tag type=\"".concat(escapeXml(tag.type), "\" id=\"").concat(escapeXml(tag.id), "\" label=\"").concat(escapeXml(tag.label), "\" value=\"").concat(escapeXml(value), "\" />");
162
+ return "<mention type=\"".concat(escapeXml(mention.type), "\" id=\"").concat(escapeXml(mention.id), "\" label=\"").concat(escapeXml(mention.label), "\" value=\"").concat(escapeXml(value), "\" />");
154
163
  }
155
164
  if (format === "markdown") {
156
- return "[/".concat(escapeMarkdownLabel(tag.label), "](xadk-tag://").concat(encodeURIComponent(tag.type), "/").concat(encodeURIComponent(tag.id), ")");
165
+ var href = mention.uri || (value.includes("://") ? value : "xadk-mention://".concat(encodeURIComponent(mention.type), "/").concat(encodeURIComponent(mention.id)));
166
+ return "[@".concat(escapeMarkdownLabel(mention.displayName || mention.label), "](").concat(href, ")");
157
167
  }
158
- return "/".concat(value || "tag-".concat(index + 1));
168
+ return "@".concat(mention.displayName || value || "mention-".concat(index + 1));
159
169
  };
160
- var serializeTag = function serializeTag(tag, format, index) {
161
- var _formatTag;
162
- return (_formatTag = formatTag === null || formatTag === void 0 ? void 0 : formatTag(tag, {
170
+ var serializeMention = function serializeMention(mention, format, index) {
171
+ var _ref10, _formatMention;
172
+ return (_ref10 = (_formatMention = formatMention === null || formatMention === void 0 ? void 0 : formatMention(mention, {
163
173
  format: format,
164
174
  index: index
165
- })) !== null && _formatTag !== void 0 ? _formatTag : defaultFormatTag(tag, format, index);
175
+ })) !== null && _formatMention !== void 0 ? _formatMention : formatTag === null || formatTag === void 0 ? void 0 : formatTag(mention, {
176
+ format: format,
177
+ index: index
178
+ })) !== null && _ref10 !== void 0 ? _ref10 : defaultFormatMention(mention, format, index);
166
179
  };
167
180
  var getSubmitParts = useCallback(function () {
168
181
  if (inlineTags) {
@@ -174,14 +187,14 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
174
187
  type: "text",
175
188
  text: value
176
189
  }] : [];
177
- var tagParts = tags.map(function (tag) {
190
+ var mentionParts = mentions.map(function (mention) {
178
191
  return {
179
- type: "tag",
180
- tag: tag
192
+ type: "mention",
193
+ mention: mention
181
194
  };
182
195
  });
183
- return [].concat(_toConsumableArray(tagParts), textParts);
184
- }, [inlineTags, tags, value]);
196
+ return [].concat(_toConsumableArray(mentionParts), textParts);
197
+ }, [inlineTags, mentions, value]);
185
198
  var serializeParts = function serializeParts(parts, format) {
186
199
  if (format === "structured") {
187
200
  return parts.reduce(function (content, part) {
@@ -191,7 +204,7 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
191
204
  var tagIndex = 0;
192
205
  return parts.map(function (part) {
193
206
  if (part.type === "text") return part.text;
194
- var result = serializeTag(part.tag, format, tagIndex);
207
+ var result = serializeMention(part.mention, format, tagIndex);
195
208
  tagIndex += 1;
196
209
  return result;
197
210
  }).join("");
@@ -207,7 +220,8 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
207
220
  format: submitFormat,
208
221
  parts: parts,
209
222
  files: formattedFiles,
210
- tags: tags
223
+ mentions: mentions,
224
+ tags: mentions
211
225
  };
212
226
  return _objectSpread(_objectSpread({}, standardData), {}, {
213
227
  payload: transformSubmitData === null || transformSubmitData === void 0 ? void 0 : transformSubmitData(standardData)
@@ -242,8 +256,8 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
242
256
  };
243
257
 
244
258
  // 内置校验器集合
245
- var builtInValidators = [function (_file, _ref6) {
246
- var files = _ref6.files;
259
+ var builtInValidators = [function (_file, _ref11) {
260
+ var files = _ref11.files;
247
261
  if (files.length >= maxFiles) {
248
262
  return "\u6700\u591A\u53EA\u80FD\u4E0A\u4F20 ".concat(maxFiles, " \u4E2A\u6587\u4EF6");
249
263
  }
@@ -259,8 +273,8 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
259
273
  return "不支持的文件类型";
260
274
  }
261
275
  return null;
262
- }, function (file, _ref7) {
263
- var files = _ref7.files;
276
+ }, function (file, _ref12) {
277
+ var files = _ref12.files;
264
278
  if (isDuplicateFile(file, files)) {
265
279
  return "文件已存在";
266
280
  }
@@ -337,20 +351,28 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
337
351
  addFiles: function addFiles(rawFiles) {
338
352
  handleFileSelect(rawFiles);
339
353
  },
340
- insertTag: function insertTag(tag) {
354
+ insertMention: function insertMention(mention) {
341
355
  if (inlineTags) {
342
356
  var _inlineInputRef$curre2;
343
- (_inlineInputRef$curre2 = inlineInputRef.current) === null || _inlineInputRef$curre2 === void 0 || _inlineInputRef$curre2.insertTag(tag);
357
+ (_inlineInputRef$curre2 = inlineInputRef.current) === null || _inlineInputRef$curre2 === void 0 || _inlineInputRef$curre2.insertMention(mention);
358
+ return;
359
+ }
360
+ setMentions([].concat(_toConsumableArray(mentions), [mention]));
361
+ },
362
+ insertTag: function insertTag(mention) {
363
+ if (inlineTags) {
364
+ var _inlineInputRef$curre3;
365
+ (_inlineInputRef$curre3 = inlineInputRef.current) === null || _inlineInputRef$curre3 === void 0 || _inlineInputRef$curre3.insertMention(mention);
344
366
  return;
345
367
  }
346
- setTags([].concat(_toConsumableArray(tags), [tag]));
368
+ setMentions([].concat(_toConsumableArray(mentions), [mention]));
347
369
  },
348
370
  focus: function focus() {
349
- var _inlineInputRef$curre3, _textareaRef$current;
350
- inlineTags ? (_inlineInputRef$curre3 = inlineInputRef.current) === null || _inlineInputRef$curre3 === void 0 ? void 0 : _inlineInputRef$curre3.focus() : (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.focus();
371
+ var _inlineInputRef$curre4, _textareaRef$current;
372
+ inlineTags ? (_inlineInputRef$curre4 = inlineInputRef.current) === null || _inlineInputRef$curre4 === void 0 ? void 0 : _inlineInputRef$curre4.focus() : (_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.focus();
351
373
  }
352
374
  };
353
- }, [handleFileSelect, inlineTags, setTags, tags]);
375
+ }, [handleFileSelect, inlineTags, setMentions, mentions]);
354
376
 
355
377
  // 触发文件选择
356
378
  var triggerFileSelect = function triggerFileSelect() {
@@ -361,7 +383,7 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
361
383
 
362
384
  // 上传文件
363
385
  var uploadFiles = /*#__PURE__*/function () {
364
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fileList) {
386
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fileList) {
365
387
  var _iterator2, _step2, _loop;
366
388
  return _regeneratorRuntime().wrap(function _callee$(_context2) {
367
389
  while (1) switch (_context2.prev = _context2.next) {
@@ -476,7 +498,7 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
476
498
  }, _callee, null, [[1, 10, 13, 16]]);
477
499
  }));
478
500
  return function uploadFiles(_x) {
479
- return _ref8.apply(this, arguments);
501
+ return _ref13.apply(this, arguments);
480
502
  };
481
503
  }();
482
504
 
@@ -516,11 +538,11 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
516
538
  }, [allowUpload, handleFileSelect]);
517
539
 
518
540
  // 删除标签
519
- var handleRemoveTag = useCallback(function (id) {
520
- setTags(tags.filter(function (t) {
521
- return t.id !== id;
541
+ var handleRemoveMention = useCallback(function (id) {
542
+ setMentions(mentions.filter(function (item) {
543
+ return item.id !== id;
522
544
  }));
523
- }, [tags, setTags]);
545
+ }, [mentions, setMentions]);
524
546
 
525
547
  // 查找当前活跃的快捷键配置
526
548
  var activeQuickKeyConfig = useMemo(function () {
@@ -586,28 +608,31 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
586
608
  }
587
609
  }, [activeQuickKey, onQuickKeyTrigger, quickKeyTriggerIdx, quickKeys]);
588
610
 
589
- // 选择快捷项后转成结构化 tag;inline 模式会替换掉触发字符和关键词。
611
+ // 选择快捷项后转成结构化 Mention;inline 模式会替换掉触发字符和关键词。
590
612
  var handleQuickKeySelect = useCallback(function (option) {
591
- var _ref9, _option$value, _activeQuickKeyConfig, _inlineInputRef$curre5, _textareaRef$current2;
592
- var tagType = (activeQuickKeyConfig === null || activeQuickKeyConfig === void 0 ? void 0 : activeQuickKeyConfig.tagType) || activeQuickKey || "unknown";
593
- var newTag = {
613
+ var _ref14, _ref15, _option$value, _ref16, _option$targetId, _option$displayName, _activeQuickKeyConfig, _inlineInputRef$curre6, _textareaRef$current2;
614
+ var mentionType = (activeQuickKeyConfig === null || activeQuickKeyConfig === void 0 ? void 0 : activeQuickKeyConfig.mentionType) || (activeQuickKeyConfig === null || activeQuickKeyConfig === void 0 ? void 0 : activeQuickKeyConfig.tagType) || activeQuickKey || "unknown";
615
+ var newMention = {
594
616
  id: generateId(),
595
617
  label: option.label,
596
- type: tagType,
597
- value: (_ref9 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.name) !== null && _ref9 !== void 0 ? _ref9 : option.label,
618
+ type: mentionType,
619
+ value: (_ref14 = (_ref15 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.uri) !== null && _ref15 !== void 0 ? _ref15 : option.name) !== null && _ref14 !== void 0 ? _ref14 : option.label,
620
+ uri: option.uri,
621
+ targetId: (_ref16 = (_option$targetId = option.targetId) !== null && _option$targetId !== void 0 ? _option$targetId : option.skillNo) !== null && _ref16 !== void 0 ? _ref16 : option.pluginNo,
622
+ displayName: (_option$displayName = option.displayName) !== null && _option$displayName !== void 0 ? _option$displayName : option.label,
598
623
  trigger: activeQuickKey || undefined,
599
624
  icon: option.icon,
600
625
  data: option
601
626
  };
602
627
  activeQuickKeyConfig === null || activeQuickKeyConfig === void 0 || (_activeQuickKeyConfig = activeQuickKeyConfig.onSelect) === null || _activeQuickKeyConfig === void 0 || _activeQuickKeyConfig.call(activeQuickKeyConfig, option);
603
628
  if (inlineTags) {
604
- var _inlineInputRef$curre4;
605
- (_inlineInputRef$curre4 = inlineInputRef.current) === null || _inlineInputRef$curre4 === void 0 || _inlineInputRef$curre4.insertTag(newTag, {
629
+ var _inlineInputRef$curre5;
630
+ (_inlineInputRef$curre5 = inlineInputRef.current) === null || _inlineInputRef$curre5 === void 0 || _inlineInputRef$curre5.insertMention(newMention, {
606
631
  start: quickKeyTriggerIdx,
607
632
  end: quickKeyTriggerIdx + 1 + quickKeyKeyword.length
608
633
  });
609
634
  } else {
610
- setTags([].concat(_toConsumableArray(tags), [newTag]));
635
+ setMentions([].concat(_toConsumableArray(mentions), [newMention]));
611
636
 
612
637
  // 从输入框中删除快捷键字符和关键词
613
638
  if (quickKeyTriggerIdx >= 0) {
@@ -619,8 +644,8 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
619
644
  setQuickKeyKeyword("");
620
645
  setQuickKeyTriggerIdx(-1);
621
646
  setQuickKeyActiveIndex(0);
622
- inlineTags ? (_inlineInputRef$curre5 = inlineInputRef.current) === null || _inlineInputRef$curre5 === void 0 ? void 0 : _inlineInputRef$curre5.focus() : (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.focus();
623
- }, [activeQuickKey, activeQuickKeyConfig, inlineTags, tags, setTags, value, quickKeyTriggerIdx, quickKeyKeyword, setValue]);
647
+ inlineTags ? (_inlineInputRef$curre6 = inlineInputRef.current) === null || _inlineInputRef$curre6 === void 0 ? void 0 : _inlineInputRef$curre6.focus() : (_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.focus();
648
+ }, [activeQuickKey, activeQuickKeyConfig, inlineTags, mentions, setMentions, value, quickKeyTriggerIdx, quickKeyKeyword, setValue]);
624
649
 
625
650
  // 处理输入框变化(含快捷键检测)
626
651
  var handleInputChange = function handleInputChange(e) {
@@ -631,10 +656,10 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
631
656
  detectQuickKey(newValue, e.target.selectionStart || 0);
632
657
  };
633
658
  var handleInlineInputChange = function handleInlineInputChange(newValue) {
634
- var _inlineInputRef$curre6;
659
+ var _inlineInputRef$curre7;
635
660
  setValue(newValue);
636
661
  // contenteditable 的 selection 不一定和 React state 同步,需实时读取内部光标 offset。
637
- detectQuickKey(newValue, ((_inlineInputRef$curre6 = inlineInputRef.current) === null || _inlineInputRef$curre6 === void 0 ? void 0 : _inlineInputRef$curre6.getCursorOffset()) || newValue.length);
662
+ detectQuickKey(newValue, ((_inlineInputRef$curre7 = inlineInputRef.current) === null || _inlineInputRef$curre7 === void 0 ? void 0 : _inlineInputRef$curre7.getCursorOffset()) || newValue.length);
638
663
  };
639
664
  var handleQuickKeyByText = function handleQuickKeyByText(text, cursorPos) {
640
665
  var quickKeyChars = quickKeys.map(function (qk) {
@@ -669,17 +694,17 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
669
694
  handleQuickKeyByText(target.value || "", target.selectionStart || 0);
670
695
  };
671
696
  var handleInlineKeyUp = function handleInlineKeyUp(e) {
672
- var _inlineInputRef$curre7, _inlineInputRef$curre8;
697
+ var _inlineInputRef$curre8, _inlineInputRef$curre9;
673
698
  if (activeQuickKey && isQuickListControlKey(e.key)) return;
674
699
  // inline 输入区不是 textarea,不能读 event.target.value,只能从 ref 取纯文本。
675
- var text = ((_inlineInputRef$curre7 = inlineInputRef.current) === null || _inlineInputRef$curre7 === void 0 ? void 0 : _inlineInputRef$curre7.getText()) || "";
676
- var cursorPos = ((_inlineInputRef$curre8 = inlineInputRef.current) === null || _inlineInputRef$curre8 === void 0 ? void 0 : _inlineInputRef$curre8.getCursorOffset()) || text.length;
700
+ var text = ((_inlineInputRef$curre8 = inlineInputRef.current) === null || _inlineInputRef$curre8 === void 0 ? void 0 : _inlineInputRef$curre8.getText()) || "";
701
+ var cursorPos = ((_inlineInputRef$curre9 = inlineInputRef.current) === null || _inlineInputRef$curre9 === void 0 ? void 0 : _inlineInputRef$curre9.getCursorOffset()) || text.length;
677
702
  handleQuickKeyByText(text, cursorPos);
678
703
  };
679
704
 
680
705
  // 处理提交
681
706
  var handleSubmit = function handleSubmit() {
682
- if (!value.trim() && files.length === 0 && tags.length === 0) {
707
+ if (!value.trim() && files.length === 0 && mentions.length === 0) {
683
708
  message.warning("请输入消息或选择文件");
684
709
  return;
685
710
  }
@@ -701,7 +726,7 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
701
726
  onSubmit(createSubmitData(formattedFiles));
702
727
  }
703
728
  setValue("");
704
- setTags([]);
729
+ setMentions([]);
705
730
  setFiles(function (prev) {
706
731
  return prev.filter(function (f) {
707
732
  return f.status !== "success";
@@ -718,7 +743,7 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
718
743
  onSubmit(createSubmitData(formattedFiles));
719
744
  }
720
745
  setValue("");
721
- setTags([]);
746
+ setMentions([]);
722
747
  setFiles(function (prev) {
723
748
  return prev.filter(function (f) {
724
749
  return f.status !== "success";
@@ -807,8 +832,8 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
807
832
  var hasFiles = files.some(function (f) {
808
833
  return f.status === "success";
809
834
  });
810
- var hasTags = tags.length > 0;
811
- var canSend = hasContent || hasFiles || hasTags;
835
+ var hasMentions = mentions.length > 0;
836
+ var canSend = hasContent || hasFiles || hasMentions;
812
837
 
813
838
  // 定义按钮组件
814
839
  var SendButton = function SendButton(props) {
@@ -951,21 +976,22 @@ var XAdkSender = /*#__PURE__*/forwardRef(function (_ref, ref) {
951
976
  children: headerNode
952
977
  }), fileListNode]
953
978
  }), !inlineTags && /*#__PURE__*/_jsx(InputTags, {
954
- tags: tags,
955
- onRemove: handleRemoveTag
979
+ mentions: mentions,
980
+ onRemove: handleRemoveMention
956
981
  }), /*#__PURE__*/_jsxs("div", {
957
982
  className: styles.inputAndButtons,
958
983
  children: [renderSlot(prefix, false), inlineTags ? /*#__PURE__*/_jsx(InlineTagInput, {
959
984
  ref: inlineInputRef,
960
985
  value: value,
961
- tags: tags,
986
+ mentions: mentions,
987
+ defaultInputParts: defaultInputParts,
962
988
  placeholder: placeholder,
963
989
  disabled: isDisabled,
964
990
  onChange: handleInlineInputChange,
965
- onTagsChange: setTags,
991
+ onMentionsChange: setMentions,
966
992
  onKeyDown: handleKeyDown,
967
993
  onKeyUp: handleInlineKeyUp,
968
- renderTag: renderTag
994
+ renderMention: renderMention !== null && renderMention !== void 0 ? renderMention : renderTag
969
995
  }) : /*#__PURE__*/_jsx("div", {
970
996
  className: styles.textAreaWrapper,
971
997
  children: /*#__PURE__*/_jsx(Input.TextArea, {