[连续对话判断]:完成自动持续对话和播报打断,包含回复意图判断、免唤醒追问和打断回归测试

This commit is contained in:
mkbk
2026-06-18 12:08:41 +08:00
parent 1e956f5eb6
commit 7519725321
16 changed files with 1059 additions and 119 deletions
+54
View File
@@ -52,6 +52,13 @@ class AppConfig:
context_mode: str = "session_memory"
context_max_messages: int = 12
context_max_chars: int = 12000
continuous_dialog_enabled: bool = True
continuation_decision_provider: str = "hybrid"
continuation_confidence_threshold: float = 0.65
followup_listen_timeout_ms: int = 3000
barge_in_enabled: bool = True
barge_in_min_speech_ms: int = 250
barge_in_echo_guard_ms: int = 500
@classmethod
def from_dotenv(cls, path: str | Path = ".env", prefix: str = "OWNER_") -> "AppConfig":
@@ -111,6 +118,18 @@ class AppConfig:
context_mode=(get("CONTEXT_MODE", "session_memory") or "session_memory").lower(),
context_max_messages=int(get("CONTEXT_MAX_MESSAGES", "12") or "12"),
context_max_chars=int(get("CONTEXT_MAX_CHARS", "12000") or "12000"),
continuous_dialog_enabled=(get("CONTINUOUS_DIALOG_ENABLED", "1") or "1").lower()
not in {"0", "false", "no"},
continuation_decision_provider=(
get("CONTINUATION_DECISION_PROVIDER", "hybrid") or "hybrid"
).lower(),
continuation_confidence_threshold=float(
get("CONTINUATION_CONFIDENCE_THRESHOLD", "0.65") or "0.65"
),
followup_listen_timeout_ms=int(get("FOLLOWUP_LISTEN_TIMEOUT_MS", "3000") or "3000"),
barge_in_enabled=(get("BARGE_IN_ENABLED", "1") or "1").lower() not in {"0", "false", "no"},
barge_in_min_speech_ms=int(get("BARGE_IN_MIN_SPEECH_MS", "250") or "250"),
barge_in_echo_guard_ms=int(get("BARGE_IN_ECHO_GUARD_MS", "500") or "500"),
)
@classmethod
@@ -340,6 +359,41 @@ class AppConfig:
"startup",
)
)
if self.continuation_decision_provider not in {"hybrid", "rule", "llm"}:
errors.append(
ProviderError(
ErrorCode.CONFIG_MISSING_VALUE,
"OWNER_CONTINUATION_DECISION_PROVIDER must be hybrid, rule, or llm",
False,
"config",
"startup",
)
)
if not 0 < self.continuation_confidence_threshold <= 1:
errors.append(
ProviderError(
ErrorCode.CONFIG_MISSING_VALUE,
"OWNER_CONTINUATION_CONFIDENCE_THRESHOLD must be in (0, 1]",
False,
"config",
"startup",
)
)
for name, value in {
"OWNER_FOLLOWUP_LISTEN_TIMEOUT_MS": self.followup_listen_timeout_ms,
"OWNER_BARGE_IN_MIN_SPEECH_MS": self.barge_in_min_speech_ms,
"OWNER_BARGE_IN_ECHO_GUARD_MS": self.barge_in_echo_guard_ms,
}.items():
if value < 0:
errors.append(
ProviderError(
ErrorCode.CONFIG_MISSING_VALUE,
f"{name} must be non-negative",
False,
"config",
"startup",
)
)
return errors
def api_url(self, path: str) -> str: