Giter VIP home page Giter VIP logo

chatgpt-steam-output's Introduction

简介

Open AI ChatGPT流式输出。Open AI Stream output. ChatGPT Stream output.

此项目只是对chatgpt-java SDK的一个简单示例项目,实现流式输出,仅做参考。大家最好还是自己基于SDK动手实现

最新版SDK参考:https://github.com/Grt1228/chatgpt-java

交流群: 二维码 群满加微信拉: 二维码

SSE

主要是基于SSE 实现的(可以百度下这个技术)。也是最近在了解到SSE。OpenAI官网在接受Completions接口的时候,有提到过这个技术。 Completion对象本身有一个stream属性,当stream为true时候Api的Response返回就会变成Http长链接。 具体可以看下文档:https://platform.openai.com/docs/api-reference/completions/create 实例2

依赖

最新版参考:https://github.com/Grt1228/chatgpt-java 目前是1.0.5版本

<dependency>
    <groupId>com.unfbx</groupId>
    <artifactId>chatgpt-java</artifactId>
    <version>1.0.5</version>
</dependency>

项目部署

拉取源代码

git clone https://github.com/Grt1228/chatgpt-steam-output

修改配置

修改application.properties文件 默认8000端口,可以自己修改,修改端口记得将1.html文件的8000端口也替换掉

server.port=8000
chatgpt.apiKey=配置自己的key
chatgpt.apiHost=配置opai的Api Host地址

运行

运行ChatgptSteamOutputApplication

com.unfbx.chatgptsteamoutput.ChatgptSteamOutputApplication

运行成功后打开浏览器:

http://localhost:8000/

能打开此页面表示运行成功 1

代码其实很简单,小伙伴们可以下载代码来看下。

chatgpt-steam-output's People

Contributors

grt1228 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.