From a2de02b0ebf28dbe2c2dfedf683870400b7a6bdb Mon Sep 17 00:00:00 2001 From: Adrien Abraham Date: Fri, 8 Mar 2024 18:22:56 +0100 Subject: [PATCH] kagi_fastgpt: fix issue when there are no more tk. --- edmond/plugins/kagi_fastgpt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/edmond/plugins/kagi_fastgpt.py b/edmond/plugins/kagi_fastgpt.py index 845903b..0ae4fe3 100644 --- a/edmond/plugins/kagi_fastgpt.py +++ b/edmond/plugins/kagi_fastgpt.py @@ -49,7 +49,10 @@ class KagiFastgptPlugin(Plugin): self.bot.log_e(f"Request error: {exc}") return None, [] - data = response.json().get("data", {}) + data = response.json().get("data") + if not data: + self.bot.log_w("No data at all, no more tokens available?") + return None, [] self.bot.log_d(f"Data received: {json.dumps(data)}") output = data.get("output", "") if not output: