🤖 自动格式化代码 [skip ci]

This commit is contained in:
github-actions[bot]
2025-05-03 17:45:14 +00:00
parent 96f33ee086
commit aa86387f36
3 changed files with 9 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
from fastapi import APIRouter
from strawberry.fastapi import GraphQLRouter
# from src.config.config import BotConfig
from src.common.logger_manager import get_logger
from src.api.reload_config import reload_config as reload_config_func
@@ -18,11 +19,12 @@ graphql_router = GraphQLRouter(schema=None, path="/") # Replace `None` with you
router.include_router(graphql_router, prefix="/graphql", tags=["GraphQL"])
@router.post("/config/reload")
async def reload_config():
return await reload_config_func()
def start_api_server():
"""启动API服务器"""
global_server.register_router(router, prefix="/api/v1")

View File

@@ -2,13 +2,14 @@ from fastapi import HTTPException
from rich.traceback import install
from src.config.config import BotConfig
import os
install(extra_lines=3)
install(extra_lines=3)
async def reload_config():
try:
from src.config import config as config_module
bot_config_path = os.path.join(BotConfig.get_config_dir(), "bot_config.toml")
config_module.global_config = BotConfig.load_config(config_path=bot_config_path)
return {"status": "reloaded"}

View File

@@ -894,9 +894,8 @@ CHAT_MESSAGE_STYLE_CONFIG = (
)
CHAT_IMAGE_STYLE_CONFIG = CHAT_IMAGE_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else CHAT_IMAGE_STYLE_CONFIG["advanced"]
INIT_STYLE_CONFIG = INIT_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else INIT_STYLE_CONFIG["advanced"]
API_SERVER_STYLE_CONFIG = (
API_SERVER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else API_SERVER_STYLE_CONFIG["advanced"]
)
API_SERVER_STYLE_CONFIG = API_SERVER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else API_SERVER_STYLE_CONFIG["advanced"]
def is_registered_module(record: dict) -> bool:
"""检查是否为已注册的模块"""