feat: 添加线索引擎、NLQ、场景检测、前端界面等核心功能模块
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""适配器注册表:按 staging 表名索引,便于调度器统一调用。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type
|
||||
|
||||
from app.ingest.base import BaseAdapter
|
||||
|
||||
# 全局注册表:staging_table -> Adapter 类
|
||||
ADAPTER_REGISTRY: dict[str, Type[BaseAdapter]] = {}
|
||||
|
||||
|
||||
def register_adapter(cls: Type[BaseAdapter]) -> Type[BaseAdapter]:
|
||||
"""类装饰器:将 Adapter 注册到全局表。"""
|
||||
if cls.staging_table:
|
||||
ADAPTER_REGISTRY[cls.staging_table] = cls
|
||||
return cls
|
||||
|
||||
|
||||
def get_adapter(staging_table: str) -> Type[BaseAdapter] | None:
|
||||
"""按 staging 表名查找已注册的适配器类。"""
|
||||
return ADAPTER_REGISTRY.get(staging_table)
|
||||
Reference in New Issue
Block a user