@myun/gimi-chat 0.9.45 → 0.9.46

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 (52) hide show
  1. package/dist/apis/useApi.d.ts +6 -0
  2. package/dist/apis/useApi.js +45 -1
  3. package/dist/components/ai-chat-dialogue/index copy.js +1 -1
  4. package/dist/components/ai-chat-dialogue/index.js +4 -2
  5. package/dist/components/answer-item/component/artifacts/index.d.ts +13 -0
  6. package/dist/components/answer-item/component/artifacts/index.js +52 -0
  7. package/dist/components/answer-item/component/artifacts/index.module.css +24 -0
  8. package/dist/components/answer-item/component/tool-list/index.d.ts +7 -0
  9. package/dist/components/answer-item/component/tool-list/index.js +97 -0
  10. package/dist/components/answer-item/component/tool-list/index.module.css +92 -0
  11. package/dist/components/answer-item/index.d.ts +2 -1
  12. package/dist/components/answer-item/index.js +160 -7
  13. package/dist/components/answer-item/index.module.css +24 -0
  14. package/dist/components/ask-card/index.d.ts +1 -1
  15. package/dist/components/chat-input/extension/index.d.ts +1 -0
  16. package/dist/components/chat-input/extension/index.js +2 -1
  17. package/dist/components/chat-input/extension/skill/MentionList.d.ts +30 -0
  18. package/dist/components/chat-input/extension/skill/MentionList.js +181 -0
  19. package/dist/components/chat-input/extension/skill/ReferSlot.d.ts +3 -0
  20. package/dist/components/chat-input/extension/skill/ReferSlot.js +100 -0
  21. package/dist/components/chat-input/extension/skill/data.d.ts +10 -0
  22. package/dist/components/chat-input/extension/skill/data.js +49 -0
  23. package/dist/components/chat-input/extension/skill/index.d.ts +7 -0
  24. package/dist/components/chat-input/extension/skill/index.js +5 -0
  25. package/dist/components/chat-input/extension/skill/index.less +100 -0
  26. package/dist/components/chat-input/extension/skill/suggestion.d.ts +14 -0
  27. package/dist/components/chat-input/extension/skill/suggestion.js +173 -0
  28. package/dist/components/chat-input/index.js +63 -15
  29. package/dist/components/file-card/index.js +2 -1
  30. package/dist/components/file-card/index.module.css +1 -0
  31. package/dist/components/knowledge-trace/tryWatch.js +8 -1
  32. package/dist/components/message-list/index.js +15 -3
  33. package/dist/components/message-list/index.module.css +3 -0
  34. package/dist/components/message-list/skill-tag/index.d.ts +5 -0
  35. package/dist/components/message-list/skill-tag/index.js +24 -0
  36. package/dist/components/message-list/skill-tag/index.module.css +22 -0
  37. package/dist/components/templates/CommonChat.js +3 -1
  38. package/dist/hooks/useChatActions.d.ts +2 -1
  39. package/dist/hooks/useChatActions.js +41 -3
  40. package/dist/hooks/useChatStream.d.ts +6 -1
  41. package/dist/hooks/useChatStream.js +96 -5
  42. package/dist/hooks/useCommonChatAPI.d.ts +1 -1
  43. package/dist/hooks/useCommonChatAPI.js +190 -54
  44. package/dist/i18n/locales/en-US.d.ts +3 -0
  45. package/dist/i18n/locales/en-US.js +10 -7
  46. package/dist/i18n/locales/zh-CN.d.ts +3 -0
  47. package/dist/i18n/locales/zh-CN.js +4 -1
  48. package/dist/interfaces/chatMessage.d.ts +38 -0
  49. package/dist/umd/index.min.js +1 -1
  50. package/dist/utils/tools.d.ts +6 -0
  51. package/dist/utils/tools.js +31 -0
  52. package/package.json +3 -2
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { IconFile, IconFolder, IconBranch, IconCode, IconGit } from '@douyinfe/semi-icons';
3
+ // 面板选项(按分组组织)
4
+ export var TestAction = {
5
+ 'Files & Folders': [{
6
+ icon: /*#__PURE__*/React.createElement(IconFile, null),
7
+ key: '1-1',
8
+ type: 'file',
9
+ name: 'TagInput.scss',
10
+ path: 'package/semi-founctaion/TagInput.scss'
11
+ }, {
12
+ icon: /*#__PURE__*/React.createElement(IconFolder, null),
13
+ key: '1-2',
14
+ type: 'folder',
15
+ name: 'package',
16
+ path: '/package'
17
+ }, {
18
+ icon: /*#__PURE__*/React.createElement(IconFolder, null),
19
+ key: '1-3',
20
+ type: 'folder',
21
+ name: 'semi-ui',
22
+ path: '/package/semi-ui'
23
+ }],
24
+ Git: [{
25
+ icon: /*#__PURE__*/React.createElement(IconBranch, null),
26
+ key: '2-1',
27
+ type: 'branch',
28
+ name: 'fix/tag'
29
+ }, {
30
+ icon: /*#__PURE__*/React.createElement(IconCode, null),
31
+ key: '2-2',
32
+ type: 'code',
33
+ name: 'v2.86.0',
34
+ path: '/package'
35
+ }, {
36
+ icon: /*#__PURE__*/React.createElement(IconGit, null),
37
+ key: '2-3',
38
+ type: 'git',
39
+ name: 'chore: publish'
40
+ }]
41
+ };
42
+
43
+ // 第一级内容
44
+ export var FirstLevel = Object.keys(TestAction);
45
+
46
+ // 扁平化所有选项,用于单层面板直接展示
47
+ export var SkillList = FirstLevel.reduce(function (acc, key) {
48
+ return acc.concat(TestAction[key] || []);
49
+ }, []);
@@ -0,0 +1,7 @@
1
+ import ReferSlot from './ReferSlot';
2
+ import SkillMention from './suggestion';
3
+ export { ReferSlot, SkillMention };
4
+ export { suggestion, setSkillContext } from './suggestion';
5
+ export { TestAction, FirstLevel } from './data';
6
+ export type { SkillItem } from './data';
7
+ export type { SkillCommandProps } from './suggestion';
@@ -0,0 +1,5 @@
1
+ import ReferSlot from "./ReferSlot";
2
+ import SkillMention from "./suggestion";
3
+ export { ReferSlot, SkillMention };
4
+ export { suggestion, setSkillContext } from "./suggestion";
5
+ export { TestAction, FirstLevel } from "./data";
@@ -0,0 +1,100 @@
1
+ .ai-chat-input-custom-extension-dropdown-menu {
2
+ background: #fff;
3
+ border: 1px solid #E3E3E1;
4
+ border-radius: 20px;
5
+ box-shadow: 0 2px 32px 0 rgba(0, 0, 0, 0.10);
6
+ padding: 10px;
7
+ max-height: 300px;
8
+ overflow-y: auto;
9
+ box-sizing: border-box;
10
+
11
+ .optionItem {
12
+ display: flex;
13
+ align-items: center;
14
+ padding: 0 10px;
15
+ cursor: pointer;
16
+ font-size: 14px;
17
+ height: 30px;
18
+ border-radius: 10px;
19
+ margin-bottom: 6px;
20
+ &:last-child {
21
+ margin-bottom: 0;
22
+ }
23
+
24
+ &:hover,
25
+ &.is-selected {
26
+ background: var(--theme-lightNeutral, #EDEDEB);
27
+ }
28
+ .name {
29
+ flex-shrink: 0;
30
+ }
31
+
32
+ }
33
+
34
+ .skillTitle {
35
+ color: var(--theme-mediumNeutral, #B3B2B2);
36
+ font-size: 12px;
37
+ font-weight: 500;
38
+ line-height: 21px;
39
+ margin-bottom: 3px;
40
+ }
41
+ .skillItem {
42
+ display: flex;
43
+ align-items: center;
44
+ width: 100%;
45
+ overflow: hidden;
46
+ .icon {
47
+ width: 14px;
48
+ height: 14px;
49
+ margin-right: 8px;
50
+ flex-shrink: 0;
51
+ }
52
+ .name {
53
+ font-size: 14px;
54
+ margin-right: 4px;
55
+ color: var(--theme-deepNeutral, #221813);
56
+ white-space: nowrap;
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ }
60
+ .toolDesc {
61
+ font-size: 12px;
62
+ color: var(--theme-dustyNeutral, #878786);
63
+ flex: 1;
64
+ min-width: 0;
65
+ white-space: nowrap;
66
+ overflow: hidden;
67
+ text-overflow: ellipsis;
68
+ }
69
+ }
70
+
71
+ .item {
72
+ padding: 20px 12px;
73
+ color: var(--theme-dustyNeutral, #878786);
74
+ font-size: 14px;
75
+ text-align: center;
76
+ }
77
+ }
78
+
79
+ .ai-chat-input-refer-slot-wrapper {
80
+ display: inline-block;
81
+ border-radius: 10px;
82
+ background:#E3E3E1;
83
+ padding: 0 8px;
84
+ height: 24px;
85
+ line-height: 24px;
86
+ margin-right: 6px;
87
+ .ai-chat-input-refer-slot {
88
+ font-size: 14px;
89
+ color: var(--theme-deepNeutral, #221813);
90
+ font-weight: 500;
91
+ vertical-align: text-bottom;
92
+
93
+ }
94
+ .ai-chat-input-refer-slot-image {
95
+ width: 14px;
96
+ height: 14px;
97
+ margin-right: 4px;
98
+ flex-shrink: 0;
99
+ }
100
+ }
@@ -0,0 +1,14 @@
1
+ import { SkillItem } from './MentionList';
2
+ import type { IUseApi } from '../../../../apis/useApi';
3
+ export interface SkillCommandProps {
4
+ item?: SkillItem;
5
+ allowHotKeySend?: boolean;
6
+ }
7
+ declare let skillContext: {
8
+ getAgentId?: () => number | undefined;
9
+ getApiService?: () => IUseApi | null;
10
+ };
11
+ export declare const setSkillContext: (ctx: Partial<typeof skillContext>) => void;
12
+ export declare const suggestion: any;
13
+ declare const SkillMention: import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
14
+ export default SkillMention;
@@ -0,0 +1,173 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { ReactRenderer } from '@tiptap/react';
8
+ import Mention from '@tiptap/extension-mention';
9
+ import { SkillList } from "./data";
10
+ import MentionList from "./MentionList";
11
+
12
+ // 选中后面板回传给 command 的结构
13
+
14
+ // 面板预期最大高度,用于估算下方空间是否足够
15
+ var PANEL_MAX_HEIGHT = 300;
16
+ // 面板与输入框的间距
17
+ var PANEL_GAP = 0;
18
+
19
+ // 把面板定位到 AIChatInput 输入框正下方,宽度与输入框一致;
20
+ // 若下方空间不足则翻转到输入框上方显示。
21
+ var positionPanel = function positionPanel(editor, element) {
22
+ var _editor$view;
23
+ var triggerEl = editor === null || editor === void 0 || (_editor$view = editor.view) === null || _editor$view === void 0 || (_editor$view = _editor$view.dom) === null || _editor$view === void 0 ? void 0 : _editor$view.closest('.semi-aiChatInput');
24
+ if (!triggerEl) return null;
25
+ var rect = triggerEl.getBoundingClientRect();
26
+ var _window = window,
27
+ scrollX = _window.scrollX,
28
+ scrollY = _window.scrollY,
29
+ innerHeight = _window.innerHeight;
30
+ // 下方剩余空间(视口高度 - 输入框底部)
31
+ var spaceBelow = innerHeight - rect.bottom;
32
+ // 渲染后的实际面板高度,未知时用预期最大高度估算
33
+ var panelHeight = element.offsetHeight || PANEL_MAX_HEIGHT;
34
+ // 下方放得下就放下方,否则翻到上方(输入框顶部之上)
35
+ var placeBelow = spaceBelow >= panelHeight + PANEL_GAP;
36
+ element.style.position = 'absolute';
37
+ element.style.left = "".concat(rect.left + scrollX, "px");
38
+ element.style.width = "".concat(rect.width, "px");
39
+ element.style.boxSizing = 'border-box';
40
+ if (placeBelow) {
41
+ element.style.transform = '';
42
+ element.style.top = "".concat(rect.bottom + scrollY + PANEL_GAP, "px");
43
+ element.style.maxHeight = "".concat(PANEL_MAX_HEIGHT, "px");
44
+ } else {
45
+ // 翻到上方:底部贴输入框顶部(留 GAP)。用 translateY(-100%) 让面板向上偏移自身高度,
46
+ // 不依赖 JS 读取 offsetHeight,避免高度测量不准导致盖到输入框
47
+ var aboveSpace = rect.top - PANEL_GAP;
48
+ element.style.maxHeight = "".concat(Math.min(PANEL_MAX_HEIGHT, aboveSpace), "px");
49
+ element.style.top = "".concat(rect.top + scrollY - PANEL_GAP, "px");
50
+ element.style.transform = 'translateY(-100%)';
51
+ }
52
+ return triggerEl;
53
+ };
54
+
55
+ // suggestion 配置
56
+ // v3 的 SuggestionOptions 签名与官方 v2 示例有差异(items 为
57
+ // ({query,editor,signal}) => I[],command 的 props 为泛型 TSelected),
58
+ // 因此用 SkillCommandProps 作为 TSelected,并在 Mention.configure 处用 as any 适配。
59
+ // 面板不跟随光标,而是贴在 AIChatInput 输入框下方、与输入框等宽,模拟官方 skillHotKey 面板效果。
60
+ // skill 面板由 tiptap ReactRenderer 渲染,脱离 ChatContext/Redux 树,
61
+ // 故通过此 setter 注入当前 agentId 与 apiService 供 MentionList 拉取接口数据
62
+ var skillContext = {};
63
+ export var setSkillContext = function setSkillContext(ctx) {
64
+ skillContext = _objectSpread(_objectSpread({}, skillContext), ctx);
65
+ };
66
+ export var suggestion = {
67
+ char: '/',
68
+ items: function items() {
69
+ return SkillList;
70
+ },
71
+ command: function command(_ref) {
72
+ var editor = _ref.editor,
73
+ range = _ref.range,
74
+ props = _ref.props;
75
+ var item = props.item,
76
+ allowHotKeySend = props.allowHotKeySend;
77
+ if (typeof allowHotKeySend === 'boolean') {
78
+ var _editor$storage;
79
+ // statusExtension(SemiAIChatInput)默认加载,storage 一定存在
80
+ if ((_editor$storage = editor.storage) !== null && _editor$storage !== void 0 && _editor$storage.SemiAIChatInput) {
81
+ editor.storage.SemiAIChatInput.allowHotKeySend = allowHotKeySend;
82
+ }
83
+ }
84
+ item && editor.chain().focus().insertContentAt(range, {
85
+ type: 'referSlot',
86
+ attrs: {
87
+ type: 'skill',
88
+ value: item.toolName || '',
89
+ info: JSON.stringify({
90
+ toolName: item.toolName || '',
91
+ toolId: item.toolId || '',
92
+ imageUrl: item.imageUrl || '',
93
+ toolType: item.toolCategoryDesc || ''
94
+ }),
95
+ uniqueKey: item.toolId || ''
96
+ }
97
+ }).run();
98
+ },
99
+ render: function render() {
100
+ var component;
101
+ var reposition = null;
102
+ return {
103
+ onStart: function onStart(props) {
104
+ console.log('[skill] onStart triggered, query=', props.query);
105
+ try {
106
+ var _skillContext$getAgen, _skillContext, _skillContext$getApiS, _skillContext$getApiS2, _skillContext2;
107
+ var agentId = (_skillContext$getAgen = (_skillContext = skillContext).getAgentId) === null || _skillContext$getAgen === void 0 ? void 0 : _skillContext$getAgen.call(_skillContext);
108
+ var apiService = (_skillContext$getApiS = (_skillContext$getApiS2 = (_skillContext2 = skillContext).getApiService) === null || _skillContext$getApiS2 === void 0 ? void 0 : _skillContext$getApiS2.call(_skillContext2)) !== null && _skillContext$getApiS !== void 0 ? _skillContext$getApiS : null;
109
+ component = new ReactRenderer(MentionList, {
110
+ props: _objectSpread(_objectSpread({}, props), {}, {
111
+ agentId: agentId,
112
+ apiService: apiService
113
+ }),
114
+ editor: props.editor
115
+ });
116
+ component.element.style.position = 'absolute';
117
+ component.element.style.zIndex = '1031';
118
+ document.body.appendChild(component.element);
119
+ positionPanel(props.editor, component.element);
120
+ // 首帧高度可能为 0,下一帧用实测高度二次校正翻转
121
+ requestAnimationFrame(function () {
122
+ return positionPanel(props.editor, component.element);
123
+ });
124
+ // 滚动/resize 时让面板跟随输入框位置
125
+ reposition = function reposition() {
126
+ return positionPanel(props.editor, component.element);
127
+ };
128
+ window.addEventListener('resize', reposition);
129
+ window.addEventListener('scroll', reposition, true);
130
+ } catch (e) {
131
+ console.error('[skill] onStart render error:', e);
132
+ }
133
+ },
134
+ onUpdate: function onUpdate(props) {
135
+ var _component, _component2;
136
+ (_component = component) === null || _component === void 0 || _component.updateProps(props);
137
+ // query 变化导致面板高度变化,重新判断上下翻转
138
+ positionPanel(props.editor, (_component2 = component) === null || _component2 === void 0 ? void 0 : _component2.element);
139
+ },
140
+ onKeyDown: function onKeyDown(props) {
141
+ var _component3, _component3$onKeyDown;
142
+ function onExit() {
143
+ component.destroy();
144
+ }
145
+ return (_component3 = component) === null || _component3 === void 0 || (_component3 = _component3.ref) === null || _component3 === void 0 || (_component3$onKeyDown = _component3.onKeyDown) === null || _component3$onKeyDown === void 0 ? void 0 : _component3$onKeyDown.call(_component3, _objectSpread(_objectSpread({}, props), {}, {
146
+ exitCb: onExit
147
+ }));
148
+ },
149
+ onExit: function onExit() {
150
+ var _component4, _component5;
151
+ if (reposition) {
152
+ window.removeEventListener('resize', reposition);
153
+ window.removeEventListener('scroll', reposition, true);
154
+ reposition = null;
155
+ }
156
+ (_component4 = component) === null || _component4 === void 0 || (_component4 = _component4.element) === null || _component4 === void 0 || _component4.remove();
157
+ (_component5 = component) === null || _component5 === void 0 || _component5.destroy();
158
+ },
159
+ focusEditor: function focusEditor(props) {
160
+ props.editor.commands.focus();
161
+ }
162
+ };
163
+ }
164
+ };
165
+
166
+ // 配置好的 Mention 扩展(/ 触发)
167
+ var SkillMention = Mention.configure({
168
+ HTMLAttributes: {
169
+ class: 'mention'
170
+ },
171
+ suggestion: suggestion
172
+ });
173
+ export default SkillMention;
@@ -1,20 +1,24 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3
7
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
14
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import React, { useContext } from "react";
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
20
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
+ import React, { useContext, useEffect, useMemo } from "react";
18
22
  import { useTranslation } from 'react-i18next';
19
23
  import { AIChatInput, Divider, Popover } from '@douyinfe/semi-ui';
20
24
  import { transformToInputSlots } from "../../utils/chatInputUtil";
@@ -33,7 +37,7 @@ import UploadList from "../upload-list";
33
37
  import { FileStatus } from "../../interfaces/fileInterface";
34
38
  import LottieImg from "../lottie-img";
35
39
  import AIChatDialogue from "../ai-chat-dialogue";
36
- import { Keydown, TitleSlot } from "./extension";
40
+ import { Keydown, TitleSlot, ReferSlot, SkillMention, setSkillContext } from "./extension";
37
41
  import QuotedContent from "../quoted-content";
38
42
  import { ReferencesEdit } from "../reference-content";
39
43
  import IconFontCom from "../iconfont-com";
@@ -45,6 +49,17 @@ var extractText = function extractText() {
45
49
  if (item.type === 'text' && typeof item.text === 'string') {
46
50
  return item.text;
47
51
  }
52
+ // skill 节点序列化为 <skilltool> 标记发送,取值来自 content 中 transformer 展开后的 item
53
+ if (item.type === 'skill') {
54
+ var _skill$toolId, _skill$toolType, _skill$imageUrl, _skill$toolName;
55
+ var skill = item;
56
+ return "<skilltool>".concat(JSON.stringify({
57
+ toolId: (_skill$toolId = skill.toolId) !== null && _skill$toolId !== void 0 ? _skill$toolId : '',
58
+ toolType: (_skill$toolType = skill.toolType) !== null && _skill$toolType !== void 0 ? _skill$toolType : '',
59
+ imageUrl: (_skill$imageUrl = skill.imageUrl) !== null && _skill$imageUrl !== void 0 ? _skill$imageUrl : '',
60
+ toolName: (_skill$toolName = skill.toolName) !== null && _skill$toolName !== void 0 ? _skill$toolName : ''
61
+ }), "</skilltool>");
62
+ }
48
63
  if (item.content && Array.isArray(item.content)) {
49
64
  return extractText(item.content);
50
65
  }
@@ -89,7 +104,26 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
89
104
  conversationIdRef.current = conversationId;
90
105
  var agentObjRef = React.useRef(agentObj);
91
106
  agentObjRef.current = agentObj;
92
-
107
+ var transformer = useMemo(function () {
108
+ return new Map([['referSlot', function (obj) {
109
+ var _obj$attrs = obj.attrs,
110
+ attrs = _obj$attrs === void 0 ? {} : _obj$attrs;
111
+ var value = attrs.value,
112
+ info = attrs.info,
113
+ _attrs$type = attrs.type,
114
+ type = _attrs$type === void 0 ? 'text' : _attrs$type,
115
+ uniqueKey = attrs.uniqueKey;
116
+ return _objectSpread({
117
+ type: type,
118
+ value: value,
119
+ uniqueKey: uniqueKey
120
+ }, JSON.parse(info || '{}'));
121
+ }]]);
122
+ }, []);
123
+ var extensions = useMemo(function () {
124
+ // 使用 / 触发 skill 下拉面板,选中后插入 referSlot
125
+ return [ReferSlot, SkillMention];
126
+ }, []);
93
127
  // 语音聊天相关
94
128
  var _React$useState = React.useState(false),
95
129
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -105,6 +139,19 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
105
139
  apiService = _useContext.apiService;
106
140
  var _ref = apiService,
107
141
  createRoomId = _ref.createRoomId;
142
+
143
+ // skill 面板由 tiptap ReactRenderer 渲染、脱离 Context 树,注入 agentId 与 apiService 供其拉取接口
144
+ useEffect(function () {
145
+ setSkillContext({
146
+ getAgentId: function getAgentId() {
147
+ var _agentObjRef$current;
148
+ return (_agentObjRef$current = agentObjRef.current) === null || _agentObjRef$current === void 0 ? void 0 : _agentObjRef$current.agentId;
149
+ },
150
+ getApiService: function getApiService() {
151
+ return apiService !== null && apiService !== void 0 ? apiService : null;
152
+ }
153
+ });
154
+ }, [apiService]);
108
155
  React.useEffect(function () {
109
156
  if (!props.defaultPrompt) {
110
157
  setHasContent(false);
@@ -187,7 +234,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
187
234
  var el = inputWrapRef.current;
188
235
  if (!el) return;
189
236
  var handlePaste = function handlePaste(e) {
190
- var _e$clipboardData, _agentObjRef$current, _fileList$length, _uploadFileRef$curren;
237
+ var _e$clipboardData, _agentObjRef$current2, _fileList$length, _uploadFileRef$curren;
191
238
  var items = Array.from(((_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.items) || []);
192
239
  var imageItem = items.find(function (item) {
193
240
  return item.kind === 'file' && item.type.startsWith('image/');
@@ -199,7 +246,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
199
246
  e.preventDefault();
200
247
 
201
248
  // 前置校验:上传功能是否开启
202
- if (!props.enableFileUpload || ((_agentObjRef$current = agentObjRef.current) === null || _agentObjRef$current === void 0 ? void 0 : _agentObjRef$current.openUploadFile) === 0) return;
249
+ if (!props.enableFileUpload || ((_agentObjRef$current2 = agentObjRef.current) === null || _agentObjRef$current2 === void 0 ? void 0 : _agentObjRef$current2.openUploadFile) === 0) return;
203
250
  if (props.disabled || isAskProcess) return;
204
251
  if (((_fileList$length = fileList === null || fileList === void 0 ? void 0 : fileList.length) !== null && _fileList$length !== void 0 ? _fileList$length : 0) >= 10) {
205
252
  Toast.info(t('chatInput.uploadLimitTen'));
@@ -601,11 +648,11 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
601
648
  };
602
649
  var handleInterrupt = function handleInterrupt() {
603
650
  var _props$onInterrupt;
604
- var latestMessage = messageList[messageList.length - 1];
651
+ // const latestMessage = messageList[messageList.length - 1];
605
652
  // 如果模型没有返回或正处于工作流调用阶段,不允许打断
606
- if (latestMessage.role === 1 && (!latestMessage.content && !latestMessage.reasoningContent || latestMessage.mcp)) {
607
- return;
608
- }
653
+ // if (latestMessage.role === 1 && (!latestMessage.content && !latestMessage.reasoningContent || latestMessage.mcp)) {
654
+ // return;
655
+ // }
609
656
  (_props$onInterrupt = props.onInterrupt) === null || _props$onInterrupt === void 0 || _props$onInterrupt.call(props);
610
657
  };
611
658
  var defaultContent = transformToInputSlots(props.defaultPrompt || '', props.titleSlot || '');
@@ -665,7 +712,8 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
665
712
  canSend: !props.disabled && hasContent,
666
713
  onMessageSend: onMessageSend,
667
714
  generating: isMsgRecieving,
668
- extensions: [TitleSlot, Keydown]
715
+ extensions: [TitleSlot, Keydown].concat(_toConsumableArray(extensions)),
716
+ transformer: transformer
669
717
  }, props)), showChatCommunication && /*#__PURE__*/React.createElement(AIChatDialogue, {
670
718
  paper: {
671
719
  enableCaptions: false,
@@ -8,6 +8,7 @@ import { setFilePreviewState, openSidebar } from "../../store/slices/gimiMenuSli
8
8
  import classNames from 'classnames';
9
9
  import { IconChevronRightStroked } from '@douyinfe/semi-icons';
10
10
  import IconFontCom from "../iconfont-com";
11
+ import { documentConstants } from "../../constants";
11
12
  export var FileCard = function FileCard(_ref) {
12
13
  var fileName = _ref.fileName,
13
14
  downloadUrl = _ref.downloadUrl,
@@ -50,7 +51,7 @@ export var FileCard = function FileCard(_ref) {
50
51
  }, /*#__PURE__*/React.createElement("div", {
51
52
  className: styles.icon
52
53
  }, /*#__PURE__*/React.createElement("img", {
53
- src: fileImgMap[fileType] || fileImgMap['xlsx'],
54
+ src: documentConstants[fileType] || documentConstants.default,
54
55
  alt: ""
55
56
  })), /*#__PURE__*/React.createElement("div", {
56
57
  className: styles.left
@@ -43,6 +43,7 @@
43
43
  align-items: center;
44
44
  gap: 10px;
45
45
  padding: 16px;
46
+ box-sizing: border-box;
46
47
  }
47
48
  .file_main:hover {
48
49
  cursor: pointer;
@@ -256,13 +256,19 @@ var TryWatch = function TryWatch(_ref7) {
256
256
  var _useTranslation4 = useTranslation(),
257
257
  t = _useTranslation4.t;
258
258
  var handleFull = function handleFull() {
259
- if (item.isDelete === 1 || item.isDeleted === 1) return;
259
+ if (item.isDelete === 1) return;
260
260
  if (platform !== 'myun') return Toast.warning(t('trace.jumpUnsupported'));
261
261
  if (type === 'information') {
262
262
  handleInformation();
263
263
  } else if (type === 'video') {
264
+ if (!item.productId) {
265
+ return Toast.warning(t('trace.noAccessibleCourse'));
266
+ }
264
267
  handleVideo();
265
268
  } else if (type === 'document') {
269
+ if (!item.productId) {
270
+ return Toast.warning(t('trace.noAccessibleCourse'));
271
+ }
266
272
  handleDocument();
267
273
  }
268
274
  };
@@ -277,6 +283,7 @@ var TryWatch = function TryWatch(_ref7) {
277
283
  var searchParams = "gradeId=".concat(item.gradeId, "&teachModuleId=").concat(item.id, "&outlineId=").concat(item.courseId, "&phaseId=").concat(item.phaseId);
278
284
  if (item.isJoinClass) {
279
285
  window.open(item.resourceMountType === 'teachingModule' ? "/learningPage?".concat(searchParams) : item.productType === 'single' ? "/courseDetail/".concat(item.gradeId, "?trigger=resource") : "/class-project/".concat(item.gradeId, "/").concat(item.productId, "?trigger=resource"));
286
+ window.open(item.resourceMountType === 'teachingModule' ? "/learningPage?".concat(searchParams) : item.productType === 'single' ? "/courseDetail/".concat(item.gradeId, "?trigger=resource&resourcesId=").concat(item.hostId) : "/class-project/".concat(item.gradeId, "/").concat(item.productId, "?trigger=resource&resourcesId=").concat(item.hostId));
280
287
  } else {
281
288
  if (item.productType === 'single') {
282
289
  window.open("/new-product/".concat(item.productId, "?").concat(searchParams));
@@ -24,6 +24,8 @@ import { FileStatus } from "../../interfaces/fileInterface";
24
24
  import useChatActions from "../../hooks/useChatActions";
25
25
  import CopyButton from "../message-actions/CopyButton";
26
26
  import { Virtuoso } from 'react-virtuoso';
27
+ import { MMarkdown } from '@myun/gimi-design';
28
+ import SkillTag from "./skill-tag";
27
29
  var MessageItem = /*#__PURE__*/React.memo(function (props) {
28
30
  var _v$quoteTeachModelLis, _v$quoteProductList, _v$messageFilesList;
29
31
  var v = props.v,
@@ -41,6 +43,7 @@ var MessageItem = /*#__PURE__*/React.memo(function (props) {
41
43
  handleClickPromptWord = props.handleClickPromptWord,
42
44
  handleShowCourse = props.handleShowCourse,
43
45
  handleClickAskList = props.handleClickAskList,
46
+ handleClickConfirm = props.handleClickConfirm,
44
47
  playTTSByText = props.playTTSByText,
45
48
  stopTTSByText = props.stopTTSByText,
46
49
  isPlaying = props.isPlaying,
@@ -73,7 +76,13 @@ var MessageItem = /*#__PURE__*/React.memo(function (props) {
73
76
  quoteTeachModelList: v.quoteTeachModelList
74
77
  }), v.content && /*#__PURE__*/React.createElement("div", {
75
78
  className: styles.title
76
- }, replaceBraces(v.content)), v.messageFiles && /*#__PURE__*/React.createElement("div", {
79
+ }, /*#__PURE__*/React.createElement(MMarkdown, {
80
+ content: replaceBraces(v.content) || '',
81
+ customRender: [{
82
+ type: 'skilltool',
83
+ component: SkillTag
84
+ }]
85
+ })), v.messageFiles && /*#__PURE__*/React.createElement("div", {
77
86
  className: styles.listBox
78
87
  }, /*#__PURE__*/React.createElement(UploadList, {
79
88
  isMessage: true,
@@ -102,6 +111,7 @@ var MessageItem = /*#__PURE__*/React.memo(function (props) {
102
111
  handleClickPromptWord: handleClickPromptWord,
103
112
  handleShowCourse: handleShowCourse,
104
113
  handleClickAskList: handleClickAskList,
114
+ handleClickConfirm: handleClickConfirm,
105
115
  playTTSByText: playTTSByText,
106
116
  stopTTSByText: stopTTSByText,
107
117
  isVoicePlaying: isPlaying,
@@ -170,7 +180,8 @@ var MessageList = function MessageList(_ref) {
170
180
  // 使用 chatActions hook 提供的函数
171
181
  var showOpera = chatActions.showOpera,
172
182
  showCommend = chatActions.showCommend,
173
- handleClickAskList = chatActions.handleClickAskList;
183
+ handleClickAskList = chatActions.handleClickAskList,
184
+ handleClickConfirm = chatActions.handleClickConfirm;
174
185
  var handleClickPromptWord = React.useCallback(function (prompt) {
175
186
  handleSend(prompt);
176
187
  }, [handleSend]);
@@ -279,6 +290,7 @@ var MessageList = function MessageList(_ref) {
279
290
  handleClickPromptWord: handleClickPromptWord,
280
291
  handleShowCourse: handleShowCourse,
281
292
  handleClickAskList: handleClickAskList,
293
+ handleClickConfirm: handleClickConfirm,
282
294
  playTTSByText: playTTSByText,
283
295
  stopTTSByText: stopTTSByText,
284
296
  isPlaying: isPlaying,
@@ -294,7 +306,7 @@ var MessageList = function MessageList(_ref) {
294
306
  onCurrentTraceVideoClick: onCurrentTraceVideoClick,
295
307
  curPlayer: curPlayer
296
308
  });
297
- }, [chatUI, hideUserMessage, showOpera, onCopyCallback, onSucessExcel, onFailureExcel, onRetryExcel, showCommend, handleClickPromptWord, handleShowCourse, handleClickAskList, playTTSByText, stopTTSByText, isPlaying, onRegenerateClick, enableCopy, enableLike, enableUnLike, enableRegenerate, enableVoicePlay, onDownloadCallback, reasoningTitle, model, handleReTry, onLikeCallback, onUnLikeCallback]);
309
+ }, [chatUI, hideUserMessage, showOpera, onCopyCallback, onSucessExcel, onFailureExcel, onRetryExcel, showCommend, handleClickPromptWord, handleShowCourse, handleClickAskList, handleClickConfirm, playTTSByText, stopTTSByText, isPlaying, onRegenerateClick, enableCopy, enableLike, enableUnLike, enableRegenerate, enableVoicePlay, onDownloadCallback, reasoningTitle, model, handleReTry, onLikeCallback, onUnLikeCallback]);
298
310
  return /*#__PURE__*/React.createElement("div", {
299
311
  className: classNames(styles.main),
300
312
  style: buildStyle()