Fix LLM Cost: accumulate per-version costs, include stems, show total
- Webhook no longer overwrites cost estimate with 0 when conversion_cost is missing from the payload - Per-version costs (A/B) are tracked separately and summed into total - Stems cost is only overwritten when a non-zero cost is reported - Template shows combined total (songs + stems) with breakdown - Added musicgpt_cost_a and musicgpt_cost_b columns to schema
This commit is contained in:
parent
f2c64848dd
commit
24838c73ac
3 changed files with 38 additions and 8 deletions
|
|
@ -60,7 +60,9 @@ CREATE TABLE IF NOT EXISTS requests (
|
|||
musicgpt_conversion_id_1 TEXT, -- conversion ID for Version A
|
||||
musicgpt_conversion_id_2 TEXT, -- conversion ID for Version B
|
||||
musicgpt_status TEXT, -- IN_QUEUE / IN_PROGRESS / COMPLETED / FAILED
|
||||
musicgpt_cost REAL, -- API-reported cost in USD credits
|
||||
musicgpt_cost REAL, -- total API-reported cost in USD credits (A + B)
|
||||
musicgpt_cost_a REAL, -- per-version cost for Version A
|
||||
musicgpt_cost_b REAL, -- per-version cost for Version B
|
||||
musicgpt_error TEXT, -- error message from MusicGPT or polling
|
||||
album_cover_url TEXT, -- URL to generated album cover image
|
||||
song_a_wav_path TEXT, -- local path to Version A WAV (if deliver_wav)
|
||||
|
|
@ -126,7 +128,7 @@ def init_db():
|
|||
'delivery_sent_at', 'square_payment_ref', 'admin_alert_email',
|
||||
'player_token', 'revision_count', 'revision_note', 'operator_notes',
|
||||
'stems_link', 'stems_interest', 'musicgpt_task_id', 'musicgpt_conversion_id_1',
|
||||
'musicgpt_conversion_id_2', 'musicgpt_status', 'musicgpt_cost', 'musicgpt_error',
|
||||
'musicgpt_conversion_id_2', 'musicgpt_status', 'musicgpt_cost', 'musicgpt_cost_a', 'musicgpt_cost_b', 'musicgpt_error',
|
||||
'album_cover_url', 'song_a_wav_path', 'song_b_wav_path', 'deliver_wav',
|
||||
'stems_task_id', 'stems_status', 'stems_cost', 'stems_url', 'stems_error'
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue