feat: 多平台 Coding Plan 统一管理系统初始实现
- 支持 MiniMax/OpenAI/Google Gemini/智谱/Kimi 五个平台 - 插件化 Provider 架构,自动发现注册 - 多维度 QuotaRule 额度追踪(固定间隔/自然周期/API同步/手动) - OpenAI + Anthropic 兼容 API 代理,SSE 流式转发 - Model 路由表 + 额度耗尽自动 fallback - 多媒体任务队列(图片/语音/视频) - Vue3 + Tailwind 单文件 Web 仪表盘 - Docker 一键部署 Made-with: Cursor
This commit is contained in:
17
app/services/queue_service.py
Normal file
17
app/services/queue_service.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""任务队列辅助服务"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app import database as db
|
||||
|
||||
|
||||
async def get_queue_stats() -> dict:
|
||||
"""队列统计"""
|
||||
d = await db.get_db()
|
||||
stats = {}
|
||||
for status in ("pending", "running", "completed", "failed", "cancelled"):
|
||||
cur = await d.execute("SELECT COUNT(*) as cnt FROM tasks WHERE status=?", (status,))
|
||||
row = await cur.fetchone()
|
||||
stats[status] = row["cnt"]
|
||||
stats["total"] = sum(stats.values())
|
||||
return stats
|
||||
Reference in New Issue
Block a user