aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn2/wqflask/views.py')
-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__