From a848e94fc04d7df28564af843c0d5fcc0d9f1f3c Mon Sep 17 00:00:00 2001 From: RA Date: Sun, 19 Mar 2023 06:08:54 +0800 Subject: [PATCH] catch Unauthorized --- model/bing/new_bing_model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/model/bing/new_bing_model.py b/model/bing/new_bing_model.py index 947a507..35101b2 100644 --- a/model/bing/new_bing_model.py +++ b/model/bing/new_bing_model.py @@ -6,7 +6,7 @@ from common import log from EdgeGPT import Chatbot, ConversationStyle user_session = dict() -# newBing对话模型逆向网页API +# newBing对话模型逆向网页gitAPI class BingModel(Model): @@ -14,7 +14,10 @@ class BingModel(Model): bot: Chatbot = None def __init__(self): - self.bot = Chatbot(cookies=model_conf_val("bing", "cookies")) + try: + self.bot = Chatbot(cookies=model_conf_val("bing", "cookies")) + except Exception as e: + log.exception(e) def reply(self, query: str, context=None) -> tuple[str, dict]: bot = user_session.get(context['from_user_id'], None)