From 6562cf2aa33b07a968c12dccc6d1e1b6d544f15c Mon Sep 17 00:00:00 2001 From: Power BI Dev Date: Thu, 4 Jun 2026 10:07:55 +0700 Subject: [PATCH] fix: guard verdict check uses 'in' to handle extra characters in DeepSeek response --- src/guard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guard.py b/src/guard.py index 4f65107..edba69d 100644 --- a/src/guard.py +++ b/src/guard.py @@ -40,7 +40,7 @@ async def is_academic_topic(question: str, client, model: str) -> bool: temperature=0, ) verdict = response.choices[0].message.content.strip().upper() - return verdict == "IZIN" + return "IZIN" in verdict except Exception: # Jika guard gagal, izinkan saja agar bot tidak mati total return True