53 lines
2.3 KiB
Python
53 lines
2.3 KiB
Python
"""
|
||
backend/app/api/__init__.py
|
||
|
||
用途:集中注册所有 HTTP Blueprint。
|
||
依赖:各 api 子模块 blueprint(单体或分包 re-export)。
|
||
逻辑:create_app 唯一调用 register_blueprints(app);后续拆包只改本文件 import 来源。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
from flask import Flask
|
||
|
||
|
||
def register_blueprints(app: Flask) -> None:
|
||
"""
|
||
注册全部 HTTP Blueprint,保持对外 url_prefix 与 Wave 0 之前一致。
|
||
核心逻辑:集中管理路由挂载点;后续 api/user、api/chat 等分包迁移时仅改本函数 import 来源。
|
||
Args:
|
||
app: Flask 应用实例。
|
||
"""
|
||
# [STEP 1] 单体模块(Wave 3 前保持不变)
|
||
from app.api.chat import chat_bp
|
||
from app.api.admin import admin_bp
|
||
from app.api.agents import agents_bp
|
||
from app.api.user import user_bp
|
||
from app.api.integration import integration_bp
|
||
from app.api.internal_jobs import internal_jobs_bp
|
||
from app.api.speech import speech_bp
|
||
|
||
# [STEP 2] 已分包骨架(Wave 3:kb、schedule 等)
|
||
from app.api.kb import knowledge_base_bp
|
||
from app.api.schedule import schedule_admin_bp
|
||
from app.api.workspace import (
|
||
workspace_file_check_bp,
|
||
workspace_schedule_bp,
|
||
workspace_shipping_notice_bp,
|
||
)
|
||
from app.api.tools import file_check_bp, shipping_notice_bp
|
||
|
||
app.register_blueprint(chat_bp, url_prefix='/api/chat')
|
||
app.register_blueprint(admin_bp, url_prefix='/api/admin')
|
||
app.register_blueprint(agents_bp, url_prefix='/api/agents')
|
||
app.register_blueprint(user_bp, url_prefix='/api/user')
|
||
app.register_blueprint(knowledge_base_bp, url_prefix='/api/kb')
|
||
app.register_blueprint(integration_bp, url_prefix='/api/integration')
|
||
app.register_blueprint(schedule_admin_bp, url_prefix='/api/admin')
|
||
app.register_blueprint(workspace_schedule_bp, url_prefix='/api/workspace')
|
||
app.register_blueprint(workspace_shipping_notice_bp, url_prefix='/api/workspace')
|
||
app.register_blueprint(workspace_file_check_bp, url_prefix='/api/workspace')
|
||
app.register_blueprint(internal_jobs_bp, url_prefix='/api/internal/jobs')
|
||
app.register_blueprint(shipping_notice_bp, url_prefix='/api/shipping-notice')
|
||
app.register_blueprint(file_check_bp, url_prefix='/api/file-check')
|
||
app.register_blueprint(speech_bp, url_prefix='/api/speech')
|