about summary refs log tree commit diff
path: root/gn3/api
diff options
context:
space:
mode:
authorAlexander_Kabui2024-03-25 16:15:23 +0300
committerAlexander_Kabui2024-03-25 16:15:23 +0300
commitd797efb7c71e001e50830c10f30a89f1642cafd7 (patch)
tree74db2c6b8496dec315bdf23a3766c201677ec20c /gn3/api
parentec60064a8ba992bc2005d3d583dca1694f5a9fa6 (diff)
downloadgenenetwork3-d797efb7c71e001e50830c10f30a89f1642cafd7.tar.gz
fetch tmpdir from current app connfig
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/llm.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/gn3/api/llm.py b/gn3/api/llm.py
index cb68526..c5946ed 100644
--- a/gn3/api/llm.py
+++ b/gn3/api/llm.py
@@ -24,9 +24,6 @@ from datetime import timedelta
 GnQNA = Blueprint("GnQNA", __name__)
 
 
-
-
-
 def handle_errors(func):
     @wraps(func)
     def decorated_function(*args, **kwargs):
@@ -39,6 +36,7 @@ def handle_errors(func):
 
 @GnQNA.route("/gnqna", methods=["POST"])
 def gnqa():
+    # todo  add auth
     query = request.json.get("querygnqa", "")
     if not query:
         return jsonify({"error": "querygnqa is missing in the request"}), 400
@@ -46,7 +44,7 @@ def gnqa():
     try:
         auth_token = current_app.config.get("FAHAMU_AUTH_TOKEN")
         task_id, answer, refs = get_gnqa(
-            query, auth_token)
+            query, auth_token, current_app.config.get("TMPDIR", "/tmp"))
 
         response = {
             "task_id": task_id,
@@ -78,7 +76,7 @@ def rating(task_id):
                                               results.get("answer"),
                                               results.get("weight", 0))
 
-            with db.connection(os.path.join(current_app.config["DATA_DIR"],"/llm.db")) as conn:
+            with db.connection(os.path.join(current_app.config["DATA_DIR"], "/llm.db")) as conn:
                 cursor = conn.cursor()
                 create_table = """CREATE TABLE IF NOT EXISTS Rating(
                       user_id INTEGER NOT NULL,