Allow Hermes callback endpoint to accept revision prompts

/api/prompt/<rid> previously rejected any request not in 'pending'
status. This blocked the revision workflow from using the callback.

Now the endpoint accepts 'pending' (sets status to 'prompt_ready') and
'revisions_requested' (keeps status as 'revisions_requested' so the
operator still sees it needs new song uploads).
This commit is contained in:
Troll (Hermes Agent) 2026-08-05 03:30:51 +00:00
parent 51f7ffd5ab
commit 7ab8388741
2 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.env
.env.local
__pycache__/
*.pyc
.venv/

12
app.py
View file

@ -549,8 +549,9 @@ def api_update_prompt(rid):
req = get_request_by_id(rid)
if not req:
abort(404)
if req['status'] != 'pending':
abort(409, description='Request is no longer pending')
# Allow updates when the request is pending or when a revision has been requested.
if req['status'] not in ('pending', 'revisions_requested'):
abort(409, description='Request is no longer pending or awaiting revision')
data = request.get_json(silent=True) or {}
@ -559,14 +560,17 @@ def api_update_prompt(rid):
if provided_email and provided_email != req['email'].lower():
abort(400, description='Email mismatch')
# When this is a revision, keep the revision note and status as revisions_requested
# so the operator still sees it as "needs new songs", and preserve customer_approved.
new_status = 'revisions_requested' if req['status'] == 'revisions_requested' else 'prompt_ready'
update_request(rid,
suno_title=data.get('suno_title', '').strip(),
suno_style=data.get('suno_style', '').strip(),
suno_lyrics=data.get('suno_lyrics', '').strip(),
status='prompt_ready'
status=new_status
)
return jsonify({'ok': True, 'request_id': rid, 'status': 'prompt_ready'}), 200
return jsonify({'ok': True, 'request_id': rid, 'status': new_status}), 200
@app.route('/thanks/<int:rid>')