aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-29 10:26:05 +0300
committerAlexander_Kabui2024-08-29 10:26:05 +0300
commitade1b4cb03de8a1c670a3e876b8a18692dfc7694 (patch)
tree45c47fe94b3f5bcced2d05d181c08b7eb6f5f189 /gn3/api
parentc32378420d58d6770045cf8d2025dabccb4d1492 (diff)
downloadgenenetwork3-ade1b4cb03de8a1c670a3e876b8a18692dfc7694.tar.gz
Check for empty values when fetching search history.
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/llm.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py
index a94badd..5901ef5 100644
--- a/gn3/api/llm.py
+++ b/gn3/api/llm.py
@@ -107,7 +107,10 @@ def fetch_prev_history():
Where task_id=? and user_id=?""",
(request.args.get("search_term"),
str(token.user.user_id),))
- return dict(cursor.fetchone())["results"]
+ record = cursor.fetchone()
+ if record:
+ return dict(record).get("results")
+ return {}
cursor.execute(
"""SELECT task_id,query from history WHERE user_id=?""",
(str(token.user.user_id),))