- Add autocomplete caching, tag prefix indexing, and stronger usage ranking - Add bundled merged Danbooru/e621 tag data - Estimate max wildcard and dynamic-prompt token counts - Store original/resolved prompt metadata and restore resolved previews - Insert short wildcard leaf names when unambiguous - Harden prompt preview toggles and textarea rebinding - Expand tests for autocomplete, metadata, tokenization, and wildcards
40 lines
853 B
Python
40 lines
853 B
Python
"""
|
|
A1111 Prompt Parser Package
|
|
|
|
Contains the Lark grammar parser and scheduling logic for A1111-style prompts.
|
|
"""
|
|
|
|
from .wildcards import (
|
|
expand_wildcards,
|
|
expand_wildcards_for_token_count,
|
|
get_wildcard_options,
|
|
list_available_wildcards,
|
|
)
|
|
|
|
try:
|
|
from .grammar import GRAMMAR, get_parser, reset_parser
|
|
from .scheduler import get_prompt_schedule
|
|
except ImportError as exc:
|
|
_PARSER_IMPORT_ERROR = exc
|
|
GRAMMAR = None
|
|
|
|
def get_parser():
|
|
raise _PARSER_IMPORT_ERROR
|
|
|
|
def reset_parser():
|
|
return None
|
|
|
|
def get_prompt_schedule(*args, **kwargs):
|
|
raise _PARSER_IMPORT_ERROR
|
|
|
|
__all__ = [
|
|
"GRAMMAR",
|
|
"get_parser",
|
|
"reset_parser",
|
|
"get_prompt_schedule",
|
|
"expand_wildcards",
|
|
"expand_wildcards_for_token_count",
|
|
"get_wildcard_options",
|
|
"list_available_wildcards",
|
|
]
|