Skip to content

Conversation

caith-h
Copy link

@caith-h caith-h commented Aug 24, 2025

Adds:
• namespace-based search filtering
• orientation filtering
• image/video filtering <-- uses your video extension function, with a fallback to frame count parameter, for things like .webp or .gif
• architecture filtering

• automatic arch group detection based on model names (needs to be maintained if new model groups get released, that you actually care about)
• optional "Architecture Group" override in the model metadata. (relevant if you do subgroups for specific model series like the pony models or illustrious models)

image image image image


if (archLower.startsWith('flux-1') || arch.startsWith('Flux.1')) return 'Flux.1';

if (archLower.startsWith('stable-diffusion-xl')) return 'SDXL';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function is a weird hack. T2IModelClassSorter is where data like this would be defined

let processedCount = 0;
const totalModels = allModels.length;

for (let modelName of allModels) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hhhhhh this will destroy people with large model sets, nopenopenope

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I have about 200 models. definitely looks like something that would crush me if done this way. you probably should make a new api endpoint that feeds you this map in 1 call.

model:sdxl (model containing sdxl)
controlnet:canny (controlnet type)
sampler:euler (sampler name)
aspectratio:16:9 (aspect ratio)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a massive chunk of text to slip into a title attrib

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also none of this should be in browsers.js

sampler:euler (sampler name)
aspectratio:16:9 (aspect ratio)

NUMERIC FILTERS (support >, <, =):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

symbols like this fed directly into an html attrib unescaped could cause problems

continue;
}
if (this.filter) {
const searchParts = typeof parseSearchQuery !== 'undefined' ? parseSearchQuery(this.filter) : [{ type: 'text', value: this.filter }];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a hack

const modelName = model.name;
const archGroup = data.architecture_group;
const archType = data.type;
if (typeof modelArchitectureMap !== 'undefined') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none of these defined check hacks should be here

@@ -397,6 +411,11 @@ class ModelBrowserWrapper {
this.models[file.name] = file;
if (this.subType == 'Stable-Diffusion') {
modelIconUrlCache[file.name] = file.data.preview_image;
if (file.data.architecture_group) {
modelArchitectureMap[file.name] = file.data.architecture_group;
} else if (file.data.architecture) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonk format

setTimeout(() => {
updateFilterButtons();
updateArchitectureDropdown();
}, 100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wh


if (searchValue.startsWith('>')) {
return parseInt(stepsValue) > parseInt(searchValue.substring(1).trim());
} else if (searchValue.startsWith('<')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is a massive pile of copypasta

@@ -127,6 +132,244 @@ function buttonsForImage(fullsrc, src, metadata) {
return buttons;
}

function parseSearchQuery(query) {
const namespaces = ['lora', 'prompt', 'model', 'controlnet', 'seed', 'steps', 'cfgscale', 'aspectratio', 'width', 'height', 'sampler', 'videoframes', 'fps', 'date'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weirdly specific, why not just a generic metadata parameter by name check?

@@ -135,6 +135,7 @@
<option value="@arch.ID" class="translate">@arch.Name</option>
}
</select></div>
<div>Architecture Group: <input type="text" id="edit_model_architecture_group" class="modal_text_extra translate" placeholder="Custom Architecture group for Image History" /></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is... odd. I don't think this needs to exist.

@bman654
Copy link
Contributor

bman654 commented Aug 25, 2025

improved image history search sounds great. I hope you can work through the review process to get it in a mergeable state @caith-h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants