mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add nodesAllowlist
to config
This commit is contained in:
parent
cc92ce3da5
commit
74cc409c72
@ -14,10 +14,11 @@ export const addReceivedOpenAPISchemaListener = () => {
|
|||||||
const schemaJSON = action.payload;
|
const schemaJSON = action.payload;
|
||||||
|
|
||||||
log.debug({ schemaJSON }, 'Received OpenAPI schema');
|
log.debug({ schemaJSON }, 'Received OpenAPI schema');
|
||||||
|
const { nodesAllowlist, nodesDenylist } = getState().config;
|
||||||
const nodeTemplates = parseSchema(
|
const nodeTemplates = parseSchema(
|
||||||
schemaJSON,
|
schemaJSON,
|
||||||
getState().config.nodesDenylist
|
nodesAllowlist,
|
||||||
|
nodesDenylist
|
||||||
);
|
);
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
|
@ -50,7 +50,8 @@ export type AppConfig = {
|
|||||||
disabledFeatures: AppFeature[];
|
disabledFeatures: AppFeature[];
|
||||||
disabledSDFeatures: SDFeature[];
|
disabledSDFeatures: SDFeature[];
|
||||||
canRestoreDeletedImagesFromBin: boolean;
|
canRestoreDeletedImagesFromBin: boolean;
|
||||||
nodesDenylist: string[];
|
nodesAllowlist: string[] | undefined;
|
||||||
|
nodesDenylist: string[] | undefined;
|
||||||
sd: {
|
sd: {
|
||||||
defaultModel?: string;
|
defaultModel?: string;
|
||||||
disabledControlNetModels: string[];
|
disabledControlNetModels: string[];
|
||||||
|
@ -61,13 +61,21 @@ const isNotInDenylist = (schema: InvocationSchemaObject) =>
|
|||||||
|
|
||||||
export const parseSchema = (
|
export const parseSchema = (
|
||||||
openAPI: OpenAPIV3.Document,
|
openAPI: OpenAPIV3.Document,
|
||||||
nodesDenylistExtra: string[] = []
|
nodesAllowlistExtra: string[] | undefined = undefined,
|
||||||
|
nodesDenylistExtra: string[] | undefined = undefined
|
||||||
): Record<string, InvocationTemplate> => {
|
): Record<string, InvocationTemplate> => {
|
||||||
const filteredSchemas = Object.values(openAPI.components?.schemas ?? {})
|
const filteredSchemas = Object.values(openAPI.components?.schemas ?? {})
|
||||||
.filter(isInvocationSchemaObject)
|
.filter(isInvocationSchemaObject)
|
||||||
.filter(isNotInDenylist)
|
.filter(isNotInDenylist)
|
||||||
.filter(
|
.filter((schema) =>
|
||||||
(schema) => !nodesDenylistExtra.includes(schema.properties.type.default)
|
nodesAllowlistExtra
|
||||||
|
? nodesAllowlistExtra.includes(schema.properties.type.default)
|
||||||
|
: true
|
||||||
|
)
|
||||||
|
.filter((schema) =>
|
||||||
|
nodesDenylistExtra
|
||||||
|
? !nodesDenylistExtra.includes(schema.properties.type.default)
|
||||||
|
: true
|
||||||
);
|
);
|
||||||
|
|
||||||
const invocations = filteredSchemas.reduce<
|
const invocations = filteredSchemas.reduce<
|
||||||
|
@ -15,7 +15,8 @@ export const initialConfigState: AppConfig = {
|
|||||||
'perlinNoise',
|
'perlinNoise',
|
||||||
'noiseThreshold',
|
'noiseThreshold',
|
||||||
],
|
],
|
||||||
nodesDenylist: [],
|
nodesAllowlist: undefined,
|
||||||
|
nodesDenylist: undefined,
|
||||||
canRestoreDeletedImagesFromBin: true,
|
canRestoreDeletedImagesFromBin: true,
|
||||||
sd: {
|
sd: {
|
||||||
disabledControlNetModels: [],
|
disabledControlNetModels: [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user