add keywords support
This commit is contained in:
@@ -91,6 +91,7 @@ def get_node_info(class_name: str) -> dict[str, Any]:
|
|||||||
"output_node": bool(getattr(cls, "OUTPUT_NODE", False)),
|
"output_node": bool(getattr(cls, "OUTPUT_NODE", False)),
|
||||||
"manual_trigger": bool(getattr(cls, "MANUAL_TRIGGER", False)),
|
"manual_trigger": bool(getattr(cls, "MANUAL_TRIGGER", False)),
|
||||||
"description": getattr(cls, "DESCRIPTION", ""),
|
"description": getattr(cls, "DESCRIPTION", ""),
|
||||||
|
"keywords": list(getattr(cls, "KEYWORDS", ())),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class EdgeDetect:
|
|||||||
"Detect edges using Sobel, Prewitt, Laplacian, or LoG operators. "
|
"Detect edges using Sobel, Prewitt, Laplacian, or LoG operators. "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
KEYWORDS = ("sobel", "prewitt", "laplacian", "log", "gradient", "edges")
|
||||||
|
|
||||||
def process(self, field: DataField, method: str, sigma: float) -> tuple:
|
def process(self, field: DataField, method: str, sigma: float) -> tuple:
|
||||||
from scipy.ndimage import sobel, prewitt, gaussian_laplace, laplace
|
from scipy.ndimage import sobel, prewitt, gaussian_laplace, laplace
|
||||||
data = field.data
|
data = field.data
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ export default function ContextMenu({
|
|||||||
for (const { className, def } of category.items) {
|
for (const { className, def } of category.items) {
|
||||||
if (seen.has(className)) continue;
|
if (seen.has(className)) continue;
|
||||||
const name = (def.display_name || className).toLowerCase();
|
const name = (def.display_name || className).toLowerCase();
|
||||||
if (name.includes(q)) {
|
const keywords: string[] = Array.isArray(def.keywords) ? def.keywords : [];
|
||||||
|
const keywordMatch = keywords.some((kw) => String(kw).toLowerCase().includes(q));
|
||||||
|
if (name.includes(q) || keywordMatch) {
|
||||||
results.push({ className, def });
|
results.push({ className, def });
|
||||||
seen.add(className);
|
seen.add(className);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user