mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 16:43:55 +08:00
feat: 统一LLM错误处理并添加系统错误回复配置
在多个LLM提供者中移除try-catch块,将错误处理统一到connection.py的流处理层 添加system_error_response配置项,支持自定义系统错误时的回复内容 在意图识别和流处理中捕获异常时返回配置的错误回复,避免硬编码错误信息 Fixes #2075
This commit is contained in:
@@ -573,3 +573,14 @@ def validate_mcp_endpoint(mcp_endpoint: str) -> bool:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def get_system_error_response(config: dict) -> str:
|
||||
"""获取系统错误时的回复
|
||||
|
||||
Args:
|
||||
config: 配置字典
|
||||
|
||||
Returns:
|
||||
str: 系统错误时的回复
|
||||
"""
|
||||
return config.get("system_error_response", "主人,小智现在有点忙,我们稍后再试吧。")
|
||||
Reference in New Issue
Block a user