diff --git a/astrbot/_internal/geteway/server.py b/astrbot/_internal/geteway/server.py index fc14b2a5f..e8648a8bc 100644 --- a/astrbot/_internal/geteway/server.py +++ b/astrbot/_internal/geteway/server.py @@ -9,7 +9,6 @@ from __future__ import annotations import asyncio import json -import logging from contextlib import asynccontextmanager from typing import Any @@ -21,7 +20,6 @@ from astrbot._internal.geteway.ws_manager import WebSocketManager try: from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.middleware.cors import CORSMiddleware - from fastapi.responses import JSONResponse except ImportError: logger.warning("FastAPI not installed, gateway unavailable.") FastAPI = None # type: ignore diff --git a/astrbot/_internal/geteway/ws_manager.py b/astrbot/_internal/geteway/ws_manager.py index 9b6ee9377..c726f7751 100644 --- a/astrbot/_internal/geteway/ws_manager.py +++ b/astrbot/_internal/geteway/ws_manager.py @@ -5,8 +5,6 @@ WebSocket connection manager for the AstrBot gateway. from __future__ import annotations import asyncio -import json -import logging from typing import Any from astrbot import logger diff --git a/astrbot/_internal/runtime/orchestrator.py b/astrbot/_internal/runtime/orchestrator.py index 0c72ca913..c54293a0d 100644 --- a/astrbot/_internal/runtime/orchestrator.py +++ b/astrbot/_internal/runtime/orchestrator.py @@ -71,6 +71,13 @@ class AstrbotOrchestrator(BaseAstrbotOrchestrator): self._running = True log.info("AstrbotOrchestrator run loop started.") + # TODO: Replace asyncio.sleep loop with proper task scheduling using anyio. + # The ASYNC110 warning is valid - this should use asyncio.Event.wait() or + # a task group with cancellation, but keeping as-is for now to allow + # periodic health checks during development. Final implementation should: + # - Use anyio.TaskGroup for managing periodic tasks + # - Implement proper cancellation via Event.wait() + # - Avoid busy-waiting with sleep intervals try: while self._running: # TODO: Periodic tasks: diff --git a/docs/dev/0.overview.md b/docs/dev/0.overview.md deleted file mode 100644 index ff2cc19d5..000000000 --- a/docs/dev/0.overview.md +++ /dev/null @@ -1,31 +0,0 @@ -# 开发者日记@lightjunction -为了避免和主分支发生大量冲突,新架构设计全部移动至了_internel包 -目前API不稳定,并不希望外部导入这个内部包 -新增astrbot dev子命令用于启动新架构 -概念: -核心运行时:core runtime -核心运行时是主进程 -主要是启动一个后端,这个后端将改为使用fastapi开发 -插件称呼为star -astrboot,这个名字就和星系相关,插件当然就是一个一个星星了 -Galaxy是星系 -我们的核心运行时需要一个协议和插件对话 -我思考,我们的插件,最好是可以做到和lsp服务器或者mcp服务器那样 -我们需要一套新的协议 -我列举本项目采用的协议如下: -lsp协议:client -mcp协议:client + server -acp协议:client + server -abp协议:astrbot protocol client + server (相当于内置插件) -协议层只管传输 -runtime则负责响应和调度 -异步库使用anyio -## 覆盖率测试 -需要完善覆盖率测试 -## 类型标注 -需要通过ty类型检查 -避免使用Any cast -## 代码风格 -需要通过ruff检查 -## 细节 -使用uv run 运行一切,别用python xxxx