Skip to content

Commit

Permalink
Change default api version from 2023-05-15 to 2024-02-01
Browse files Browse the repository at this point in the history
  • Loading branch information
blrchen committed Apr 4, 2024
1 parent 6085628 commit dfa584d
Show file tree
Hide file tree
Showing 9 changed files with 980 additions and 1,345 deletions.
22 changes: 14 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Duplicate this to .env.local for local development
# For more details, visit the following link: https://github.com/blrchen/chatgpt-minimal#environment-variables
# Duplicate this file and rename as '.env.local' for local development.
# You must obtain OpenAI or Azure OpenAI credentials to run this application.
# For detailed instructions on using these variables, visit:
# https://github.com/blrchen/chatgpt-minimal#environment-variables

# OpenAI API credentials. These are necessary if you intend to utilize the OpenAI API.
OPENAI_API_KEY=
# OpenAI API credentials (required for using the OpenAI API):
# Sign up at https://openai.com/api/ to get your API key.
OPENAI_API_KEY= # <-- Insert your OpenAI API key here
OPENAI_API_BASE_URL="https://api.openai.com"

# Azure OpenAI API credentials. These are necessary if you intend to utilize the Azure OpenAI API.
# AZURE_OPENAI_API_BASE_URL=
# AZURE_OPENAI_API_KEY=
# AZURE_OPENAI_DEPLOYMENT=
# Azure OpenAI API credentials (required for using the Azure OpenAI API):
# Sign up at https://azure.microsoft.com/en-us/services/cognitive-services/openai/ for Azure OpenAI credentials.
# Uncomment the following lines and insert your credentials if you're using Azure OpenAI.
# AZURE_OPENAI_API_BASE_URL= # <-- Insert your Azure OpenAI API base URL here
# AZURE_OPENAI_API_KEY= # <-- Insert your Azure OpenAI API key here
# AZURE_OPENAI_DEPLOYMENT= # <-- Insert your Azure OpenAI deployment name here

18 changes: 9 additions & 9 deletions .github/workflows/docker.chatgpt-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ on:
- main

jobs:
build_and_push_image:
build-and-push-image:
name: Push image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: blrchen/chatgpt-minimal
- name: Build and push multi-arch image
uses: docker/build-push-action@v4
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This Dockerfile is generated based on sample in the following document
# https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
FROM node:18-alpine AS base

FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
Expand Down Expand Up @@ -30,6 +31,10 @@ RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
Expand All @@ -41,4 +46,6 @@ EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ English | [简体中文](./README.zh-CN.md)

## Demo

