mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-12-18 01:26:59 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fc6fa7784 | ||
|
|
aae4fd64d7 | ||
|
|
cd983f0a0c | ||
|
|
76993fcce8 | ||
|
|
fa645a80d8 | ||
|
|
1e3e233adc | ||
|
|
002ff558b0 | ||
|
|
6f66431bb5 | ||
|
|
d815bf991e | ||
|
|
10488aeaa5 | ||
|
|
97f1c4f45f | ||
|
|
0d0ae4a95a | ||
|
|
37b0dd7c36 | ||
|
|
4a852bd070 | ||
|
|
0ca230a853 | ||
|
|
6eeadb49ac |
46
.github/workflows/oaifree-docker-image.yml
vendored
46
.github/workflows/oaifree-docker-image.yml
vendored
@@ -1,46 +0,0 @@
|
||||
name: oaifree Build and Push Docker Image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag Name'
|
||||
required: true
|
||||
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Set tag name
|
||||
id: tag_name
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
|
||||
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "::set-output name=tag::${{ github.event.inputs.tag }}"
|
||||
fi
|
||||
|
||||
- name: Build and push Docker image with Release tag
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
yangclivia/pandora-to-api:${{ steps.tag_name.outputs.tag }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: TARGETPLATFORM=${{ matrix.platform }}
|
||||
46
.github/workflows/xyhelper-deploy.yml
vendored
46
.github/workflows/xyhelper-deploy.yml
vendored
@@ -1,46 +0,0 @@
|
||||
name: xyhelper Build and Push Docker Image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag Name'
|
||||
required: true
|
||||
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Set tag name
|
||||
id: tag_name
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "release" ]; then
|
||||
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
|
||||
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "::set-output name=tag::${{ github.event.inputs.tag }}"
|
||||
fi
|
||||
|
||||
- name: Build and push Docker image with Release tag
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
yangclivia/pandora-to-api:${{ steps.tag_name.outputs.tag }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: TARGETPLATFORM=${{ matrix.platform }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
|
||||
*.log
|
||||
6
.idea/encodings.xml
generated
6
.idea/encodings.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/log/access.log" charset="GBK" />
|
||||
</component>
|
||||
</project>
|
||||
41
Readme.md
41
Readme.md
@@ -2,24 +2,20 @@
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> Respect `oaiFree` , Respect `Wizerd`!
|
||||
> Respect Zhile大佬 , Respect Wizerd!
|
||||
|
||||
感谢oaiFree、Ink-Osier大佬们的付出,敬礼!!!
|
||||
感谢pandoraNext和Wizerd的付出,敬礼!!!
|
||||
|
||||
本项目支持:
|
||||
|
||||
1. 将 oaiFree `proxy` 模式下的 `backend-api` 转为 `/v1/chat/completions` 接口,支持流式和非流式响应。
|
||||
1. 将 ninja `proxy` 模式下的 `backend-api` 转为 `/v1/chat/completions` 接口,支持流式和非流式响应。
|
||||
|
||||
2. 将 oaiFree `proxy` 模式下的 `backend-api` 转为 `/v1/images/generations` 接口
|
||||
2. 将 ninja `proxy` 模式下的 `backend-api` 转为 `/v1/images/generations` 接口
|
||||
|
||||
3. 支持直接把refresh_token作为请求key,方便接入one_api
|
||||
|
||||
4. 支持 gpt-4-mobile 、gpt-4-s 、基本所有的GPTS
|
||||
|
||||
* **oaiFree 的 免费 backend-api 接口,无需打码**
|
||||
|
||||
* 之后可能跟[Linux.do](https://linux.do/latest)论坛挂钩,请提前做好准备
|
||||
|
||||
如果本项目对你有帮助的话,请点个小星星吧~
|
||||
|
||||
如果有什么在项目的使用过程中的疑惑或需求,欢迎加入 Community Telegram Channel: [Inker 的魔法世界](https://t.me/InkerWorld) 来和大家一起交流一下~
|
||||
@@ -38,7 +34,7 @@
|
||||
|
||||
- [x] 支持 gpt-3.5-turbo
|
||||
|
||||
- [x] 暂不 支持 gpts
|
||||
- [x] 支持 gpts
|
||||
|
||||
- [x] 支持 流式输出
|
||||
|
||||
@@ -63,13 +59,13 @@
|
||||
## 注意
|
||||
|
||||
> [!CAUTION]
|
||||
> 1. 本项目的运行需要 oaiFree 的免费接口
|
||||
> 1. 本项目的运行需要 ninja
|
||||
>
|
||||
> 2. 本项目实际为将来自 `/v1/chat/completions` 的请求转发到oaiFree免费接口的 `/backend-api/conversation` 接口,因此本项目并不支持高并发操作,请不要接入如 `沉浸式翻译` 等高并发项目。
|
||||
> 2. 本项目实际为将来自 `/v1/chat/completions` 的请求转发到ninja的 `/backend-api/conversation` 接口,因此本项目并不支持高并发操作,请不要接入如 `沉浸式翻译` 等高并发项目。
|
||||
>
|
||||
> 3. 本项目支持使用apple平台的refresh_token作为请求key.
|
||||
>
|
||||
> 4. 本项目并不能绕过 OpenAI 和 oaiFree 官方的限制,只提供便利,不提供绕过。
|
||||
> 4. 本项目并不能绕过 OpenAI 和 ninja 官方的限制,只提供便利,不提供绕过。
|
||||
>
|
||||
> 5. 提问的艺术:当出现项目不能正常运行时,请携带 `DEBUG` 级别的日志在 `Issue` 或者社区群内提问,否则将开启算命模式~
|
||||
|
||||
@@ -81,7 +77,7 @@
|
||||
|
||||
2. gpt-4-mobile:支持代码解释器、bing联网、dalle绘图的 GPT-4,对应的是官方的手机版 GPT-4,截止至2023年12月15日,本模型使用量不计入 GPT-4 用量(即不受每 3 小时 40 次的限制)
|
||||
|
||||
3. 由于oaiFree未提供GPTS接口,暂不支持几乎所有的 GPTS(配置方式见下文)
|
||||
3. 几乎所有的 GPTS(配置方式见下文)
|
||||
|
||||
4. gpt-3.5-turbo
|
||||
|
||||
@@ -95,19 +91,19 @@
|
||||
|
||||
- `need_log_to_file`: 用于设置是否需要将日志输出到文件,可选值为:`true`、`false`,默认为 `true`,日志文件路径为:`./log/access.log`,默认每天会自动分割日志文件。
|
||||
|
||||
- `process_workers`: 用于设置进程数,如果不需要设置,可以保持不变,如果需要设置,可以设置为需要设置的值,默认为 `2`。
|
||||
- `process_workers`: 用于设置进程数,如果不需要设置,可以保持不变,如果需要设置,可以设置为需要设置的值,如果设置为 `1`,则会强制设置为单进程模式。
|
||||
|
||||
- `process_threads`: 用于设置线程数,如果不需要设置,可以保持不变,如果需要设置,可以设置为需要设置的值,默认为 `2`。
|
||||
- `process_threads`: 用于设置线程数,如果不需要设置,可以保持不变,如果需要设置,可以设置为需要设置的值,如果设置为 `1`,则会强制设置为单线程模式。
|
||||
|
||||
- `upstream_base_url`: oaiFree 的接口地址,如:`https://chat.oaifree.com`,注意:不要以 `/` 结尾。
|
||||
- `upstream_base_url`: ninja 的部署地址,如:`https://pandoranext.com`,注意:不要以 `/` 结尾。可以填写为本项目可以访问到的 PandoraNext 的内网地址。
|
||||
|
||||
- `upstream_api_prefix`: 默认为["dad04481-fa3f-494e-b90c-b822128073e5"],之后可多填
|
||||
- `upstream_api_prefix`: PandoraNext Proxy 模式下的 API 前缀
|
||||
|
||||
- `backend_container_url`: 用于dalle模型生成图片的时候展示所用,需要设置为使用如 [ChatGPT-Next-Web](https://github.com/ChatGPTNextWebTeam/ChatGPT-Next-Web) 的用户可以访问到的本项目地址,如:`http://1.2.3.4:50011`,同原环境变量中的 `UPLOAD_BASE_URL`
|
||||
|
||||
- `backend_container_api_prefix`: 用于设置本项目 `/v1/xxx` 接口的前缀,如果留空则与官方api调用接口一致。设置示例:`666 `
|
||||
|
||||
- `key_for_gpts_info(选填)`: 填入refresh_token(每天自动转成access_token 推荐)或者access_token(不推荐), 仅获取 GPTS 信息的 access_token,需要该 access_token 能够访问所有配置的 GPTS。后续发送消息仍需要在请求头携带请求所用的 access_token,如果未配置该项,请将 `gpts.json` 文件修改为:
|
||||
- `key_for_gpts_info`: 填入refresh_token(每天自动转成access_token 推荐)或者access_token(不推荐), 仅获取 GPTS 信息的 access_token,需要该 access_token 能够访问所有配置的 GPTS。后续发送消息仍需要在请求头携带请求所用的 access_token,如果未配置该项,请将 `gpts.json` 文件修改为:
|
||||
|
||||
```json
|
||||
{}
|
||||
@@ -147,8 +143,7 @@ PS. 注意,arkose_urls中的地址需要支持PandoraNext的Arkose Token获取
|
||||
|
||||
- `enableOai`:用于设置是否使用官网通过refresh_token刷新access_token,仅在 `enableOai` 为 `true` 时生效。
|
||||
|
||||
- `oaiFree_refreshToAccess_Url`:用于设置使用oaiFree来进行使用refresh_token刷新access_token,enableOai为false的时候必填
|
||||
- 默认为"https://token.oaifree.com/api/auth/refresh"
|
||||
- `ninja_refreshToAccess_Url`:用于设置使用ninja来进行使用refresh_token刷新access_token,enableOai为false的时候必填。
|
||||
|
||||
- `redis`
|
||||
|
||||
@@ -187,7 +182,7 @@ PS. 注意,arkose_urls中的地址需要支持PandoraNext的Arkose Token获取
|
||||
|
||||
请求方式:`POST`
|
||||
|
||||
请求头:正常携带 `Authorization` 和 `Content-Type` 即可,`Authorization` 的值为 `Bearer <refresh_token>`,`Content-Type` 的值为 `application/json`
|
||||
请求头:正常携带 `Authorization` 和 `Content-Type` 即可,`Authorization` 的值为 `Bearer <ninja 的 fk>`,`Content-Type` 的值为 `application/json`
|
||||
|
||||
请求体格式示例:
|
||||
|
||||
@@ -326,7 +321,7 @@ PS. 注意,arkose_urls中的地址需要支持PandoraNext的Arkose Token获取
|
||||
version: '3'
|
||||
services:
|
||||
chatgpt-next-web:
|
||||
image: yangclivia/chatgpt-next-web-langchain
|
||||
image: yidadaa/chatgpt-next-web
|
||||
ports:
|
||||
- "50013:3000"
|
||||
environment:
|
||||
@@ -384,4 +379,4 @@ services:
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#Yanyutin753/oaiFreeV1Api_refresh&Date)
|
||||
[](https://star-history.com/#Yanyutin753/ninjaToV1Api_refresh&Date)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"process_workers": 2,
|
||||
"process_threads": 2,
|
||||
"proxy": "",
|
||||
"upstream_base_url": "https://chat.oaifree.com",
|
||||
"upstream_api_prefix": ["dad04481-fa3f-494e-b90c-b822128073e5"],
|
||||
"upstream_base_url": "",
|
||||
"upstream_api_prefix": "",
|
||||
"backend_container_url": "",
|
||||
"backend_container_api_prefix": "",
|
||||
"key_for_gpts_info": "",
|
||||
@@ -26,8 +26,8 @@
|
||||
},
|
||||
"refresh_ToAccess": {
|
||||
"stream_sleep_time": 0,
|
||||
"enableOai":"false",
|
||||
"oaifree_refreshToAccess_Url": "https://token.oaifree.com/api/auth/refresh"
|
||||
"enableOai":"true",
|
||||
"ninja_refreshToAccess_Url": ""
|
||||
},
|
||||
"redis": {
|
||||
"host": "redis",
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
{}
|
||||
{
|
||||
"gpt-4-classic": {
|
||||
"id":"g-YyyyMT9XH-chatgpt-classic"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
backend-to-api:
|
||||
image: yangclivia/pandora-to-api:0.7.9
|
||||
image: yangclivia/pandora-to-api:0.7.7
|
||||
restart: always
|
||||
ports:
|
||||
- "50011:33333"
|
||||
|
||||
Reference in New Issue
Block a user