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

This commit is contained in:
github-actions[bot]
2025-05-07 14:08:29 +00:00
parent 162dc49acd
commit 61f6bf3e7e
4 changed files with 12 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ async def forced_change_subheartflow_status(subheartflow_id: str, status: ChatSt
return await heartflow.force_change_subheartflow_status(subheartflow_id, status)
return False
async def get_subheartflow_cycle_info(subheartflow_id: str, history_len: int) -> dict:
"""获取子心流的循环信息"""
subheartflow_cycle_info = await heartflow.api_get_subheartflow_cycle_info(subheartflow_id, history_len)

View File

@@ -2,6 +2,7 @@ from fastapi import APIRouter
from strawberry.fastapi import GraphQLRouter
import os
import sys
# from src.heart_flow.heartflow import heartflow
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
# from src.config.config import BotConfig
@@ -73,6 +74,7 @@ async def force_stop_maibot():
logger.error("MAI Bot强制停止失败")
return {"status": "failed"}
@router.get("/gui/subheartflow/cycleinfo")
async def get_subheartflow_cycle_info_api(subheartflow_id: str, history_len: int):
"""获取子心流的循环信息"""
@@ -83,6 +85,7 @@ async def get_subheartflow_cycle_info_api(subheartflow_id: str, history_len: int
logger.warning(f"子心流 {subheartflow_id} 循环信息未找到")
return {"status": "failed", "reason": "subheartflow not found"}
@router.get("/gui/get_all_states")
async def get_all_states_api():
"""获取所有状态"""
@@ -93,6 +96,7 @@ async def get_all_states_api():
logger.warning("获取所有状态失败")
return {"status": "failed", "reason": "failed to get all states"}
def start_api_server():
"""启动API服务器"""
global_server.register_router(router, prefix="/api/v1")

View File

@@ -71,7 +71,6 @@ class Heartflow:
"""获取所有状态"""
return await self.interest_logger.api_get_all_states()
async def api_get_subheartflow_cycle_info(self, subheartflow_id: str, history_len: int) -> Optional[dict]:
"""获取子心流的循环信息"""
subheartflow = await self.subheartflow_manager.get_or_create_subheartflow(subheartflow_id)