Update README

This commit is contained in:
JustSong 2023-04-22 22:29:00 +08:00
parent 5e8c22fbf6
commit f95f5948ff
2 changed files with 17 additions and 117 deletions

View File

@ -1,95 +0,0 @@
<p align="right">
<a href="./README.md">中文</a> | <strong>English</strong>
</p>
<p align="center">
<a href="https://github.com/songquanpeng/one-api"><img src="https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png" width="150" height="150" alt="one-api logo"></a>
</p>
<div align="center">
# Gin Template
_✨ Template for Gin & React projects ✨_
</div>
<p align="center">
<a href="https://raw.githubusercontent.com/songquanpeng/one-api/main/LICENSE">
<img src="https://img.shields.io/github/license/songquanpeng/one-api?color=brightgreen" alt="license">
</a>
<a href="https://github.com/songquanpeng/one-api/releases/latest">
<img src="https://img.shields.io/github/v/release/songquanpeng/one-api?color=brightgreen&include_prereleases" alt="release">
</a>
<a href="https://github.com/songquanpeng/one-api/releases/latest">
<img src="https://img.shields.io/github/downloads/songquanpeng/one-api/total?color=brightgreen&include_prereleases" alt="release">
</a>
<a href="https://goreportcard.com/report/github.com/songquanpeng/go-file">
<img src="https://goreportcard.com/badge/github.com/songquanpeng/one-api" alt="GoReportCard">
</a>
</p>
<p align="center">
<a href="https://github.com/songquanpeng/one-api/releases">Download</a>
·
<a href="https://github.com/songquanpeng/one-api/blob/main/README.en.md#deployment">Tutorial</a>
·
<a href="https://github.com/songquanpeng/one-api/issues">Feedback</a>
·
<a href="https://one-api.vercel.app/">Demo</a>
</p>
## Features
+ [x] Built-in user management.
+ [x] Built-in file management.
+ [x] [GitHub OAuth](https://github.com/settings/applications/new).
+ [x] WeChat official account authorization (need [wechat-server](https://github.com/songquanpeng/wechat-server)).
+ [x] Email verification & password reset.
+ [x] Request rate limiting.
+ [x] Static files caching.
+ [x] Mobile friendly UI.
+ [x] Token based authorization.
+ [x] Use GitHub Actions to build releases & Docker images.
+ [x] Cloudflare Turnstile user validation.
## Deployment
### Manual deployment
1. Download built binary from [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) or build from source:
```shell
git clone https://github.com/songquanpeng/one-api.git
go mod download
go build -ldflags "-s -w" -o one-api
````
2. Run it:
```shell
chmod u+x one-api
./one-api --port 3000 --log-dir ./logs
```
3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `root` and the password is `123456`.
### Deploy with Docker
Execute: `docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api`
Data will be saved in `/home/ubuntu/data/one-api`.
## Configurations
The system works out of the box.
You can configure the system by set environment variables or specify command line arguments.
After the system starts, use `root` user to log in to the system and do further configuration.
### Environment Variables
1. `REDIS_CONN_STRING`: when set, Redis will be used as the storage for request rate limitation instead of memory storage.
+ Example: `REDIS_CONN_STRING=redis://default:redispw@localhost:49153`
2. `SESSION_SECRET`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
+ Example: `SESSION_SECRET=random_string`
3. `SQL_DSN`: when set, the target SQL database will be used instead of SQLite.
+ Example: `SQL_DSN=root:123456@tcp(localhost:3306)/one-api`
### Command line Arguments
1. `--port <port_number>`: specify the port number, the default value is `3000`.
+ Example: `--port 3000`
2. `--log-dir <log_dir>`: specify the log dir, if not set, the log won't be saved.
+ Example: `--log-dir ./logs`
3. `--version`: print the version and exit.

View File

@ -1,16 +1,12 @@
<p align="right">
<strong>中文</strong> | <a href="./README.en.md">English</a>
</p>
<p align="center">
<a href="https://github.com/songquanpeng/one-api"><img src="https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png" width="150" height="150" alt="one-api logo"></a>
</p>
<div align="center">
# Gin One API
# One API
_✨ 用于 Gin & React 项目的模板 ✨_
_✨ All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用✨_
</div>
@ -40,19 +36,23 @@ _✨ 用于 Gin & React 项目的模板 ✨_
</p>
## 功能
+ [x] 内置用户管理
+ [x] 内置文件管理
+ [x] [GitHub 开放授权](https://github.com/settings/applications/new)
+ [x] 微信公众号授权(需要 [wechat-server](https://github.com/songquanpeng/wechat-server)
+ [x] 邮箱验证以及通过邮件进行密码重置
+ [x] 请求频率限制
+ [x] 静态文件缓存
+ [x] 移动端适配
+ [x] 基于令牌的鉴权
+ [x] 使用 GitHub Actions 自动打包可执行文件与 Docker 镜像
+ [x] Cloudflare Turnstile 用户校验
1. 多种 API 访问方式:
+ [ ] One API 服务端中继
+ [ ] [API2D](https://api2d.com/r/197971)
2. 聚合多种 API 访问方式,通过负载均衡的方式进行访问。
3. 单个访问渠道支持设置多个 API Key利用起来你的多个 API Key。
4. 多种用户登录注册方式:
+ 邮箱登录注册以及通过邮箱进行密码重置。
+ [GitHub 开放授权](https://github.com/settings/applications/new)。
+ 微信公众号授权(需要额外部署 [WeChat Server](https://github.com/songquanpeng/wechat-server))。
5. 支持用户管理。
## 部署
### 基于 Docker 进行部署
执行:`docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api`
数据将会保存在宿主机的 `/home/ubuntu/data/one-api` 目录。
### 手动部署
1. 从 [GitHub Releases](https://github.com/songquanpeng/one-api/releases/latest) 下载可执行文件或者从源码编译:
```shell
@ -69,11 +69,6 @@ _✨ 用于 Gin & React 项目的模板 ✨_
更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。
### 基于 Docker 进行部署
执行:`docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api`
数据将会保存在宿主机的 `/home/ubuntu/data/one-api` 目录。
## 配置
系统本身开箱即用。