包含多个会话的累积代码变更: - backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔 - admin-web: ETL 状态页、任务管理、调度配置、登录优化 - miniprogram: 看板页面、聊天集成、UI 组件、导航更新 - etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强 - tenant-admin: 项目初始化 - db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8) - packages/shared: 枚举和工具函数更新 - tools: 数据库工具、报表生成、健康检查 - docs: PRD/架构/部署/合约文档更新 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""
|
||
配置路由:CONFIG-1 技能类型。
|
||
|
||
前缀 /api/xcx/config,由 main.py 注册。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import logging
|
||
|
||
from fastapi import APIRouter, Depends
|
||
|
||
from app.auth.dependencies import CurrentUser
|
||
from app.middleware.permission import require_approved
|
||
from app.schemas.xcx_config import SkillTypeItem
|
||
from app.services import fdw_queries
|
||
from app.trace.decorators import trace_service
|
||
|
||
logger = logging.getLogger(__name__)
|
||
|
||
router = APIRouter(prefix="/api/xcx/config", tags=["xcx-config"])
|
||
|
||
|
||
@router.get("/skill-types", response_model=list[SkillTypeItem])
|
||
@trace_service("获取技能类型配置", "Get skill types config")
|
||
async def get_skill_types(
|
||
user: CurrentUser = Depends(require_approved()),
|
||
):
|
||
"""技能类型配置(CONFIG-1)。查询失败降级返回空数组。"""
|
||
try:
|
||
from app.database import get_connection
|
||
conn = get_connection()
|
||
try:
|
||
return fdw_queries.get_skill_types(conn, user.site_id)
|
||
finally:
|
||
conn.close()
|
||
except Exception:
|
||
logger.warning("CONFIG-1 技能类型查询失败,降级为空数组", exc_info=True)
|
||
return []
|