feat: update authentication handling and integrate token usage across frontend and backend

This commit is contained in:
Siddhant Rai
2025-03-18 08:29:57 +05:30
parent 4406426515
commit 6583aeff08
19 changed files with 430 additions and 186 deletions

View File

@@ -398,7 +398,7 @@ class Stream(Resource):
decoded_token = request.decoded_token
if not decoded_token:
return bad_request(401, "Unauthorized")
return make_response({"error": "Unauthorized"}, 401)
logger.info(
f"/stream - request_data: {data}, source: {source}",
@@ -545,7 +545,7 @@ class Answer(Resource):
decoded_token = request.decoded_token
if not decoded_token:
return bad_request(401, "Unauthorized")
return make_response({"error": "Unauthorized"}, 401)
prompt = get_prompt(prompt_id)
@@ -723,6 +723,9 @@ class Search(Resource):
user_api_key = None
decoded_token = request.decoded_token
if not decoded_token:
return make_response({"error": "Unauthorized"}, 401)
logger.info(
f"/api/answer - request_data: {data}, source: {source}",
extra={"data": json.dumps({"request_data": data, "source": source})},