fix: model picker price sort broken for image models (v0.13.9)

applySort() always read input_price_per_m for price sorting, but image
models carry cost_per_image instead — input_price_per_m is undefined on
them, so every image model got an effective price of 0 and the sort was a
no-op.

Fix: detect image models via cost_per_image !== undefined and use that
field when present; fall back to input_price_per_m for text models.

Files changed:
- assets/js/model-picker.js — applySort price branch
- prautoblogger.php        — version bump 0.13.8 → 0.13.9
- CHANGELOG.md             — release notes
This commit is contained in:
peptiderepo
2026-04-26 02:36:56 +00:00
parent 3f60ecd0ff
commit ca82e395f4
3 changed files with 13 additions and 4 deletions

View File

@@ -101,8 +101,9 @@
var valA, valB;
if ( col === 'price' ) {
valA = a.input_price_per_m || 0;
valB = b.input_price_per_m || 0;
// Image models use cost_per_image; text models use input_price_per_m.
valA = ( a.cost_per_image !== undefined ) ? a.cost_per_image : ( a.input_price_per_m || 0 );
valB = ( b.cost_per_image !== undefined ) ? b.cost_per_image : ( b.input_price_per_m || 0 );
} else if ( col === 'context' ) {
valA = a.context_length || 0;
valB = b.context_length || 0;