fix: openclaw migration overwrites model config dict with string (#3924)
migrate_model_config() was writing `config["model"] = model_str` which
replaces the entire model dict (default, provider, base_url) with a
bare string. This causes 'str' object has no attribute 'get' errors
throughout Hermes when any code does model_cfg.get("default").
Now preserves the existing model dict and only updates the "default"
key, keeping provider/base_url intact.
This commit is contained in:
@@ -1297,7 +1297,11 @@ class Migrator:
|
|||||||
|
|
||||||
if self.execute:
|
if self.execute:
|
||||||
backup_path = self.maybe_backup(destination)
|
backup_path = self.maybe_backup(destination)
|
||||||
hermes_config["model"] = model_str
|
existing_model = hermes_config.get("model")
|
||||||
|
if isinstance(existing_model, dict):
|
||||||
|
existing_model["default"] = model_str
|
||||||
|
else:
|
||||||
|
hermes_config["model"] = {"default": model_str}
|
||||||
dump_yaml_file(destination, hermes_config)
|
dump_yaml_file(destination, hermes_config)
|
||||||
self.record("model-config", source_path, destination, "migrated", backup=str(backup_path) if backup_path else "", model=model_str)
|
self.record("model-config", source_path, destination, "migrated", backup=str(backup_path) if backup_path else "", model=model_str)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user