mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-04-29 05:20:26 +00:00
Upload: communicate failure, minor frontend updates (#2048)
* (feat:pause-stream) generator exit * (feat:pause-stream) close request * (feat:pause-stream) finally close; google anthropic * (feat:task_status)communicate failure * (clean:connector) unused routes * (feat:file-table) missing skeletons * (fix:apiKeys) build err --------- Co-authored-by: GH Action - Upstream Sync <action@github.com>
This commit is contained in:
@@ -291,12 +291,12 @@ function Upload({
|
||||
id: clientTaskId,
|
||||
updates: {
|
||||
status: 'failed',
|
||||
errorMessage: errorMessage || t('attachments.uploadFailed'),
|
||||
errorMessage: errorMessage,
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
[dispatch, t],
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
const trackTraining = useCallback(
|
||||
@@ -308,6 +308,15 @@ function Upload({
|
||||
.getTaskStatus(backendTaskId, null)
|
||||
.then((response) => response.json())
|
||||
.then(async (data) => {
|
||||
if (!data.success && data.message) {
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
handleTaskFailure(clientTaskId, data.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
@@ -376,12 +385,12 @@ function Upload({
|
||||
timeoutId = window.setTimeout(poll, 5000);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
handleTaskFailure(clientTaskId);
|
||||
handleTaskFailure(clientTaskId, error?.message);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user