@myun/gimi-chat 0.0.8 → 0.1.0
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/apis/useApi.d.ts +2 -0
- package/dist/apis/useApi.js +50 -2
- package/dist/components/ai-chat-dialogue/index.js +135 -181
- package/dist/components/ai-correction/index.js +25 -38
- package/dist/components/ai-loading/index.js +8 -12
- package/dist/components/answer-item/index.d.ts +3 -0
- package/dist/components/answer-item/index.js +126 -135
- package/dist/components/ask-card/index.js +33 -42
- package/dist/components/chat-input/extension/index.d.ts +2 -0
- package/dist/components/chat-input/extension/index.js +2 -0
- package/dist/components/chat-input/extension/keydown/index.d.ts +3 -0
- package/dist/components/chat-input/extension/keydown/index.js +37 -0
- package/dist/components/chat-input/extension/title-slot/Component.d.ts +4 -0
- package/dist/components/chat-input/extension/title-slot/Component.js +18 -0
- package/dist/components/chat-input/extension/title-slot/index.d.ts +3 -0
- package/dist/components/chat-input/extension/title-slot/index.js +47 -0
- package/dist/components/chat-input/extension/title-slot/index.less +22 -0
- package/dist/components/chat-input/index.d.ts +4 -0
- package/dist/components/chat-input/index.js +144 -145
- package/dist/components/chat-input/index.module.css +7 -0
- package/dist/components/chat-voice/VoiceCommunication.js +21 -23
- package/dist/components/chat-voice/VoiceRecord.js +21 -24
- package/dist/components/conversation-delete/index.js +8 -10
- package/dist/components/dots-loading/index.js +7 -10
- package/dist/components/empty/index.js +7 -12
- package/dist/components/excel-components/ExcelCard.js +3 -7
- package/dist/components/excel-components/ExcelExcuting.js +43 -60
- package/dist/components/excel-components/ExcelFailCard.js +10 -15
- package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -1
- package/dist/components/excel-components/ExcelSuccessCard.js +13 -6
- package/dist/components/file-card/fileCardSidebar.js +17 -23
- package/dist/components/file-card/index.d.ts +3 -0
- package/dist/components/file-card/index.js +59 -69
- package/dist/components/file-card/index.module.css +1 -1
- package/dist/components/file-preview/index.js +62 -37
- package/dist/components/file-preview/index.module.css +33 -0
- package/dist/components/file-upload/index.js +7 -10
- package/dist/components/file-upload/uploadV1.js +27 -33
- package/dist/components/gimi-sidebar/index.js +13 -20
- package/dist/components/header/index.js +11 -18
- package/dist/components/iconfont-com/index.js +33 -12
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +22 -28
- package/dist/components/knowledge-trace/classList.js +28 -37
- package/dist/components/knowledge-trace/documentList.js +27 -36
- package/dist/components/knowledge-trace/index.js +21 -28
- package/dist/components/knowledge-trace/videoList.js +36 -46
- package/dist/components/lottie-img/index.js +8 -10
- package/dist/components/message-actions/CopyButton.d.ts +1 -1
- package/dist/components/message-actions/CopyButton.js +22 -25
- package/dist/components/message-actions/LikeButton.js +22 -25
- package/dist/components/message-actions/RegenerateButton.js +18 -21
- package/dist/components/message-actions/UnLikeButton.js +22 -25
- package/dist/components/message-actions/VoicePlay.js +22 -25
- package/dist/components/message-list/index.js +83 -87
- package/dist/components/no-microphone-root/index.js +29 -39
- package/dist/components/preset-agent-content/index.d.ts +1 -0
- package/dist/components/preset-agent-content/index.js +27 -20
- package/dist/components/quoted-content/index.d.ts +3 -0
- package/dist/components/quoted-content/index.js +271 -163
- package/dist/components/quoted-content/index.module.css +20 -0
- package/dist/components/reasoning-content/index.d.ts +3 -2
- package/dist/components/reasoning-content/index.js +50 -61
- package/dist/components/reference-content/index.js +62 -71
- package/dist/components/reference-content/index.module.css +1 -0
- package/dist/components/search-result/index.d.ts +7 -0
- package/dist/components/search-result/index.js +182 -0
- package/dist/components/search-result/index.module.css +235 -0
- package/dist/components/templates/CommonChat.js +75 -79
- package/dist/components/templates/GimiChatComponent.js +6 -13
- package/dist/components/upload-list/index.js +41 -56
- package/dist/components/voice-bars/index.js +19 -22
- package/dist/components/voice-check-dialog/index.js +17 -24
- package/dist/components/voice-recording/index.js +42 -57
- package/dist/components/work-flow-content/index.js +8 -11
- package/dist/hooks/useChatActions.d.ts +1 -1
- package/dist/hooks/useChatActions.js +3 -1
- package/dist/hooks/useCommonChatAPI.d.ts +2 -1
- package/dist/hooks/useCommonChatAPI.js +10 -8
- package/dist/hooks/useQuoted.d.ts +12 -0
- package/dist/hooks/useQuoted.js +202 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/types/answer.d.ts +16 -0
- package/dist/types/chat.d.ts +124 -0
- package/dist/types/file.d.ts +20 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/modules.d.ts +36 -0
- package/dist/utils/aes.d.ts +21 -0
- package/dist/utils/aes.js +61 -0
- package/dist/utils/chatInputUtil.d.ts +1 -1
- package/dist/utils/chatInputUtil.js +4 -3
- package/package.json +1 -1
- package/dist/components/templates/demo/demo.d.ts +0 -2
- package/dist/components/templates/demo/demo.js +0 -111
- package/dist/components/work-flow-content/demo.d.ts +0 -3
- package/dist/components/work-flow-content/demo.js +0 -12
|
@@ -17,9 +17,6 @@ import CopyButton from "../message-actions/CopyButton";
|
|
|
17
17
|
import LikeButton from "../message-actions/LikeButton";
|
|
18
18
|
import UnLikeButton from "../message-actions/UnLikeButton";
|
|
19
19
|
import RegenerateButton from "../message-actions/RegenerateButton";
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
20
|
var AnswerItem = function AnswerItem(_ref) {
|
|
24
21
|
var _agentDetail$voiceCon;
|
|
25
22
|
var item = _ref.item,
|
|
@@ -38,6 +35,7 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
38
35
|
onLikeCallback = _ref.onLikeCallback,
|
|
39
36
|
onUnLikeCallback = _ref.onUnLikeCallback,
|
|
40
37
|
onRegenerateClick = _ref.onRegenerateClick,
|
|
38
|
+
onDownloadCallback = _ref.onDownloadCallback,
|
|
41
39
|
_ref$enableCopy = _ref.enableCopy,
|
|
42
40
|
enableCopy = _ref$enableCopy === void 0 ? true : _ref$enableCopy,
|
|
43
41
|
_ref$enableLike = _ref.enableLike,
|
|
@@ -47,7 +45,9 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
47
45
|
_ref$enableRegenerate = _ref.enableRegenerate,
|
|
48
46
|
enableRegenerate = _ref$enableRegenerate === void 0 ? true : _ref$enableRegenerate,
|
|
49
47
|
_ref$enableVoicePlay = _ref.enableVoicePlay,
|
|
50
|
-
enableVoicePlay = _ref$enableVoicePlay === void 0 ? true : _ref$enableVoicePlay
|
|
48
|
+
enableVoicePlay = _ref$enableVoicePlay === void 0 ? true : _ref$enableVoicePlay,
|
|
49
|
+
reasoningTitle = _ref.reasoningTitle,
|
|
50
|
+
model = _ref.model;
|
|
51
51
|
var isMsgRecieving = useAppSelector(function (state) {
|
|
52
52
|
return state.gimiMenu.isMsgRecieving;
|
|
53
53
|
});
|
|
@@ -81,136 +81,127 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
81
81
|
var agentDetail = useAppSelector(function (state) {
|
|
82
82
|
return state.gimiMenu.agentObj || {};
|
|
83
83
|
});
|
|
84
|
-
return /*#__PURE__*/
|
|
85
|
-
className: styles.title
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}) : null, course.name]
|
|
207
|
-
})]
|
|
208
|
-
}, course.id);
|
|
209
|
-
})
|
|
210
|
-
})]
|
|
211
|
-
})
|
|
212
|
-
})]
|
|
213
|
-
})
|
|
214
|
-
});
|
|
84
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: styles.title
|
|
86
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: classNames(styles.answer)
|
|
88
|
+
}, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
|
|
89
|
+
chatItem: item
|
|
90
|
+
}), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
|
|
91
|
+
reasoningTitle: reasoningTitle,
|
|
92
|
+
item: item
|
|
93
|
+
}), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: styles.completed
|
|
95
|
+
}, /*#__PURE__*/React.createElement(IconTickCircle, {
|
|
96
|
+
className: styles.checkIcon
|
|
97
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: styles.checkText
|
|
99
|
+
}, "\u672C\u6B21\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF01")), showContentFlag && /*#__PURE__*/React.createElement(MMarkdown, {
|
|
100
|
+
content: processString(item.content || ''),
|
|
101
|
+
customRender: [{
|
|
102
|
+
type: 'excel',
|
|
103
|
+
component: function component(value) {
|
|
104
|
+
var newVal = {
|
|
105
|
+
content: value.value,
|
|
106
|
+
onDownloadCallback: onDownloadCallback,
|
|
107
|
+
model: model
|
|
108
|
+
};
|
|
109
|
+
return /*#__PURE__*/React.createElement(ExcelSuccessCard, {
|
|
110
|
+
value: newVal
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
type: 'knowledge',
|
|
115
|
+
component: function component(value) {
|
|
116
|
+
var newVal = {
|
|
117
|
+
content: value.value,
|
|
118
|
+
messageId: item.id
|
|
119
|
+
};
|
|
120
|
+
return /*#__PURE__*/React.createElement(KnowledgeIconGroup, {
|
|
121
|
+
value: newVal
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
type: 'correction',
|
|
126
|
+
component: AICorrection
|
|
127
|
+
}],
|
|
128
|
+
showLoading: item.loading
|
|
129
|
+
}), showAskTag && /*#__PURE__*/React.createElement(AskCard, {
|
|
130
|
+
item: item,
|
|
131
|
+
moduleInfo: item.moduleInfo,
|
|
132
|
+
handleClickAskList: handleClickAskList
|
|
133
|
+
}), showSkillTag && /*#__PURE__*/React.createElement(ExcelCard, {
|
|
134
|
+
onRetry: onRetry,
|
|
135
|
+
item: item,
|
|
136
|
+
moduleInfo: item.moduleInfo,
|
|
137
|
+
onSucess: onSucess,
|
|
138
|
+
onFailure: onFailure
|
|
139
|
+
}), item.stop === 1 && /*#__PURE__*/React.createElement("div", {
|
|
140
|
+
className: styles.stop
|
|
141
|
+
}, item.vipLevel === 1 && item.reasoningStatus === 3 ? '已停止推理' : '已停止内容输出'), showOperation && /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: styles.opera
|
|
143
|
+
}, (showOpera === null || showOpera === void 0 ? void 0 : showOpera(item.id)) && !item.loading && /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
className: styles.opera_item
|
|
145
|
+
}, enableCopy && /*#__PURE__*/React.createElement(CopyButton, {
|
|
146
|
+
item: item,
|
|
147
|
+
onCopyCallback: onCopyCallback
|
|
148
|
+
}), enableLike && /*#__PURE__*/React.createElement(LikeButton, {
|
|
149
|
+
item: item,
|
|
150
|
+
onLikeCallback: onLikeCallback
|
|
151
|
+
}), enableUnLike && /*#__PURE__*/React.createElement(UnLikeButton, {
|
|
152
|
+
item: item,
|
|
153
|
+
onUnLikeCallback: onUnLikeCallback
|
|
154
|
+
}), enableVoicePlay && !showAskTag && !showSkillTag && ((_agentDetail$voiceCon = agentDetail.voiceConfigs) === null || _agentDetail$voiceCon === void 0 ? void 0 : _agentDetail$voiceCon.length) > 0 && /*#__PURE__*/React.createElement(VoicePlay, {
|
|
155
|
+
playTTSByText: playTTSByText,
|
|
156
|
+
stopTTSByText: stopTTSByText,
|
|
157
|
+
isVoicePlaying: isVoicePlaying,
|
|
158
|
+
text: processString(item.content || ''),
|
|
159
|
+
messageId: item.id
|
|
160
|
+
}), showRegerate && enableRegenerate && /*#__PURE__*/React.createElement(RegenerateButton, {
|
|
161
|
+
onRegenerateClick: onRegenerateClick
|
|
162
|
+
}))), (item.relatedResourceList || []).length > 0 && (showCommend === null || showCommend === void 0 ? void 0 : showCommend(item.id)) && /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: styles.quickInputList
|
|
164
|
+
}, (item.relatedResourceList || []).map(function (item, index) {
|
|
165
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: styles.quickInputItem,
|
|
167
|
+
key: index,
|
|
168
|
+
onClick: function onClick() {
|
|
169
|
+
return handleClickPromptWord === null || handleClickPromptWord === void 0 ? void 0 : handleClickPromptWord(item.recommendQuestions);
|
|
170
|
+
}
|
|
171
|
+
}, item.recommendQuestions);
|
|
172
|
+
})), (item.relatedCourseRecommendation || []).length > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: styles.course_recommend
|
|
174
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
className: styles.course_recommend_header
|
|
176
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
className: styles.course_recommend_header_title
|
|
178
|
+
}, "\u76F8\u5173\u8BFE\u7A0B\u63A8\u8350"), (item.relatedCourseRecommendation || []).length > 4 && /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: styles.course_recommend_header_more,
|
|
180
|
+
onClick: function onClick() {
|
|
181
|
+
handleShowCourse(item);
|
|
182
|
+
}
|
|
183
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
184
|
+
className: styles.all
|
|
185
|
+
}, "\u5168\u90E8\u8BFE\u7A0B"))), /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
className: styles.course_recommend_list
|
|
187
|
+
}, (item.relatedCourseRecommendation || []).map(function (course, i) {
|
|
188
|
+
if (i > 3) return null;
|
|
189
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: styles.courseItem,
|
|
191
|
+
key: course.id,
|
|
192
|
+
onClick: function onClick() {
|
|
193
|
+
return window.open(course.productType === 'project' ? "/project-product/".concat(course.productId || course.id) : "/new-product/".concat(course.productId || course.id));
|
|
194
|
+
}
|
|
195
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
196
|
+
className: styles.cover
|
|
197
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
198
|
+
src: course.productUrl,
|
|
199
|
+
alt: ""
|
|
200
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: classNames(styles.courseTitle, 'ellipsis-3')
|
|
202
|
+
}, course !== null && course !== void 0 && course.showStyle ? /*#__PURE__*/React.createElement("span", {
|
|
203
|
+
className: classNames(styles.newEquityLabel, styles["newEquityLabel-".concat(course.showStyle)])
|
|
204
|
+
}, course === null || course === void 0 ? void 0 : course.equityLabel) : null, course.name));
|
|
205
|
+
}))))));
|
|
215
206
|
};
|
|
216
207
|
export default AnswerItem;
|
|
@@ -9,8 +9,6 @@ import styles from "./index.module.css";
|
|
|
9
9
|
import { MMarkdown } from '@myun/gimi-design';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import FileUpload from "../file-upload";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
12
|
var AskCard = function AskCard(_ref) {
|
|
15
13
|
var item = _ref.item,
|
|
16
14
|
moduleInfo = _ref.moduleInfo,
|
|
@@ -39,47 +37,40 @@ var AskCard = function AskCard(_ref) {
|
|
|
39
37
|
optionsList = _React$useMemo.optionsList,
|
|
40
38
|
questionContent = _React$useMemo.questionContent;
|
|
41
39
|
var optionRender = function optionRender(v) {
|
|
42
|
-
return /*#__PURE__*/
|
|
43
|
-
children: v.value ? v.value : v.key
|
|
44
|
-
});
|
|
40
|
+
return /*#__PURE__*/React.createElement("span", null, v.value ? v.value : v.key);
|
|
45
41
|
};
|
|
46
|
-
return /*#__PURE__*/
|
|
47
|
-
className: styles.askList
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onClick: function onClick() {
|
|
63
|
-
return handleClickAskList(moduleInfo, 'click', v.key, v.value || v.key);
|
|
64
|
-
},
|
|
65
|
-
children: optionRender(v)
|
|
66
|
-
}, v.key);
|
|
67
|
-
})), detailInfo.uploadFile && detailInfo.answerType === 0 && /*#__PURE__*/_jsx("div", {
|
|
68
|
-
className: classNames(styles.showUpload, item.disableUploadFile ? styles.disableFile : ''),
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: styles.askList
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: styles.askQuestion,
|
|
46
|
+
style: detailInfo.answerType === 1 || detailInfo.uploadFile ? {
|
|
47
|
+
marginBottom: 12
|
|
48
|
+
} : {
|
|
49
|
+
marginBottom: 0
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(MMarkdown, {
|
|
52
|
+
content: questionContent,
|
|
53
|
+
id: item.id
|
|
54
|
+
})), detailInfo.answerType === 1 && (optionsList === null || optionsList === void 0 ? void 0 : optionsList.map(function (v) {
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: classNames(styles.askItem, detailInfo.answerType === 0 || item.selectValue ? styles.disablebox : ''),
|
|
57
|
+
key: v.key,
|
|
69
58
|
onClick: function onClick() {
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
59
|
+
return handleClickAskList(moduleInfo, 'click', v.key, v.value || v.key);
|
|
60
|
+
}
|
|
61
|
+
}, optionRender(v));
|
|
62
|
+
})), detailInfo.uploadFile && detailInfo.answerType === 0 && /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: classNames(styles.showUpload, item.disableUploadFile ? styles.disableFile : ''),
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
return onAskCardCallback === null || onAskCardCallback === void 0 ? void 0 : onAskCardCallback();
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/React.createElement(FileUpload, {
|
|
68
|
+
disabled: item.disableUploadFile
|
|
69
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: classNames(styles.uploadIcon)
|
|
71
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
72
|
+
src: item.disableUploadFile ? 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/19/b1e04_20250919162201.png' : 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/11/83ad4_20250911153220.png',
|
|
73
|
+
alt: ""
|
|
74
|
+
}), "\u6587\u4EF6\u4E0A\u4F20"))));
|
|
84
75
|
};
|
|
85
76
|
export default AskCard;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export default Extension.create(function () {
|
|
3
|
+
function onCreate() {}
|
|
4
|
+
function onUpdate() {}
|
|
5
|
+
var validate = function validate(_ref) {
|
|
6
|
+
var editor = _ref.editor;
|
|
7
|
+
var doc = editor.state.doc;
|
|
8
|
+
var hasTitleSlot = false;
|
|
9
|
+
doc.descendants(function (node) {
|
|
10
|
+
if (node.type.name === 'titleSlot') {
|
|
11
|
+
hasTitleSlot = true;
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
});
|
|
16
|
+
var selectionPos = editor.state.selection.from;
|
|
17
|
+
return hasTitleSlot ? !(selectionPos > 2) : false;
|
|
18
|
+
};
|
|
19
|
+
function addKeyboardShortcuts() {
|
|
20
|
+
return {
|
|
21
|
+
ArrowLeft: validate,
|
|
22
|
+
Backspace: validate,
|
|
23
|
+
Delete: validate
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
name: 'customExtension',
|
|
28
|
+
onCreate: onCreate,
|
|
29
|
+
onUpdate: onUpdate,
|
|
30
|
+
addKeyboardShortcuts: addKeyboardShortcuts,
|
|
31
|
+
addOptions: function addOptions() {
|
|
32
|
+
return {
|
|
33
|
+
hasTitleSlot: false
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeViewWrapper } from '@tiptap/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import "./index.less";
|
|
4
|
+
export default (function (props) {
|
|
5
|
+
var node = props.node,
|
|
6
|
+
deleteNode = props.deleteNode;
|
|
7
|
+
var value = node.attrs.value ? node.attrs.value : '';
|
|
8
|
+
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
9
|
+
className: "ai-chat-title-slot-wrapper"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
11
|
+
className: "ai-chat-title-slot",
|
|
12
|
+
contentEditable: false
|
|
13
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
14
|
+
className: "ai-chat-title-slot-title"
|
|
15
|
+
}, value), /*#__PURE__*/React.createElement("span", {
|
|
16
|
+
className: "ai-chat-title-slot-line"
|
|
17
|
+
}, "|")));
|
|
18
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mergeAttributes, Node } from '@tiptap/core';
|
|
2
|
+
import { ReactNodeViewRenderer } from '@tiptap/react';
|
|
3
|
+
import Component from "./Component";
|
|
4
|
+
export default Node.create({
|
|
5
|
+
name: 'titleSlot',
|
|
6
|
+
inline: true,
|
|
7
|
+
group: 'inline',
|
|
8
|
+
atom: true,
|
|
9
|
+
selectable: false,
|
|
10
|
+
draggable: false,
|
|
11
|
+
// 不可拖拽
|
|
12
|
+
isolating: true,
|
|
13
|
+
addAttributes: function addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
value: {
|
|
16
|
+
default: ''
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
addOptions: function addOptions() {
|
|
21
|
+
return {
|
|
22
|
+
value: '',
|
|
23
|
+
HTMLAttributes: {}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
parseHTML: function parseHTML() {
|
|
27
|
+
return [{
|
|
28
|
+
tag: 'title-slot',
|
|
29
|
+
getAttrs: function getAttrs(node) {
|
|
30
|
+
return {
|
|
31
|
+
value: node.textContent
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}];
|
|
35
|
+
},
|
|
36
|
+
renderHTML: function renderHTML(_ref) {
|
|
37
|
+
var node = _ref.node,
|
|
38
|
+
HTMLAttributes = _ref.HTMLAttributes;
|
|
39
|
+
console.log('HTMLAttributes', node, HTMLAttributes);
|
|
40
|
+
return ['title-slot', mergeAttributes(HTMLAttributes)];
|
|
41
|
+
},
|
|
42
|
+
addNodeView: function addNodeView() {
|
|
43
|
+
return ReactNodeViewRenderer(Component, {
|
|
44
|
+
as: 'span'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.ai-chat-title-slot-wrapper {
|
|
2
|
+
display: inline-block !important;
|
|
3
|
+
.ai-chat-title-slot {
|
|
4
|
+
.ai-chat-title-slot-title {
|
|
5
|
+
background: #f1f7ff;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
-ms-flex-negative: 0;
|
|
8
|
+
flex-shrink: 0;
|
|
9
|
+
gap: 10px;
|
|
10
|
+
padding: 2px 4px;
|
|
11
|
+
font-size: 16px;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
}
|
|
14
|
+
.ai-chat-title-slot-line {
|
|
15
|
+
color: #d9dce5;
|
|
16
|
+
margin: 0 5px;
|
|
17
|
+
padding: 2px 4px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -9,10 +9,12 @@ interface IAIInputProps {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
defaultPrompt?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
|
+
onBeforeSend?: (text: string) => void;
|
|
12
13
|
onSend?: (text: string) => void;
|
|
13
14
|
enableVoiceRecord?: boolean;
|
|
14
15
|
enableVoiceChat?: boolean;
|
|
15
16
|
enableFileUpload?: boolean;
|
|
17
|
+
enableSourceQuote?: boolean;
|
|
16
18
|
style?: React.CSSProperties;
|
|
17
19
|
className?: string;
|
|
18
20
|
maxLength?: number;
|
|
@@ -25,7 +27,9 @@ interface IAIInputProps {
|
|
|
25
27
|
disableVoiceCommunication?: boolean;
|
|
26
28
|
onHistoryReload?: () => void;
|
|
27
29
|
accept?: string[];
|
|
30
|
+
titleSlot?: string;
|
|
28
31
|
showDefaultPrompt?: boolean;
|
|
32
|
+
onConversationCreated?: (conversationId: number) => void;
|
|
29
33
|
}
|
|
30
34
|
declare const ChatInput: React.ForwardRefExoticComponent<IAIInputProps & React.RefAttributes<ChatInputRef>>;
|
|
31
35
|
export default ChatInput;
|