fix: guard verdict check uses 'in' to handle extra characters in DeepSeek response
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ async def is_academic_topic(question: str, client, model: str) -> bool:
|
|||||||
temperature=0,
|
temperature=0,
|
||||||
)
|
)
|
||||||
verdict = response.choices[0].message.content.strip().upper()
|
verdict = response.choices[0].message.content.strip().upper()
|
||||||
return verdict == "IZIN"
|
return "IZIN" in verdict
|
||||||
except Exception:
|
except Exception:
|
||||||
# Jika guard gagal, izinkan saja agar bot tidak mati total
|
# Jika guard gagal, izinkan saja agar bot tidak mati total
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user