-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ae7f75
Showing
35 changed files
with
2,896 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
logs | ||
dist | ||
doc | ||
node_modules | ||
.vscode | ||
.git | ||
.gitignore | ||
README.md | ||
*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 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: | | ||
vinlic/glm-free-api:${{ steps.tag_name.outputs.tag }} | ||
vinlic/glm-free-api:latest | ||
platforms: linux/amd64,linux/arm64 | ||
build-args: TARGETPLATFORM=${{ matrix.platform }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist/ | ||
node_modules/ | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM node:lts AS BUILD_IMAGE | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN npm i --registry http://registry.npmmirror.com && npm run build | ||
|
||
FROM node:lts-alpine | ||
|
||
COPY --from=BUILD_IMAGE /app/configs ./configs | ||
COPY --from=BUILD_IMAGE /app/package.json ./package.json | ||
COPY --from=BUILD_IMAGE /app/dist ./dist | ||
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["npm", "start"] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# GLM AI Free 服务 | ||
|
||
![](https://img.shields.io/github/license/llm-red-team/glm-free-api.svg) | ||
![](https://img.shields.io/github/stars/llm-red-team/glm-free-api.svg) | ||
![](https://img.shields.io/github/forks/llm-red-team/glm-free-api.svg) | ||
![](https://img.shields.io/docker/pulls/vinlic/glm-free-api.svg) | ||
|
||
支持高速流式输出、支持多轮对话、支持智能体对话、支持AI绘图、支持联网搜索、支持长文档解读、支持图像解析,零配置部署,多路token支持,自动清理会话痕迹。 | ||
|
||
与ChatGPT接口完全兼容。 | ||
|
||
## 声明 | ||
|
||
仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担! | ||
|
||
仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担! | ||
|
||
仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 服务名称 | ||
name: glm-free-api | ||
# 服务绑定主机地址 | ||
host: '0.0.0.0' | ||
# 服务绑定端口 | ||
port: 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 是否开启请求日志 | ||
requestLog: true | ||
# 临时目录路径 | ||
tmpDir: ./tmp | ||
# 日志目录路径 | ||
logDir: ./logs | ||
# 日志写入间隔(毫秒) | ||
logWriteInterval: 200 | ||
# 日志文件有效期(毫秒) | ||
logFileExpires: 2626560000 | ||
# 公共目录路径 | ||
publicDir: ./public | ||
# 临时文件有效期(毫秒) | ||
tmpFileExpires: 86400000 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "glm-free-api", | ||
"version": "0.0.1", | ||
"description": "GLM Free API Server", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"directories": { | ||
"dist": "dist" | ||
}, | ||
"files": [ | ||
"dist/" | ||
], | ||
"scripts": { | ||
"dev": "tsup src/index.ts --format cjs,esm --sourcemap --dts --publicDir public --watch --onSuccess \"node dist/index.js\"", | ||
"start": "node dist/index.js", | ||
"build": "tsup src/index.ts --format cjs,esm --sourcemap --dts --clean --publicDir public" | ||
}, | ||
"author": "Vinlic", | ||
"license": "ISC", | ||
"dependencies": { | ||
"axios": "^1.6.7", | ||
"colors": "^1.4.0", | ||
"crc-32": "^1.2.2", | ||
"cron": "^3.1.6", | ||
"date-fns": "^3.3.1", | ||
"eventsource-parser": "^1.1.2", | ||
"form-data": "^4.0.0", | ||
"fs-extra": "^11.2.0", | ||
"koa": "^2.15.0", | ||
"koa-body": "^5.0.0", | ||
"koa-bodyparser": "^4.4.1", | ||
"koa-range": "^0.3.0", | ||
"koa-router": "^12.0.1", | ||
"koa2-cors": "^2.0.6", | ||
"lodash": "^4.17.21", | ||
"mime": "^4.0.1", | ||
"minimist": "^1.2.8", | ||
"randomstring": "^1.3.0", | ||
"uuid": "^9.0.1", | ||
"yaml": "^2.3.4" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.202", | ||
"@types/mime": "^3.0.4", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default { | ||
API_TEST: [-9999, 'API异常错误'], | ||
API_REQUEST_PARAMS_INVALID: [-2000, '请求参数非法'], | ||
API_REQUEST_FAILED: [-2001, '请求失败'], | ||
API_TOKEN_EXPIRES: [-2002, 'Token已失效'], | ||
API_FILE_URL_INVALID: [-2003, '远程文件URL非法'], | ||
API_FILE_EXECEEDS_SIZE: [-2004, '远程文件超出大小'], | ||
API_CHAT_STREAM_PUSHING: [-2005, '已有对话流正在输出'] | ||
} |
Oops, something went wrong.