mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
@@ -49,6 +49,7 @@ Plus new **Krea 2** model and **SDNQ** improvements: now with NPU support and it
|
||||
- `hipBLASLt` improved detection, thanks @0xDELUXA
|
||||
- `embeddings` handle textual-inversion with new transformers
|
||||
- `options` handle compatibility options
|
||||
- `log` strip ansi sequences from ring buffer and client side logging
|
||||
|
||||
## Update for 2026-06-16
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from fastapi.exceptions import HTTPException
|
||||
from fastapi.responses import JSONResponse, Response
|
||||
from fastapi.responses import Response
|
||||
from modules import shared
|
||||
from modules.logger import log
|
||||
from modules.api import models, helpers
|
||||
@@ -92,7 +92,7 @@ def get_embeddings():
|
||||
def get_wildcards():
|
||||
"""List wildcard basenames (relative path with `.txt` stripped) from the configured wildcards directory."""
|
||||
from modules import ui_extra_networks_wildcards
|
||||
return [models.ItemWildcard(name=n) for n in ui_extra_networks_wildcards.list_wildcard_names()]
|
||||
return [{"name": n} for n in ui_extra_networks_wildcards.list_wildcard_names()]
|
||||
|
||||
def get_extra_networks(page: str | None = None, name: str | None = None, filename: str | None = None, title: str | None = None, fullname: str | None = None, hash: str | None = None): # pylint: disable=redefined-builtin
|
||||
"""List extra networks (LoRA, checkpoints, embeddings, etc.) with optional filtering by page, name, filename, title, fullname, or hash."""
|
||||
|
||||
@@ -10,11 +10,9 @@ from PIL import Image
|
||||
from modules import shared, images, files_cache, modelstats
|
||||
from modules.logger import log
|
||||
from modules.paths import resolve_output_path
|
||||
from modules.api import models
|
||||
|
||||
|
||||
debug = log.debug if os.environ.get('SD_BROWSER_DEBUG', None) is not None else lambda *args, **kwargs: None
|
||||
|
||||
|
||||
OPTS_FOLDERS = [
|
||||
"outdir_samples",
|
||||
"outdir_txt2img_samples",
|
||||
@@ -140,13 +138,13 @@ def register_api(api): # register api
|
||||
log.error(f'Gallery image failed: file="{filepath}" | Error: {e}')
|
||||
return {}
|
||||
|
||||
# @app.get('/sdapi/v1/browser/folders', response_model=list[models.ItemFolder])
|
||||
# @app.get('/sdapi/v1/browser/folders', response_model=list[dict])
|
||||
def get_folders():
|
||||
def make_folder(path, label=None):
|
||||
"""Create folder entry with path and display label."""
|
||||
if label is None:
|
||||
label = os.path.basename(path) or path
|
||||
return models.ItemFolder(path=path, label=label)
|
||||
return {"path": path, "label": label}
|
||||
|
||||
reference_dir = os.path.join('models', 'Reference')
|
||||
base_samples = shared.opts.outdir_samples
|
||||
|
||||
@@ -262,13 +262,6 @@ class ItemExtension(BaseModel):
|
||||
commit_date: str | int = Field(title="Commit Date", description="Extension Repository Commit Date")
|
||||
enabled: bool = Field(title="Enabled", description="Flag specifying whether this extension is enabled")
|
||||
|
||||
class ItemFolder(BaseModel):
|
||||
path: str = Field(title="Path", description="Full path to the folder")
|
||||
label: str = Field(title="Label", description="Display label for the folder")
|
||||
|
||||
class ItemWildcard(BaseModel):
|
||||
name: str = Field(title="Name", description="Wildcard basename (relative path with .txt stripped)")
|
||||
|
||||
class ItemScheduler(BaseModel):
|
||||
name: str = Field(title="Name", description="Scheduler name")
|
||||
cls: str = Field(title="Class", description="Scheduler class name")
|
||||
|
||||
+8
-2
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import logging
|
||||
import socket
|
||||
@@ -102,6 +103,10 @@ def setup_logging(debug=None, trace=None, filename=None):
|
||||
self.buffer = []
|
||||
self.formatter = logging.Formatter('{ "asctime":"%(asctime)s", "created":%(created)f, "facility":"%(name)s", "pid":%(process)d, "tid":%(thread)d, "level":"%(levelname)s", "module":"%(module)s", "func":"%(funcName)s", "msg":"%(message)s" }')
|
||||
|
||||
def strip(self, line):
|
||||
ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]')
|
||||
return ansi_escape.sub('', str(line))
|
||||
|
||||
def emit(self, record):
|
||||
if record.msg is not None and not isinstance(record.msg, str):
|
||||
record.msg = str(record.msg)
|
||||
@@ -109,8 +114,9 @@ def setup_logging(debug=None, trace=None, filename=None):
|
||||
record.msg = record.msg.replace('"', "'")
|
||||
except Exception:
|
||||
pass
|
||||
msg = self.format(record)
|
||||
self.buffer.append(msg)
|
||||
line = self.format(record)
|
||||
line = self.strip(line)
|
||||
self.buffer.append(line[:1024])
|
||||
if len(self.buffer) > self.capacity:
|
||||
self.buffer.pop(0)
|
||||
|
||||
|
||||
Vendored
+8
-3
@@ -12004,7 +12004,10 @@ function htmlEscape(text) {
|
||||
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
||||
}
|
||||
function parseLogLine(line) {
|
||||
const parsed = JSON.parse(line.replaceAll("\n", " ").replaceAll("\\", "\\\\"));
|
||||
let str = line.replaceAll("\n", " ").replaceAll("\\", "\\\\");
|
||||
const tracebackIndex = str.indexOf("Traceback");
|
||||
if (tracebackIndex !== -1) str = str.substring(0, tracebackIndex);
|
||||
const parsed = JSON.parse(str);
|
||||
return {
|
||||
created: Number(parsed.created ?? Date.now()),
|
||||
level: String(parsed.level ?? "INFO"),
|
||||
@@ -12029,8 +12032,10 @@ async function logMonitor() {
|
||||
row.innerHTML = `<td>${dateToStr(l.created)}</td>${level}${facility}${module}<td>${htmlEscape(l.msg)}</td>`;
|
||||
logMonitorEl.appendChild(row);
|
||||
} catch (err) {
|
||||
error(`logMonitor: ${String(err)}
|
||||
${line}`);
|
||||
error(`logMonitor: ${String(err)}`);
|
||||
error(`logMonitor: ${line}`);
|
||||
console.error(line);
|
||||
window.eee = line;
|
||||
}
|
||||
};
|
||||
const cleanupLog = (atBottom2) => {
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+8
-2
@@ -34,7 +34,10 @@ function htmlEscape(text: string): string {
|
||||
}
|
||||
|
||||
function parseLogLine(line: string): LogLine {
|
||||
const parsed = JSON.parse(line.replaceAll('\n', ' ').replaceAll('\\', '\\\\')) as Partial<LogLine>;
|
||||
let str = line.replaceAll('\n', ' ').replaceAll('\\', '\\\\');
|
||||
const tracebackIndex = str.indexOf('Traceback');
|
||||
if (tracebackIndex !== -1) str = str.substring(0, tracebackIndex);
|
||||
const parsed = JSON.parse(str) as Partial<LogLine>;
|
||||
return {
|
||||
created: Number(parsed.created ?? Date.now()),
|
||||
level: String(parsed.level ?? 'INFO'),
|
||||
@@ -61,7 +64,10 @@ async function logMonitor() {
|
||||
row.innerHTML = `<td>${dateToStr(l.created)}</td>${level}${facility}${module}<td>${htmlEscape(l.msg)}</td>`;
|
||||
logMonitorEl.appendChild(row);
|
||||
} catch (err) {
|
||||
error(`logMonitor: ${String(err)}\n${line}`);
|
||||
error(`logMonitor: ${String(err)}`);
|
||||
error(`logMonitor: ${line}`);
|
||||
console.error(line);
|
||||
window.eee = line;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user