You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mm): support generic API tokens via regex/token pairs in config
A list of regex and token pairs is accepted. As a file is downloaded by the model installer, the URL is tested against the provided regex/token pairs. The token for the first matching regex is used during download, added as a bearer token.
url_regex: str=Field(description="Regular expression to match against the URL")
211
+
token: str=Field(description="Token to use when the URL matches the regex")
212
+
213
+
@field_validator("url_regex")
214
+
@classmethod
215
+
defvalidate_url_regex(cls, v: str) ->str:
216
+
"""Validate that the value is a valid regex."""
217
+
try:
218
+
re.compile(v)
219
+
exceptre.errorase:
220
+
raiseValueError(f"Invalid regex: {e}")
221
+
returnv
222
+
223
+
208
224
classInvokeAIAppConfig(InvokeAISettings):
209
225
"""Configuration object for InvokeAI App."""
210
226
@@ -288,7 +304,7 @@ class InvokeAIAppConfig(InvokeAISettings):
288
304
node_cache_size : int=Field(default=512, description="How many cached nodes to keep in memory", json_schema_extra=Categories.Nodes)
289
305
290
306
# MODEL IMPORT
291
-
remote_repo_api_key: Optional[str]=Field(default=os.environ.get("INVOKEAI_REMOTE_REPO_API_KEY"), description="API key used when downloading remote repositories", json_schema_extra=Categories.Other)
307
+
remote_api_tokens: Optional[list[URLRegexToken]]=Field(default=None, description="List of regular expression and token pairs used when downloading models from URLs. The download URL is tested against the regex, and if it matches, the token is provided in as a Bearer token.", json_schema_extra=Categories.Other)
292
308
293
309
# DEPRECATED FIELDS - STILL HERE IN ORDER TO OBTAN VALUES FROM PRE-3.1 CONFIG FILES
294
310
always_use_cpu : bool=Field(default=False, description="If true, use the CPU for rendering even if a GPU is available.", json_schema_extra=Categories.MemoryPerformance)
0 commit comments