From 9f37a05627c37ceab0c438082e4a1edd84b9eac4 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Wed, 3 Apr 2024 17:12:05 +0300 Subject: Update gnqa rating route. --- gn2/wqflask/views.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index 47233099..fce009ba 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -307,20 +307,24 @@ def gnqna_hist(search_term): return render_template("gnqa_answer.html", **{"gn_server_url": GN3_LOCAL_URL, **response}) - -@app.route("/gnqna/rating/",methods=["POST"]) -def gnqna_rating(task_id): +@app.route("/gnqna/rating//", + methods=["POST"]) +@require_oauth2 +def gnqna_rating(task_id, weight): token = session_info()["user"]["token"].either( - lambda err: err, lambda tok: tok["access_token"]) + lambda err: err, lambda tok: tok["access_token"]) return monad_requests.post( urljoin(GN3_LOCAL_URL, f"/api/llm/rating/{task_id}"), - json= request.json, + json={**dict(request.form), "weight": weight}, headers={ "Authorization": f"Bearer {token}" } ).then( - lambda resp: resp).either(lambda x: (x.json(),x.status_code),lambda x:(x.json(),x.status_code)) + lambda resp: resp).either(lambda x: (x.json(), x.status_code), + lambda x: (x.json(), x.status_code)) + + @app.route("/gsearch_updating", methods=('POST',)) def gsearch_updating(): result = UpdateGSearch(request.args).__dict__ -- cgit v1.2.3