Skip to content

Commit

Permalink
Merge pull request #100 from WeihanLi/main
Browse files Browse the repository at this point in the history
add docker-compose support
  • Loading branch information
202252197 committed Mar 4, 2024
2 parents cdbfdfd + 41e4d0f commit 8eaf5e6
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .env.serve
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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

0 comments on commit 8eaf5e6

Please sign in to comment.