mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-25 17:18:11 +00:00
fix(moa): parse JSON string reference_models in _normalize_preset
When reference_models is stored as a JSON string (e.g. from hermes moa configure or hand-edited config.yaml), _normalize_preset silently falls back to hardcoded defaults because the string fails both isinstance(x, list) and isinstance(x, dict) checks. Add json.loads() parsing before the type checks so both formats work.
This commit is contained in:
parent
c1f5f0f911
commit
3638abfbf9
1 changed files with 6 additions and 0 deletions
|
|
@ -207,6 +207,12 @@ def _normalize_preset(raw: Any) -> dict[str, Any]:
|
|||
raw = {}
|
||||
|
||||
raw_refs = raw.get("reference_models")
|
||||
# reference_models may be a JSON string (hand-edited config.yaml) or a list.
|
||||
if isinstance(raw_refs, str):
|
||||
try:
|
||||
raw_refs = json.loads(raw_refs)
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
raw_refs = []
|
||||
if not isinstance(raw_refs, list):
|
||||
# A hand-edited scalar / single mapping (or a bad type) must degrade to
|
||||
# defaults instead of crashing the iteration, mirroring the tolerance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue