MCPcopy
hub / github.com/MAA1999/M9A / apply_param_overrides

Method apply_param_overrides

agent/utils/params.py:97–114  ·  view source on GitHub ↗
(self, params: dict)

Source from the content-addressed store, hash-verified

95 OVERRIDABLE: frozenset = frozenset()
96
97 def apply_param_overrides(self, params: dict) -> None:
98 for const in self.OVERRIDABLE:
99 self.__dict__.pop(const, None)
100 for key, value in params.items():
101 if key == "query":
102 continue
103 const = key.upper()
104 if const not in self.OVERRIDABLE:
105 logger.warning(f"[{type(self).__name__}] 未知参数 {key},已忽略")
106 continue
107 try:
108 setattr(
109 self, const, coerce_like(value, getattr(type(self), const), key)
110 )
111 except ValueError as e:
112 logger.error(
113 f"[{type(self).__name__}] 参数 {key} 非法({e}),回落默认值"
114 )

Callers 3

analyzeMethod · 0.80
analyzeMethod · 0.80
analyzeMethod · 0.80

Calls 1

coerce_likeFunction · 0.85

Tested by

no test coverage detected