about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-05-23 12:29:04 +0300
committerAlexander_Kabui2024-05-23 12:29:04 +0300
commitef955f9b456a591f64faa428b8ef83252923bb63 (patch)
tree7a4316bcb1dcca2661fbf9344cf6adc5909cab8f
parentd4b0ae19e55a45eed7b6bca43abb5340f58ccfbe (diff)
downloadgenenetwork3-ef955f9b456a591f64faa428b8ef83252923bb63.tar.gz
Remove irrelevant variable assignments.
-rw-r--r--gn3/api/llm.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py
index e8ffa1a..5ad58cb 100644
--- a/gn3/api/llm.py
+++ b/gn3/api/llm.py
@@ -69,9 +69,8 @@ def search():
 def rate_queries(task_id):
     """Endpoint for rating qnqa query and answer"""
     try:
-        llm_db_path = current_app.config["LLM_DB_PATH"]
         with (require_oauth.acquire("profile") as token,
-              db.connection(llm_db_path) as conn):
+              db.connection(current_app.config["LLM_DB_PATH"]) as conn):
 
             results = request.json
             user_id, query, answer, weight = (token.user.user_id,
@@ -108,17 +107,18 @@ def rate_queries(task_id):
 def fetch_prev_history():
     """ api method to fetch search query records"""
     try:
-        llm_db_path = current_app.config["LLM_DB_PATH"]
         with (require_oauth.acquire("profile user") as token,
-              db.connection(llm_db_path) as conn):
+              db.connection(current_app.config["LLM_DB_PATH"]) as conn):
             cursor = conn.cursor()
             if request.args.get("search_term"):
-                query = """SELECT results from history Where task_id=? and user_id=?"""
-                cursor.execute(query, (request.args.get(
-                    "search_term"), str(token.user.user_id),))
+                cursor.execute(
+                    """SELECT results from history Where task_id=? and user_id=?""",
+                    (request.args.get("search_term"),
+                     str(token.user.user_id),))
                 return dict(cursor.fetchone())
-            query = """SELECT task_id,query from history WHERE user_id=?"""
-            cursor.execute(query, (str(token.user.user_id),))
+            cursor.execute(
+                """SELECT task_id,query from history WHERE user_id=?""",
+                (str(token.user.user_id),))
             return jsonify([dict(item) for item in cursor.fetchall()])
     except sqlite3.Error as error:
         raise sqlite3.OperationalError(*error.args) from error