format: auto-format code [skip ci]
This commit is contained in:
+8
-17
@@ -794,7 +794,9 @@ def generate( # noqa: PLR0915
|
||||
] = None,
|
||||
scene_prompt: Annotated[
|
||||
str | None,
|
||||
typer.Option("--scene-prompt", help='Inline scene fragment, comma-separated (e.g. "luxury penthouse, volumetric lighting")'),
|
||||
typer.Option(
|
||||
"--scene-prompt", help='Inline scene fragment, comma-separated (e.g. "luxury penthouse, volumetric lighting")'
|
||||
),
|
||||
] = None,
|
||||
family: Annotated[
|
||||
str | None,
|
||||
@@ -920,9 +922,7 @@ def generate( # noqa: PLR0915
|
||||
character_prompt = ", ".join(str(x) for x in val if str(x).strip())
|
||||
if "character_prompt" in mapped and "character_prompt" not in explicit:
|
||||
cp_val = mapped["character_prompt"]
|
||||
character_prompt = (
|
||||
cp_val if isinstance(cp_val, str) else ", ".join(str(x) for x in cp_val if str(x).strip())
|
||||
)
|
||||
character_prompt = cp_val if isinstance(cp_val, str) else ", ".join(str(x) for x in cp_val if str(x).strip())
|
||||
if "scene" in mapped and "scene" not in explicit:
|
||||
sv = mapped["scene"]
|
||||
if isinstance(sv, str):
|
||||
@@ -931,9 +931,7 @@ def generate( # noqa: PLR0915
|
||||
scene_prompt = ", ".join(str(x) for x in sv if str(x).strip())
|
||||
if "scene_prompt" in mapped and "scene_prompt" not in explicit:
|
||||
sp_val = mapped["scene_prompt"]
|
||||
scene_prompt = (
|
||||
sp_val if isinstance(sp_val, str) else ", ".join(str(x) for x in sp_val if str(x).strip())
|
||||
)
|
||||
scene_prompt = sp_val if isinstance(sp_val, str) else ", ".join(str(x) for x in sp_val if str(x).strip())
|
||||
if "rating" in mapped and "rating" not in explicit:
|
||||
rating = mapped["rating"]
|
||||
|
||||
@@ -1150,10 +1148,7 @@ def _run_generation( # noqa: PLR0915
|
||||
prompt_parts.extend(scene_elements)
|
||||
if not json_output:
|
||||
origin = f"'{scene}'" if scene else "inline"
|
||||
console.print(
|
||||
f"[dim]Scene ({origin}, {len(scene_elements)} elements): "
|
||||
f"{', '.join(scene_elements)}[/dim]"
|
||||
)
|
||||
console.print(f"[dim]Scene ({origin}, {len(scene_elements)} elements): {', '.join(scene_elements)}[/dim]")
|
||||
|
||||
# Add rating tag based on model family (Pony/Illustrious)
|
||||
if rating:
|
||||
@@ -1744,11 +1739,7 @@ def style_sweep( # noqa: PLR0915
|
||||
elif isinstance(name_val, (list, tuple)):
|
||||
inline_out = ", ".join(str(x) for x in name_val if str(x).strip())
|
||||
if prompt_val is not None:
|
||||
inline_out = (
|
||||
prompt_val
|
||||
if isinstance(prompt_val, str)
|
||||
else ", ".join(str(x) for x in prompt_val if str(x).strip())
|
||||
)
|
||||
inline_out = prompt_val if isinstance(prompt_val, str) else ", ".join(str(x) for x in prompt_val if str(x).strip())
|
||||
return name_out, inline_out
|
||||
|
||||
char_name, char_inline = _split_fragment(tpl_data.get("character"), tpl_data.get("character_prompt"))
|
||||
@@ -1950,7 +1941,7 @@ def template(
|
||||
str | None,
|
||||
typer.Option(
|
||||
"--scene-prompt",
|
||||
help='Inline scene fragment, comma-separated (merged with --scene into `scene`)',
|
||||
help="Inline scene fragment, comma-separated (merged with --scene into `scene`)",
|
||||
),
|
||||
] = None,
|
||||
output: Annotated[Path | None, typer.Option("-o", "--output", help="Save template to file")] = None,
|
||||
|
||||
@@ -55,9 +55,7 @@ class FragmentLibrary:
|
||||
|
||||
def _validate_name(self, name: str) -> None:
|
||||
if not name or not _NAME_RE.match(name):
|
||||
raise ValueError(
|
||||
f"Invalid {self._singular} name {name!r}: only letters, digits, '.', '_', '-' allowed"
|
||||
)
|
||||
raise ValueError(f"Invalid {self._singular} name {name!r}: only letters, digits, '.', '_', '-' allowed")
|
||||
|
||||
def path(self, name: str) -> Path:
|
||||
"""Return the on-disk path for ``name`` (without ensuring it exists)."""
|
||||
@@ -108,9 +106,7 @@ class FragmentLibrary:
|
||||
value = str(value)
|
||||
except json.JSONDecodeError:
|
||||
value = (
|
||||
item[1:-1].replace("''", "'")
|
||||
if len(item) >= _MIN_QUOTED_SCALAR_LEN and item[0] == item[-1] == "'"
|
||||
else item
|
||||
item[1:-1].replace("''", "'") if len(item) >= _MIN_QUOTED_SCALAR_LEN and item[0] == item[-1] == "'" else item
|
||||
)
|
||||
elements.append(value)
|
||||
return elements
|
||||
|
||||
Reference in New Issue
Block a user