Class DefaultOpenAiAuthInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    public class DefaultOpenAiAuthInterceptor
    extends OpenAiAuthInterceptor
    描述:请求增加header apikey
    Since:
    2023-03-23
    Author:
    https:www.unfbx.com
    • Constructor Detail

      • DefaultOpenAiAuthInterceptor

        public DefaultOpenAiAuthInterceptor()
        请求头处理
      • DefaultOpenAiAuthInterceptor

        public DefaultOpenAiAuthInterceptor​(Map warringConfig)
        构造方法
        Parameters:
        warringConfig - 所有的key都失效后的告警参数配置
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws IOException
        拦截器鉴权
        Parameters:
        chain - Chain
        Returns:
        Response对象
        Throws:
        IOException - io异常
      • onErrorDealApiKeys

        protected List<String> onErrorDealApiKeys​(String apiKey)
        key失效或者禁用后的处理逻辑 默认不处理
        Specified by:
        onErrorDealApiKeys in class OpenAiAuthInterceptor
        Parameters:
        apiKey - 返回新的api keys集合
        Returns:
        新的apiKey集合
      • noHaveActiveKeyWarring

        protected void noHaveActiveKeyWarring()
        Description copied from class: OpenAiAuthInterceptor
        所有的key都失效后,自定义预警配置 可以通过warringConfig配置参数实现飞书、钉钉、企业微信、邮箱预警等
        Specified by:
        noHaveActiveKeyWarring in class OpenAiAuthInterceptor