Commit Graph
4 Commits
Author SHA1 Message Date
gitea 4d977bb704 SealAI 发布版本接口:publish_draft_rules + POST /sealai/rule-set-versions/publish 2026-04-14 18:25:37 +08:00
gitea 9525f327cd 新增 SealAI 审核规则服务层:草稿 CRUD + 版本历史查询 2026-04-14 18:10:40 +08:00
gitea 9d517defe3 新增 SealAI 子模块:认证层 + API 传输层 + 服务层
架构:融入现有三层结构,SealAI 作为各层的子目录与 HAB 模块并列
  api/sealai/    - SealAiClient(Bearer JWT)+ auth_api + billing_api + schemas
  services/sealai/ - auth_service(SSO换token/缓存)+ billing_service
  config.py      - 新增 get_corp(corp_id) 按ID查询企业配置

认证流程:快报 accesstoken → SSO 换 Bearer JWT → 缓存到 sealai_tokens.json
已验证:auth/me 和 billing/status 端点正常返回数据
2026-04-14 16:33:22 +08:00
gitea 475ce518f9 重构第2批:API 层加固 + 新增 service 层
api/__init__.py:
- EkbClient.get/post 捕获 HTTP 错误,转换为 AuthenticationError /
  ApiResponseError;识别快报 errorCode=401 结构
- get_client() 改为抛出 NotLoggedInError(原为 RuntimeError)
- 新增 close() 方法便于非 with 场景使用

新增 services/ 目录(业务逻辑层):
- auth_service.py:企业认证配置的增删查改,返回 CorpInfo dataclass
- agent_service.py:Agent CRUD + copy + 高阶组合查询 get_dedup_rules_across_agents
  AgentCreateInput / AgentUpdateInput dataclass 统一输入结构
- rule_service.py:Rule 查询(支持按编码/ID 查找)+ CRUD
- __init__.py:统一 re-export,上层只从此处导入
2026-04-14 11:06:06 +08:00