Skip to content

Commit

Permalink
docs: README update
Browse files Browse the repository at this point in the history
  • Loading branch information
tsinghu committed Jan 21, 2025
1 parent f810304 commit bd827a2
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DeepLX Serverless

[English](./README_en.md) | 简体中文

DeepLX 免费翻译API**腾讯云函数部署版**,与[原项目DeepLX](https://github.com/OwO-Network/DeepLX)的区别在于**利用了云函数的请求IP不固定的特性,极大程度上避免了`429`请求太频繁报错**

感谢原项目[OwO-Network/DeepLX](https://github.com/OwO-Network/DeepLX)提供的灵感,这是本项目的坚实基础
Expand All @@ -13,6 +15,8 @@ DeepLX 免费翻译API**腾讯云函数部署版**,与[原项目DeepLX](https:

### Deploy | 部署

#### Tencent Cloud | 腾讯云

[https://cloud.tencent.com/](https://cloud.tencent.com/) 注册账号

进入云函数控制台:[https://console.cloud.tencent.com/scf/list](https://console.cloud.tencent.com/scf/list)
Expand All @@ -38,6 +42,11 @@ DeepLX 免费翻译API**腾讯云函数部署版**,与[原项目DeepLX](https:

此时已部署完成,可以点击“完成”按钮,进入【函数管理】,点击【函数代码】,往下拉,找到【访问路径】并复制后续使用

#### Vercel | 部署到 Vercel

现已支持部署到 Vercel,请点击下方按钮进行一键部署(经测试,稳定性不如腾讯云,容易出现429错误)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FLegendLeo%2Fdeeplx-serverless)

### How to use | 如何使用

Expand Down
66 changes: 66 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# DeepLX Serverless

English | [简体中文](./README.md)

DeepLX Free Translation API **Tencent Cloud Function Deployment Version**. Compared to the [original DeepLX project](https://github.com/OwO-Network/DeepLX), the main difference is that it **utilizes the dynamic IP feature of cloud functions, greatly reducing the '429' request frequency errors**.

Thanks to the original project [OwO-Network/DeepLX](https://github.com/OwO-Network/DeepLX) for the inspiration, which serves as the solid foundation for this project.

## Usage

### Prerequisites

- A computer or tablet
- A Tencent account or phone number

### Deploy

#### Tencent Cloud

Register an account at [https://cloud.tencent.com/](https://cloud.tencent.com/)

Go to the cloud function console: [https://console.cloud.tencent.com/scf/list](https://console.cloud.tencent.com/scf/list)

Click [New] -> [Start from Scratch], then configure as follows (**use default settings for unmentioned options**):

- Function Type: Web Function
- Function Name: deeplx (can be customized)
- Region: Any (domestic regions work as well)
- Runtime: Nodejs 16.13 (or higher version)
- Advanced Configuration:
- Memory: 64M
- Execution Timeout: 60 seconds
- Concurrent Requests: 5 (2 works fine based on personal experience)
- Log Configuration -> Log Delivery: Enable (optional, costs a few cents per month if enabled)
- Function Code: Upload local zip package ([Download ZIP package](https://github.com/LegendLeo/deeplx-serverless/releases/download/v1.0.0/dist.zip))
- Trigger Configuration (you may need to create a new trigger):
- Default trigger
- Trigger Alias/Version: Default traffic
- Request Method: ANY
- Release Environment: Release
- Authentication Method: No authentication

After deployment, click "Complete", enter [Function Management], click [Function Code], scroll down to find and copy the [Access Path] for later use.

#### Deploy to Vercel

Now supports deployment to Vercel. Click the button below for one-click deployment (Note: Testing shows it's less stable than Tencent Cloud and more prone to 429 errors)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FLegendLeo%2Fdeeplx-serverless)

### How to Use

Recommended to use with the Immersive Translation browser plugin. When using, replace the `/release` part in the access path with `translate`

For example: Change `https://service-aaaaa.gz.apigw.tencentcs.com/release/` to: `https://service-aaaaa.gz.apigw.tencentcs.com/translate`

Request example:

```bash
curl --location 'https://service-aaaaa.gz.apigw.tencentcs.com/translate' \
--header 'Content-Type: application/json' \
--data '{
"text": "Hello, world",
"source_lang": "en",
"target_lang": "zh"
}'

0 comments on commit bd827a2

Please sign in to comment.