[结束提示音]:完成对话结束音效提示,包含本地短音生成、恢复待机播放和配置测试

This commit is contained in:
mkbk
2026-06-18 13:59:12 +08:00
parent ac72738fc8
commit 80549fb312
12 changed files with 130 additions and 23 deletions
+20
View File
@@ -59,6 +59,9 @@ class AppConfig:
barge_in_enabled: bool = True
barge_in_min_speech_ms: int = 250
barge_in_echo_guard_ms: int = 500
end_chime_enabled: bool = True
end_chime_frequency_hz: int = 880
end_chime_duration_ms: int = 140
@classmethod
def from_dotenv(cls, path: str | Path = ".env", prefix: str = "OWNER_") -> "AppConfig":
@@ -130,6 +133,9 @@ class AppConfig:
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"),
end_chime_enabled=(get("END_CHIME_ENABLED", "1") or "1").lower() not in {"0", "false", "no"},
end_chime_frequency_hz=int(get("END_CHIME_FREQUENCY_HZ", "880") or "880"),
end_chime_duration_ms=int(get("END_CHIME_DURATION_MS", "140") or "140"),
)
@classmethod
@@ -394,6 +400,20 @@ class AppConfig:
"startup",
)
)
for name, value in {
"OWNER_END_CHIME_FREQUENCY_HZ": self.end_chime_frequency_hz,
"OWNER_END_CHIME_DURATION_MS": self.end_chime_duration_ms,
}.items():
if value <= 0:
errors.append(
ProviderError(
ErrorCode.CONFIG_MISSING_VALUE,
f"{name} must be positive",
False,
"config",
"startup",
)
)
return errors
def api_url(self, path: str) -> str: