fix(annotations): derive the suggestion cap from the image tag set cap

py/autotag.py now takes MAX_SUGGESTION_LIMIT from database.annotations
MAX_IMAGE_TAGS. The two copies that cannot import it (py/config.py loads
before the database, utils/inspection_response.py stays storage-free) are
pinned equal by a test, so the 100 limits cannot drift apart.
This commit is contained in:
Vito Sansevero
2026-10-22 10:06:44 -07:00
parent 16d6b88df3
commit f6b37b1cfd
4 changed files with 21 additions and 5 deletions
+6 -3
View File
@@ -16,10 +16,13 @@ from PIL import Image
# A loader takes (model_type, use_gpu) and returns ("gguf" | "wd14" | "hf", backend)
ModelLoader = Callable[[str, bool], Tuple[str, Any]]
# Suggestions keep only names a Save accepts (the vocabulary tag rules).
# Suggestions keep only names a Save accepts (the vocabulary tag rules), and
# never more than one image tag set holds.
try:
from ..database.annotations import MAX_IMAGE_TAGS
from ..database.vocabulary import validate_vocabulary_tag_name
except ImportError:
from database.annotations import MAX_IMAGE_TAGS
from database.vocabulary import validate_vocabulary_tag_name
# Try to import logging from utils, fallback to standard logging
@@ -94,8 +97,8 @@ DEFAULT_PROMPT = (
"descriptive."
)
# Upper bound of one suggestion request: the image tag set cap (100 names).
MAX_SUGGESTION_LIMIT = 100
# Upper bound of one suggestion request: the image tag set cap.
MAX_SUGGESTION_LIMIT = MAX_IMAGE_TAGS
SYSTEM_PROMPT = (
"You are a helpful assistant and help users with any queries they may have "
+1 -1
View File
@@ -468,7 +468,7 @@ class IntegrationConfig:
# Number of tag suggestions the Tag dialogs request by default (D68). The cap
# is the image tag set limit: more suggestions could never all be kept.
DEFAULT_SUGGESTION_LIMIT = 10
MAX_SUGGESTION_LIMIT = 100
MAX_SUGGESTION_LIMIT = 100 # pinned to MAX_IMAGE_TAGS by tests/test_config.py
class AutotagConfig: