Class PluginListener<R extends PluginParam,​T>

  • Direct Known Subclasses:
    DefaultPluginListener

    public abstract class PluginListener<R extends PluginParam,​T>
    extends okhttp3.sse.EventSourceListener
    描述: 插件开发返回信息收集sse监听器
    Author:
    https:www.unfbx.com 2023-08-18
    • Constructor Detail

      • PluginListener

        public PluginListener​(OpenAiStreamClient client,
                              okhttp3.sse.EventSourceListener eventSourceListener,
                              PluginAbstract<R,​T> plugin,
                              ChatCompletion chatCompletion)
        构造方法必备四个元素
        Parameters:
        client - OpenAiStreamClient
        eventSourceListener - 处理真实第二次sse请求的自定义监听
        plugin - 插件信息
        chatCompletion - 请求参数
    • Method Detail

      • onClosedAfter

        public void onClosedAfter()
        sse关闭后处理,第二次请求方法
      • onEvent

        public final void onEvent​(okhttp3.sse.EventSource eventSource,
                                  String id,
                                  String type,
                                  String data)
        Overrides:
        onEvent in class okhttp3.sse.EventSourceListener
      • onClosed

        public final void onClosed​(okhttp3.sse.EventSource eventSource)
        Overrides:
        onClosed in class okhttp3.sse.EventSourceListener
      • onOpen

        public void onOpen​(okhttp3.sse.EventSource eventSource,
                           okhttp3.Response response)
        Overrides:
        onOpen in class okhttp3.sse.EventSourceListener
      • onFailure

        public void onFailure​(okhttp3.sse.EventSource eventSource,
                              Throwable t,
                              okhttp3.Response response)
        Overrides:
        onFailure in class okhttp3.sse.EventSourceListener