Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker-compose support #100

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.serve
@@ -1,2 +1,4 @@
#设置openai的key,防止页面刷新重新输入
VUE_APP_OPENAI_API_KEY=""
VUE_APP_OPENAI_API_KEY=""
#设置 OpenAI Url
VUE_APP_OPENAI_API_URL=""
5 changes: 5 additions & 0 deletions Dockerfile
Expand Up @@ -5,6 +5,11 @@ WORKDIR /app
COPY package.json .
RUN npm install

ARG OPENAI_API_KEY=""
ARG OPENAI_API_URL=""
ENV VUE_APP_OPENAI_API_KEY="${OPENAI_API_KEY}"
ENV VUE_APP_OPENAI_API_URL="${OPENAI_API_URL}"

COPY . .
RUN npm run build

Expand Down
20 changes: 16 additions & 4 deletions README.md
Expand Up @@ -42,25 +42,37 @@ https://www.bilibili.com/video/BV1ss4y1d72g 此项目微调使用的简单案例

# 部署步骤
## 本地部署
```

```sh
npm install
npm run serve
npm run build
```
# 在线体验地址 (需要使用OpenAI KEY)

# 在线体验地址 (需要使用OpenAI KEY)

> https://huggingface.co/spaces/junchenmo/OpenAI-Manager

## OpenAI-Key设置以及自定义设置

### 在.env.serve中添加代码
```

```env
VUE_APP_OPENAI_API_KEY='你的openai api key'
```

### 配置使用自定义的 OpenAI proxy

在 .env.serve 中添加代码

```env
VUE_APP_OPENAI_API_URL='你的openai api proxy'
```

### 在/src/store/mutation-types.js

可以在此文件中设置AI头像+用户头像+用户名称


# 技术栈

| 名称 | 版本 |
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,19 @@
version: "3.6"

services:
chatgpt:
container_name: chatgpt
build:
context: .
dockerfile: ./Dockerfile
args:
# - OPENAI_API_KEY=xx-xxx
# - OPENAI_API_URL=http://baidu.com
ports:
- 8090:80
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "1"
2 changes: 1 addition & 1 deletion src/api/index.js
Expand Up @@ -30,7 +30,7 @@ axios.interceptors.response.use(function (response) {

const base = {
axios: axios,
baseUrl: 'https://api.openai.com'
baseUrl: process.env.VUE_APP_OPENAI_API_URL || 'https://api.openai.com'
}

export default base