docs: fix

This commit is contained in:
Vincent Young 2023-11-27 15:04:46 -05:00
parent 5489e11113
commit fdcac338fe
No known key found for this signature in database
GPG Key ID: DD9998BCFD278F6A

View File

@ -2,7 +2,7 @@
* @Author: Vincent Young * @Author: Vincent Young
* @Date: 2022-10-18 07:32:29 * @Date: 2022-10-18 07:32:29
* @LastEditors: Vincent Young * @LastEditors: Vincent Young
* @LastEditTime: 2023-11-19 19:21:24 * @LastEditTime: 2023-11-27 15:03:26
* @FilePath: /DeepLX/README.md * @FilePath: /DeepLX/README.md
* @Telegram: https://t.me/missuo * @Telegram: https://t.me/missuo
* *
@ -41,39 +41,35 @@
- `DeepLX` is unlimited to the number of requests. - `DeepLX` is unlimited to the number of requests.
## Usage ## Usage
### Request Parameters ### For Developer
#### Request Parameters
- text: string - text: string
- source_lang: string - source_lang: string
- target_lang: string - target_lang: string
### Response #### Response
```json ```json
{ {
"alternatives": [ "alternatives": [
"no one else", "Did you hear about this?",
"there is no other person (idiom); there is no one else", "You've heard about this?",
"there is no other person" "You've heard of this?"
], ],
"code": 200, "code": 200,
"data": "there is no one else", "data": "Have you heard about this?",
"id": 8352115005, "id": 8356681003,
"method": "Free",
"source_lang": "ZH", "source_lang": "ZH",
"target_lang": "EN" "target_lang": "EN"
} }
``` ```
### Specify the port (Optional) ### Custom Options
**Thanks to [cijiugechu](https://github.com/cijiugechu) for [his contribution](https://github.com/OwO-Network/DeepLX/commit/4a0920579ea868b0f05ccdff6bceae316bfd5dc8) to make this feature possible for this project!** **The following settings are optional and not required.**
```bash - `-port` or `-p` : Listening port. Default is `1188`.
./deeplx -p 3333 - `-token` : Access token. If you have set it up, each request will need to include an `Authorization` header.
# or - `-authkey` : DeepL Official `AuthKey`. If you have set it up, after the 429 response, the official AuthKey will be used for the request.
./deeplx -port 3333
```
### Set access password (Optional)
**To prevent abuse of your public API, you can use a token to restrict translation requests.**
```bash
./deeplx -token hellodeeplx
```
#### Requesting a token-protected **DeepLX API** instance using the `curl`
``` ```
curl -X POST http://localhost:1188/translate \ curl -X POST http://localhost:1188/translate \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
@ -83,7 +79,6 @@ curl -X POST http://localhost:1188/translate \
"source_lang": "EN", "source_lang": "EN",
"target_lang": "DE" "target_lang": "DE"
}' }'
``` ```
### Run with Docker ### Run with Docker
@ -91,18 +86,26 @@ curl -X POST http://localhost:1188/translate \
# ghcr.io # ghcr.io
docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest
# custom environment variables
docker run -itd -p 1188:1188 -e "TOKEN=helloxxx" -e "AUTHKEY=xxxx:fx" ghcr.io/owo-network/deeplx:latest
# dockerhub # dockerhub
docker run -itd -p 1188:1188 missuo/deeplx:latest docker run -itd -p 1188:1188 missuo/deeplx:latest
# custom environment variables
docker run -itd -p 1188:1188 -e "TOKEN=helloxxx" -e "AUTHKEY=xxxx:fx" missuo/deeplx:latest
``` ```
### Run with Docker Compose ### Run with Docker Compose
```bash ```bash
mkdir deeplx mkdir deeplx
cd deeplx cd deeplx
wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/docker-compose.yaml wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/compose.yaml
# docker compose v1 # modify environment variables
docker-compose up -d # environment:
# or docker compose v2 # - TOKEN=helloxxx
# - AUTHKEY=xxxxxxx:fx
# docker compose
docker compose up -d docker compose up -d
``` ```