refactor: remove legacy assistant compatibility

This commit is contained in:
Xin Wang
2026-08-18 10:07:18 +08:00
parent abfcd4cd19
commit d003ee77a5
40 changed files with 505 additions and 729 deletions
+3 -20
View File
@@ -364,31 +364,14 @@ class PromptBrain(BaseBrain):
)
def _opening_message(self) -> dict[str, Any] | None:
startup = self._cfg.startup if isinstance(self._cfg.startup, dict) else {}
value = startup.get("opening_message", startup.get("openingMessage"))
value = self._cfg.startup["opening_message"]
return value if isinstance(value, dict) else None
def _opening_mode(self) -> str:
startup = self._cfg.startup if isinstance(self._cfg.startup, dict) else {}
value = str(startup.get("opening_mode", startup.get("openingMode")) or "")
if value in {"interruptible", "playback", "confirmation"}:
return value
# Before openingMode existed, an opening message meant confirmation;
# ordinary Prompt greetings were interruptible.
return (
"confirmation"
if self._opening_message() is not None
else "interruptible"
)
return str(self._cfg.startup["opening_mode"])
def _entry_mode(self) -> str:
startup = self._cfg.startup if isinstance(self._cfg.startup, dict) else {}
value = str(startup.get("entry_mode", startup.get("entryMode")) or "")
if value in {"wait_user", "generate"}:
return value
# Raw runtime configs saved before entryMode existed generated a first
# reply after their opening confirmation. Keep that legacy behavior.
return "generate" if self._opening_mode() == "confirmation" else "wait_user"
return str(self._cfg.startup["entry_mode"])
async def _enter_prompt_if_ready(self) -> None:
if (