revert: getModels to receivedModels

This commit is contained in:
blessedcoolant 2023-06-18 19:35:46 +12:00
parent e0c105f413
commit 9634c96020
6 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
import { log } from 'app/logging/useLogger';
import { appSocketConnected, socketConnected } from 'services/events/actions';
import { receivedPageOfImages } from 'services/thunks/image';
import { getModels } from 'services/thunks/model';
import { receivedModels } from 'services/thunks/model';
import { receivedOpenAPISchema } from 'services/thunks/schema';
import { startAppListening } from '../..';
@ -25,11 +25,11 @@ export const addSocketConnectedEventListener = () => {
}
if (!sd1pipelinemodels.ids.length) {
dispatch(getModels({ baseModel: 'sd-1', modelType: 'pipeline' }));
dispatch(receivedModels({ baseModel: 'sd-1', modelType: 'pipeline' }));
}
if (!sd2pipelinemodels.ids.length) {
dispatch(getModels({ baseModel: 'sd-2', modelType: 'pipeline' }));
dispatch(receivedModels({ baseModel: 'sd-2', modelType: 'pipeline' }));
}
if (!nodes.schema && !disabledTabs.includes('nodes')) {

View File

@ -5,7 +5,7 @@ import { configChanged } from 'features/system/store/configSlice';
import { clamp, sortBy } from 'lodash-es';
import { ImageDTO } from 'services/api';
import { imageUrlsReceived } from 'services/thunks/image';
import { getModels } from 'services/thunks/model';
import { receivedModels } from 'services/thunks/model';
import {
CfgScaleParam,
HeightParam,
@ -224,7 +224,7 @@ export const generationSlice = createSlice({
},
},
extraReducers: (builder) => {
builder.addCase(getModels.fulfilled, (state, action) => {
builder.addCase(receivedModels.fulfilled, (state, action) => {
if (!state.model) {
const firstModel = sortBy(action.payload, 'name')[0];
state.model = firstModel.name;

View File

@ -5,7 +5,7 @@ import {
StableDiffusion1ModelDiffusersConfig,
} from 'services/api';
import { getModels } from 'services/thunks/model';
import { receivedModels } from 'services/thunks/model';
export type SD1PipelineModelType = (
| StableDiffusion1ModelCheckpointConfig
@ -35,7 +35,7 @@ export const sd1PipelineModelsSlice = createSlice({
/**
* Received Models - FULFILLED
*/
builder.addCase(getModels.fulfilled, (state, action) => {
builder.addCase(receivedModels.fulfilled, (state, action) => {
if (action.meta.arg.baseModel !== 'sd-1') return;
sd1PipelineModelsAdapter.setAll(state, action.payload);
});

View File

@ -5,7 +5,7 @@ import {
StableDiffusion2ModelDiffusersConfig,
} from 'services/api';
import { getModels } from 'services/thunks/model';
import { receivedModels } from 'services/thunks/model';
export type SD2PipelineModelType = (
| StableDiffusion2ModelCheckpointConfig
@ -35,7 +35,7 @@ export const sd2PipelineModelsSlice = createSlice({
/**
* Received Models - FULFILLED
*/
builder.addCase(getModels.fulfilled, (state, action) => {
builder.addCase(receivedModels.fulfilled, (state, action) => {
if (action.meta.arg.baseModel !== 'sd-2') return;
sd2PipelineModelsAdapater.setAll(state, action.payload);
});

View File

@ -20,7 +20,7 @@ import {
} from 'services/events/actions';
import { ProgressImage } from 'services/events/types';
import { imageUploaded } from 'services/thunks/image';
import { getModels } from 'services/thunks/model';
import { receivedModels } from 'services/thunks/model';
import { isAnySessionRejected, sessionCanceled } from 'services/thunks/session';
import { makeToast } from '../../../app/components/Toaster';
import { LANGUAGES } from '../components/LanguagePicker';
@ -377,7 +377,7 @@ export const systemSlice = createSlice({
/**
* Received available models from the backend
*/
builder.addCase(getModels.fulfilled, (state) => {
builder.addCase(receivedModels.fulfilled, (state) => {
state.wereModelsReceived = true;
});

View File

@ -9,14 +9,14 @@ const models = log.child({ namespace: 'model' });
export const IMAGES_PER_PAGE = 20;
type getModelsArg = {
type receivedModelsArg = {
baseModel: BaseModelType | undefined;
modelType: ModelType | undefined;
};
export const getModels = createAppAsyncThunk(
'models/getModels',
async (arg: getModelsArg) => {
export const receivedModels = createAppAsyncThunk(
'models/receivedModels',
async (arg: receivedModelsArg) => {
const response = await ModelsService.listModels(arg);
let deserializedModels = {};