Add system node to serach box db (#128)

This commit is contained in:
Chenlei Hu
2024-07-13 09:25:58 -04:00
committed by GitHub
parent 5fac7c9365
commit 93a0c1012f
2 changed files with 44 additions and 2 deletions

View File

@@ -10,7 +10,10 @@ import { onMounted, onUnmounted, provide, ref } from "vue";
import NodeSearchboxPopover from "@/components/NodeSearchBoxPopover.vue";
import ProgressSpinner from "primevue/progressspinner";
import { api } from "@/scripts/api";
import { NodeSearchService } from "./services/nodeSearchService";
import {
NodeSearchService,
SYSTEM_NODE_DEFS,
} from "./services/nodeSearchService";
import { ColorPaletteLoadedEvent } from "./types/colorPalette";
import { LiteGraphNodeSearchSettingEvent } from "./scripts/ui";
@@ -35,7 +38,10 @@ const updateNodeSearchSetting = (e: LiteGraphNodeSearchSettingEvent) => {
const init = async () => {
const nodeDefs = Object.values(await api.getNodeDefs());
nodeSearchService.value = new NodeSearchService(nodeDefs);
nodeSearchService.value = new NodeSearchService([
...nodeDefs,
...SYSTEM_NODE_DEFS,
]);
document.addEventListener("comfy:setting:color-palette-loaded", updateTheme);
document.addEventListener(

View File

@@ -3,6 +3,42 @@ import { getNodeSource } from "@/types/nodeSource";
import Fuse, { IFuseOptions, FuseSearchOptions } from "fuse.js";
import _ from "lodash";
export const SYSTEM_NODE_DEFS: ComfyNodeDef[] = [
{
name: "PrimitiveNode",
display_name: "Primitive",
category: "utils",
input: { required: {}, optional: {} },
output: ["*"],
output_name: ["connect to widget input"],
output_is_list: [false],
python_module: "nodes",
description: "Primitive values like numbers, strings, and booleans.",
},
{
name: "Reroute",
display_name: "Reroute",
category: "utils",
input: { required: { "": ["*"] }, optional: {} },
output: ["*"],
output_name: [""],
output_is_list: [false],
python_module: "nodes",
description: "Reroute the connection to another node.",
},
{
name: "Note",
display_name: "Note",
category: "utils",
input: { required: {}, optional: {} },
output: [],
output_name: [],
output_is_list: [],
python_module: "nodes",
description: "Node that add notes to your project",
},
];
export class FuseSearch<T> {
private fuse: Fuse<T>;
public readonly data: T[];