feat(voice): configurable user voice-recognition time (bargeInMs, default 700ms)

Expose the barge-in sustained-speech threshold as a dashboard bot setting
"유저 음성 인식 시간" (ms). Server clamps 0..5000, persists via state_store,
and the bot reads it each report round-trip; WSAI_BARGE_IN_MS/700 stays the
fallback default.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-08-27 11:35:01 +09:00
parent d5501d0b8a
commit 0e4e7c6bb2
3 changed files with 41 additions and 4 deletions

View File

@@ -37,7 +37,13 @@ class BotControl:
self._lists: dict[str, dict[str, Any]] = st.get("lists") or {}
# Bot behaviour settings the dashboard toggles and the bot reads on each
# report. bargeIn: stop the bot's current TTS the moment a user speaks.
self._settings: dict[str, Any] = {"bargeIn": True, **(st.get("botSettings") or {})}
# bargeInMs: how long (ms) a user must keep speaking before that barge-in
# fires — the "유저 음성 인식 시간" the dashboard exposes (default 700).
self._settings: dict[str, Any] = {
"bargeIn": True,
"bargeInMs": 700,
**(st.get("botSettings") or {}),
}
# -- bot behaviour settings ------------------------------------------ #
def get_settings(self) -> dict[str, Any]:
@@ -48,6 +54,13 @@ class BotControl:
with self._lock:
if "bargeIn" in data:
self._settings["bargeIn"] = bool(data["bargeIn"])
if "bargeInMs" in data:
try:
ms = int(data["bargeInMs"])
except (TypeError, ValueError):
ms = 700
# Keep it sane: 0ms = instant, cap at 5s so a typo can't wedge it.
self._settings["bargeInMs"] = max(0, min(5000, ms))
out = dict(self._settings)
from . import state_store
state_store.patch("botSettings", out)