Re-read voice_to_text / text_to_voice from config and drop the cached voice bots so the next call picks up the new provider. Used by the web console after the user edits voice settings. Does NOT touch the agent_bridge / agent state.
(self)
| 91 | self._agent_bridge = None |
| 92 | |
| 93 | def refresh_voice(self): |
| 94 | """Re-read voice_to_text / text_to_voice from config and drop the |
| 95 | cached voice bots so the next call picks up the new provider. |
| 96 | Used by the web console after the user edits voice settings. |
| 97 | Does NOT touch the agent_bridge / agent state. |
| 98 | """ |
| 99 | new_v2t = conf().get("voice_to_text") or self._auto_pick_voice_to_text() |
| 100 | new_t2v = conf().get("text_to_voice", "google") |
| 101 | if conf().get("use_linkai") and conf().get("linkai_api_key"): |
| 102 | if not conf().get("voice_to_text") or conf().get("voice_to_text") in ["openai"]: |
| 103 | new_v2t = const.LINKAI |
| 104 | if not conf().get("text_to_voice") or conf().get("text_to_voice") in ["openai", const.TTS_1, const.TTS_1_HD]: |
| 105 | new_t2v = const.LINKAI |
| 106 | self.btype["voice_to_text"] = new_v2t |
| 107 | self.btype["text_to_voice"] = new_t2v |
| 108 | self.bots.pop("voice_to_text", None) |
| 109 | self.bots.pop("text_to_voice", None) |
| 110 | logger.info(f"[Bridge] voice refreshed: voice_to_text={new_v2t}, text_to_voice={new_t2v}") |
| 111 | |
| 112 | @staticmethod |
| 113 | def _auto_pick_voice_to_text() -> str: |
no test coverage detected