balibabu
commited on
Commit
·
512aaee
1
Parent(s):
cdbe301
fix: Fixed the issue where the error message was not displayed when uploading a file that was too large #1782 (#2654)
Browse files### What problem does this PR solve?
_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
web/src/hooks/file-manager-hooks.ts
CHANGED
@@ -208,13 +208,13 @@ export const useUploadFile = () => {
|
|
208 |
formData.append('path', pathList[index]);
|
209 |
});
|
210 |
try {
|
211 |
-
const
|
212 |
-
if (data.retcode === 0) {
|
213 |
message.success(t('message.uploaded'));
|
214 |
setPaginationParams(1);
|
215 |
queryClient.invalidateQueries({ queryKey: ['fetchFileList'] });
|
216 |
}
|
217 |
-
return data
|
218 |
} catch (error) {
|
219 |
console.log('🚀 ~ useUploadFile ~ error:', error);
|
220 |
}
|
|
|
208 |
formData.append('path', pathList[index]);
|
209 |
});
|
210 |
try {
|
211 |
+
const ret = await fileManagerService.uploadFile(formData);
|
212 |
+
if (ret?.data.retcode === 0) {
|
213 |
message.success(t('message.uploaded'));
|
214 |
setPaginationParams(1);
|
215 |
queryClient.invalidateQueries({ queryKey: ['fetchFileList'] });
|
216 |
}
|
217 |
+
return ret?.data?.retcode;
|
218 |
} catch (error) {
|
219 |
console.log('🚀 ~ useUploadFile ~ error:', error);
|
220 |
}
|
web/src/pages/add-knowledge/components/knowledge-file/model.ts
CHANGED
@@ -217,20 +217,20 @@ const model: DvaModel<KFModelState> = {
|
|
217 |
formData.append('file', file);
|
218 |
});
|
219 |
|
220 |
-
const
|
221 |
|
222 |
-
const succeed = data
|
223 |
|
224 |
if (succeed) {
|
225 |
message.success(i18n.t('message.uploaded'));
|
226 |
}
|
227 |
-
if (succeed || data
|
228 |
yield put({
|
229 |
type: 'getKfList',
|
230 |
payload: { kb_id: payload.kb_id },
|
231 |
});
|
232 |
}
|
233 |
-
return data;
|
234 |
},
|
235 |
*web_crawl({ payload = {} }, { call, put }) {
|
236 |
const formData = new FormData();
|
|
|
217 |
formData.append('file', file);
|
218 |
});
|
219 |
|
220 |
+
const ret = yield call(kbService.document_upload, formData);
|
221 |
|
222 |
+
const succeed = ret?.data?.retcode === 0;
|
223 |
|
224 |
if (succeed) {
|
225 |
message.success(i18n.t('message.uploaded'));
|
226 |
}
|
227 |
+
if (succeed || ret?.data?.retcode === 500) {
|
228 |
yield put({
|
229 |
type: 'getKfList',
|
230 |
payload: { kb_id: payload.kb_id },
|
231 |
});
|
232 |
}
|
233 |
+
return ret?.data;
|
234 |
},
|
235 |
*web_crawl({ payload = {} }, { call, put }) {
|
236 |
const formData = new FormData();
|