Visit [ChatGPT Minimal Demo Site](https://chatgpt-minimal.vercel.app)
Visit the [ChatGPT Minimal Demo Site](https://chatgpt-minimal.vercel.app)

## Features

ChatGPT Minimal is a lightweight chatbot built using Next.js and the OpenAI Streaming API for the GPT-3.5 model. It supports both OpenAI and Azure OpenAI accounts.

Components:

- Next.js v13
- OpenAI Streaming API (GPT-3.5 model, gpt-3.5-turbo)
- API Routes
- Chatbot UI with React and Ant Design

![demo](./docs/images/demo.jpg)

For a full-featured ChatGPT UI, visit [ChatGPT Lite](https://github.com/blrchen/chatgpt-lite).
For a full-featured ChatGPT UI codebase, visit [ChatGPT Lite](https://github.com/blrchen/chatgpt-lite).

## Prerequisites

Expand Down Expand Up @@ -57,16 +58,16 @@ docker run -d -p 3000:3000 \

### Running Locally

1. Install NodeJS 18.
1. Install NodeJS 20.
2. Clone the repository.
3. Install dependencies with `npm install`.
4. Copy `.env.example` to `.env.local` and modify environment variables accordingly.
4. Copy `.env.example` to `.env.local` and modify environment variables as needed.
5. Start the application using `npm run dev`.
6. Visit `http://localhost:3000` in your browser.
6. Open `http://localhost:3000` in your browser.

### Running Locally with Docker

1. Clone the repository and navigate to the root directory.
1. Clone the repository and go to the root directory.
2. Update the `OPENAI_API_KEY` environment variable in the `docker-compose.yml` file.
3. Build the application using `docker-compose build .`.
4. Start the application by running `docker-compose up -d`.
Expand All @@ -78,18 +79,18 @@ Required environment variables:
For OpenAI account:

| Name | Description | Default Value |
|---------------------|---------------------------------------------------------------------------------------------------------|--------------------------|
| ------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------ |
| OPENAI_API_BASE_URL | Use if you intend to use a reverse proxy for `api.openai.com`. | `https://api.openai.com` |
| OPENAI_API_KEY | Secret key string obtained from the [OpenAI API website](https://platform.openai.com/account/api-keys). |

For Azure OpenAI account:

| Name | Description |
|---------------------------|------------------------------------------------|
| ------------------------- | ---------------------------------------------- |
| AZURE_OPENAI_API_BASE_URL | Endpoint (e.g., https://xxx.openai.azure.com). |
| AZURE_OPENAI_API_KEY | Key |
| AZURE_OPENAI_DEPLOYMENT | Model deployment name |

## Contribution

We welcome PRs of all sizes.
We welcome PRs of all sizes.
23 changes: 12 additions & 11 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
ChatGPT Minimal 是一个简单的聊天机器人,使用 Next.js 和 OpenAI Streaming API 为 GPT-3.5 模型创建。它支持 OpenAI 和 Azure OpenAI 帐户。

组件:

- Next.js v13
- OpenAI Streaming API(GPT-3.5 模型,gpt-3.5-turbo)
- API 路由
- 基于 React 和 Ant Design 的聊天机器人用户界面

![演示](./docs/images/demo.jpg)

如需完整功能的 ChatGPT UI,请访问 [ChatGPT Lite](https://github.com/blrchen/chatgpt-lite)
如需完整功能的 ChatGPT UI代码库,请访问 [ChatGPT Lite](https://github.com/blrchen/chatgpt-lite)

## 前提条件

Expand All @@ -31,7 +32,7 @@ ChatGPT Minimal 是一个简单的聊天机器人,使用 Next.js 和 OpenAI St
### 在Vercel上部署

点击下方按钮部署到Vercel:
[![使用 Vercel 部署](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fblrchen%2Fchatgpt-minimal&project-name=chatgpt-minimal&framework=nextjs&repository-name=chatgpt-minimal)
[![使用Vercel部署](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fblrchen%2Fchatgpt-minimal&project-name=chatgpt-minimal&framework=nextjs&repository-name=chatgpt-minimal)

### 使用Docker部署

Expand All @@ -57,7 +58,7 @@ docker run -d -p 3000:3000 \

### 本地运行

1. 安装NodeJS 18
1. 安装NodeJS 20
2. 克隆仓库。
3. 使用`npm install`安装依赖。
4. 复制`.env.example`文件为`.env.local`并更新环境变量。
Expand All @@ -73,22 +74,22 @@ docker run -d -p 3000:3000 \

## 环境变量

运行应用所需的环境变量
运行应用需要的环境变量

OpenAI账户环境变量:

| 名称 | 描述 | 默认值 |
|---------------------|------------------------------------------------------------------------|--------------------------|
| OPENAI_API_BASE_URL | 如需为`api.openai.com`使用反向代理,请使用此变量。 | `https://api.openai.com` |
| 名称 | 描述 | 默认值 |
| ------------------- | ---------------------------------------------------------------------------------- | ------------------------ |
| OPENAI_API_BASE_URL | 如需为`api.openai.com`使用反向代理,请使用此变量。 | `https://api.openai.com` |
| OPENAI_API_KEY |[OpenAI API网站](https://platform.openai.com/account/api-keys)获取的密钥字符串。 |

Azure OpenAI账户环境变量:

| 名称 | 描述 |
|---------------------------|-------------------------------------|
| 名称 | 描述 |
| ------------------------- | ------------------------------------------ |
| AZURE_OPENAI_API_BASE_URL | 端点(如,https://xxx.openai.azure.com)。 |
| AZURE_OPENAI_API_KEY | 密钥 |
| AZURE_OPENAI_DEPLOYMENT | 模型部署名称 |
| AZURE_OPENAI_API_KEY | 密钥 |
| AZURE_OPENAI_DEPLOYMENT | 模型部署名称 |

## 贡献

Expand Down
Loading

0 comments on commit dfa584d

Please sign in to comment.