22 lines
655 B
Python
22 lines
655 B
Python
# Part of the ai_deepseek module.
|
||
# -*- coding: utf-8 -*-
|
||
import logging
|
||
|
||
from . import deepseek_client
|
||
from . import models
|
||
from . import transport_patch
|
||
|
||
_logger = logging.getLogger(__name__)
|
||
|
||
|
||
def post_load_hook():
|
||
"""服务器启动、模块导入后立即接管传输层。
|
||
|
||
用 post_load 而非 post_init_hook:前者在**每次**服务器启动时都会执行,
|
||
从而保证重启后拦截持续生效(post_init 只在安装那一次跑)。
|
||
"""
|
||
try:
|
||
transport_patch.apply_patch()
|
||
except Exception: # noqa: BLE001
|
||
_logger.exception("ai_deepseek: 传输层接管失败,AI 将回退官方 IAP 服务")
|