mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
detect if user has patchmatch enabled
This commit is contained in:
parent
fba25792f9
commit
d6c914eedc
@ -6,8 +6,10 @@ import { generationSelector } from 'features/parameters/store/generationSelector
|
|||||||
import { setInfillMethod } from 'features/parameters/store/generationSlice';
|
import { setInfillMethod } from 'features/parameters/store/generationSlice';
|
||||||
import { systemSelector } from 'features/system/store/systemSelectors';
|
import { systemSelector } from 'features/system/store/systemSelectors';
|
||||||
|
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback, useEffect, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useGetAppConfigQuery } from '../../../../../../services/api/endpoints/appInfo';
|
||||||
|
import { setAvailableInfillMethods } from '../../../../../system/store/systemSlice';
|
||||||
|
|
||||||
const selector = createSelector(
|
const selector = createSelector(
|
||||||
[generationSelector, systemSelector],
|
[generationSelector, systemSelector],
|
||||||
@ -27,6 +29,8 @@ const ParamInfillMethod = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { infillMethod, infillMethods } = useAppSelector(selector);
|
const { infillMethod, infillMethods } = useAppSelector(selector);
|
||||||
|
|
||||||
|
const { data: appConfigData } = useGetAppConfigQuery();
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleChange = useCallback(
|
const handleChange = useCallback(
|
||||||
@ -36,6 +40,19 @@ const ParamInfillMethod = () => {
|
|||||||
[dispatch]
|
[dispatch]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!appConfigData) return;
|
||||||
|
if (!appConfigData.patchmatch_enabled) {
|
||||||
|
const filteredMethods = infillMethods.filter(
|
||||||
|
(method) => method !== 'patchmatch'
|
||||||
|
);
|
||||||
|
dispatch(setAvailableInfillMethods(filteredMethods));
|
||||||
|
dispatch(setInfillMethod(filteredMethods[0]));
|
||||||
|
} else {
|
||||||
|
dispatch(setInfillMethod('patchmatch'));
|
||||||
|
}
|
||||||
|
}, [appConfigData, infillMethods, dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IAIMantineSelect
|
<IAIMantineSelect
|
||||||
label={t('parameters.infillMethod')}
|
label={t('parameters.infillMethod')}
|
||||||
|
@ -219,6 +219,9 @@ export const systemSlice = createSlice({
|
|||||||
progressImageSet(state, action: PayloadAction<ProgressImage | null>) {
|
progressImageSet(state, action: PayloadAction<ProgressImage | null>) {
|
||||||
state.progressImage = action.payload;
|
state.progressImage = action.payload;
|
||||||
},
|
},
|
||||||
|
setAvailableInfillMethods(state, action: PayloadAction<InfillMethod[]>) {
|
||||||
|
state.infillMethods = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
extraReducers(builder) {
|
extraReducers(builder) {
|
||||||
/**
|
/**
|
||||||
@ -451,6 +454,7 @@ export const {
|
|||||||
shouldAntialiasProgressImageChanged,
|
shouldAntialiasProgressImageChanged,
|
||||||
languageChanged,
|
languageChanged,
|
||||||
progressImageSet,
|
progressImageSet,
|
||||||
|
setAvailableInfillMethods,
|
||||||
} = systemSlice.actions;
|
} = systemSlice.actions;
|
||||||
|
|
||||||
export default systemSlice.reducer;
|
export default systemSlice.reducer;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { api } from '..';
|
import { api } from '..';
|
||||||
import { AppVersion } from '../types';
|
import { AppVersion, AppConfig } from '../types';
|
||||||
|
|
||||||
export const appInfoApi = api.injectEndpoints({
|
export const appInfoApi = api.injectEndpoints({
|
||||||
endpoints: (build) => ({
|
endpoints: (build) => ({
|
||||||
@ -9,7 +9,13 @@ export const appInfoApi = api.injectEndpoints({
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
getAppConfig: build.query<AppConfig, void>({
|
||||||
|
query: () => ({
|
||||||
|
url: `app/config`,
|
||||||
|
method: 'GET',
|
||||||
|
}),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const { useGetAppVersionQuery } = appInfoApi;
|
export const { useGetAppVersionQuery, useGetAppConfigQuery } = appInfoApi;
|
||||||
|
1375
invokeai/frontend/web/src/services/api/schema.d.ts
vendored
1375
invokeai/frontend/web/src/services/api/schema.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,7 @@ type TypeReq<T> = O.Required<T, 'type'>;
|
|||||||
|
|
||||||
// App Info
|
// App Info
|
||||||
export type AppVersion = components['schemas']['AppVersion'];
|
export type AppVersion = components['schemas']['AppVersion'];
|
||||||
|
export type AppConfig = components['schemas']['AppConfig'];
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
export type ImageDTO = components['schemas']['ImageDTO'];
|
export type ImageDTO = components['schemas']['ImageDTO'];
|
||||||
|
Loading…
Reference in New Issue
Block a user