fix(ui): model install progress sets total bytes correctly

This commit is contained in:
psychedelicious 2024-02-27 15:52:06 +11:00
parent 80065858ed
commit b218282149

View File

@ -12,13 +12,14 @@ export const addModelInstallEventListener = () => {
startAppListening({
actionCreator: socketModelInstallDownloading,
effect: async (action, { dispatch }) => {
const { bytes, id } = action.payload.data;
const { bytes, total_bytes, id } = action.payload.data;
dispatch(
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
const modelImport = draft.find((m) => m.id === id);
if (modelImport) {
modelImport.bytes = bytes;
modelImport.total_bytes = total_bytes;
modelImport.status = 'downloading';
}
return draft;
@ -48,7 +49,7 @@ export const addModelInstallEventListener = () => {
startAppListening({
actionCreator: socketModelInstallError,
effect: (action, { dispatch }) => {
const { id, error_type } = action.payload.data;
const { id, error, error_type } = action.payload.data;
dispatch(
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
@ -56,6 +57,7 @@ export const addModelInstallEventListener = () => {
if (modelImport) {
modelImport.status = 'error';
modelImport.error_reason = error_type;
modelImport.error = error;
}
return draft;
})