Files
syops/backend/app/api/__init__.py
T

53 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
backend/app/api/__init__.py
用途:集中注册所有 Blueprint(Wave 1 接入 create_app)。
依赖:各 api 子包 blueprint。
逻辑:替代 app/__init__.py 内 15 行散乱 register_blueprint。
"""
from __future__ import annotations
from flask import Flask
def register_blueprints(app: Flask) -> None:
"""
注册全部 HTTP Blueprint,保持对外 url_prefix 不变。
核心逻辑:Wave 0 仍从既有单体模块 import;Wave 1+ 逐步切换至分包。
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.knowledge_base import knowledge_base_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] 已分包骨架(re-export 旧模块,Wave 1 可切换 import 来源)
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')