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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user