@ant-design/agentic-ui 2.0.8 → 2.0.10
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/style.js +4 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.d.ts +0 -33
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +15 -16
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts +4 -45
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +107 -146
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +100 -67
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +25 -1
- package/dist/MarkdownInputField/AttachmentButton/index.js +28 -11
- package/dist/MarkdownInputField/AttachmentButton/types.d.ts +15 -0
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +265 -199
- package/dist/MarkdownInputField/FileMapView/style.js +1 -0
- package/dist/MarkdownInputField/FileUploadManager/index.js +19 -6
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ var useFileUploadManager = ({
|
|
|
76
76
|
input.id = "uploadImage_" + Math.random();
|
|
77
77
|
input.type = "file";
|
|
78
78
|
input.accept = ((_a = supportedFormat == null ? void 0 : supportedFormat.extensions) == null ? void 0 : _a.join(",")) || "image/*";
|
|
79
|
-
input.multiple =
|
|
79
|
+
input.multiple = false;
|
|
80
80
|
input.style.display = "none";
|
|
81
81
|
input.onchange = (e) => __async(void 0, null, function* () {
|
|
82
82
|
if (input.dataset.readonly) {
|
|
@@ -116,14 +116,25 @@ var useFileUploadManager = ({
|
|
|
116
116
|
}
|
|
117
117
|
}));
|
|
118
118
|
const handleFileRetry = useRefFunction((file) => __async(void 0, null, function* () {
|
|
119
|
-
var _a;
|
|
120
119
|
try {
|
|
121
120
|
file.status = "uploading";
|
|
122
121
|
const map = new Map(fileMap);
|
|
123
122
|
map.set(file.uuid || "", file);
|
|
124
123
|
updateAttachmentFiles(map);
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
let url;
|
|
125
|
+
let isSuccess = false;
|
|
126
|
+
let errorMsg = null;
|
|
127
|
+
if (attachment == null ? void 0 : attachment.uploadWithResponse) {
|
|
128
|
+
const uploadResult = yield attachment.uploadWithResponse(file, 0);
|
|
129
|
+
url = uploadResult.fileUrl;
|
|
130
|
+
isSuccess = uploadResult.uploadStatus === "SUCCESS";
|
|
131
|
+
errorMsg = uploadResult.errorMessage || null;
|
|
132
|
+
file.uploadResponse = uploadResult;
|
|
133
|
+
} else if (attachment == null ? void 0 : attachment.upload) {
|
|
134
|
+
url = yield attachment.upload(file);
|
|
135
|
+
isSuccess = !!url;
|
|
136
|
+
}
|
|
137
|
+
if (isSuccess && url) {
|
|
127
138
|
file.status = "done";
|
|
128
139
|
file.url = url;
|
|
129
140
|
map.set(file.uuid || "", file);
|
|
@@ -133,7 +144,8 @@ var useFileUploadManager = ({
|
|
|
133
144
|
file.status = "error";
|
|
134
145
|
map.set(file.uuid || "", file);
|
|
135
146
|
updateAttachmentFiles(map);
|
|
136
|
-
|
|
147
|
+
const failedMsg = errorMsg || (locale == null ? void 0 : locale.uploadFailed) || "Upload failed";
|
|
148
|
+
message.error(failedMsg);
|
|
137
149
|
}
|
|
138
150
|
} catch (error) {
|
|
139
151
|
console.error("Error retrying file upload:", error);
|
|
@@ -141,7 +153,8 @@ var useFileUploadManager = ({
|
|
|
141
153
|
const map = new Map(fileMap);
|
|
142
154
|
map.set(file.uuid || "", file);
|
|
143
155
|
updateAttachmentFiles(map);
|
|
144
|
-
message
|
|
156
|
+
const errorMessage = error instanceof Error ? error.message : (locale == null ? void 0 : locale.uploadFailed) || "Upload failed";
|
|
157
|
+
message.error(errorMessage);
|
|
145
158
|
}
|
|
146
159
|
}));
|
|
147
160
|
return {
|