mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-14 14:25:40 -05:00
feat(ui): add autocomplete for Graph.addEdgeToMetadata
This commit is contained in:
@@ -9,6 +9,7 @@ import type {
|
||||
AnyInvocationInputField,
|
||||
AnyInvocationOutputField,
|
||||
AnyModelConfig,
|
||||
CoreMetadataFields,
|
||||
InputFields,
|
||||
Invocation,
|
||||
InvocationType,
|
||||
@@ -433,7 +434,7 @@ export class Graph {
|
||||
addEdgeToMetadata<TFrom extends AnyInvocation>(
|
||||
fromNode: TFrom,
|
||||
fromField: OutputFields<TFrom>,
|
||||
metadataField: string
|
||||
metadataField: CoreMetadataFields | (string & Record<string, never>)
|
||||
): Edge {
|
||||
// @ts-expect-error `Graph` excludes `core_metadata` nodes due to its excessively wide typing
|
||||
return this.addEdge(fromNode, fromField, this.getMetadataNode(), metadataField);
|
||||
|
||||
@@ -322,6 +322,15 @@ type NonInputFields = 'id' | 'type' | 'is_intermediate' | 'use_cache' | 'board'
|
||||
export type AnyInvocationInputField = Exclude<KeysOfUnion<Required<AnyInvocation>>, NonInputFields>;
|
||||
export type InputFields<T extends AnyInvocation> = Extract<keyof T, AnyInvocationInputField>;
|
||||
|
||||
type ExcludeIndexSignature<T> = {
|
||||
[K in keyof T as string extends K ? never : K]: T[K];
|
||||
};
|
||||
|
||||
export type CoreMetadataFields = Exclude<
|
||||
keyof ExcludeIndexSignature<components['schemas']['CoreMetadataInvocation']>,
|
||||
NonInputFields
|
||||
>;
|
||||
|
||||
type NonOutputFields = 'type';
|
||||
export type AnyInvocationOutputField = Exclude<KeysOfUnion<Required<AnyInvocationOutput>>, NonOutputFields>;
|
||||
export type OutputFields<T extends AnyInvocation> = Extract<
|
||||
|
||||
Reference in New Issue
Block a user