GithubHelp home page GithubHelp logo

darvenking / openai-java Goto Github PK

View Code? Open in Web Editor NEW
42.0 0.0 144.0 99 KB

基于Spring boot 2.6.4,thymeleaf 的 Openai API 的简单包装项目,测试请用自己的Key

Home Page: https://ai.zyun.vip

License: Apache License 2.0

JavaScript 7.50% Java 32.37% CSS 52.83% HTML 7.04% Dockerfile 0.26%

openai-java's Introduction

OpenAi-Java

一个基于Spring boot 2.6.4,thymeleaf 的 Openai API 的简单包装项目

前端界面基于Hostloc论坛流出的源码修改而来,目前支持的功能如下

  • 支持余额查询
  • 支持随机获取Key,支持自定义Key
  • 支持对话与生成图片,连续对话

注意:Openai API 并未开放连续对话的API,因此连续对话功能受上下文Tokens长度影响只能进行简单的对话

项目截图

Docker一键运行项目

docker镜像地址与教程:https://hub.docker.com/r/dqjdda/openai-java

# 替换 KEYS 即可
# 参数教程见:https://hub.docker.com/r/dqjdda/openai-java
docker run -d \
--name openai --restart always \
-p 18080:18080 \
-e MAX_TOKENS=512 \
-e TEMPERATURE=0.6 \
-e KEYS=sk-xxxx,sk-xxxx \
-e BD_TONG_JI_TOKEN= \
dqjdda/openai-java

运行项目

  1. 修改 application.yml 中的 apiKey
  2. 运行 OpenAiRun 类
  3. 访问 http://localhost:18080

部署项目

  1. 打包为 war 包后,上传到服务器
  2. 运行项目 nohup java -jar openai-1.0.0.war > nohup.out 2>&1 &
  3. 访问 http://IP:18080

nginx 反代

server
{
    listen 80;
    server_name yourdomain;

    location / {
        proxy_read_timeout 120; 
        proxy_pass http://127.0.0.1:18080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

openai-java's People

Contributors

elunez avatar

Stargazers

小卒 avatar  avatar Algacez avatar PEIN avatar Andares Cui avatar  avatar  avatar  avatar Alex Li avatar  avatar  avatar  avatar Xiaozhaiyuan avatar  avatar asuna avatar velor2012 avatar Yukino avatar  avatar  avatar 流星 avatar  avatar polyooe avatar Mushroom avatar  avatar  avatar Tsukino Nami avatar Rez avatar Jincheng avatar Chicecream-nomeltechnology avatar  avatar Public avatar  avatar  avatar 番茄 avatar zidon avatar 痕菌 avatar  avatar Eamon avatar  avatar MoeWhale avatar TaoQi avatar  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.