aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-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),))