@ant-design/agentic-ui 2.0.15 → 2.0.16
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/Bubble/AIBubble.js +3 -0
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
- package/dist/Bubble/style.js +4 -1
- package/dist/History/index.js +7 -2
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +11 -8
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
- package/dist/MarkdownEditor/editor/utils/dom.d.ts +1 -1
- package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +9 -8
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +2 -0
- package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
- package/dist/MarkdownInputField/Enlargement/index.js +9 -29
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +30 -27
- package/dist/MarkdownInputField/FileMapView/index.d.ts +4 -4
- package/dist/MarkdownInputField/FileMapView/index.js +20 -13
- package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
- package/dist/MarkdownInputField/MarkdownInputField.js +154 -191
- package/dist/MarkdownInputField/RefinePromptButton/index.js +8 -53
- package/dist/MarkdownInputField/style.js +40 -45
- package/dist/Plugins/chart/AreaChart/index.d.ts +2 -2
- package/dist/Plugins/chart/AreaChart/index.js +9 -29
- package/dist/Plugins/chart/BarChart/index.d.ts +8 -8
- package/dist/Plugins/chart/BarChart/index.js +9 -8
- package/dist/Plugins/chart/DonutChart/constants.d.ts +0 -1
- package/dist/Plugins/chart/DonutChart/constants.js +0 -14
- package/dist/Plugins/chart/DonutChart/index.js +51 -16
- package/dist/Plugins/chart/DonutChart/style.js +7 -0
- package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.d.ts +8 -8
- package/dist/Plugins/chart/FunnelChart/index.js +85 -66
- package/dist/Plugins/chart/FunnelChart/style.js +12 -0
- package/dist/Plugins/chart/LineChart/index.d.ts +2 -2
- package/dist/Plugins/chart/LineChart/index.js +16 -19
- package/dist/Plugins/chart/RadarChart/index.d.ts +11 -5
- package/dist/Plugins/chart/RadarChart/index.js +35 -50
- package/dist/Plugins/chart/RadarChart/style.js +8 -0
- package/dist/Plugins/chart/ScatterChart/index.d.ts +23 -6
- package/dist/Plugins/chart/ScatterChart/index.js +58 -57
- package/dist/Plugins/chart/ScatterChart/style.js +8 -0
- package/dist/Plugins/chart/components/ChartContainer/style.js +7 -1
- package/dist/Plugins/chart/hooks/useChartStatistic.d.ts +0 -6
- package/dist/Plugins/chart/hooks/useChartStatistic.js +0 -16
- package/dist/Workspace/File/PreviewComponent.js +3 -2
- package/dist/Workspace/File/style.js +2 -1
- package/dist/Workspace/RealtimeFollow/style.js +1 -6
- package/dist/Workspace/style.js +2 -1
- package/package.json +1 -1
- package/dist/MarkdownInputField/Enlargement/style.d.ts +0 -10
- package/dist/MarkdownInputField/Enlargement/style.js +0 -75
|
@@ -78,7 +78,7 @@ import { useFileUploadManager } from "./FileUploadManager";
|
|
|
78
78
|
import { QuickActions } from "./QuickActions";
|
|
79
79
|
import { SendActions } from "./SendActions";
|
|
80
80
|
import { SkillModeBar } from "./SkillModeBar";
|
|
81
|
-
import {
|
|
81
|
+
import { useStyle } from "./style";
|
|
82
82
|
import { Suggestion } from "./Suggestion";
|
|
83
83
|
import TopOperatingArea from "./TopOperatingArea";
|
|
84
84
|
import { useVoiceInputManager } from "./VoiceInputManager";
|
|
@@ -98,7 +98,7 @@ var MarkdownInputField = (_a) => {
|
|
|
98
98
|
"onFocus",
|
|
99
99
|
"isShowTopOperatingArea"
|
|
100
100
|
]);
|
|
101
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
101
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
102
102
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
103
103
|
const baseCls = getPrefixCls("agentic-md-input-field");
|
|
104
104
|
const { wrapSSR, hashId } = useStyle(baseCls);
|
|
@@ -127,16 +127,27 @@ var MarkdownInputField = (_a) => {
|
|
|
127
127
|
const topOverlayPadding = (topRightPadding || 0) + (quickRightOffset || 0);
|
|
128
128
|
return Math.max(bottomOverlayPadding, topOverlayPadding);
|
|
129
129
|
}, [props.toolsRender, rightPadding, topRightPadding, quickRightOffset]);
|
|
130
|
+
const collapsedHeight = useMemo(() => {
|
|
131
|
+
var _a3;
|
|
132
|
+
const mh = (_a3 = props.style) == null ? void 0 : _a3.maxHeight;
|
|
133
|
+
const base = typeof mh === "number" ? mh : mh ? parseFloat(String(mh)) || 114 : 114;
|
|
134
|
+
return base;
|
|
135
|
+
}, [(_a2 = props.style) == null ? void 0 : _a2.maxHeight, (_b2 = props.attachment) == null ? void 0 : _b2.enable]);
|
|
136
|
+
const collapsedHeightPx = useMemo(() => {
|
|
137
|
+
var _a3;
|
|
138
|
+
const extra = ((_a3 = props.attachment) == null ? void 0 : _a3.enable) ? 90 : 0;
|
|
139
|
+
return collapsedHeight + extra;
|
|
140
|
+
}, [(_c = props.style) == null ? void 0 : _c.maxHeight, (_d = props.attachment) == null ? void 0 : _d.enable]);
|
|
130
141
|
const [fileMap, setFileMap] = useMergedState(void 0, {
|
|
131
|
-
value: (
|
|
132
|
-
onChange: (
|
|
142
|
+
value: (_e = props.attachment) == null ? void 0 : _e.fileMap,
|
|
143
|
+
onChange: (_f = props.attachment) == null ? void 0 : _f.onFileMapChange
|
|
133
144
|
});
|
|
134
145
|
const isMultiRowLayout = useMemo(() => {
|
|
135
146
|
var _a3;
|
|
136
147
|
return !!((props == null ? void 0 : props.quickActionRender) || ((_a3 = props == null ? void 0 : props.refinePrompt) == null ? void 0 : _a3.enable) || (props == null ? void 0 : props.actionsRender) || (props == null ? void 0 : props.toolsRender));
|
|
137
148
|
}, [
|
|
138
149
|
props == null ? void 0 : props.quickActionRender,
|
|
139
|
-
(
|
|
150
|
+
(_g = props == null ? void 0 : props.refinePrompt) == null ? void 0 : _g.enable,
|
|
140
151
|
props == null ? void 0 : props.actionsRender,
|
|
141
152
|
props == null ? void 0 : props.toolsRender
|
|
142
153
|
]);
|
|
@@ -164,18 +175,6 @@ var MarkdownInputField = (_a) => {
|
|
|
164
175
|
(_b3 = (_a3 = markdownEditorRef.current) == null ? void 0 : _a3.store) == null ? void 0 : _b3.setMDContent(value);
|
|
165
176
|
}, [props.value]);
|
|
166
177
|
useImperativeHandle(props.inputRef, () => markdownEditorRef.current);
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
var _a3;
|
|
169
|
-
const targetElement = (_a3 = props.enlargeTargetRef) == null ? void 0 : _a3.current;
|
|
170
|
-
if (targetElement && isEnlarged) {
|
|
171
|
-
const computedStyle = window.getComputedStyle(targetElement);
|
|
172
|
-
if (computedStyle.position === "static") {
|
|
173
|
-
console.warn(
|
|
174
|
-
"MarkdownInputField: enlargeTargetRef 容器的 position 为 static,这可能导致放大功能无法正常工作。请为目标容器设置 position: relative、absolute 或 fixed。"
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, [isEnlarged, props.enlargeTargetRef]);
|
|
179
178
|
const handleEnlargeClick = useRefFunction(() => {
|
|
180
179
|
setIsEnlarged(!isEnlarged);
|
|
181
180
|
});
|
|
@@ -204,32 +203,14 @@ var MarkdownInputField = (_a) => {
|
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
}));
|
|
207
|
-
const bgSize = useMemo(() => {
|
|
208
|
-
var _a3, _b3;
|
|
209
|
-
const height = ((_a3 = props.style) == null ? void 0 : _a3.height) ? addGlowBorderOffset(props.style.height) : addGlowBorderOffset("100%");
|
|
210
|
-
const width = ((_b3 = props.style) == null ? void 0 : _b3.width) ? addGlowBorderOffset(props.style.width) : addGlowBorderOffset("100%");
|
|
211
|
-
return { height, width };
|
|
212
|
-
}, [(_d = props.style) == null ? void 0 : _d.height, (_e = props.style) == null ? void 0 : _e.width]);
|
|
213
206
|
const enlargedStyle = useMemo(() => {
|
|
214
|
-
var _a3;
|
|
215
207
|
if (!isEnlarged)
|
|
216
208
|
return {};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
left: "0",
|
|
223
|
-
right: "0",
|
|
224
|
-
bottom: "0",
|
|
225
|
-
width: "auto",
|
|
226
|
-
height: `calc(100% - ${topOffset}px)`,
|
|
227
|
-
maxWidth: "none",
|
|
228
|
-
zIndex: 1e3
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
return {};
|
|
232
|
-
}, [isEnlarged, props.enlargeTargetRef]);
|
|
209
|
+
return {
|
|
210
|
+
maxHeight: "980px",
|
|
211
|
+
minHeight: "280px"
|
|
212
|
+
};
|
|
213
|
+
}, [isEnlarged]);
|
|
233
214
|
const beforeTools = useMemo(() => {
|
|
234
215
|
if (props.beforeToolsRender) {
|
|
235
216
|
return props.beforeToolsRender(__spreadProps(__spreadValues({}, props), {
|
|
@@ -288,6 +269,113 @@ var MarkdownInputField = (_a) => {
|
|
|
288
269
|
}),
|
|
289
270
|
[fileMap, markdownProps == null ? void 0 : markdownProps.attachment]
|
|
290
271
|
);
|
|
272
|
+
const attachmentList = useMemo(() => {
|
|
273
|
+
var _a3;
|
|
274
|
+
if (!((_a3 = props.attachment) == null ? void 0 : _a3.enable))
|
|
275
|
+
return null;
|
|
276
|
+
return /* @__PURE__ */ React.createElement(
|
|
277
|
+
AttachmentFileList,
|
|
278
|
+
{
|
|
279
|
+
fileMap,
|
|
280
|
+
onDelete: handleFileRemoval,
|
|
281
|
+
onRetry: handleFileRetry,
|
|
282
|
+
onClearFileMap: () => {
|
|
283
|
+
updateAttachmentFiles(/* @__PURE__ */ new Map());
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}, [
|
|
288
|
+
fileMap,
|
|
289
|
+
(_h = props.attachment) == null ? void 0 : _h.enable,
|
|
290
|
+
handleFileRemoval,
|
|
291
|
+
handleFileRetry,
|
|
292
|
+
updateAttachmentFiles
|
|
293
|
+
]);
|
|
294
|
+
const handleKeyDown = useRefFunction(
|
|
295
|
+
(e) => {
|
|
296
|
+
var _a3;
|
|
297
|
+
const triggerSendKey = props.triggerSendKey || "Enter";
|
|
298
|
+
if ((_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store.inputComposition)
|
|
299
|
+
return;
|
|
300
|
+
const isEnter = e.key === "Enter";
|
|
301
|
+
const isMod = e.ctrlKey || e.metaKey;
|
|
302
|
+
if (triggerSendKey === "Enter") {
|
|
303
|
+
if (!(isEnter && !isMod))
|
|
304
|
+
return;
|
|
305
|
+
e.stopPropagation();
|
|
306
|
+
e.preventDefault();
|
|
307
|
+
if (props.onSend)
|
|
308
|
+
sendMessage();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (triggerSendKey === "Mod+Enter") {
|
|
312
|
+
if (!(isEnter && isMod))
|
|
313
|
+
return;
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
if (props.onSend)
|
|
317
|
+
sendMessage();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
const handleContainerClick = useRefFunction(
|
|
322
|
+
(e) => {
|
|
323
|
+
var _a3, _b3, _c2, _d2;
|
|
324
|
+
if ((_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store.inputComposition)
|
|
325
|
+
return;
|
|
326
|
+
if (props.disabled)
|
|
327
|
+
return;
|
|
328
|
+
if ((_b3 = actionsRef.current) == null ? void 0 : _b3.contains(e.target))
|
|
329
|
+
return;
|
|
330
|
+
if ((_c2 = quickActionsRef.current) == null ? void 0 : _c2.contains(e.target))
|
|
331
|
+
return;
|
|
332
|
+
const editor = (_d2 = markdownEditorRef.current) == null ? void 0 : _d2.markdownEditorRef.current;
|
|
333
|
+
if (!editor)
|
|
334
|
+
return;
|
|
335
|
+
if (ReactEditor.isFocused(editor))
|
|
336
|
+
return;
|
|
337
|
+
ReactEditor.focus(editor);
|
|
338
|
+
Transforms.move(editor, { distance: 1, unit: "offset" });
|
|
339
|
+
Transforms.select(editor, {
|
|
340
|
+
anchor: Editor.end(editor, []),
|
|
341
|
+
focus: Editor.end(editor, [])
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
const sendActionsNode = /* @__PURE__ */ React.createElement(
|
|
346
|
+
SendActions,
|
|
347
|
+
{
|
|
348
|
+
attachment: __spreadProps(__spreadValues({}, props.attachment), {
|
|
349
|
+
supportedFormat,
|
|
350
|
+
fileMap,
|
|
351
|
+
onFileMapChange: setFileMap,
|
|
352
|
+
upload: ((_i = props.attachment) == null ? void 0 : _i.upload) ? (file) => props.attachment.upload(file, 0) : void 0
|
|
353
|
+
}),
|
|
354
|
+
voiceRecognizer: props.voiceRecognizer,
|
|
355
|
+
value,
|
|
356
|
+
disabled: props.disabled,
|
|
357
|
+
typing: props.typing,
|
|
358
|
+
isLoading,
|
|
359
|
+
fileUploadDone,
|
|
360
|
+
recording,
|
|
361
|
+
collapseSendActions,
|
|
362
|
+
allowEmptySubmit: props.allowEmptySubmit,
|
|
363
|
+
uploadImage,
|
|
364
|
+
onStartRecording: startRecording,
|
|
365
|
+
onStopRecording: stopRecording,
|
|
366
|
+
onSend: sendMessage,
|
|
367
|
+
onStop: () => {
|
|
368
|
+
var _a3;
|
|
369
|
+
setIsLoading(false);
|
|
370
|
+
(_a3 = props.onStop) == null ? void 0 : _a3.call(props);
|
|
371
|
+
},
|
|
372
|
+
actionsRender: props.actionsRender,
|
|
373
|
+
prefixCls: baseCls,
|
|
374
|
+
hashId,
|
|
375
|
+
hasTools: !!props.toolsRender,
|
|
376
|
+
onResize: setRightPadding
|
|
377
|
+
}
|
|
378
|
+
);
|
|
291
379
|
return wrapSSR(
|
|
292
380
|
/* @__PURE__ */ React.createElement(React.Fragment, null, isShowTopOperatingArea && /* @__PURE__ */ React.createElement("div", { className: classNames(`${baseCls}-top-area`, hashId) }, /* @__PURE__ */ React.createElement(
|
|
293
381
|
TopOperatingArea,
|
|
@@ -316,60 +404,16 @@ var MarkdownInputField = (_a) => {
|
|
|
316
404
|
[`${baseCls}-enlarged`]: isEnlarged
|
|
317
405
|
}),
|
|
318
406
|
style: __spreadProps(__spreadValues(__spreadValues({}, props.style), enlargedStyle), {
|
|
407
|
+
height: isEnlarged ? `${(_k = (_j = props.enlargeable) == null ? void 0 : _j.height) != null ? _k : 980}px` : `${collapsedHeight}px`,
|
|
319
408
|
borderRadius: borderRadius || 16,
|
|
320
|
-
|
|
409
|
+
maxHeight: isEnlarged ? "none" : `${collapsedHeightPx}px`,
|
|
410
|
+
transition: "height, max-height 0.3s,border-radius 0.3s,box-shadow 0.3s,transform 0.3s,opacity 0.3s,background 0.3s"
|
|
321
411
|
}),
|
|
322
412
|
tabIndex: 1,
|
|
323
413
|
onMouseEnter: () => setHover(true),
|
|
324
414
|
onMouseLeave: () => setHover(false),
|
|
325
|
-
onKeyDown:
|
|
326
|
-
|
|
327
|
-
const { triggerSendKey = "Enter" } = props;
|
|
328
|
-
if ((_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store.inputComposition) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (triggerSendKey === "Enter" && e.key === "Enter" && !(e.ctrlKey || e.metaKey)) {
|
|
332
|
-
e.stopPropagation();
|
|
333
|
-
e.preventDefault();
|
|
334
|
-
if (props.onSend) {
|
|
335
|
-
sendMessage();
|
|
336
|
-
}
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (triggerSendKey === "Mod+Enter" && (e.ctrlKey || e.metaKey) && e.key === "Enter") {
|
|
340
|
-
e.stopPropagation();
|
|
341
|
-
e.preventDefault();
|
|
342
|
-
if (props.onSend) {
|
|
343
|
-
sendMessage();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
onClick: (e) => {
|
|
348
|
-
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
349
|
-
if ((_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store.inputComposition) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
if (props.disabled) {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
if ((_b3 = actionsRef.current) == null ? void 0 : _b3.contains(e.target)) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
if ((_c2 = quickActionsRef.current) == null ? void 0 : _c2.contains(e.target)) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
if (((_e2 = (_d2 = markdownEditorRef.current) == null ? void 0 : _d2.store) == null ? void 0 : _e2.editor) && !ReactEditor.isFocused((_g2 = (_f2 = markdownEditorRef.current) == null ? void 0 : _f2.store) == null ? void 0 : _g2.editor)) {
|
|
362
|
-
const editor = (_h2 = markdownEditorRef.current) == null ? void 0 : _h2.markdownEditorRef.current;
|
|
363
|
-
if (editor) {
|
|
364
|
-
ReactEditor.focus(editor);
|
|
365
|
-
Transforms.move(editor, { distance: 1, unit: "offset" });
|
|
366
|
-
Transforms.select(editor, {
|
|
367
|
-
anchor: Editor.end(editor, []),
|
|
368
|
-
focus: Editor.end(editor, [])
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
415
|
+
onKeyDown: handleKeyDown,
|
|
416
|
+
onClick: handleContainerClick
|
|
373
417
|
},
|
|
374
418
|
/* @__PURE__ */ React.createElement(
|
|
375
419
|
"div",
|
|
@@ -378,9 +422,9 @@ var MarkdownInputField = (_a) => {
|
|
|
378
422
|
[`${baseCls}-hover`]: isHover
|
|
379
423
|
}),
|
|
380
424
|
style: {
|
|
381
|
-
minHeight: ((
|
|
382
|
-
height:
|
|
383
|
-
width:
|
|
425
|
+
minHeight: ((_l = props.style) == null ? void 0 : _l.minHeight) || 0,
|
|
426
|
+
height: "100%",
|
|
427
|
+
width: "100%"
|
|
384
428
|
}
|
|
385
429
|
}
|
|
386
430
|
),
|
|
@@ -388,10 +432,10 @@ var MarkdownInputField = (_a) => {
|
|
|
388
432
|
"div",
|
|
389
433
|
{
|
|
390
434
|
style: {
|
|
391
|
-
flex: 1,
|
|
392
435
|
backgroundColor: "#fff",
|
|
393
|
-
width: "100%",
|
|
394
|
-
height: isEnlarged ? "100%" : "
|
|
436
|
+
width: "calc(100% - 4px)",
|
|
437
|
+
height: isEnlarged ? "calc(100% - 4px)" : "calc(100% - 4px)",
|
|
438
|
+
maxHeight: isEnlarged ? "calc(100% - 4px)" : "calc(100% - 4px)",
|
|
395
439
|
display: "flex",
|
|
396
440
|
zIndex: 9,
|
|
397
441
|
flexDirection: "column",
|
|
@@ -399,8 +443,7 @@ var MarkdownInputField = (_a) => {
|
|
|
399
443
|
borderRadius: (borderRadius || 16) - 2 || 10,
|
|
400
444
|
cursor: isLoading || props.disabled ? "not-allowed" : "auto",
|
|
401
445
|
opacity: props.disabled ? 0.5 : 1,
|
|
402
|
-
minHeight: isEnlarged ? "auto" : isMultiRowLayout ?
|
|
403
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)"
|
|
446
|
+
minHeight: isEnlarged ? "auto" : isMultiRowLayout ? 106 : void 0
|
|
404
447
|
}
|
|
405
448
|
},
|
|
406
449
|
/* @__PURE__ */ React.createElement(
|
|
@@ -418,8 +461,7 @@ var MarkdownInputField = (_a) => {
|
|
|
418
461
|
return `min(${base + extra}px)`;
|
|
419
462
|
})(),
|
|
420
463
|
height: isEnlarged ? "100%" : "auto",
|
|
421
|
-
flex: 1
|
|
422
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)"
|
|
464
|
+
flex: 1
|
|
423
465
|
},
|
|
424
466
|
className: classNames(`${baseCls}-editor`, hashId, {
|
|
425
467
|
[`${baseCls}-editor-hover`]: isHover,
|
|
@@ -433,20 +475,7 @@ var MarkdownInputField = (_a) => {
|
|
|
433
475
|
onSkillModeOpenChange: props.onSkillModeOpenChange
|
|
434
476
|
}
|
|
435
477
|
),
|
|
436
|
-
/* @__PURE__ */ React.createElement("div", { className: classNames(`${baseCls}-editor-content`, hashId) },
|
|
437
|
-
var _a3;
|
|
438
|
-
return ((_a3 = props.attachment) == null ? void 0 : _a3.enable) ? /* @__PURE__ */ React.createElement(
|
|
439
|
-
AttachmentFileList,
|
|
440
|
-
{
|
|
441
|
-
fileMap,
|
|
442
|
-
onDelete: handleFileRemoval,
|
|
443
|
-
onRetry: handleFileRetry,
|
|
444
|
-
onClearFileMap: () => {
|
|
445
|
-
updateAttachmentFiles(/* @__PURE__ */ new Map());
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
) : null;
|
|
449
|
-
}, [fileMap == null ? void 0 : fileMap.values(), (_g = props.attachment) == null ? void 0 : _g.enable]), /* @__PURE__ */ React.createElement(
|
|
478
|
+
/* @__PURE__ */ React.createElement("div", { className: classNames(`${baseCls}-editor-content`, hashId) }, attachmentList, /* @__PURE__ */ React.createElement(
|
|
450
479
|
BaseMarkdownEditor,
|
|
451
480
|
__spreadValues({
|
|
452
481
|
editorRef: markdownEditorRef,
|
|
@@ -465,7 +494,7 @@ var MarkdownInputField = (_a) => {
|
|
|
465
494
|
},
|
|
466
495
|
readonly: isLoading,
|
|
467
496
|
contentStyle: {
|
|
468
|
-
padding: "
|
|
497
|
+
padding: "var(--padding-card-base)"
|
|
469
498
|
},
|
|
470
499
|
textAreaProps: {
|
|
471
500
|
enable: true,
|
|
@@ -510,19 +539,19 @@ var MarkdownInputField = (_a) => {
|
|
|
510
539
|
justifyContent: "space-between",
|
|
511
540
|
gap: 8,
|
|
512
541
|
width: "100%",
|
|
513
|
-
paddingRight:
|
|
514
|
-
paddingLeft:
|
|
515
|
-
paddingBottom:
|
|
542
|
+
paddingRight: "var(--padding-card-base)",
|
|
543
|
+
paddingLeft: "var(--padding-card-base)",
|
|
544
|
+
paddingBottom: "var(--padding-card-base)"
|
|
516
545
|
}
|
|
517
546
|
},
|
|
518
|
-
|
|
547
|
+
/* @__PURE__ */ React.createElement(
|
|
519
548
|
"div",
|
|
520
549
|
{
|
|
521
550
|
ref: actionsRef,
|
|
522
551
|
contentEditable: false,
|
|
523
552
|
className: classNames(`${baseCls}-send-tools`, hashId)
|
|
524
553
|
},
|
|
525
|
-
props.toolsRender
|
|
554
|
+
props.toolsRender(__spreadProps(__spreadValues({
|
|
526
555
|
value,
|
|
527
556
|
fileMap,
|
|
528
557
|
onFileMapChange: setFileMap
|
|
@@ -530,77 +559,11 @@ var MarkdownInputField = (_a) => {
|
|
|
530
559
|
isHover,
|
|
531
560
|
isLoading,
|
|
532
561
|
fileUploadStatus: fileUploadDone ? "done" : "uploading"
|
|
533
|
-
}))
|
|
534
|
-
)
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
attachment: __spreadProps(__spreadValues({}, props.attachment), {
|
|
539
|
-
supportedFormat,
|
|
540
|
-
fileMap,
|
|
541
|
-
onFileMapChange: setFileMap,
|
|
542
|
-
upload: ((_h = props.attachment) == null ? void 0 : _h.upload) ? (file) => props.attachment.upload(file, 0) : void 0
|
|
543
|
-
}),
|
|
544
|
-
voiceRecognizer: props.voiceRecognizer,
|
|
545
|
-
value,
|
|
546
|
-
disabled: props.disabled,
|
|
547
|
-
typing: props.typing,
|
|
548
|
-
isLoading,
|
|
549
|
-
fileUploadDone,
|
|
550
|
-
recording,
|
|
551
|
-
collapseSendActions,
|
|
552
|
-
allowEmptySubmit: props.allowEmptySubmit,
|
|
553
|
-
uploadImage,
|
|
554
|
-
onStartRecording: startRecording,
|
|
555
|
-
onStopRecording: stopRecording,
|
|
556
|
-
onSend: sendMessage,
|
|
557
|
-
onStop: () => {
|
|
558
|
-
var _a3;
|
|
559
|
-
setIsLoading(false);
|
|
560
|
-
(_a3 = props.onStop) == null ? void 0 : _a3.call(props);
|
|
561
|
-
},
|
|
562
|
-
actionsRender: props.actionsRender,
|
|
563
|
-
prefixCls: baseCls,
|
|
564
|
-
hashId,
|
|
565
|
-
hasTools: !!props.toolsRender,
|
|
566
|
-
onResize: setRightPadding
|
|
567
|
-
}
|
|
568
|
-
)
|
|
569
|
-
) : /* @__PURE__ */ React.createElement(
|
|
570
|
-
SendActions,
|
|
571
|
-
{
|
|
572
|
-
attachment: __spreadProps(__spreadValues({}, props.attachment), {
|
|
573
|
-
supportedFormat,
|
|
574
|
-
fileMap,
|
|
575
|
-
onFileMapChange: setFileMap,
|
|
576
|
-
upload: ((_i = props.attachment) == null ? void 0 : _i.upload) ? (file) => props.attachment.upload(file, 0) : void 0
|
|
577
|
-
}),
|
|
578
|
-
voiceRecognizer: props.voiceRecognizer,
|
|
579
|
-
value,
|
|
580
|
-
disabled: props.disabled,
|
|
581
|
-
typing: props.typing,
|
|
582
|
-
isLoading,
|
|
583
|
-
fileUploadDone,
|
|
584
|
-
recording,
|
|
585
|
-
collapseSendActions,
|
|
586
|
-
allowEmptySubmit: props.allowEmptySubmit,
|
|
587
|
-
uploadImage,
|
|
588
|
-
onStartRecording: startRecording,
|
|
589
|
-
onStopRecording: stopRecording,
|
|
590
|
-
onSend: sendMessage,
|
|
591
|
-
onStop: () => {
|
|
592
|
-
var _a3;
|
|
593
|
-
setIsLoading(false);
|
|
594
|
-
(_a3 = props.onStop) == null ? void 0 : _a3.call(props);
|
|
595
|
-
},
|
|
596
|
-
actionsRender: props.actionsRender,
|
|
597
|
-
prefixCls: baseCls,
|
|
598
|
-
hashId,
|
|
599
|
-
hasTools: !!props.toolsRender,
|
|
600
|
-
onResize: setRightPadding
|
|
601
|
-
}
|
|
602
|
-
),
|
|
603
|
-
(props == null ? void 0 : props.quickActionRender) || ((_j = props.refinePrompt) == null ? void 0 : _j.enable) ? /* @__PURE__ */ React.createElement(
|
|
562
|
+
}))
|
|
563
|
+
),
|
|
564
|
+
sendActionsNode
|
|
565
|
+
) : sendActionsNode,
|
|
566
|
+
(props == null ? void 0 : props.quickActionRender) || ((_m = props.refinePrompt) == null ? void 0 : _m.enable) ? /* @__PURE__ */ React.createElement(
|
|
604
567
|
QuickActions,
|
|
605
568
|
{
|
|
606
569
|
ref: quickActionsRef,
|
|
@@ -621,7 +584,7 @@ var MarkdownInputField = (_a) => {
|
|
|
621
584
|
quickActionRender: props.quickActionRender,
|
|
622
585
|
prefixCls: baseCls,
|
|
623
586
|
hashId,
|
|
624
|
-
enlargeable: props.enlargeable,
|
|
587
|
+
enlargeable: !!((_n = props.enlargeable) == null ? void 0 : _n.enable),
|
|
625
588
|
isEnlarged,
|
|
626
589
|
onEnlargeClick: handleEnlargeClick,
|
|
627
590
|
onResize: (width, rightOffset) => {
|
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
// src/MarkdownInputField/RefinePromptButton/index.tsx
|
|
2
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
2
3
|
import { TextOptimize } from "@sofa-design/icons";
|
|
3
4
|
import { ConfigProvider, Tooltip } from "antd";
|
|
4
|
-
import classNames from "classnames";
|
|
5
5
|
import React, { useContext } from "react";
|
|
6
6
|
import { ErrorBoundary } from "react-error-boundary";
|
|
7
|
+
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
7
8
|
import { useStyle } from "./style";
|
|
8
|
-
function LoadingIcon() {
|
|
9
|
-
return /* @__PURE__ */ React.createElement(
|
|
10
|
-
"svg",
|
|
11
|
-
{
|
|
12
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
-
fill: "none",
|
|
14
|
-
width: "1em",
|
|
15
|
-
height: "1em",
|
|
16
|
-
viewBox: "0 0 32 32",
|
|
17
|
-
"aria-label": "Loading",
|
|
18
|
-
role: "img"
|
|
19
|
-
},
|
|
20
|
-
/* @__PURE__ */ React.createElement("circle", { cx: "16", cy: "16", r: "16", fill: "transparent" }),
|
|
21
|
-
/* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement(
|
|
22
|
-
"path",
|
|
23
|
-
{
|
|
24
|
-
className: "refine-icon-ring",
|
|
25
|
-
d: "M16 5.333a10.667 10.667 0 110 21.334A10.667 10.667 0 0116 5.333zm0 2.134a8.533 8.533 0 100 17.066 8.533 8.533 0 000-17.066z",
|
|
26
|
-
fill: "currentColor"
|
|
27
|
-
}
|
|
28
|
-
), /* @__PURE__ */ React.createElement(
|
|
29
|
-
"path",
|
|
30
|
-
{
|
|
31
|
-
className: "refine-icon-spinner",
|
|
32
|
-
d: "M16 2.667a13.333 13.333 0 0113.333 13.333 1.333 1.333 0 11-2.666 0 10.667 10.667 0 10-10.667 10.667 1.333 1.333 0 110 2.666A13.333 13.333 0 0116 2.667z",
|
|
33
|
-
fill: "currentColor"
|
|
34
|
-
}
|
|
35
|
-
))
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
9
|
var RefinePromptButton = (props) => {
|
|
39
|
-
const {
|
|
10
|
+
const { disabled, status, onRefine } = props;
|
|
40
11
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
41
12
|
const baseCls = getPrefixCls("agentic-md-input-field-refine-button");
|
|
42
|
-
const { wrapSSR
|
|
13
|
+
const { wrapSSR } = useStyle(baseCls);
|
|
43
14
|
const handleClick = () => {
|
|
44
15
|
if (disabled)
|
|
45
16
|
return;
|
|
@@ -49,7 +20,7 @@ var RefinePromptButton = (props) => {
|
|
|
49
20
|
};
|
|
50
21
|
const renderIcon = () => {
|
|
51
22
|
if (status === "loading")
|
|
52
|
-
return /* @__PURE__ */ React.createElement(
|
|
23
|
+
return /* @__PURE__ */ React.createElement(LoadingOutlined, null);
|
|
53
24
|
return /* @__PURE__ */ React.createElement(TextOptimize, null);
|
|
54
25
|
};
|
|
55
26
|
if (typeof window === "undefined" || typeof document === "undefined" || !window.document) {
|
|
@@ -57,27 +28,11 @@ var RefinePromptButton = (props) => {
|
|
|
57
28
|
}
|
|
58
29
|
return wrapSSR(
|
|
59
30
|
/* @__PURE__ */ React.createElement(Tooltip, { title: status === "loading" ? "优化中" : "一键优化提示词" }, /* @__PURE__ */ React.createElement(
|
|
60
|
-
|
|
31
|
+
ActionIconBox,
|
|
61
32
|
{
|
|
62
|
-
"data-testid": "refine-prompt-button",
|
|
63
|
-
onClick: handleClick,
|
|
64
|
-
style,
|
|
65
|
-
className: classNames(baseCls, hashId, {
|
|
66
|
-
[`${baseCls}-compact`]: props.compact,
|
|
67
|
-
[`${baseCls}-disabled`]: disabled,
|
|
68
|
-
[`${baseCls}-loading`]: status === "loading",
|
|
69
|
-
[`${baseCls}-hover`]: isHover && !disabled
|
|
70
|
-
}),
|
|
71
33
|
title: "优化提示词",
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
tabIndex: 0,
|
|
75
|
-
onKeyDown: (e) => {
|
|
76
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
handleClick();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
34
|
+
onClick: handleClick,
|
|
35
|
+
"data-testid": "refine-prompt-button"
|
|
81
36
|
},
|
|
82
37
|
/* @__PURE__ */ React.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React.createElement("div", null) }, renderIcon())
|
|
83
38
|
))
|