aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-04-03 17:12:05 +0300
committerAlexander_Kabui2024-04-05 15:11:31 +0300
commit9f37a05627c37ceab0c438082e4a1edd84b9eac4 (patch)
tree2f2979b2859c4a7d473d29fee65df2eb141c9a0f
parent86f18b45cc1bcb2ef1e1b4c88681c0a0654085a9 (diff)
downloadgenenetwork2-9f37a05627c37ceab0c438082e4a1edd84b9eac4.tar.gz
Update gnqa rating route.
-rw-r--r--gn2/wqflask/views.py16
1 files 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/<task_id>",methods=["POST"])
-def gnqna_rating(task_id):
+@app.route("/gnqna/rating/<task_id>/<int(signed=True):weight>",
+ 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__