mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
refactor(connection): 优化日志记录和代码结构
- 移除全局 logger 变量,使用 self.logger 替代 -优化日志记录格式,使用 bind 方法添加标签 - 删除不必要的空行,提高代码可读性- 简化 GitHub Actions工作流配置
This commit is contained in:
parent
03cc7318f8
commit
b740c15dee
2 changed files with 3 additions and 4 deletions
1
.github/workflows/docker-image.yml
vendored
1
.github/workflows/docker-image.yml
vendored
|
|
@ -1,6 +1,5 @@
|
||||||
name: Docker Image CI
|
name: Docker Image CI
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ from core.utils.auth_code_gen import AuthCodeGenerator
|
||||||
from core.mcp.manager import MCPManager
|
from core.mcp.manager import MCPManager
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
TAG = __name__
|
TAG = __name__
|
||||||
logger = setup_logging()
|
|
||||||
auto_import_modules("plugins_func.functions")
|
auto_import_modules("plugins_func.functions")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -370,8 +369,9 @@ class ConnectionHandler:
|
||||||
|
|
||||||
# 处理最后剩余的文本
|
# 处理最后剩余的文本
|
||||||
full_text = "".join(response_message)
|
full_text = "".join(response_message)
|
||||||
|
self.logger.bind(tag=TAG).info(
|
||||||
logger.bind(tag=TAG).info(f"deviceId: {self.conn.private_config.device_id},datetime: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")},模型回复: {full_text}")
|
f"deviceId: {self.conn.private_config.device_id},datetime: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")},模型回复: {full_text}"
|
||||||
|
)
|
||||||
remaining_text = full_text[processed_chars:]
|
remaining_text = full_text[processed_chars:]
|
||||||
if remaining_text:
|
if remaining_text:
|
||||||
segment_text = get_string_no_punctuation_or_emoji(remaining_text)
|
segment_text = get_string_no_punctuation_or_emoji(remaining_text)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue