fix: guard AI tidy verdict against non-string LLM output (#1486)
The AI document-tidy endpoint parses verdicts from LLM JSON output and calls .lower().strip() directly. If the model returns null or a non-string element, this crashes with AttributeError. Coerce to str so malformed output is treated as 'keep' instead of crashing.
This commit is contained in:
committed by
GitHub
parent
24be3f3ca8
commit
441905bc13
@@ -901,7 +901,7 @@ def setup_document_routes(session_manager, upload_handler=None) -> APIRouter:
|
||||
for i, doc in enumerate(batch):
|
||||
if i >= len(verdicts):
|
||||
break
|
||||
verdict = verdicts[i].lower().strip()
|
||||
verdict = str(verdicts[i] or "").lower().strip()
|
||||
if verdict == "junk":
|
||||
doc.tidy_verdict = "junk"
|
||||
db.delete(doc)
|
||||
|
||||
Reference in New Issue
Block a user