mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-06 16:36:45 -03:00
fix(autocomplete): reduce tag search overhead (#895)
This commit is contained in:
@@ -13,6 +13,7 @@ import contextlib
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
@@ -2433,6 +2434,7 @@ class CustomWordsHandler:
|
||||
even without category filtering.
|
||||
"""
|
||||
try:
|
||||
started_at = time.perf_counter()
|
||||
search_term = request.query.get("search", "")
|
||||
limit = int(request.query.get("limit", "20"))
|
||||
offset = max(0, int(request.query.get("offset", "0")))
|
||||
@@ -2444,6 +2446,16 @@ class CustomWordsHandler:
|
||||
if category_param:
|
||||
categories = self._parse_category_param(category_param)
|
||||
|
||||
logger.info(
|
||||
"LM custom words request search=%r category_param=%r categories=%s limit=%s offset=%s enriched=%s",
|
||||
search_term,
|
||||
category_param,
|
||||
categories,
|
||||
limit,
|
||||
offset,
|
||||
enriched_param,
|
||||
)
|
||||
|
||||
results = self._service.search_words(
|
||||
search_term,
|
||||
limit,
|
||||
@@ -2452,6 +2464,14 @@ class CustomWordsHandler:
|
||||
enriched=enriched_param,
|
||||
)
|
||||
|
||||
elapsed_ms = (time.perf_counter() - started_at) * 1000
|
||||
logger.info(
|
||||
"LM custom words response search=%r result_count=%s elapsed_ms=%.2f",
|
||||
search_term,
|
||||
len(results),
|
||||
elapsed_ms,
|
||||
)
|
||||
|
||||
return web.json_response({"success": True, "words": results})
|
||||
except Exception as exc:
|
||||
logger.error("Error searching custom words: %s", exc, exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user