From beb3bb2df004efc597e7d006b18798bebff28817 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 9 May 2024 16:00:20 +0300 Subject: Improve error messaging for use of invalid fahamu token. --- gn3/api/llm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gn3/api/llm.py b/gn3/api/llm.py index 6a5b02e..7d860d8 100644 --- a/gn3/api/llm.py +++ b/gn3/api/llm.py @@ -36,9 +36,11 @@ def gnqa(): return jsonify({"error": "querygnqa is missing in the request"}), 400 try: - auth_token = current_app.config.get("FAHAMU_AUTH_TOKEN") + fahamu_token = current_app.config.get("FAHAMU_AUTH_TOKEN") + if fahamu_token is None: + return jsonify({"query": query, "error": "Use of invalid fahamu auth token"}), 500 task_id, answer, refs = get_gnqa( - query, auth_token, current_app.config.get("DATA_DIR")) + query, fahamu_token, current_app.config.get("DATA_DIR")) response = { "task_id": task_id, "query": query, -- cgit v1.2.3