fix: avoid duplicating LLM hooks on checkpoint restore

This commit is contained in:
Greyson LaLonde
2026-04-04 22:41:59 +08:00
parent e0fc32144c
commit 6e7afb732f

View File

@@ -136,8 +136,10 @@ class CrewAgentExecutor(BaseAgentExecutor):
def __init__(self, i18n: I18N | None = None, **kwargs: Any) -> None:
super().__init__(**kwargs)
self._i18n = i18n or get_i18n()
self.before_llm_call_hooks.extend(get_before_llm_call_hooks())
self.after_llm_call_hooks.extend(get_after_llm_call_hooks())
if not self.before_llm_call_hooks:
self.before_llm_call_hooks.extend(get_before_llm_call_hooks())
if not self.after_llm_call_hooks:
self.after_llm_call_hooks.extend(get_after_llm_call_hooks())
if self.llm and not isinstance(self.llm, str):
existing_stop = getattr(self.llm, "stop", [])
self.llm.stop = list(