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 { log } from 'app/logging/useLogger';
import { appSocketConnected, socketConnected } from 'services/events/actions'; import { appSocketConnected, socketConnected } from 'services/events/actions';
import { receivedPageOfImages } from 'services/thunks/image'; 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 { receivedOpenAPISchema } from 'services/thunks/schema';
import { startAppListening } from '../..'; import { startAppListening } from '../..';
@ -25,11 +25,11 @@ export const addSocketConnectedEventListener = () => {
} }
if (!sd1pipelinemodels.ids.length) { if (!sd1pipelinemodels.ids.length) {
dispatch(getModels({ baseModel: 'sd-1', modelType: 'pipeline' })); dispatch(receivedModels({ baseModel: 'sd-1', modelType: 'pipeline' }));
} }
if (!sd2pipelinemodels.ids.length) { if (!sd2pipelinemodels.ids.length) {
dispatch(getModels({ baseModel: 'sd-2', modelType: 'pipeline' })); dispatch(receivedModels({ baseModel: 'sd-2', modelType: 'pipeline' }));
} }
if (!nodes.schema && !disabledTabs.includes('nodes')) { 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 { clamp, sortBy } from 'lodash-es';
import { ImageDTO } from 'services/api'; import { ImageDTO } from 'services/api';
import { imageUrlsReceived } from 'services/thunks/image'; import { imageUrlsReceived } from 'services/thunks/image';
import { getModels } from 'services/thunks/model'; import { receivedModels } from 'services/thunks/model';
import { import {
CfgScaleParam, CfgScaleParam,
HeightParam, HeightParam,
@ -224,7 +224,7 @@ export const generationSlice = createSlice({
}, },
}, },
extraReducers: (builder) => { extraReducers: (builder) => {
builder.addCase(getModels.fulfilled, (state, action) => { builder.addCase(receivedModels.fulfilled, (state, action) => {
if (!state.model) { if (!state.model) {
const firstModel = sortBy(action.payload, 'name')[0]; const firstModel = sortBy(action.payload, 'name')[0];
state.model = firstModel.name; state.model = firstModel.name;

View File

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

View File

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

View File

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

View File

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