Files
dn20/ai_deepseek/__init__.py
2026-11-04 19:58:07 +08:00

22 lines
655 B
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.
# 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 服务")