@ant-design/agentic-ui 2.0.23 → 2.0.24
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.
|
@@ -106,6 +106,7 @@ var MarkdownInputField = (_a) => {
|
|
|
106
106
|
const markdownEditorRef = React.useRef();
|
|
107
107
|
const quickActionsRef = React.useRef(null);
|
|
108
108
|
const actionsRef = React.useRef(null);
|
|
109
|
+
const isSendingRef = React.useRef(false);
|
|
109
110
|
const [collapseSendActions, setCollapseSendActions] = useState(() => {
|
|
110
111
|
if (typeof window === "undefined")
|
|
111
112
|
return false;
|
|
@@ -199,6 +200,10 @@ var MarkdownInputField = (_a) => {
|
|
|
199
200
|
return;
|
|
200
201
|
if (props.typing)
|
|
201
202
|
return;
|
|
203
|
+
if (isLoading)
|
|
204
|
+
return;
|
|
205
|
+
if (isSendingRef.current)
|
|
206
|
+
return;
|
|
202
207
|
if (recording)
|
|
203
208
|
yield stopRecording();
|
|
204
209
|
const mdValue = (_b3 = (_a3 = markdownEditorRef == null ? void 0 : markdownEditorRef.current) == null ? void 0 : _a3.store) == null ? void 0 : _b3.getMDContent();
|
|
@@ -206,6 +211,7 @@ var MarkdownInputField = (_a) => {
|
|
|
206
211
|
(_c2 = props.onChange) == null ? void 0 : _c2.call(props, mdValue);
|
|
207
212
|
}
|
|
208
213
|
if (props.onSend && (props.allowEmptySubmit || mdValue)) {
|
|
214
|
+
isSendingRef.current = true;
|
|
209
215
|
setIsLoading(true);
|
|
210
216
|
try {
|
|
211
217
|
yield props.onSend(mdValue || "");
|
|
@@ -213,8 +219,12 @@ var MarkdownInputField = (_a) => {
|
|
|
213
219
|
(_f2 = props.onChange) == null ? void 0 : _f2.call(props, "");
|
|
214
220
|
setValue("");
|
|
215
221
|
setFileMap == null ? void 0 : setFileMap(/* @__PURE__ */ new Map());
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.error("Send message failed:", error);
|
|
224
|
+
throw error;
|
|
216
225
|
} finally {
|
|
217
226
|
setIsLoading(false);
|
|
227
|
+
isSendingRef.current = false;
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
}));
|
|
@@ -328,8 +338,9 @@ var MarkdownInputField = (_a) => {
|
|
|
328
338
|
return;
|
|
329
339
|
e.stopPropagation();
|
|
330
340
|
e.preventDefault();
|
|
331
|
-
if (props.onSend)
|
|
341
|
+
if (props.onSend && !isLoading && !props.disabled && !props.typing) {
|
|
332
342
|
sendMessage();
|
|
343
|
+
}
|
|
333
344
|
}
|
|
334
345
|
}
|
|
335
346
|
);
|
|
@@ -748,13 +748,7 @@ ${instrumented}`;
|
|
|
748
748
|
);
|
|
749
749
|
if (!worker)
|
|
750
750
|
return;
|
|
751
|
-
this.setupWorkerHandlers(
|
|
752
|
-
worker,
|
|
753
|
-
workerUrl,
|
|
754
|
-
timeoutId,
|
|
755
|
-
resolve,
|
|
756
|
-
reject
|
|
757
|
-
);
|
|
751
|
+
this.setupWorkerHandlers(worker, workerUrl, timeoutId, resolve, reject);
|
|
758
752
|
});
|
|
759
753
|
}
|
|
760
754
|
/**
|