diff --git a/src/comfydv/_llm/retry.py b/src/comfydv/_llm/retry.py index 6c7ffad..fb60dcb 100644 --- a/src/comfydv/_llm/retry.py +++ b/src/comfydv/_llm/retry.py @@ -60,7 +60,7 @@ def next_seed(options: dict | None, attempt: int) -> int: REFUSAL_LEXICAL_PATTERNS: tuple[re.Pattern, ...] = tuple( re.compile(p, re.IGNORECASE) for p in ( - r"\bI\s*(?:'m|\s+am)?\s*(?:cannot|can't|won't|will not)\b[^.]{0,60}?\b" + r"\b(?:I\s*(?:'m|\s+am)?\s*)?(?:cannot|can't|won't|will not)\b[^.]{0,60}?\b" r"(?:generate|create|produce|write|provide|help|assist|describe|depict|continue)\b", r"\bI(?:'m|\s+am) (?:not able|unable) to\b", r"\bI don't feel comfortable\b", diff --git a/tests/test_llm_retry.py b/tests/test_llm_retry.py index f3ddee1..6ce6220 100644 --- a/tests/test_llm_retry.py +++ b/tests/test_llm_retry.py @@ -51,6 +51,8 @@ class TestLexicalDetection: "I cannot generate that image for you.", "I'm not able to help with this request.", "I am unable to comply with your instruction.", + "Cannot generate this image due to the sensitive content.", + '{"error": "cannot generate this content"}', "I don't feel comfortable creating this content.", "I'm sorry, but I can't produce that description.", "As an AI, I'm unable to depict this scenario.",