diff --git a/ltx_director.py b/ltx_director.py
index e06098a..3fb342f 100644
--- a/ltx_director.py
+++ b/ltx_director.py
@@ -439,9 +439,10 @@ _PROVIDER_DEFAULTS = {
}
_ANALYZE_PROMPT = (
- "Describe the character's physical appearance in two concise sentences. "
- "Specify their hair color/style, face details, and their clothing type/color. "
- "Keep the entire response very brief."
+ "Describe only the visible character in exactly two short sentences. "
+ "Mention hair, face, standout physical traits, and clothing. "
+ "Output only the description itself. Do not explain, do not list requirements, "
+ "do not say what the user wants, and do not include headings, bullets, or notes."
)
@@ -512,58 +513,6 @@ def _analysis_text_is_usable(text: str) -> bool:
return True
-def _sanitize_analysis_text(text: str) -> str:
- text = (text or "").strip()
- if not text:
- return ""
-
- if "" in text:
- text = text.split("")[-1].strip()
-
- cleaned_lines = []
- for raw_line in text.splitlines():
- line = raw_line.strip().replace("**", "")
- if not line:
- continue
- lower = line.lower()
- if lower.startswith("the user wants"):
- continue
- if lower.startswith("key elements to include"):
- continue
- if lower.startswith("drafting the sentences"):
- continue
- if lower.startswith("sentence 1"):
- continue
- if lower.startswith("sentence 2"):
- continue
- if line.startswith("*"):
- continue
- if re.match(r"^\d+\.\s", line):
- continue
- cleaned_lines.append(line)
-
- text = " ".join(cleaned_lines).strip()
- text = re.sub(r"\s+", " ", text)
- if not text:
- return ""
-
- sentences = re.split(r"(?<=[.!?])\s+", text)
- descriptive = []
- for sentence in sentences:
- sentence = sentence.strip()
- if not sentence:
- continue
- lower = sentence.lower()
- if "the user wants" in lower or "key elements" in lower or "drafting the sentences" in lower:
- continue
- descriptive.append(sentence)
-
- if descriptive:
- return " ".join(descriptive[-2:]).strip()
-
- return text
-
-
def _compress_analysis_image_b64(b64_payload: str, max_dim: int = 768, quality: int = 82) -> str:
"""Shrink analysis images so multimodal providers do not burn their full context on pixels."""
try:
@@ -726,7 +675,8 @@ async def analyze_character_endpoint(request):
"message": f"Could not connect to {provider} at {base_url}. Make sure the server is running and reachable.",
})
- generated_text = _sanitize_analysis_text(generated_text)
+ if "" in generated_text:
+ generated_text = generated_text.split("")[-1].strip()
log.info("[LTXDirector] Analysis complete: %s", generated_text)
return web.json_response({"status": "success", "description": generated_text})