Centralize negative prompt hygiene
This commit is contained in:
@@ -3,9 +3,9 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from .prompt_hygiene import sanitize_caption_text, sanitize_negative_text, sanitize_prompt_text
|
||||
from .prompt_hygiene import combine_negative_text, sanitize_caption_text, sanitize_negative_text, sanitize_prompt_text
|
||||
except ImportError: # Allows local smoke tests with `python tools/prompt_smoke.py`.
|
||||
from prompt_hygiene import sanitize_caption_text, sanitize_negative_text, sanitize_prompt_text
|
||||
from prompt_hygiene import combine_negative_text, sanitize_caption_text, sanitize_negative_text, sanitize_prompt_text
|
||||
|
||||
|
||||
def _trigger_tuple(active_trigger: str) -> tuple[str, ...]:
|
||||
@@ -24,8 +24,7 @@ def prepend_trigger(prompt: str, trigger: str, enabled: bool) -> str:
|
||||
|
||||
|
||||
def combined_negative(base: str, extra: str) -> str:
|
||||
parts = [str(part).strip() for part in (base, extra) if part and str(part).strip()]
|
||||
return ", ".join(parts)
|
||||
return combine_negative_text(base, extra)
|
||||
|
||||
|
||||
def caption_from_parts(parts: list[Any] | tuple[Any, ...], *, active_trigger: str = "") -> str:
|
||||
|
||||
Reference in New Issue
Block a user