From 961e70f17e59b5498c638128b04c10c10d3a93af Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Mon, 10 Apr 2023 14:34:38 +0200 Subject: [PATCH] See quotet 'none' and 'null' also as None answer. --- fjerkroa_bot/ai_responder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fjerkroa_bot/ai_responder.py b/fjerkroa_bot/ai_responder.py index 41565d8..2b5fd7f 100644 --- a/fjerkroa_bot/ai_responder.py +++ b/fjerkroa_bot/ai_responder.py @@ -116,7 +116,8 @@ class AIResponder(object): async def post_process(self, message: AIMessage, response: Dict[str, Any]) -> AIResponse: for fld in ('answer', 'staff', 'picture'): - if str(response[fld]).strip().lower() in ('none', '', 'null'): + if str(response[fld]).strip().lower() in \ + ('none', '', 'null', '"none"', '"null"', "'none'", "'null'"): response[fld] = None for fld in ('answer_needed', 'hack'): if str(response[fld]).strip().lower() == 'true':