Atualizar app/app.py
This commit is contained in:
+18
@@ -34,6 +34,24 @@ def notifications(ws):
|
|||||||
ws.send(json.dumps({"type": "pong", "payload": data}))
|
ws.send(json.dumps({"type": "pong", "payload": data}))
|
||||||
|
|
||||||
|
|
||||||
|
@celery.task(name="tasks.admin_generate", bind=True, max_retries=3)
|
||||||
|
def admin_generate(self, conversation_id, model, prompt):
|
||||||
|
# Same logic as generate_task, but runs in the admin queue
|
||||||
|
...
|
||||||
|
|
||||||
|
@app.route("/api/queue/admin_generate", methods=["POST"])
|
||||||
|
@login_required
|
||||||
|
@admin_required
|
||||||
|
def queue_admin_generate():
|
||||||
|
data = request.json
|
||||||
|
cid = data["conversation_id"]
|
||||||
|
model = data["model"]
|
||||||
|
prompt = data["prompt"]
|
||||||
|
|
||||||
|
task = admin_generate.delay(cid, model, prompt)
|
||||||
|
return jsonify({"task_id": task.id})
|
||||||
|
|
||||||
|
|
||||||
# ================
|
# ================
|
||||||
# DECORATORS
|
# DECORATORS
|
||||||
# ================
|
# ================
|
||||||
|
|||||||
Reference in New Issue
Block a user