lzhpo / chatgpt-spring-boot-starter

支持OpenAi所有可用的接口,包括但不限于流式输出和Token计算等,可配置多个API-Key、权重、代理、自定义API等诸多功能...
http://www.lzhpo.com
Apache License 2.0
153 stars 30 forks source link

Dev http client #2

Open lunasaw opened 1 year ago

lunasaw commented 1 year ago

增加 HttpOpenAiClient 实现OpenAiClient接口,使用httpclient5, 处理api请求,包含sse处理.新增统一接口回调标志接口,com.lzhpo.chatgpt.sse.Listener,上层回调用接口使用这个标志入参。 使用5.2.1最新版本,因为springboo-parent的spring-boot-dependencies索引了httpClient5.1.5会有class not found风险。顾需要本地管理。

<dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5 -->
            <dependency>
                <groupId>org.apache.httpcomponents.client5</groupId>
                <artifactId>httpclient5</artifactId>
                <version>5.2.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents.core5</groupId>
                <artifactId>httpcore5</artifactId>
                <version>5.2.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents.core5</groupId>
                <artifactId>httpcore5-h2</artifactId>
                <version>5.2.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>