mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-15 20:58:33 -05:00
Compare commits
17 Commits
feat/invoc
...
invoke-3.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cc54915e3 | ||
|
|
228497a375 | ||
|
|
d43cd17f0a | ||
|
|
e4f6a1078e | ||
|
|
e9da116642 | ||
|
|
9024c2f11c | ||
|
|
a1cf091f2e | ||
|
|
a7ff82247c | ||
|
|
97e29cf595 | ||
|
|
e444e1272c | ||
|
|
f177798894 | ||
|
|
cf6b2904b1 | ||
|
|
2643f9aa30 | ||
|
|
13449b96ef | ||
|
|
f36b5990ed | ||
|
|
5706237ec7 | ||
|
|
163b22a7b3 |
131
invokeai/app/invocations/adapters_linked.py
Normal file
131
invokeai/app/invocations/adapters_linked.py
Normal file
@@ -0,0 +1,131 @@
|
||||
from typing import Optional, Union
|
||||
|
||||
from invokeai.app.invocations.baseinvocation import (
|
||||
BaseInvocationOutput,
|
||||
Input,
|
||||
InputField,
|
||||
InvocationContext,
|
||||
OutputField,
|
||||
invocation,
|
||||
invocation_output,
|
||||
)
|
||||
from invokeai.app.invocations.controlnet_image_processors import ControlField, ControlNetInvocation
|
||||
from invokeai.app.invocations.ip_adapter import IPAdapterField, IPAdapterInvocation
|
||||
from invokeai.app.invocations.t2i_adapter import T2IAdapterField, T2IAdapterInvocation
|
||||
from invokeai.app.shared.fields import FieldDescriptions
|
||||
|
||||
|
||||
def append_list(new_item, items, item_cls):
|
||||
"""Add an item to an exiting item or list of items then output as a list of items."""
|
||||
|
||||
result = []
|
||||
if items is None or (isinstance(items, list) and len(items) == 0):
|
||||
pass
|
||||
elif isinstance(items, item_cls):
|
||||
result.append(items)
|
||||
elif isinstance(items, list) and all(isinstance(i, item_cls) for i in items):
|
||||
result.extend(items)
|
||||
else:
|
||||
raise ValueError(f"Invalid adapter list format: {items}")
|
||||
|
||||
result.append(new_item)
|
||||
return result
|
||||
|
||||
|
||||
@invocation_output("control_list_output")
|
||||
class ControlListOutput(BaseInvocationOutput):
|
||||
# Outputs
|
||||
control_list: list[ControlField] = OutputField(description=FieldDescriptions.control)
|
||||
|
||||
|
||||
@invocation(
|
||||
"controlnet-linked",
|
||||
title="ControlNet-Linked",
|
||||
tags=["controlnet"],
|
||||
category="controlnet",
|
||||
version="1.1.0",
|
||||
)
|
||||
class ControlNetLinkedInvocation(ControlNetInvocation):
|
||||
"""Collects ControlNet info to pass to other nodes."""
|
||||
|
||||
control_list: Optional[Union[ControlField, list[ControlField]]] = InputField(
|
||||
default=None,
|
||||
title="ControlNet-List",
|
||||
input=Input.Connection,
|
||||
ui_order=0,
|
||||
)
|
||||
|
||||
def invoke(self, context: InvocationContext) -> ControlListOutput:
|
||||
# Call parent
|
||||
output = super().invoke(context).control
|
||||
# Append the control output to the input list
|
||||
control_list = append_list(output, self.control_list, ControlField)
|
||||
return ControlListOutput(control_list=control_list)
|
||||
|
||||
|
||||
@invocation_output("ip_adapter_list_output")
|
||||
class IPAdapterListOutput(BaseInvocationOutput):
|
||||
# Outputs
|
||||
ip_adapter_list: list[IPAdapterField] = OutputField(
|
||||
description=FieldDescriptions.ip_adapter, title="IP-Adapter-List"
|
||||
)
|
||||
|
||||
|
||||
@invocation(
|
||||
"ip_adapter_linked",
|
||||
title="IP-Adapter-Linked",
|
||||
tags=["ip_adapter", "control"],
|
||||
category="ip_adapter",
|
||||
version="1.1.0",
|
||||
)
|
||||
class IPAdapterLinkedInvocation(IPAdapterInvocation):
|
||||
"""Collects IP-Adapter info to pass to other nodes."""
|
||||
|
||||
ip_adapter_list: Optional[Union[IPAdapterField, list[IPAdapterField]]] = InputField(
|
||||
description=FieldDescriptions.ip_adapter,
|
||||
title="IP-Adapter-List",
|
||||
default=None,
|
||||
input=Input.Connection,
|
||||
ui_order=0,
|
||||
)
|
||||
|
||||
def invoke(self, context: InvocationContext) -> IPAdapterListOutput:
|
||||
# Call parent
|
||||
output = super().invoke(context).ip_adapter
|
||||
# Append the control output to the input list
|
||||
result = append_list(output, self.ip_adapter_list, IPAdapterField)
|
||||
return IPAdapterListOutput(ip_adapter_list=result)
|
||||
|
||||
|
||||
@invocation_output("ip_adapters_output")
|
||||
class T2IAdapterListOutput(BaseInvocationOutput):
|
||||
# Outputs
|
||||
t2i_adapter_list: list[T2IAdapterField] = OutputField(
|
||||
description=FieldDescriptions.t2i_adapter, title="T2I Adapter-List"
|
||||
)
|
||||
|
||||
|
||||
@invocation(
|
||||
"t2i_adapter_linked",
|
||||
title="T2I-Adapter-Linked",
|
||||
tags=["t2i_adapter", "control"],
|
||||
category="t2i_adapter",
|
||||
version="1.0.0",
|
||||
)
|
||||
class T2IAdapterLinkedInvocation(T2IAdapterInvocation):
|
||||
"""Collects T2I-Adapter info to pass to other nodes."""
|
||||
|
||||
t2i_adapter_list: Optional[Union[T2IAdapterField, list[T2IAdapterField]]] = InputField(
|
||||
description=FieldDescriptions.ip_adapter,
|
||||
title="T2I-Adapter",
|
||||
default=None,
|
||||
input=Input.Connection,
|
||||
ui_order=0,
|
||||
)
|
||||
|
||||
def invoke(self, context: InvocationContext) -> T2IAdapterListOutput:
|
||||
# Call parent
|
||||
output = super().invoke(context).t2i_adapter
|
||||
# Append the control output to the input list
|
||||
t2i_adapter_list = append_list(output, self.t2i_adapter_list, T2IAdapterField)
|
||||
return T2IAdapterListOutput(t2i_adapter_list=t2i_adapter_list)
|
||||
1029
invokeai/app/invocations/metadata_linked.py
Normal file
1029
invokeai/app/invocations/metadata_linked.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -52,10 +52,22 @@ const dynamicBaseQuery: BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryE
|
||||
const baseUrl = $baseUrl.get();
|
||||
const authToken = $authToken.get();
|
||||
const projectId = $projectId.get();
|
||||
const isOpenAPIRequest =
|
||||
(args instanceof Object && args.url.includes('openapi.json')) ||
|
||||
(typeof args === 'string' && args.includes('openapi.json'));
|
||||
|
||||
const fetchBaseQueryArgs: FetchBaseQueryArgs = {
|
||||
baseUrl: baseUrl ? `${baseUrl}/api/v1` : `${window.location.href.replace(/\/$/, '')}/api/v1`,
|
||||
prepareHeaders: (headers) => {
|
||||
};
|
||||
|
||||
// When fetching the openapi.json, we need to remove circular references from the JSON.
|
||||
if (isOpenAPIRequest) {
|
||||
fetchBaseQueryArgs.jsonReplacer = getCircularReplacer();
|
||||
}
|
||||
|
||||
// openapi.json isn't protected by authorization, but all other requests need to include the auth token and project id.
|
||||
if (!isOpenAPIRequest) {
|
||||
fetchBaseQueryArgs.prepareHeaders = (headers) => {
|
||||
if (authToken) {
|
||||
headers.set('Authorization', `Bearer ${authToken}`);
|
||||
}
|
||||
@@ -64,15 +76,7 @@ const dynamicBaseQuery: BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryE
|
||||
}
|
||||
|
||||
return headers;
|
||||
},
|
||||
};
|
||||
|
||||
// When fetching the openapi.json, we need to remove circular references from the JSON.
|
||||
if (
|
||||
(args instanceof Object && args.url.includes('openapi.json')) ||
|
||||
(typeof args === 'string' && args.includes('openapi.json'))
|
||||
) {
|
||||
fetchBaseQueryArgs.jsonReplacer = getCircularReplacer();
|
||||
};
|
||||
}
|
||||
|
||||
const rawBaseQuery = fetchBaseQuery(fetchBaseQueryArgs);
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "3.6.3"
|
||||
__version__ = "3.7.0"
|
||||
|
||||
Reference in New Issue
Block a user