autocomplete dont fetch disabled networks

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-09-13 07:40:53 +02:00
parent b8f60b7237
commit e6d5efa97f
6 changed files with 60 additions and 41 deletions
+19 -11
View File
@@ -108,19 +108,27 @@ export const xnEngine: XnEngine = {
this.lora = new XnIndex(items);
}
// Embeddings: {loaded: [...], skipped: [...]}
const embData = await this.fetchJson('/embeddings') as Record<string, unknown> | null;
if (embData && typeof embData === 'object') {
const loaded = Array.isArray(embData.loaded) ? embData.loaded : [];
this.embed = new XnIndex(loaded.map((name) => ({ name: String(name) })));
if (window.opts.diffusers_enable_embed) {
const embData = await this.fetchJson('/embeddings') as Record<string, unknown> | null;
if (embData && typeof embData === 'object') {
const loaded = Array.isArray(embData.loaded) ? embData.loaded : [];
this.embed = new XnIndex(loaded.map((name) => ({ name: String(name) })));
}
} else {
this.embed = new XnIndex([]);
}
// Wildcards: [{name}, ...]
const wcData = await this.fetchJson('/wildcards');
if (Array.isArray(wcData)) {
this.wildcard = new XnIndex(
wcData
.filter((w) => typeof w === 'object' && w && 'name' in w && typeof w.name === 'string')
.map((w) => ({ name: w.name })),
);
if (window.opts.wildcards_enabled) {
const wcData = await this.fetchJson('/wildcards');
if (Array.isArray(wcData)) {
this.wildcard = new XnIndex(
wcData
.filter((w) => typeof w === 'object' && w && 'name' in w && typeof w.name === 'string')
.map((w) => ({ name: w.name })),
);
}
} else {
this.wildcard = new XnIndex([]);
}
log('autoComplete', {
xnLoaded: true,
+17 -9
View File
@@ -14759,16 +14759,24 @@ var xnEngine = {
}
this.lora = new XnIndex(items);
}
const embData = await this.fetchJson("/embeddings");
if (embData && typeof embData === "object") {
const loaded = Array.isArray(embData.loaded) ? embData.loaded : [];
this.embed = new XnIndex(loaded.map((name) => ({ name: String(name) })));
if (window.opts.diffusers_enable_embed) {
const embData = await this.fetchJson("/embeddings");
if (embData && typeof embData === "object") {
const loaded = Array.isArray(embData.loaded) ? embData.loaded : [];
this.embed = new XnIndex(loaded.map((name) => ({ name: String(name) })));
}
} else {
this.embed = new XnIndex([]);
}
const wcData = await this.fetchJson("/wildcards");
if (Array.isArray(wcData)) {
this.wildcard = new XnIndex(
wcData.filter((w) => typeof w === "object" && w && "name" in w && typeof w.name === "string").map((w) => ({ name: w.name }))
);
if (window.opts.wildcards_enabled) {
const wcData = await this.fetchJson("/wildcards");
if (Array.isArray(wcData)) {
this.wildcard = new XnIndex(
wcData.filter((w) => typeof w === "object" && w && "name" in w && typeof w.name === "string").map((w) => ({ name: w.name }))
);
}
} else {
this.wildcard = new XnIndex([]);
}
log("autoComplete", {
xnLoaded: true,
+2 -2
View File
File diff suppressed because one or more lines are too long