wangzhibo
10 天以前 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
xiaozhi-esp32-server/main/xiaozhi-server/core/http_server.py
@@ -1,6 +1,7 @@
import asyncio
from aiohttp import web
from config.logger import setup_logging
from core.api.lesson_audio_handler import LessonAudioHandler
from core.api.ota_handler import OTAHandler
from core.api.vision_handler import VisionHandler
@@ -13,6 +14,7 @@
        self.logger = setup_logging()
        self.ota_handler = OTAHandler(config)
        self.vision_handler = VisionHandler(config)
        self.lesson_audio_handler = LessonAudioHandler(config)
    def _get_websocket_url(self, local_ip: str, port: int) -> str:
        """获取websocket地址
@@ -72,6 +74,14 @@
                        web.options(
                            "/mcp/vision/explain", self.vision_handler.handle_options
                        ),
                        web.get(
                            "/lesson-audio/{org_id}/index/{kind}/{level}/{story}/{lang}",
                            self.lesson_audio_handler.handle_index,
                        ),
                        web.get(
                            "/lesson-audio/{org_id}/{path:.*}",
                            self.lesson_audio_handler.handle_get,
                        ),
                    ]
                )
@@ -80,6 +90,7 @@
                await runner.setup()
                site = web.TCPSite(runner, host, port)
                await site.start()
                self.lesson_audio_handler.log_ready()
                # 保持服务运行
                while True: