Files
DemonGatanjieuandClaude Opus 5.5 98148481bc Models page tabs, base model filter, Tidy tab redone with covers
- The models page has tabs: All models, Tidy (with its count) and Sources;
  the type bar keeps the type chips and Import.
- Base model chips under the type chips (All, Illustrious, SDXL, Unknown...),
  one per family the listed models have (model_bases.js; SDXL 1.0 = SDXL);
  models not scanned are listed by their header's guess (metadata base_guess).
- Tidy is cards with the model's cover and name in two steps: models in a
  folder whose loader cannot read them (from -> to, one plain reason, Move
  there, Change place), and identical files side by side with the copy to
  keep marked (the one in the right folder; click another to change) and one
  button for the extra copies. Models that load anyway and extra copies of a
  well-placed file are not in step 1. Same-size files up to 256 MB are
  compared at once; larger ones on Compare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 23:02:00 +08:00

22 lines
1.1 KiB
JavaScript

// The models page's base model filter (web/modules/model_bases.js).
import assert from 'node:assert/strict';
import { baseFamily, countBases, inFamily } from '../web/modules/model_bases.js';
const model = (baseModel, base_guess = '') => ({ metadata: { baseModel, base_guess } });
// Spellings of one family are one; the header's guess counts when nothing was scanned.
assert.equal(baseFamily(model('SDXL 1.0')), 'SDXL');
assert.equal(baseFamily(model('', 'SDXL')), 'SDXL');
assert.equal(baseFamily(model('Flux.1 D')), 'Flux');
assert.equal(baseFamily(model('Illustrious')), 'Illustrious');
assert.equal(baseFamily(model('Unknown')), '');
assert.equal(baseFamily({}), '');
const list = [model('SDXL 1.0'), model('SDXL'), model('Illustrious'), model(''), model('Pony'), model('Pony')];
assert.deepEqual(countBases(list), [['Pony', 2], ['SDXL', 2], ['Illustrious', 1], ['', 1]]);
assert.equal(list.filter(item => inFamily(item, 'SDXL')).length, 2);
assert.equal(list.filter(item => inFamily(item, '')).length, 1);
assert.equal(list.filter(item => inFamily(item, null)).length, 6);
console.log('model_bases: ok');