mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add UI-level nodes denylist
This simply hides nodes from the workflow editor. The nodes will still work if an API request is made with them. For example, you could hide `iterate` nodes from the workflow editor, but if the Linear UI makes use of those nodes, they will still function. - Update `AppConfig` with optional property `nodesDenylist: string[]` - If provided, nodes are filtered out by `type` in the workflow editor
This commit is contained in:
parent
dc771d9645
commit
7254a6a517
@ -9,13 +9,16 @@ import { startAppListening } from '..';
|
|||||||
export const addReceivedOpenAPISchemaListener = () => {
|
export const addReceivedOpenAPISchemaListener = () => {
|
||||||
startAppListening({
|
startAppListening({
|
||||||
actionCreator: receivedOpenAPISchema.fulfilled,
|
actionCreator: receivedOpenAPISchema.fulfilled,
|
||||||
effect: (action, { dispatch }) => {
|
effect: (action, { dispatch, getState }) => {
|
||||||
const log = logger('system');
|
const log = logger('system');
|
||||||
const schemaJSON = action.payload;
|
const schemaJSON = action.payload;
|
||||||
|
|
||||||
log.debug({ schemaJSON }, 'Received OpenAPI schema');
|
log.debug({ schemaJSON }, 'Received OpenAPI schema');
|
||||||
|
|
||||||
const nodeTemplates = parseSchema(schemaJSON);
|
const nodeTemplates = parseSchema(
|
||||||
|
schemaJSON,
|
||||||
|
getState().config.nodesDenylist
|
||||||
|
);
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
{ nodeTemplates: parseify(nodeTemplates) },
|
{ nodeTemplates: parseify(nodeTemplates) },
|
||||||
|
@ -50,6 +50,7 @@ export type AppConfig = {
|
|||||||
disabledFeatures: AppFeature[];
|
disabledFeatures: AppFeature[];
|
||||||
disabledSDFeatures: SDFeature[];
|
disabledSDFeatures: SDFeature[];
|
||||||
canRestoreDeletedImagesFromBin: boolean;
|
canRestoreDeletedImagesFromBin: boolean;
|
||||||
|
nodesDenylist: string[];
|
||||||
sd: {
|
sd: {
|
||||||
defaultModel?: string;
|
defaultModel?: string;
|
||||||
disabledControlNetModels: string[];
|
disabledControlNetModels: string[];
|
||||||
|
@ -60,11 +60,15 @@ const isNotInDenylist = (schema: InvocationSchemaObject) =>
|
|||||||
!invocationDenylist.includes(schema.properties.type.default);
|
!invocationDenylist.includes(schema.properties.type.default);
|
||||||
|
|
||||||
export const parseSchema = (
|
export const parseSchema = (
|
||||||
openAPI: OpenAPIV3.Document
|
openAPI: OpenAPIV3.Document,
|
||||||
|
nodesDenylistExtra: string[] = []
|
||||||
): 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(
|
||||||
|
(schema) => !nodesDenylistExtra.includes(schema.properties.type.default)
|
||||||
|
);
|
||||||
|
|
||||||
const invocations = filteredSchemas.reduce<
|
const invocations = filteredSchemas.reduce<
|
||||||
Record<string, InvocationTemplate>
|
Record<string, InvocationTemplate>
|
||||||
|
@ -15,6 +15,7 @@ export const initialConfigState: AppConfig = {
|
|||||||
'perlinNoise',
|
'perlinNoise',
|
||||||
'noiseThreshold',
|
'noiseThreshold',
|
||||||
],
|
],
|
||||||
|
nodesDenylist: [],
|
||||||
canRestoreDeletedImagesFromBin: true,
|
canRestoreDeletedImagesFromBin: true,
|
||||||
sd: {
|
sd: {
|
||||||
disabledControlNetModels: [],
|
disabledControlNetModels: [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user