Skip to content

Commit 01291ac

Browse files
authored
Update README (#25)
1 parent 055d02a commit 01291ac

File tree

7 files changed

+142
-171
lines changed

7 files changed

+142
-171
lines changed

README.en-US.md

Lines changed: 0 additions & 110 deletions
This file was deleted.

README.md

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
# Azure OpenAI Proxy
22

3-
[English](./README.en-US.md) | 简体中文
3+
English | [简体中文](./README.zh-CN.md)
44

5-
Azure OpenAI Proxy 是一个 OpenAI API 的代理工具,能将 OpenAI API 请求转为 Azure OpenAI API 请求,从而让只支持 OpenAI 的应用程序无缝使用 Azure OpenAI。
5+
Azure OpenAI Proxy is a tool that transforms OpenAI API requests into Azure OpenAI API requests, allowing OpenAI-compatible applications to seamlessly use Azure Open AI.
66

7-
## 使用条件
7+
## Prerequisites
88

9-
你需要有一个 Azure OpenAI 账户才能使用 Azure OpenAI Proxy
9+
An Azure OpenAI account is required to use Azure OpenAI Proxy.
1010

11-
## Azure 部署
11+
## Azure Deployment
1212

1313
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fscalaone%2Fazure-openai-proxy%2Fmain%2Fdeploy%2Fazure-deploy.json)
1414

15-
请注意:
15+
Remember to:
1616

17-
- 选择与你的 Azure OpenAI 资源相匹配的区域以获得最佳性能。
18-
- 如果部署失败是因为 'proxywebapp' 名称已被占用,只需修改资源前缀再重新部署。
19-
- 已部署的代理应用位于 B1 定价层级的 Azure 网页应用计划下,你可以在部署后在 Azure 门户中进行更新。
17+
- Select the region that matches your Azure OpenAI resource for best performance.
18+
- If deployment fails because the 'proxywebapp' name is already taken, change the resource prefix and redeploy.
19+
- The deployed proxy app is part of a B1 pricing tier Azure web app plan, which can be modified in the Azure Portal after deployment.
2020

21-
## Docker 部署
21+
## Docker Deployment
22+
23+
To deploy using Docker, execute the following command:
2224

2325
```bash
2426
docker run -d -p 3000:3000 scalaone/azure-openai-proxy
2527
```
2628

27-
## 本地运行和测试,命令行方式
29+
## Local Execution and Testing
2830

29-
1. 安装 NodeJS 18。
30-
2. 克隆代码到命令行窗口。
31-
3. 运行 `npm install` 安装依赖项。
32-
4. 运行 `npm start` 启动应用程序。
33-
5. 运行下面脚本测试,运行前需要把`AZURE_RESOURCE_ID``AZURE_MODEL_DEPLOYMENT``AZURE_API_KEY``AZURE_API_VERSION`替换,`AZURE_API_VERSION`参数可选,默认是`2023-05-15`
31+
Follow these steps:
3432

35-
<details>
36-
<summary>测试脚本</summary>
33+
1. Install NodeJS 18.
34+
2. Clone the repository in the command line window.
35+
3. Run `npm install` to install the dependencies.
36+
4. Run `npm start` to start the application.
37+
5. Use the script below for testing. Replace `AZURE_RESOURCE_ID`, `AZURE_MODEL_DEPLOYMENT`, and `AZURE_API_KEY` before running. The default value for `AZURE_API_VERSION` is `2023-05-15` and is optional.
3738

39+
<details>
40+
<summary>Test script</summary>
3841
```bash
3942
curl -X "POST" "http://localhost:3000/v1/chat/completions" \
4043
-H 'Authorization: AZURE_RESOURCE_ID:AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY:AZURE_API_VERSION' \
@@ -55,52 +58,42 @@ curl -X "POST" "http://localhost:3000/v1/chat/completions" \
5558
"stream": false
5659
}'
5760
```
58-
5961
</details>
6062

61-
## 已测试应用
63+
## Tested Applications
6264

63-
以下应用已经过测试,确认可以与 azure-openai-proxy 一起工作:
65+
The azure-openai-proxy has been tested and confirmed to work with the following applications:
6466

