mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix controlnet selects data types
This commit is contained in:
parent
6c551df311
commit
70ffd6b03f
@ -1,6 +1,8 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import IAIMantineSelect from 'common/components/IAIMantineSelect';
|
||||
import IAIMantineSelect, {
|
||||
IAISelectDataType,
|
||||
} from 'common/components/IAIMantineSelect';
|
||||
import { useIsReadyToInvoke } from 'common/hooks/useIsReadyToInvoke';
|
||||
import {
|
||||
CONTROLNET_MODELS,
|
||||
@ -17,7 +19,7 @@ type ParamControlNetModelProps = {
|
||||
};
|
||||
|
||||
const selector = createSelector(configSelector, (config) => {
|
||||
return map(CONTROLNET_MODELS, (m) => ({
|
||||
const controlNetModels: IAISelectDataType[] = map(CONTROLNET_MODELS, (m) => ({
|
||||
label: m.label,
|
||||
value: m.type,
|
||||
})).filter(
|
||||
@ -26,6 +28,8 @@ const selector = createSelector(configSelector, (config) => {
|
||||
d.value as ControlNetModelName
|
||||
)
|
||||
);
|
||||
|
||||
return controlNetModels;
|
||||
});
|
||||
|
||||
const ParamControlNetModel = (props: ParamControlNetModelProps) => {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
|
||||
import IAIMantineSelect from 'common/components/IAIMantineSelect';
|
||||
import IAIMantineSelect, {
|
||||
IAISelectDataType,
|
||||
} from 'common/components/IAIMantineSelect';
|
||||
import { map } from 'lodash-es';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { CONTROLNET_PROCESSORS } from '../../store/constants';
|
||||
@ -22,17 +24,20 @@ type ParamControlNetProcessorSelectProps = {
|
||||
const selector = createSelector(
|
||||
configSelector,
|
||||
(config) => {
|
||||
return map(CONTROLNET_PROCESSORS, (p) => ({
|
||||
const controlNetProcessors: IAISelectDataType[] = map(
|
||||
CONTROLNET_PROCESSORS,
|
||||
(p) => ({
|
||||
value: p.type,
|
||||
key: p.label,
|
||||
}))
|
||||
label: p.label,
|
||||
})
|
||||
)
|
||||
.sort((a, b) =>
|
||||
// sort 'none' to the top
|
||||
a.value === 'none'
|
||||
? -1
|
||||
: b.value === 'none'
|
||||
? 1
|
||||
: a.key.localeCompare(b.key)
|
||||
: a.label.localeCompare(b.label)
|
||||
)
|
||||
.filter(
|
||||
(d) =>
|
||||
@ -40,6 +45,8 @@ const selector = createSelector(
|
||||
d.value as ControlNetProcessorType
|
||||
)
|
||||
);
|
||||
|
||||
return controlNetProcessors;
|
||||
},
|
||||
defaultSelectorOptions
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user