[Feat] server-args: Add --enable-hicache alias for --enable-hierarchical-cache (#44849)

Co-authored-by: Mohammad Angkad <mohammad.angkad@radixark.ai>
This commit is contained in:
Mohammad Miadh Angkad
2026-10-17 13:22:34 +08:00
committed by GitHub
co-authored by Mohammad Angkad
parent 4fc86f73c2
commit 3fc08b939a
3 changed files with 18 additions and 4 deletions
@@ -95,7 +95,10 @@ class Memory(msgspec.Struct):
# -------------------------------------------------------------------------
# Hierarchical cache
# -------------------------------------------------------------------------
enable_hierarchical_cache: A[bool, "Enable hierarchical cache"] = False
enable_hierarchical_cache: A[
bool,
Arg(help="Enable hierarchical cache", aliases=["--enable-hicache"]),
] = False
hicache_host_memory_mode: A[
str,
Arg(
@@ -14,6 +14,15 @@ import yaml
logger = logging.getLogger(__name__)
def _config_keys(action: argparse.Action) -> set[str]:
# YAML keys may use any long spelling of a flag, not just the one matching dest.
return {action.dest} | {
option[2:].replace("-", "_")
for option in action.option_strings
if option.startswith("--")
}
class ConfigArgumentMerger:
"""Handles merging of configuration file arguments with command-line arguments."""
@@ -27,12 +36,13 @@ class ConfigArgumentMerger:
if parser is not None:
self.parser = parser
self.store_true_actions = [
action.dest
key
for action in parser._actions
if isinstance(action, argparse._StoreTrueAction)
for key in _config_keys(action)
]
self.unsupported_actions = {
a.dest: a
key: a
for a in parser._actions
if a.option_strings
and not isinstance(a, argparse._StoreTrueAction)
@@ -40,6 +50,7 @@ class ConfigArgumentMerger:
and "--config" not in a.option_strings
and "--help" not in a.option_strings
and "-h" not in a.option_strings
for key in _config_keys(a)
}
elif boolean_actions is not None:
# Legacy interface for compatibility