65-
| 应用名称 | E2E测试 Docker-compose 文件 |
67+
| Application Name | Docker-compose File for E2E Test |
6668
| --------------------------------------------------------------- | --------------------------------------------------------------- |
6769
| [chatgpt-lite](https://github.com/blrchen/chatgpt-lite) | [docker-compose.yml](./e2e/chatgpt-lite/docker-compose.yml) |
6870
| [chatgpt-next-web](https://github.com/Yidadaa/ChatGPT-Next-Web) | [docker-compose.yml](./e2e/chatgpt-next-web/docker-compose.yml) |
6971
| [chatbot-ui](https://github.com/mckaywrigley/chatbot-ui) | [docker-compose.yml](./e2e/chatbot-ui/docker-compose.yml) |
7072
| [chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web) | [docker-compose.yml](./e2e/chatgpt-web/docker-compose.yml) |
7173
| [chatgpt-minimal](https://github.com/blrchen/chatgpt-minimal) | [docker-compose.yml](./e2e/chatgpt-minimal/docker-compose.yml) |
7274

73-
要在本地运行测试,请按照以下步骤操作:
75+
To test locally, follow these steps:
7476

75-
1. 在命令行窗口中克隆代码。
76-
2. 更新环境变量`OPENAPI_API_KEY`的值为`AZURE_RESOURCE_ID:AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY`。或者,直接在`docker-compose.yml`文件中更新`OPENAPI_API_KEY`值。
77-
3. 导航到包含要测试的应用程序的`docker-compose.yml`文件所在的目录。
78-
4. 执行构建命令:`docker-compose build`
79-
5. 启动服务:`docker-compose up -d`
80-
6. 根据`docker-compose.yml`文件中定义的公开端口,启动应用以在本地进行测试。例如,访问 http://localhost:3000
77+
1. Clone the repository in a command-line window.
78+
2. Update the `OPENAI_API_KEY` environment variable with `AZURE_RESOURCE_ID:AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY`. Alternatively, update the OPENAI_API_KEY value in the docker-compose.yml file directly.
79+
3. Navigate to the directory containing the `docker-compose.yml` file for the application you want to test.
80+
4. Execute the build command: `docker-compose build`.
81+
5. Start the service: `docker-compose up -d`.
82+
6. Access the application locally using the port defined in the docker-compose.yml file. For example, visit http://localhost:3000.
8183

82-
## 常见问题
84+
## FAQs
8385

8486
<details>
85-
<summary>Q:什么是`AZURE_RESOURCE_ID`,`AZURE_MODEL_DEPLOYMENT`,`AZURE_API_KEY`</summary>
86-
A: 可以在Azure的管理门户里查找,具体见下图标注
87-
88-
![resource-and-model](./resource-and-model.jpg)
89-
87+
<summary>Q: What are `AZURE_RESOURCE_ID`,`AZURE_MODEL_DEPLOYMENT`, and `AZURE_API_KEY`?</summary>
88+
A: These can be found in the Azure management portal. See the image below for reference:
89+
![resource-and-model](./docs/images/resource-and-model.jpg)
9090
</details>
91-
9291
<details>
93-
<summary>Q: 如何使用gpt-4 and gpt-4-32k模型</summary>
94-
A: 要使用gpt-4 and gpt-4-32k模型,请使用下列格式的key:
95-
92+
<summary>Q: How can I use gpt-4 and gpt-4-32k models?</summary>
93+
A: To use gpt-4 and gpt-4-32k models, follow the key format below:
9694
`AZURE_RESOURCE_ID:gpt-3.5-turbo|AZURE_MODEL_DEPLOYMENT,gpt-4|AZURE_MODEL_DEPLOYMENT,gpt-4-32k|AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY:AZURE_API_VERSION`
97-
9895
</details>
9996

100-
# 贡献代码方式
101-
102-
欢迎提交各种 PR。
103-
104-
# 免责声明
97+
## Contributing
10598

106-
此代码仅供演示和测试目的。
99+
We welcome all PR submissions.

README.zh-CN.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Azure OpenAI Proxy
2+
3+
[English](./README.md) | 简体中文
4+
5+
Azure OpenAI Proxy 是一个 OpenAI API 的代理工具,能将 OpenAI API 请求转为 Azure OpenAI API 请求,从而让只支持 OpenAI 的应用程序无缝使用 Azure OpenAI。
6+
7+
## 使用条件
8+
9+
你需要有一个 Azure OpenAI 账户才能使用 Azure OpenAI Proxy。
10+
11+
## Azure 部署
12+
13+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fscalaone%2Fazure-openai-proxy%2Fmain%2Fdeploy%2Fazure-deploy.json)
14+
15+
请注意:
16+
17+
- 选择与你的 Azure OpenAI 资源相匹配的区域以获得最佳性能。
18+
- 如果部署失败是因为 'proxywebapp' 名称已被占用,只需修改资源前缀再重新部署。
19+
- 已部署的代理应用位于 B1 定价层级的 Azure 网页应用计划下,你可以在部署后在 Azure 门户中进行更新。
20+
21+
## Docker 部署
22+
23+
要使用Docker进行部署,请执行以下命令:
24+
25+
```bash
26+
docker run -d -p 3000:3000 scalaone/azure-openai-proxy
27+
```
28+
29+
## 本地运行和测试
30+
31+
遵循以下步骤:
32+
33+
1. 安装 NodeJS 18。
34+
2. 克隆代码到命令行窗口。
35+
3. 运行 `npm install` 安装依赖项。
36+
4. 运行 `npm start` 启动应用程序。
37+
5. 运行下面脚本测试,运行前需要把`AZURE_RESOURCE_ID``AZURE_MODEL_DEPLOYMENT``AZURE_API_KEY``AZURE_API_VERSION`替换,`AZURE_API_VERSION`参数可选,默认是`2023-05-15`
38+
39+
<details>
40+
<summary>测试脚本</summary>
41+
```bash
42+
curl -X "POST" "http://localhost:3000/v1/chat/completions" \
43+
-H 'Authorization: AZURE_RESOURCE_ID:AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY:AZURE_API_VERSION' \
44+
-H 'Content-Type: application/json; charset=utf-8' \
45+
-d $'{
46+
"messages": [
47+
{
48+
"role": "system",
49+
"content": "You are an AI assistant that helps people find information."
50+
},
51+
{
52+
"role": "user",
53+
"content": "hi."
54+
}
55+
],
56+
"temperature": 1,
57+
"model": "gpt-3.5-turbo",
58+
"stream": false
59+
}'
60+
```
61+
</details>
62+
63+
## 已测试应用
64+
65+
以下应用已经过测试,确认可以与 azure-openai-proxy 一起工作:
66+
67+
| 应用名称 | E2E测试 Docker-compose 文件 |
68+
| --------------------------------------------------------------- | --------------------------------------------------------------- |
69+
| [chatgpt-lite](https://github.com/blrchen/chatgpt-lite) | [docker-compose.yml](./e2e/chatgpt-lite/docker-compose.yml) |
70+
| [chatgpt-next-web](https://github.com/Yidadaa/ChatGPT-Next-Web) | [docker-compose.yml](./e2e/chatgpt-next-web/docker-compose.yml) |
71+
| [chatbot-ui](https://github.com/mckaywrigley/chatbot-ui) | [docker-compose.yml](./e2e/chatbot-ui/docker-compose.yml) |
72+
| [chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web) | [docker-compose.yml](./e2e/chatgpt-web/docker-compose.yml) |
73+
| [chatgpt-minimal](https://github.com/blrchen/chatgpt-minimal) | [docker-compose.yml](./e2e/chatgpt-minimal/docker-compose.yml) |
74+
75+
要在本地运行测试,请按照以下步骤操作:
76+
77+
1. 在命令行窗口中克隆代码。
78+
2. 更新环境变量`OPENAI_API_KEY`的值为`AZURE_RESOURCE_ID:AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY`。或者,直接在`docker-compose.yml`文件中更新`OPENAI_API_KEY`值。
79+
3. 导航到包含要测试的应用程序的`docker-compose.yml`文件所在的目录。
80+
4. 执行构建命令:`docker-compose build`
81+
5. 启动服务:`docker-compose up -d`
82+
6. 根据`docker-compose.yml`文件中定义的公开端口,启动应用以在本地进行测试。例如,访问 http://localhost:3000。
83+
84+
## 常见问题
85+
86+
<details>
87+
<summary>Q:什么是`AZURE_RESOURCE_ID`,`AZURE_MODEL_DEPLOYMENT`,`AZURE_API_KEY`</summary>
88+
A: 可以在Azure的管理门户里查找,具体见下图标注
89+
![resource-and-model](./docs/images/resource-and-model.jpg)
90+
</details>
91+
<details>
92+
<summary>Q: 如何使用gpt-4 and gpt-4-32k模型</summary>
93+
A: 要使用gpt-4 and gpt-4-32k模型,请使用下列格式的key:
94+
`AZURE_RESOURCE_ID:gpt-3.5-turbo|AZURE_MODEL_DEPLOYMENT,gpt-4|AZURE_MODEL_DEPLOYMENT,gpt-4-32k|AZURE_MODEL_DEPLOYMENT:AZURE_API_KEY:AZURE_API_VERSION`
95+
</details>
96+
97+
## 贡献代码方式
98+
99+
欢迎提交各种 PR。

app/layout.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import type { Metadata } from 'next'
1+
import React, { ReactNode } from 'react'
22
import { Inter } from 'next/font/google'
33

44
const inter = Inter({ subsets: ['latin'] })
5-
6-
export const metadata: Metadata = {
7-
title: 'Create Next App',
8-
description: 'Generated by create next app'
9-
}
10-
11-
export default function RootLayout({ children }: { children: React.ReactNode }) {
5+
export default function RootLayout({ children }: { children: ReactNode }) {
126
return (
137
<html lang="en">
148
<body className={inter.className}>{children}</body>

app/page.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import Image from 'next/image'
2-
31
export default function Home() {
4-
return (
5-
<main>
6-
</main>
7-
)
2+
return <main></main>
83
}

app/v1/models/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NextRequest, NextResponse } from 'next/server'
1+
import { NextResponse } from 'next/server'
22

33
export async function GET() {
44
const models = {
File renamed without changes.

0 commit comments

Comments
 (0)