Giter VIP home page Giter VIP logo

chatgpt-java's Introduction

ChatGPT Java Api

stable Maven Central

English Doc.

OpenAI ChatGPT 的逆向工程SDK。可扩展用于聊天机器人等。觉得不错请右上角Star

感谢 revChatGPT.

功能

image

image

image

可以写代码,写小说,写作文、演讲稿、工作报告、读书笔记、合同等

使用

maven

<dependency>
    <groupId>com.github.plexpt</groupId>
    <artifactId>chatgpt</artifactId>
    <version>1.0.3</version>
</dependency>

gradle

implementation group: 'com.github.plexpt', name: 'chatgpt', version: '1.0.3'

然后

  Chatbot chatbot = new Chatbot("sessionToken");
  Map<String, Object> chatResponse = chatbot.getChatResponse("hello");
  System.out.println(chatResponse.get("message"));

注意:一个Chatbot实例为一个Session,会持有对话上下文,可以回复:继续 让机器人接着说。如果需要对话互相隔离,new 多个Chatbot实例即可。

sessionToken获取

https://github.com/acheong08/ChatGPT/wiki/Setup#token-authentication

  1. 通过 https://chat.openai.com/chat 注册并登录。
  2. 打开浏览器开发者工具,切换到 Application 标签页。
  3. 在左侧的 Storage - Cookies 中找到 __Secure-next-auth.session-token 一行并复制其值

注册教程

https://juejin.cn/post/7173447848292253704

https://mirror.xyz/boxchen.eth/9O9CSqyKDj4BKUIil7NC1Sa1LJM-3hsPqaeW_QjfFBc

也可以控制台直接使用

  1. 下载
  2. 编辑 config.json 里的sessionToken
  3. 运行 run.bat
  4. 注意:输入之后需要回车两次

Awesome ChatGPT

My list

If you have a cool project you want added to the list, open an issue.

Disclaimers

这不是官方的 OpenAI 产品。这是一个个人项目,与 OpenAI 没有任何关联。

This is a library and not intended for direct CLI use

CLI 功能仅用于演示和测试。不支持验证码(对于不干净的 IP 地址)

CLI use

@rawandahmad698 has a much better CLI tool at

PyChatGPT supports captcha!

Star History

Star History Chart

chatgpt-java's People

Contributors

plexpt 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.