diff options
author | Alexander_Kabui | 2024-08-29 10:26:05 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-08-29 10:26:05 +0300 |
commit | ade1b4cb03de8a1c670a3e876b8a18692dfc7694 (patch) | |
tree | 45c47fe94b3f5bcced2d05d181c08b7eb6f5f189 | |
parent | c32378420d58d6770045cf8d2025dabccb4d1492 (diff) | |
download | genenetwork3-ade1b4cb03de8a1c670a3e876b8a18692dfc7694.tar.gz |
Check for empty values when fetching search history.
-rw-r--r-- | gn3/api/llm.py | 5 |
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),)) |