fix: use hermes_yaml with yaml fallback; add model column to default config
PyYAML is no longer installed in the Hermes venv since recent updates — /sl failed at runtime with ModuleNotFoundError: No module named 'yaml'. Now uses the core hermes_yaml module, falling back to PyYAML when present.
This commit is contained in:
1 parent
d45bfbee2a
commit
992e17d458
2 files changed
+10
-3
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
__pycache__/
|
||||||
|
docs/.bak/
|
||||||
+8
-3
@@ -171,8 +171,9 @@ def _ensure_default_config() -> None:
|
|||||||
# Used by /sl slash command. Survives `hermes update`.
|
# Used by /sl slash command. Survives `hermes update`.
|
||||||
|
|
||||||
columns:
|
columns:
|
||||||
- {field: last_active, width: 10, label: Active}
|
- {field: last_active, width: 7, label: Active}
|
||||||
- {field: title, width: 42, label: Title}
|
- {field: title, width: 28, label: Title}
|
||||||
|
- {field: model, width: 14, label: Model}
|
||||||
- {field: message_count, width: 4, label: Msgs}
|
- {field: message_count, width: 4, label: Msgs}
|
||||||
- {field: cache_read_tokens, width: 6, label: Hit}
|
- {field: cache_read_tokens, width: 6, label: Hit}
|
||||||
- {field: input_tokens, width: 6, label: Miss}
|
- {field: input_tokens, width: 6, label: Miss}
|
||||||
@@ -191,14 +192,18 @@ columns:
|
|||||||
|
|
||||||
def _handle_sl(raw_args: str) -> Optional[str]:
|
def _handle_sl(raw_args: str) -> Optional[str]:
|
||||||
"""Handle /sl [limit] — show recent sessions with custom columns."""
|
"""Handle /sl [limit] — show recent sessions with custom columns."""
|
||||||
|
try:
|
||||||
|
from hermes_yaml import safe_load as yaml_safe_load
|
||||||
|
except ImportError:
|
||||||
import yaml
|
import yaml
|
||||||
|
yaml_safe_load = yaml.safe_load
|
||||||
|
|
||||||
config_path = _hermes_home() / "session_list_config.yaml"
|
config_path = _hermes_home() / "session_list_config.yaml"
|
||||||
|
|
||||||
# Load column config
|
# Load column config
|
||||||
try:
|
try:
|
||||||
if config_path.exists():
|
if config_path.exists():
|
||||||
cfg = yaml.safe_load(config_path.read_text(encoding="utf-8"))
|
cfg = yaml_safe_load(config_path.read_text(encoding="utf-8"))
|
||||||
columns = cfg.get("columns", [])
|
columns = cfg.get("columns", [])
|
||||||
else:
|
else:
|
||||||
columns = []
|
columns = []
|
||||||
|
|||||||
Reference in new issue
Block a user