aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-05-17 17:07:32 +0300
committerAlexander_Kabui2024-05-17 17:07:32 +0300
commit0832e9579d6fe6c9b46bfa499f1c7726301ac10c (patch)
tree5c7a4fa767597573212320cfaa145efb8cb3dd77
parentf8c87e6fd1b26887c84a390a1a253d2c629942bc (diff)
downloadgenenetwork3-0832e9579d6fe6c9b46bfa499f1c7726301ac10c.tar.gz
Add endpoint for getting prev user searches
-rw-r--r--gn3/api/llm.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py
index 442252f..41cc376 100644
--- a/gn3/api/llm.py
+++ b/gn3/api/llm.py
@@ -90,6 +90,18 @@ def rating(task_id):
return jsonify({"error": str(error)}), 500
+
+@gnqa.route("/searches/", methods=["GET"])
+@require_oauth("profile user")
+def fetch_prev_searches():
+ with (require_oauth.acquire("profile user") as __the_token,
+ Redis.from_url(current_app.config["REDIS_URI"],
+ decode_responses=True) as redis_conn):
+ return jsonify({
+ "prev_queries": get_user_queries("random_user", redis_conn)
+ })
+
+
@gnqa.route("/history/<query>", methods=["GET"])
@require_oauth("profile user")
def fetch_user_hist(query):
@@ -103,6 +115,7 @@ def fetch_user_hist(query):
})
+
@gnqa.route("/historys/<query>", methods=["GET"])
def fetch_users_hist_records(query):
"""method to fetch all users hist:note this is a test functionality