MCPcopy Index your code
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / init

Function init

web/js/autocompleter.js:277–529  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275app.registerExtension({
276 name: id,
277 init() {
278 const STRING = ComfyWidgets.STRING;
279 const SKIP_WIDGETS = new Set(["ttN xyPlot.x_values", "ttN xyPlot.y_values"]);
280 ComfyWidgets.STRING = function (node, inputName, inputData) {
281 const r = STRING.apply(this, arguments);
282
283 if (inputData[1]?.multiline) {
284 // Disabled on this input
285 const config = inputData[1]?.["pysssss.autocomplete"];
286 if (config === false) return r;
287
288 // In list of widgets to skip
289 const id = `${node.comfyClass}.${inputName}`;
290 if (SKIP_WIDGETS.has(id)) return r;
291
292 let words;
293 let separator;
294 if (typeof config === "object") {
295 separator = config.separator;
296 words = {};
297 if (config.words) {
298 // Custom wordlist, this will have been registered on setup
299 Object.assign(words, TextAreaAutoComplete.groups[node.comfyClass + "." + inputName] ?? {});
300 }
301
302 for (const item of config.groups ?? []) {
303 if (item === "*") {
304 // This widget wants all global words included
305 Object.assign(words, TextAreaAutoComplete.globalWords);
306 } else {
307 // This widget wants a specific group included
308 Object.assign(words, TextAreaAutoComplete.groups[item] ?? {});
309 }
310 }
311 }
312
313 new TextAreaAutoComplete(r.widget.inputEl ?? r.widget.element, words, separator);
314 }
315
316 return r;
317 };
318
319 TextAreaAutoComplete.globalSeparator = localStorage.getItem(id + ".AutoSeparate") ?? ", ";
320 const enabledSetting = app.ui.settings.addSetting({
321 id,
322 name: "🐍 Text Autocomplete",
323 defaultValue: true,
324 type: (name, setter, value) => {
325 return $el("tr", [
326 $el("td", [
327 $el("label", {
328 for: id.replaceAll(".", "-"),
329 textContent: name,
330 }),
331 ]),
332 $el("td", [
333 $el(
334 "label",

Callers

nothing calls this directly

Calls 3

toggleLorasFunction · 0.85
closeMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected