From 0cf86d3bbc7eb985cd47ebb7aec16b2ca5188ee2 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sat, 20 Jul 2024 03:34:34 +0530 Subject: [PATCH] share api key through response --- application/api/user/routes.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 0f9f5829..a26ddc51 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -596,7 +596,7 @@ def share_conversation(): }) ## Identifier as route parameter in frontend return jsonify({"success":True, "identifier":str(explicit_binary.as_uuid())}),201 - except ArithmeticError as err: + except Exception as err: print (err) return jsonify({"success":False,"error":str(err)}),400 @@ -619,13 +619,15 @@ def get_publicly_shared_conversations(identifier : str): else: return jsonify({"sucess":False,"error":"might have broken url or the conversation does not exist"}),404 date = conversation["_id"].generation_time.isoformat() - return jsonify({ + res = { "success":True, "queries":conversation_queries, "title":conversation["name"], "timestamp":date - }), 200 + } + if(shared["isPromptable"] and "api_key" in shared): + res["api_key"] = shared["api_key"] + return jsonify(res), 200 except Exception as err: print (err) - return jsonify({"success":False,"error":str(err)}),400 - \ No newline at end of file + return jsonify({"success":False,"error":str(err)}),400 \ No newline at end of file