mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 01:40:15 +08:00
* refactor: migrate to fastapi * structure refactor * fix: pyright fix * refactor: improve error handling and public messages in plugin services * feat(api): refactor API client integration and enhance request handling - Updated API client configuration to use a dedicated HTTP client. - Introduced utility functions for generating options, queries, and form data for API requests. - Refactored multiple API methods to utilize the new utility functions for improved consistency and readability. - Renamed types for clarity and updated import statements accordingly. feat(docs): add script to update OpenAPI JSON from YAML spec - Created a Python script to convert OpenAPI YAML specification to JSON format. - The script supports customizable input and output paths. - Ensured the script handles directory creation for output paths and validates the YAML structure. * fix * feat(auth): implement rate limiting for v1 login endpoint and enhance request handling * Refactor dashboard API routers to use legacy_router for backward compatibility - Changed all instances of dashboard_router to legacy_router across multiple API modules including platform, plugins, providers, sessions, skills, stats, subagents, t2i, tools, updates, and asgi_runtime. - Updated route definitions to ensure existing endpoints remain functional under the new router structure. - Introduced support for Quart request context in asgi_runtime to enhance compatibility with existing Quart-based plugins. - Added a test case to validate the functionality of the new Quart request context handling in plugin extensions. * chore: remove cli test * fix: update dashboard tests for fastapi migration * chore: satisfy ruff checks * fix: update openapi api key scopes * fix: sync config scope chip selection * fix: restore quart dependency * docs: clarify quart plugin api compatibility * docs: update openapi scope documentation * fix: use singular skill openapi scope * fix: hide update service exception details * fix: address fastapi review comments * fix: address dashboard review findings * docs: revert unrelated package deployment changes * docs: update agent api generation guidance * feat: add plugin page web api helpers * docs: add plugin page bridge demo * fix: type plugin upload files * fix: stabilize plugin page uploads * fix: type plugin web request proxy * docs: remove plugin page docs example * fix: authenticate plugin page SSE bridge
64 lines
2.5 KiB
Python
64 lines
2.5 KiB
Python
"""FastAPI HTTP API surface for the AstrBot dashboard."""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from .api_keys import router as api_keys_router
|
|
from .auth import router as auth_router
|
|
from .backups import router as backups_router
|
|
from .bots import router as bots_router
|
|
from .chat import router as chat_router
|
|
from .chat_projects import router as chat_projects_router
|
|
from .config_profiles import router as config_profiles_router
|
|
from .conversations import router as conversations_router
|
|
from .cron import router as cron_router
|
|
from .extensions import router as extensions_router
|
|
from .files import router as files_router
|
|
from .knowledge_bases import router as knowledge_bases_router
|
|
from .live_chat import router as live_chat_router
|
|
from .logs import router as logs_router
|
|
from .open_api import router as open_api_router
|
|
from .personas import router as personas_router
|
|
from .platform import router as platform_router
|
|
from .plugins import router as plugins_router
|
|
from .providers import router as providers_router
|
|
from .sessions import router as sessions_router
|
|
from .skills import router as skills_router
|
|
from .stats import router as stats_router
|
|
from .subagents import router as subagents_router
|
|
from .t2i import router as t2i_router
|
|
from .tools import router as tools_router
|
|
from .updates import router as updates_router
|
|
|
|
API_V1_PREFIX = "/api/v1"
|
|
|
|
|
|
def build_api_router() -> APIRouter:
|
|
router = APIRouter(prefix=API_V1_PREFIX)
|
|
router.include_router(auth_router)
|
|
router.include_router(backups_router)
|
|
router.include_router(config_profiles_router)
|
|
router.include_router(api_keys_router)
|
|
router.include_router(bots_router)
|
|
router.include_router(providers_router)
|
|
router.include_router(plugins_router)
|
|
router.include_router(chat_router)
|
|
router.include_router(chat_projects_router)
|
|
router.include_router(conversations_router)
|
|
router.include_router(cron_router)
|
|
router.include_router(files_router)
|
|
router.include_router(knowledge_bases_router)
|
|
router.include_router(extensions_router)
|
|
router.include_router(skills_router)
|
|
router.include_router(sessions_router)
|
|
router.include_router(subagents_router)
|
|
router.include_router(logs_router)
|
|
router.include_router(stats_router)
|
|
router.include_router(tools_router)
|
|
router.include_router(platform_router)
|
|
router.include_router(t2i_router)
|
|
router.include_router(personas_router)
|
|
router.include_router(updates_router)
|
|
router.include_router(open_api_router)
|
|
router.include_router(live_chat_router)
|
|
return router
|