mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
updated model manager to display when import item is cancelled
This commit is contained in:
parent
54f1a1f952
commit
2a648da557
@ -405,7 +405,7 @@ class EventServiceBase:
|
|||||||
payload={"source": source, "total_bytes": total_bytes, "key": key, "id": id},
|
payload={"source": source, "total_bytes": total_bytes, "key": key, "id": id},
|
||||||
)
|
)
|
||||||
|
|
||||||
def emit_model_install_cancelled(self, source: str) -> None:
|
def emit_model_install_cancelled(self, source: str, id: int) -> None:
|
||||||
"""
|
"""
|
||||||
Emit when an install job is cancelled.
|
Emit when an install job is cancelled.
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ class EventServiceBase:
|
|||||||
"""
|
"""
|
||||||
self.__emit_model_event(
|
self.__emit_model_event(
|
||||||
event_name="model_install_cancelled",
|
event_name="model_install_cancelled",
|
||||||
payload={"source": source},
|
payload={"source": source, "id": id},
|
||||||
)
|
)
|
||||||
|
|
||||||
def emit_model_install_error(self, source: str, error_type: str, error: str, id: int) -> None:
|
def emit_model_install_error(self, source: str, error_type: str, error: str, id: int) -> None:
|
||||||
|
@ -892,7 +892,7 @@ class ModelInstallService(ModelInstallServiceBase):
|
|||||||
def _signal_job_cancelled(self, job: ModelInstallJob) -> None:
|
def _signal_job_cancelled(self, job: ModelInstallJob) -> None:
|
||||||
self._logger.info(f"{job.source}: model installation was cancelled")
|
self._logger.info(f"{job.source}: model installation was cancelled")
|
||||||
if self._event_bus:
|
if self._event_bus:
|
||||||
self._event_bus.emit_model_install_cancelled(str(job.source))
|
self._event_bus.emit_model_install_cancelled(str(job.source), id=job.id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_fetcher_from_url(url: str):
|
def get_fetcher_from_url(url: str):
|
||||||
|
@ -2,6 +2,7 @@ import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'
|
|||||||
import { api } from 'services/api';
|
import { api } from 'services/api';
|
||||||
import { modelsApi } from 'services/api/endpoints/models';
|
import { modelsApi } from 'services/api/endpoints/models';
|
||||||
import {
|
import {
|
||||||
|
socketModelInstallCancelled,
|
||||||
socketModelInstallCompleted,
|
socketModelInstallCompleted,
|
||||||
socketModelInstallDownloading,
|
socketModelInstallDownloading,
|
||||||
socketModelInstallError,
|
socketModelInstallError,
|
||||||
@ -63,4 +64,21 @@ export const addModelInstallEventListener = (startAppListening: AppStartListenin
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
startAppListening({
|
||||||
|
actionCreator: socketModelInstallCancelled,
|
||||||
|
effect: (action, { dispatch }) => {
|
||||||
|
const { id } = action.payload.data;
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
modelsApi.util.updateQueryData('listModelInstalls', undefined, (draft) => {
|
||||||
|
const modelImport = draft.find((m) => m.id === id);
|
||||||
|
if (modelImport) {
|
||||||
|
modelImport.status = 'cancelled';
|
||||||
|
}
|
||||||
|
return draft;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@ import type {
|
|||||||
InvocationErrorEvent,
|
InvocationErrorEvent,
|
||||||
InvocationRetrievalErrorEvent,
|
InvocationRetrievalErrorEvent,
|
||||||
InvocationStartedEvent,
|
InvocationStartedEvent,
|
||||||
|
ModelInstallCancelledEvent,
|
||||||
ModelInstallCompletedEvent,
|
ModelInstallCompletedEvent,
|
||||||
ModelInstallDownloadingEvent,
|
ModelInstallDownloadingEvent,
|
||||||
ModelInstallErrorEvent,
|
ModelInstallErrorEvent,
|
||||||
@ -71,6 +72,10 @@ export const socketModelInstallError = createAction<{
|
|||||||
data: ModelInstallErrorEvent;
|
data: ModelInstallErrorEvent;
|
||||||
}>('socket/socketModelInstallError');
|
}>('socket/socketModelInstallError');
|
||||||
|
|
||||||
|
export const socketModelInstallCancelled = createAction<{
|
||||||
|
data: ModelInstallCancelledEvent;
|
||||||
|
}>('socket/socketModelInstallCancelled');
|
||||||
|
|
||||||
export const socketSessionRetrievalError = createAction<{
|
export const socketSessionRetrievalError = createAction<{
|
||||||
data: SessionRetrievalErrorEvent;
|
data: SessionRetrievalErrorEvent;
|
||||||
}>('socket/socketSessionRetrievalError');
|
}>('socket/socketSessionRetrievalError');
|
||||||
|
@ -69,6 +69,12 @@ export type ModelInstallErrorEvent = {
|
|||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ModelInstallCancelledEvent = {
|
||||||
|
source: string;
|
||||||
|
timestamp: number;
|
||||||
|
id: number;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A `generator_progress` socket.io event.
|
* A `generator_progress` socket.io event.
|
||||||
*
|
*
|
||||||
@ -264,6 +270,7 @@ export type ServerToClientEvents = {
|
|||||||
model_install_downloading: (payload: ModelInstallDownloadingEvent) => void;
|
model_install_downloading: (payload: ModelInstallDownloadingEvent) => void;
|
||||||
model_install_completed: (payload: ModelInstallCompletedEvent) => void;
|
model_install_completed: (payload: ModelInstallCompletedEvent) => void;
|
||||||
model_install_error: (payload: ModelInstallErrorEvent) => void;
|
model_install_error: (payload: ModelInstallErrorEvent) => void;
|
||||||
|
model_install_canceled: (payload: ModelInstallCancelledEvent) => void;
|
||||||
session_retrieval_error: (payload: SessionRetrievalErrorEvent) => void;
|
session_retrieval_error: (payload: SessionRetrievalErrorEvent) => void;
|
||||||
invocation_retrieval_error: (payload: InvocationRetrievalErrorEvent) => void;
|
invocation_retrieval_error: (payload: InvocationRetrievalErrorEvent) => void;
|
||||||
queue_item_status_changed: (payload: QueueItemStatusChangedEvent) => void;
|
queue_item_status_changed: (payload: QueueItemStatusChangedEvent) => void;
|
||||||
|
Loading…
Reference in New Issue
Block a user