This commit is contained in:
dean 2024-10-31 13:32:00 +08:00
parent 18116c6f75
commit ecc986169a
2 changed files with 199 additions and 193 deletions

View File

@ -1,6 +1,5 @@
<p align="right">
<strong>English</strong> | <a href="./README.zh.md">中文</a>
<strong>English</strong> | <a href="./README.md">中文</a>
</p>
<div align="center">
@ -9,11 +8,11 @@
<a href="https://trendshift.io/repositories/7350" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7350" alt="deanxv%2Fcoze-discord-proxy | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
_Proxies `Discord` conversations to `Coze-Bot`, enabling API requests to the GPT4 model, offering functionalities such as conversation, text-to-image, image-to-text, and knowledge base retrieval._
_Proxy `Discord` conversations for `Coze-Bot`, enabling API requests to the GPT4 model with features like conversation, text-to-image, image-to-text, and knowledge base retrieval._
_If you find this interesting, don't forget to give it a 🌟_
📄<a href="https://cdp-docs.pages.dev" style="font-size: 15px;">CDP Project Documentation</a> (Essential Tutorial)
📄<a href="https://cdp-docs.pages.dev" style="font-size: 15px;">CDP Project Documentation Site</a> (Must-read tutorial)
🐞<a href="https://t.me/+LGKwlC_xa-E5ZDk9" style="font-size: 15px;">CDP Project - Discussion Group</a> (Discussion)
@ -21,18 +20,18 @@ _If you find this interesting, don't forget to give it a 🌟_
</div>
## Features (The project features are now stable, iterations will not be frequent, feel free to raise an issue if you find bugs!)
## Features (The project's features are now stable, updates will not be frequent, feel free to raise an issue if you find bugs!)
- [x] Perfectly compatible with `NextChat`, `one-api`, `LobeChat`, and other chat panels.
- [x] Fully supports conversation isolation.
- [x] Conversation API supports streaming responses.
- [x] Perfectly compatible with `NextChat`, `one-api`, `LobeChat` and other conversation panels.
- [x] Perfect support for conversation isolation.
- [x] Conversation interface supports streaming responses.
- [x] Supports creating `discord` categories/channels/threads.
- [x] Supports conversation interfaces aligned with `openai` (`v1/chat/completions`) (also supports `dall-e-3` text-to-image) (supports specifying `discord-channel`).
- [x] Supports image-to-text/image-to-image/file-to-text interfaces aligned with `openai` (`v1/chat/completions`) (using the `GPT4V` request format [supports `url` or `base64`]) (supports specifying `discord-channel`).
- [x] Supports conversation interface aligned with `openai` (`v1/chat/completions`) (also supports `dall-e-3` text-to-image) (supports specifying `discord-channel`).
- [x] Supports image-to-text/image-to-image/file-to-text interfaces aligned with `openai` (`v1/chat/completions`) (following the `GPT4V` interface request format [ supports `url` or `base64` ])(supports specifying `discord-channel`).
- [x] Supports `dall-e-3` text-to-image interface aligned with `openai` (`v1/images/generations`).
- [x] Supports daily tasks at `9` AM to keep the bot active.
- [x] Supports configuring multiple Discord user `Authorization` (environment variable `USER_AUTHORIZATION`) for request load balancing (**currently, each Discord user's use of coze-bot is limited to 24 hours, configure multiple users to stack request limits and load balance**).
- [x] Supports configuring multiple coze bots for response load balancing (specified through `PROXY_SECRET`/`model`) see [Advanced Configuration](#advanced-configuration) for details.
- [x] Supports daily `9 AM` scheduled tasks to keep the bot active.
- [x] Supports configuring multiple discord user `Authorization` (environment variable `USER_AUTHORIZATION`) for request load balancing (**currently each discord user has a 24-hour limit on coze-bot calls, configure multiple users to stack request counts and balance load**).
- [x] Supports configuring multiple coze bots for response load balancing (specified through `PROXY_SECRET`/`model`), see [Advanced Configuration](#advanced-configuration) for details.
### API Documentation:
@ -46,29 +45,29 @@ _If you find this interesting, don't forget to give it a 🌟_
## How to Use
1. Open [Discord's official website](https://discord.com/app), log in, click settings -> advanced settings -> developer mode -> turn on.
2. Create a Discord server, right-click this server to choose `Copy Server ID (GUILD_ID)` and record it, create a default channel in this server, right-click this channel to choose `Copy Channel ID (CHANNEL_ID)` and record it.
1. Open [Discord's official website](https://discord.com/app), log in, click settings-advanced settings-developer mode-turn on.
2. Create a discord server, right-click this server to select `Copy Server ID (GUILD_ID)` and record it, create a default channel in this server, right-click this channel to select `Copy Channel ID (CHANNEL_ID)` and record it.
3. Open [Discord Developer Portal](https://discord.com/developers/applications) and log in.
4. Create a new application -> Bot named `COZE-BOT`, and record its exclusive `token` and `id (COZE_BOT_ID)`, this bot will be managed by coze.
5. Create a new application -> Bot named `CDP-BOT`, and record its exclusive `token (BOT_TOKEN)`, this bot will listen for Discord messages.
6. Grant appropriate permissions (`Administrator`) to both bots and invite them to the created Discord server (this process is not described here).
7. Open [Discord's official website](https://discord.com/app), enter the server, press F12 to open developer tools, send a message in any channel, find the request `https://discord.com/api/v9/channels/1206*******703/messages` in the developer tools-`Network`, get `Authorization (USER_AUTHORIZATION)` from the header of this interface and record it.
8. Open [coze's official website](https://www.coze.com) to create a bot and configure it (note `Auto-Suggestion` should be `Default/on` (usually no need to change)).
9. After configuration, choose to publish to Discord, fill in the `COZE-BOT`'s `token`, after publishing, you can see `COZE-BOT` online in the Discord server and can be used with @.
10. Use the recorded parameters to start configuring [environment variables](#environment-variables) and [deploy](#deployment) this project.
11. Access the API documentation address, and you can start debugging or integrating other projects.
4. Create a new application-Bot, i.e., `COZE-BOT`, and record its unique `token` and `id (COZE_BOT_ID)`, this bot will be managed by coze.
5. Create a new application-Bot, i.e., `CDP-BOT`, and record its unique `token (BOT_TOKEN)`, this bot will listen for discord messages.
6. Grant corresponding permissions (`Administrator`) to both bots and invite them to the created discord server (the process is not described here).
7. Open [Discord's official website](https://discord.com/app), enter the server, press F12 to open developer tools, send a message in any channel, find the request `https://discord.com/api/v9/channels/1206*******703/messages` in developer tools-`Network`, get `Authorization (USER_AUTHORIZATION)` from the header of this interface and record it.
8. Open [Coze's official website](https://www.coze.com), create and configure a bot (note `Auto-Suggestion` should be `Default/on` (usually no need to change)).
9. After configuration, choose to publish to discord, fill in the `token` of `COZE-BOT`, after publishing, you can see `COZE-BOT` online and can be used with @ in the discord server.
10. Start configuring [environment variables](#environment-variables) and [deploy](#deployment) this project using the recorded parameters.
11. Visit the API documentation address, and you can start debugging or integrating other projects.
## How to Integrate with NextChat
Fill in the interface address (ip:port/domain) and API-Key (`PROXY_SECRET`), other fields are optional.
> If you haven't set up a NextChat panel yourself, here's one that's already set up and available for use: [NextChat](https://ci.goeast.io/)
> If you haven't set up a NextChat panel yourself, here's one already set up that you can use: [NextChat](https://ci.goeast.io/)
<span><img src="docs/img5.png" width="800"/></span>
## How to Integrate with one-api
Fill in `BaseURL` (ip:port/domain) and the key (`PROXY_SECRET`), other fields are optional.
Fill in `BaseURL` (ip:port/domain) and key (`PROXY_SECRET`), other fields are optional.
<span><img src="docs/img3.png" width="800"/></span>
@ -95,12 +94,12 @@ services:
volumes:
- ./data:/app/coze-discord-proxy/data
environment:
- USER_AUTHORIZATION=MTA5OTg5N************aXUBHVI # Must be modified to your Discord user's authorization key (multiple keys separated by commas)
- BOT_TOKEN=MTE5OT************UrUWNbG63w # Must be modified to the listening bot's token
- GUILD_ID=11************96 # Must be modified to the server ID where both bots are located
- COZE_BOT_ID=11************97 # Must be modified to the bot ID managed by coze
- CHANNEL_ID=11************94 # [Optional] Default channel - (in the current version, this parameter is only used to keep the bot active)
- PROXY_SECRET=123456 # [Optional] API key - modify this line to the value checked in the request header (multiple keys separated by commas)
- USER_AUTHORIZATION=MTA5OTg5N************aXUBHVI # Must modify to your discord user's authorization key (multiple keys separated by commas)
- BOT_TOKEN=MTE5OT************UrUWNbG63w # Must modify to the listening bot's token
- GUILD_ID=11************96 # Must modify to the server ID where both bots are located
- COZE_BOT_ID=11************97 # Must modify to the bot ID managed by coze
- CHANNEL_ID=11************94 # [Optional] Default channel - (currently this parameter is only used to keep the bot active)
- PROXY_SECRET=123456 # [Optional] API key - modify this line to the value used for request header verification (multiple keys separated by commas)
- TZ=Asia/Shanghai
```
@ -122,12 +121,12 @@ deanxv/coze-discord-proxy
Modify `USER_AUTHORIZATION`, `BOT_TOKEN`, `GUILD_ID`, `COZE_BOT_ID`, `PROXY_SECRET`, `CHANNEL_ID` to your own values.
If the above image cannot be pulled, you may try using the GitHub Docker image by replacing `deanxv/coze-discord-proxy` with `ghcr.io/deanxv/coze-discord-proxy`.
If the above image cannot be pulled, try using the GitHub Docker image by replacing `deanxv/coze-discord-proxy` with `ghcr.io/deanxv/coze-discord-proxy`.
### Deployment on Third-Party Platforms
### Deploying to a Third-Party Platform
<details>
<summary><strong>Deploying on Zeabur</strong></summary>
<summary><strong>Deploy to Zeabur</strong></summary>
<div>
> Zeabur's servers are located abroad, automatically solving network issues, and the free tier is sufficient for personal use.
@ -136,42 +135,40 @@ Click to deploy:
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/GMU8C8?referralCode=deanxv)
**After one-click deployment, variables like `USER_AUTHORIZATION`, `BOT_TOKEN`, `GUILD_ID`, `COZE_BOT_ID`, `PROXY_SECRET`, `CHANNEL_ID` need to be replaced!**
**After one-click deployment, the variables `USER_AUTHORIZATION`, `BOT_TOKEN`, `GUILD_ID`, `COZE_BOT_ID`, `PROXY_SECRET`, `CHANNEL_ID` must also be replaced!**
Or manually deploy:
1. First **fork** a copy of the code.
2. Enter [Zeabur](https://zeabur.com?referralCode=deanxv), log in with GitHub, and go to the console.
3. In Service -> Add Service, select Git (authorization is required for the first use), choose the repository you forked.
2. Enter [Zeabur](https://zeabur.com?referralCode=deanxv), log in with GitHub, go to the console.
3. In Service -> Add Service, choose Git (authorize first if it's your first time), select the repository you forked.
4. Deployment will automatically start, cancel it first.
5. Add environment variables:
5. Add environment variables
`USER_AUTHORIZATION:MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for the Discord user initiating messages (separate multiple keys with commas)
`USER_AUTHORIZATION:MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for discord users initiating messages (separated by commas)
`BOT_TOKEN:MTE5OTk************WNbG63w` Token for the bot that listens for messages
`BOT_TOKEN:MTE5OTk************WNbG63w` Token for the bot listening to messages
`GUILD_ID:11************96` Server ID where both bots are located
`COZE_BOT_ID:11************97` Bot ID managed by coze
`CHANNEL_ID:11************24` [Optional] Default channel - (in the current version, this parameter is only used to keep the bot active)
`CHANNEL_ID:11************24` # [Optional] Default channel - (currently this parameter is only used to keep the bot active)
`PROXY_SECRET:123456` [Optional] API key - modify this line to the value checked in the request header (separate multiple keys with commas) (used in the same way as the openai API-KEY)
`PROXY_SECRET:123456` [Optional] API key - modify this line to the value used for request header verification (separated by commas) (similar to the openai-API-KEY)
Save.
6. Choose Redeploy.
</div>
</details>
<details>
<summary><strong>Deploying on Render</strong></summary>
<summary><strong>Deploy to Render</strong></summary>
<div>
> Render offers a free tier, and linking a card can further increase the limit.
> Render provides a free tier, and linking a card can further increase the limit.
Render can directly deploy Docker images without needing to fork the repository: [Render](https://dashboard.render.com)
@ -182,41 +179,41 @@ Render can directly deploy Docker images without needing to fork the repository:
### Environment Variables
1. `USER_AUTHORIZATION=MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for the Discord user initiating messages (separate multiple keys with commas)
2. `BOT_TOKEN=MTE5OTk2************rUWNbG63w` Token for the bot that listens for messages
1. `USER_AUTHORIZATION=MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for discord users initiating messages (separated by commas)
2. `BOT_TOKEN=MTE5OTk2************rUWNbG63w` Token for the bot listening to messages
3. `GUILD_ID=11************96` Server ID where all bots are located
4. `COZE_BOT_ID=11************97` Bot ID managed by coze
5. `PORT=7077` [Optional] Port, default is 7077
6. `SWAGGER_ENABLE=1` [Optional] Whether to enable Swagger API documentation [0: No; 1: Yes] (default is 1)
7. `ONLY_OPENAI_API=0` [Optional] Whether to expose only the interfaces aligned with OpenAI [0: No; 1: Yes] (default is 0)
8. `CHANNEL_ID=11************24` [Optional] Default channel - (in the current version, this parameter is only used to keep the bot active)
9. `PROXY_SECRET=123456` [Optional] API key - modify this line to the value checked in the request header (separate multiple keys with commas) (used in the same way as the openai API-KEY), **it is recommended to use this environment variable**
10. `DEFAULT_CHANNEL_ENABLE=0` [Optional] Whether to enable the default channel [0: No; 1: Yes] (default is 0) If enabled, every conversation will take place in the default channel, **session isolation will be ineffective**, **it is recommended not to use this environment variable**
11. `ALL_DIALOG_RECORD_ENABLE=1` [Optional] Whether to enable full context recording [0: No; 1: Yes] (default is 1) If disabled, each conversation will only send the last `content` of `role` as `user` in `messages`, **it is recommended not to use this environment variable**
12. `CHANNEL_AUTO_DEL_TIME=5` [Optional] Auto-delete time for channels (seconds) This parameter sets the time to automatically delete the channel after each conversation (default is 5s), 0 means no deletion, **it is recommended not to use this environment variable**
13. `COZE_BOT_STAY_ACTIVE_ENABLE=1` [Optional] Whether to enable a daily task at `9` AM to keep the coze-bot active [0: No; 1: Yes] (default is 1), **it is recommended not to use this environment variable**
14. `REQUEST_OUT_TIME=60` [Optional] Request timeout for non-stream response under conversation interface, **it is recommended not to use this environment variable**
15. `STREAM_REQUEST_OUT_TIME=60` [Optional] Timeout for each stream return under stream response of conversation interface, **it is recommended not to use this environment variable**
6. `SWAGGER_ENABLE=1` [Optional] Enable Swagger API documentation [0: No; 1: Yes] (default is 1)
7. `ONLY_OPENAI_API=0` [Optional] Expose only interfaces aligned with openai [0: No; 1: Yes] (default is 0)
8. `CHANNEL_ID=11************24` [Optional] Default channel - (currently this parameter is only used to keep the bot active)
9. `PROXY_SECRET=123456` [Optional] API key - modify this line to the value used for request header verification (separated by commas) (similar to the openai-API-KEY), **recommended to use this environment variable**
10. `DEFAULT_CHANNEL_ENABLE=0` [Optional] Enable default channel [0: No; 1: Yes] (default is 0) If enabled, each conversation will occur in the default channel, **session isolation will be ineffective**, **not recommended to use this environment variable**
11. `ALL_DIALOG_RECORD_ENABLE=1` [Optional] Enable full context [0: No; 1: Yes] (default is 1) If disabled, each conversation will only send the last `content` in `messages` where `role` is `user`, **not recommended to use this environment variable**
12. `CHANNEL_AUTO_DEL_TIME=5` [Optional] Channel auto-delete time (seconds) This parameter is for automatically deleting the channel after each conversation (default is 5s), if set to 0 then it will not delete, **not recommended to use this environment variable**
13. `COZE_BOT_STAY_ACTIVE_ENABLE=1` [Optional] Enable daily `9 AM` task to keep coze-bot active [0: No; 1: Yes] (default is 1), **not recommended to use this environment variable**
14. `REQUEST_OUT_TIME=60` [Optional] Non-stream response timeout for conversation interface, **not recommended to use this environment variable**
15. `STREAM_REQUEST_OUT_TIME=60` [Optional] Stream response timeout for each stream return in conversation interface, **not recommended to use this environment variable**
16. `REQUEST_RATE_LIMIT=60` [Optional] Request rate limit per minute per IP, default: 60 requests/min
17. `USER_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36` [Optional] User agent for Discord users, using your own might effectively prevent being banned, if not set, the default is the author's, **it is recommended to use this environment variable**
18. `NOTIFY_TELEGRAM_BOT_TOKEN=6232***********Niz9c` [Optional] Token for a Telegram Bot used for notifications (notification events: 1. No available `user_authorization`; 2. `BOT_TOKEN` associated BOT triggers risk control)
19. `NOTIFY_TELEGRAM_USER_ID=10******35` [Optional] The `Telegram-Bot` associated with `NOTIFY_TELEGRAM_BOT_TOKEN` will push to the `Telegram-User` associated with this variable (**`NOTIFY_TELEGRAM_BOT_TOKEN` must not be empty if this variable is set**)
17. `USER_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36` [Optional] Discord user agent, using your own might help prevent being banned, if not set, defaults to the author's, **recommended to use this environment variable**
18. `NOTIFY_TELEGRAM_BOT_TOKEN=6232***********Niz9c` [Optional] Token for a Telegram bot used for notifications (Notification events: 1. No available `user_authorization`; 2. `BOT_TOKEN` related BOT triggers risk control)
19. `NOTIFY_TELEGRAM_USER_ID=10******35` [Optional] The `Telegram-Bot` associated with `NOTIFY_TELEGRAM_BOT_TOKEN` will push to the `Telegram-User` associated with this variable (**`NOTIFY_TELEGRAM_BOT_TOKEN` must not be empty if this variable is used**)
20. `PROXY_URL=http://127.0.0.1:10801` [Optional] Proxy (supports http only)
## Advanced Configuration
### Configuring Multiple Bots
1. Before deploying, create a `data/config/bot_config.json` file in the same directory as your `docker`/`docker-compose` deployment.
2. Write the following `json` file, `bot_config.json` format as shown below:
1. Before deployment, create a `data/config/bot_config.json` file in the same directory as the `docker`/`docker-compose` deployment
2. Write the `json` file, `bot_config.json` format as follows
```shell
[
{
"proxySecret": "123", // API request key (PROXY_SECRET) (Note: this key must exist in the environment variable PROXY_SECRET for this bot to be matched!)
"proxySecret": "123", // API request key (PROXY_SECRET) (Note: this key must exist in the environment variable PROXY_SECRET for this Bot to be matched!)
"cozeBotId": "12***************31", // Bot ID managed by coze
"model": ["gpt-3.5","gpt-3.5-16k"], // Model names (array format) (matches the `model` in the request body, if the model in the request is not matched in this json, an exception will be thrown)
"channelId": "12***************56" // [Optional] Discord channel ID (the bot must be in the server where this channel is located) (in the current version, this parameter is only used to keep the bot active)
"model": ["gpt-3.5","gpt-3.5-16k"], // Model names (array format) (if the model in the request does not match any in this json, an exception will be thrown)
"channelId": "12***************56" // [Optional] Discord channel ID (the bot must be in the server where this channel is located) (currently this parameter is only used to keep the bot active)
},
{
"proxySecret": "456",
@ -233,24 +230,24 @@ Render can directly deploy Docker images without needing to fork the repository:
]
```
3. Restart the service.
3. Restart the service
> When this json configuration is present, it will match the `cozeBotId` through the request header's [request key] + request body's [`model`].
> If multiple matches are found, one will be selected at random. The configuration is very flexible and can be adjusted according to your needs.
> When this json configuration is present, the bot will be matched through the [request key] carried in the request header and the [`model`] in the request body.
> If multiple matches are found, one will be randomly selected. The configuration is very flexible and can be adjusted according to your needs.
For services deployed on third-party platforms (such as `zeabur`) that need [configuring multiple bots], please refer to [issue#30](https://github.com/deanxv/coze-discord-proxy/issues/30).
For services deployed on third-party platforms (such as `zeabur`) that need [configuring multiple bots], please refer to [issue#30](https://github.com/deanxv/coze-discord-proxy/issues/30)
## Limitations
Current details of coze's free and paid subscriptions: https://www.coze.com/docs/guides/subscription?_lang=en
You can configure multiple Discord user `Authorization` (refer to [Environment Variables](#environment-variables) `USER_AUTHORIZATION`) or [configure multiple bots](#configuring-multiple-bots) to stack request limits and achieve load balancing.
You can configure multiple discord users `Authorization` (refer to [Environment Variables](#environment-variables) `USER_AUTHORIZATION`) or [configure multiple bots](#configuring-multiple-bots) to stack request counts and balance load.
## Q&A
Q: How should I configure the service for high concurrency?
Q: How should I configure for high concurrency?
A: First, [configure multiple bots](#configuring-multiple-bots) to be used as response bots for load balancing. Next, prepare multiple Discord accounts for request load balancing and invite them to the same server. Obtain `Authorization` for each account, separate them with commas, and configure them in the environment variable `USER_AUTHORIZATION`. Each request will then pick one Discord account to initiate the conversation, effectively achieving load balancing.
A: First, [configure multiple bots](#configuring-multiple-bots) to serve as response bots. Secondly, prepare multiple discord accounts to serve as request load and invite them into the same server, obtain the `Authorization` for each account, separate them with commas, and configure them in the environment variable `USER_AUTHORIZATION`. Each request will then pick one discord account to initiate the conversation, effectively achieving load balancing.
## ⭐ Star History
@ -258,10 +255,16 @@ A: First, [configure multiple bots](#configuring-multiple-bots) to be used as re
## Related
[GPT-Content-Audit](https://github.com/deanxv/gpt-content-audit): Aggregates platforms like OpenAI, Alibaba Cloud, Baidu Intelligent Cloud, Qiniu Cloud, etc., providing content moderation services aligned with OpenAI's request format.
[GPT-Content-Audit](https://github.com/deanxv/gpt-content-audit): An aggregation of Openai, Alibaba Cloud, Baidu Intelligent Cloud, Qiniu Cloud, and other open platforms, providing content audit services aligned with `openai` request formats.
## Other
## Others
**Open source is challenging; if you refer to this project or base your project on it, could you please credit this project in your project documentation? Thank you!**
**Open source is not easy, if you refer to this project or base your project on it, could you please mention this project in your project documentation? Thank you!**
Java: https://github.com/oddfar/coze-discord (currently unavailable
Java: https://github.com/oddfar/coze-discord (Currently unavailable)
## References
Coze Official Website: https://www.coze.com
Discord Development Address: https://discord.com/developers/applications

235
README.md
View File

@ -1,5 +1,5 @@
<p align="right">
<strong>English</strong> | <a href="./README.zh.md">中文</a>
<strong>中文</strong> | <a href="./README.en.md">English</a>
</p>
<div align="center">
@ -8,72 +8,73 @@
<a href="https://trendshift.io/repositories/7350" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7350" alt="deanxv%2Fcoze-discord-proxy | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
_Proxy `Discord` conversations for `Coze-Bot`, enabling API requests to the GPT4 model with features like conversation, text-to-image, image-to-text, and knowledge base retrieval._
_代理`Discord`对话`Coze-Bot`实现以API形式请求GPT4模型提供对话、文生图、图生文、知识库检索等功能_
_If you find this interesting, don't forget to give it a 🌟_
_觉得有点意思的话 别忘了点个🌟_
📄<a href="https://cdp-docs.pages.dev" style="font-size: 15px;">CDP Project Documentation Site</a> (Must-read tutorial)
📄<a href="https://cdp-docs.pages.dev" style="font-size: 15px;">CDP项目文档站</a>(必看教程)
🐞<a href="https://t.me/+LGKwlC_xa-E5ZDk9" style="font-size: 15px;">CDP Project - Discussion Group</a> (Discussion)
🐞<a href="https://t.me/+LGKwlC_xa-E5ZDk9" style="font-size: 15px;">CDP项目-交流群</a>(交流)
📢<a href="https://t.me/+0fYkYY_zUZYzNzRl" style="font-size: 15px;">CDP项目-通知频道</a>(通知)
📢<a href="https://t.me/+0fYkYY_zUZYzNzRl" style="font-size: 15px;">CDP Project - Notification Channel</a> (Notifications)
</div>
## Features (The project's features are now stable, updates will not be frequent, feel free to raise an issue if you find bugs!)
## 功能(目前项目功能已趋于稳定迭代不会很频繁有bug可以提issue哦)
- [x] Perfectly compatible with `NextChat`, `one-api`, `LobeChat` and other conversation panels.
- [x] Perfect support for conversation isolation.
- [x] Conversation interface supports streaming responses.
- [x] Supports creating `discord` categories/channels/threads.
- [x] Supports conversation interface aligned with `openai` (`v1/chat/completions`) (also supports `dall-e-3` text-to-image) (supports specifying `discord-channel`).
- [x] Supports image-to-text/image-to-image/file-to-text interfaces aligned with `openai` (`v1/chat/completions`) (following the `GPT4V` interface request format [ supports `url` or `base64` ])(supports specifying `discord-channel`).
- [x] Supports `dall-e-3` text-to-image interface aligned with `openai` (`v1/images/generations`).
- [x] Supports daily `9 AM` scheduled tasks to keep the bot active.
- [x] Supports configuring multiple discord user `Authorization` (environment variable `USER_AUTHORIZATION`) for request load balancing (**currently each discord user has a 24-hour limit on coze-bot calls, configure multiple users to stack request counts and balance load**).
- [x] Supports configuring multiple coze bots for response load balancing (specified through `PROXY_SECRET`/`model`), see [Advanced Configuration](#advanced-configuration) for details.
- [x] 完美适配`NextChat`,`one-api`,`LobeChat`等对话面板。
- [x] 完美支持对话隔离。
- [x] 对话接口支持流式返回。
- [x] 支持创建 `discord`分类/频道/线程。
- [x] 支持和`openai`对齐的对话接口(`v1/chat/completions`)(也支持`dall-e-3`文生图)(支持指定`discord-channel`)。
- [x] 支持和`openai`对齐的图生文/图改图/文件生文接口(`v1/chat/completions`)(按照`GPT4V`接口的请求格式 [ 支持`url`或`base64` ])(支持指定`discord-channel`)。
- [x] 支持和`openai`对齐的`dall-e-3`文生图接口(`v1/images/generations`)。
- [x] 支持每日`9`点定时任务自动活跃机器人。
- [x] 支持配置多discord用户`Authorization`(环境变量`USER_AUTHORIZATION`)作请求负载均衡(**目前每个discord用户调用coze-bot在24h内有次数[限制](#限制),可配置多用户来实现叠加请求次数及请求负载均衡**)。
- [x] 支持配置多coze机器人作响应负载均衡 (通过`PROXY_SECRET`/`model`指定) 详细请看[进阶配置](#进阶配置)。
### API Documentation:
### 接口文档:
`http://<ip>:<port>/swagger/index.html`
<span><img src="docs/img.png" width="800"/></span>
### Example:
### 示例:
<span><img src="docs/img2.png" width="800"/></span>
## How to Use
## 如何使用
1. Open [Discord's official website](https://discord.com/app), log in, click settings-advanced settings-developer mode-turn on.
2. Create a discord server, right-click this server to select `Copy Server ID (GUILD_ID)` and record it, create a default channel in this server, right-click this channel to select `Copy Channel ID (CHANNEL_ID)` and record it.
3. Open [Discord Developer Portal](https://discord.com/developers/applications) and log in.
4. Create a new application-Bot, i.e., `COZE-BOT`, and record its unique `token` and `id (COZE_BOT_ID)`, this bot will be managed by coze.
5. Create a new application-Bot, i.e., `CDP-BOT`, and record its unique `token (BOT_TOKEN)`, this bot will listen for discord messages.
6. Grant corresponding permissions (`Administrator`) to both bots and invite them to the created discord server (the process is not described here).
7. Open [Discord's official website](https://discord.com/app), enter the server, press F12 to open developer tools, send a message in any channel, find the request `https://discord.com/api/v9/channels/1206*******703/messages` in developer tools-`Network`, get `Authorization (USER_AUTHORIZATION)` from the header of this interface and record it.
8. Open [Coze's official website](https://www.coze.com), create and configure a bot (note `Auto-Suggestion` should be `Default/on` (usually no need to change)).
9. After configuration, choose to publish to discord, fill in the `token` of `COZE-BOT`, after publishing, you can see `COZE-BOT` online and can be used with @ in the discord server.
10. Start configuring [environment variables](#environment-variables) and [deploy](#deployment) this project using the recorded parameters.
11. Visit the API documentation address, and you can start debugging or integrating other projects.
1. 打开 [discord官网](https://discord.com/app) ,登陆后点击设置-高级设置-开发者模式-打开。
2. 创建discord服务器,右键点击此服务器选择`复制服务器ID(GUILD_ID)`并记录,在此服务器中创建默认频道,右键点击此频道选择`复制频道ID(CHANNEL_ID)`并记录。
3. 打开 [discord开发者平台](https://discord.com/developers/applications) 登陆。
4. 创建新应用-Bot即`COZE-BOT`,并记录该bot专属的`token`和`id(COZE_BOT_ID)`,此bot为即将被coze托管的bot。
5. 创建新应用-Bot即`CDP-BOT`,并记录该bot专属的`token(BOT_TOKEN)`,此bot为监听discord消息的bot。
6. 两个bot开通对应权限(`Administrator`)并邀请进创建好的discord服务器 (过程不在此赘述)。
7. 打开 [discord官网](https://discord.com/app)进入服务器,按F12打开开发者工具,在任一频道内发送一次消息,在开发者工具-`Network`中找到请求 `https://discord.com/api/v9/channels/1206*******703/messages`从该接口header中获取`Authorization(USER_AUTHORIZATION)`并记录。
8. 打开 [coze官网](https://www.coze.com) 创建bot并进行个性化配置(注意`Auto-Suggestion`为`Default/on`(默认不用改))。
9. 配置好后选择发布到discord,填写`COZE-BOT`的`token`,发布完成后在discord服务器中可看到`COZE-BOT`在线并可以@使用。
10. 使用上述记录的参数开始配置[环境变量](#环境变量)并[部署](#部署)本项目。
11. 访问接口文档地址,即可开始调试或集成其他项目。
## How to Integrate with NextChat
## 如何集成NextChat
Fill in the interface address (ip:port/domain) and API-Key (`PROXY_SECRET`), other fields are optional.
填 接口地址(ip:端口/域名) 及 API-Key(`PROXY_SECRET`),其它的随便填随便选。
> If you haven't set up a NextChat panel yourself, here's one already set up that you can use: [NextChat](https://ci.goeast.io/)
> 如果自己没有搭建NextChat面板,这里有个已经搭建好的可以使用 [NextChat](https://ci.goeast.io/)
<span><img src="docs/img5.png" width="800"/></span>
## How to Integrate with one-api
## 如何集成one-api
Fill in `BaseURL` (ip:port/domain) and key (`PROXY_SECRET`), other fields are optional.
`BaseURL`(ip:端口/域名) 及 密钥(`PROXY_SECRET`),其它的随便填随便选。
<span><img src="docs/img3.png" width="800"/></span>
## Deployment
## 部署
### Deploying with Docker-Compose (All In One)
### 基于 Docker-Compose(All In One) 进行部署
```shell
docker-compose pull && docker-compose up -d
@ -94,16 +95,16 @@ services:
volumes:
- ./data:/app/coze-discord-proxy/data
environment:
- USER_AUTHORIZATION=MTA5OTg5N************aXUBHVI # Must modify to your discord user's authorization key (multiple keys separated by commas)
- BOT_TOKEN=MTE5OT************UrUWNbG63w # Must modify to the listening bot's token
- GUILD_ID=11************96 # Must modify to the server ID where both bots are located
- COZE_BOT_ID=11************97 # Must modify to the bot ID managed by coze
- CHANNEL_ID=11************94 # [Optional] Default channel - (currently this parameter is only used to keep the bot active)
- PROXY_SECRET=123456 # [Optional] API key - modify this line to the value used for request header verification (multiple keys separated by commas)
- USER_AUTHORIZATION=MTA5OTg5N************aXUBHVI # 必须修改为我们discord用户的授权密钥(多个请以,分隔)
- BOT_TOKEN=MTE5OT************UrUWNbG63w # 必须修改为监听消息的Bot-Token
- GUILD_ID=11************96 # 必须修改为两个机器人所在的服务器ID
- COZE_BOT_ID=11************97 # 必须修改为由coze托管的机器人ID
- CHANNEL_ID=11************94 # [可选]默认频道-(目前版本下该参数仅用来活跃机器人)
- PROXY_SECRET=123456 # [可选]接口密钥-修改此行为请求头校验的值(多个请以,分隔)
- TZ=Asia/Shanghai
```
### Deploying with Docker
### 基于 Docker 进行部署
```docker
docker run --name coze-discord-proxy -d --restart always \
@ -119,101 +120,103 @@ docker run --name coze-discord-proxy -d --restart always \
deanxv/coze-discord-proxy
```
Modify `USER_AUTHORIZATION`, `BOT_TOKEN`, `GUILD_ID`, `COZE_BOT_ID`, `PROXY_SECRET`, `CHANNEL_ID` to your own values.
其中`USER_AUTHORIZATION`,`BOT_TOKEN`,`GUILD_ID`,`COZE_BOT_ID`,`PROXY_SECRET`,`CHANNEL_ID`修改为自己的。
If the above image cannot be pulled, try using the GitHub Docker image by replacing `deanxv/coze-discord-proxy` with `ghcr.io/deanxv/coze-discord-proxy`.
如果上面的镜像无法拉取,可以尝试使用 GitHub 的 Docker 镜像,将上面的`deanxv/coze-discord-proxy`替换为`ghcr.io/deanxv/coze-discord-proxy`即可。
### Deploying to a Third-Party Platform
### 部署到第三方平台
<details>
<summary><strong>Deploy to Zeabur</strong></summary>
<summary><strong>部署到 Zeabur</strong></summary>
<div>
> Zeabur's servers are located abroad, automatically solving network issues, and the free tier is sufficient for personal use.
> Zeabur 的服务器在国外,自动解决了网络的问题,同时免费的额度也足够个人使用
Click to deploy:
点击一键部署:
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/GMU8C8?referralCode=deanxv)
**After one-click deployment, the variables `USER_AUTHORIZATION`, `BOT_TOKEN`, `GUILD_ID`, `COZE_BOT_ID`, `PROXY_SECRET`, `CHANNEL_ID` must also be replaced!**
**一键部署后 `USER_AUTHORIZATION`,`BOT_TOKEN`,`GUILD_ID`,`COZE_BOT_ID`,`PROXY_SECRET`,`CHANNEL_ID`变量也需要替换!**
Or manually deploy:
或手动部署:
1. First **fork** a copy of the code.
2. Enter [Zeabur](https://zeabur.com?referralCode=deanxv), log in with GitHub, go to the console.
3. In Service -> Add Service, choose Git (authorize first if it's your first time), select the repository you forked.
4. Deployment will automatically start, cancel it first.
5. Add environment variables
1. 首先 **fork** 一份代码。
2. 进入 [Zeabur](https://zeabur.com?referralCode=deanxv),使用github登录,进入控制台。
3. 在 Service -> Add Service,选择 Git第一次使用需要先授权,选择你 fork 的仓库。
4. Deploy 会自动开始,先取消。
5. 添加环境变量
`USER_AUTHORIZATION:MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for discord users initiating messages (separated by commas)
`USER_AUTHORIZATION:MTA5OTg5N************uIfytxUgJfmaXUBHVI` 主动发送消息的discord用户的授权密钥(多个请以,分隔)
`BOT_TOKEN:MTE5OTk************WNbG63w` Token for the bot listening to messages
`BOT_TOKEN:MTE5OTk************WNbG63w` 监听消息的Bot-Token
`GUILD_ID:11************96` Server ID where both bots are located
`GUILD_ID:11************96` 两个机器人所在的服务器ID
`COZE_BOT_ID:11************97` Bot ID managed by coze
`COZE_BOT_ID:11************97` 由coze托管的机器人ID
`CHANNEL_ID:11************24` # [Optional] Default channel - (currently this parameter is only used to keep the bot active)
`CHANNEL_ID:11************24` # [可选]默认频道-(目前版本下该参数仅用来活跃机器人)
`PROXY_SECRET:123456` [Optional] API key - modify this line to the value used for request header verification (separated by commas) (similar to the openai-API-KEY)
`PROXY_SECRET:123456` [可选]接口密钥-修改此行为请求头校验的值(多个请以,分隔)(与openai-API-KEY用法一致)
Save.
保存。
6. Choose Redeploy.
6. 选择 Redeploy。
</div>
</details>
<details>
<summary><strong>Deploy to Render</strong></summary>
<summary><strong>部署到 Render</strong></summary>
<div>
> Render provides a free tier, and linking a card can further increase the limit.
> Render 提供免费额度,绑卡后可以进一步提升额度
Render can directly deploy Docker images without needing to fork the repository: [Render](https://dashboard.render.com)
Render 可以直接部署 docker 镜像,不需要 fork 仓库:[Render](https://dashboard.render.com)
</div>
</details>
## Configuration
## 配置
### Environment Variables
### 环境变量
1. `USER_AUTHORIZATION=MTA5OTg5N************uIfytxUgJfmaXUBHVI` Authorization key for discord users initiating messages (separated by commas)
2. `BOT_TOKEN=MTE5OTk2************rUWNbG63w` Token for the bot listening to messages
3. `GUILD_ID=11************96` Server ID where all bots are located
4. `COZE_BOT_ID=11************97` Bot ID managed by coze
5. `PORT=7077` [Optional] Port, default is 7077
6. `SWAGGER_ENABLE=1` [Optional] Enable Swagger API documentation [0: No; 1: Yes] (default is 1)
7. `ONLY_OPENAI_API=0` [Optional] Expose only interfaces aligned with openai [0: No; 1: Yes] (default is 0)
8. `CHANNEL_ID=11************24` [Optional] Default channel - (currently this parameter is only used to keep the bot active)
9. `PROXY_SECRET=123456` [Optional] API key - modify this line to the value used for request header verification (separated by commas) (similar to the openai-API-KEY), **recommended to use this environment variable**
10. `DEFAULT_CHANNEL_ENABLE=0` [Optional] Enable default channel [0: No; 1: Yes] (default is 0) If enabled, each conversation will occur in the default channel, **session isolation will be ineffective**, **not recommended to use this environment variable**
11. `ALL_DIALOG_RECORD_ENABLE=1` [Optional] Enable full context [0: No; 1: Yes] (default is 1) If disabled, each conversation will only send the last `content` in `messages` where `role` is `user`, **not recommended to use this environment variable**
12. `CHANNEL_AUTO_DEL_TIME=5` [Optional] Channel auto-delete time (seconds) This parameter is for automatically deleting the channel after each conversation (default is 5s), if set to 0 then it will not delete, **not recommended to use this environment variable**
13. `COZE_BOT_STAY_ACTIVE_ENABLE=1` [Optional] Enable daily `9 AM` task to keep coze-bot active [0: No; 1: Yes] (default is 1), **not recommended to use this environment variable**
14. `REQUEST_OUT_TIME=60` [Optional] Non-stream response timeout for conversation interface, **not recommended to use this environment variable**
15. `STREAM_REQUEST_OUT_TIME=60` [Optional] Stream response timeout for each stream return in conversation interface, **not recommended to use this environment variable**
16. `REQUEST_RATE_LIMIT=60` [Optional] Request rate limit per minute per IP, default: 60 requests/min
17. `USER_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36` [Optional] Discord user agent, using your own might help prevent being banned, if not set, defaults to the author's, **recommended to use this environment variable**
18. `NOTIFY_TELEGRAM_BOT_TOKEN=6232***********Niz9c` [Optional] Token for a Telegram bot used for notifications (Notification events: 1. No available `user_authorization`; 2. `BOT_TOKEN` related BOT triggers risk control)
19. `NOTIFY_TELEGRAM_USER_ID=10******35` [Optional] The `Telegram-Bot` associated with `NOTIFY_TELEGRAM_BOT_TOKEN` will push to the `Telegram-User` associated with this variable (**`NOTIFY_TELEGRAM_BOT_TOKEN` must not be empty if this variable is used**)
20. `PROXY_URL=http://127.0.0.1:10801` [Optional] Proxy (supports http only)
1. `USER_AUTHORIZATION=MTA5OTg5N************uIfytxUgJfmaXUBHVI` 主动发送消息的discord用户的授权密钥(多个请以,分隔)
2. `BOT_TOKEN=MTE5OTk2************rUWNbG63w` 监听消息的Bot-Token
3. `GUILD_ID=11************96` 所有Bot所在的服务器ID
4. `COZE_BOT_ID=11************97` 由coze托管的Bot-ID
5. `PORT=7077` [可选]端口,默认为7077
6. `SWAGGER_ENABLE=1` [可选]是否启用Swagger接口文档[0:否;1:是] (默认为1)
7. `ONLY_OPENAI_API=0` [可选]是否只暴露与openai对齐的接口[0:否;1:是] (默认为0)
8. `CHANNEL_ID=11************24` [可选]默认频道-(目前版本下该参数仅用来活跃Bot)
9. `PROXY_SECRET=123456` [可选]接口密钥-修改此行为请求头校验的值(多个请以,分隔)(与openai-API-KEY用法一致),**推荐使用此环境变量**
10. `DEFAULT_CHANNEL_ENABLE=0` [可选]是否启用默认频道[0:否;1:是] (默认为0) 启用后每次对话都会在默认频道中,**会话隔离会失效**,**推荐不使用此环境变量**
11. `ALL_DIALOG_RECORD_ENABLE=1` [可选]是否启用全量上下文[0:否;1:是] (默认为1) 关闭后每次对话只会发送`messages`中最后一个`role`为`user`的`content`,**推荐不使用此环境变量**
12. `CHANNEL_AUTO_DEL_TIME=5` [可选]频道自动删除时间(秒) 此参数为每次对话完成后自动删除频道的时间(默认为5s),为0时则不删除,**推荐不使用此环境变量**
13. `COZE_BOT_STAY_ACTIVE_ENABLE=1` [可选]是否开启每日`9`点活跃coze-bot的定时任务[0:否;1:是] (默认为1),**推荐不使用此环境变量**
14. `REQUEST_OUT_TIME=60` [可选]对话接口非流响应下的请求超时时间,**推荐不使用此环境变量**
15. `STREAM_REQUEST_OUT_TIME=60` [可选]对话接口流响应下的每次流返回超时时间,**推荐不使用此环境变量**
16. `REQUEST_RATE_LIMIT=60` [可选]每分钟下的单ip请求速率限制,默认:60次/min
17. `USER_AGENT=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36` [可选]discord用户端Agent,使用自己的可能有效防止被ban,不设置时默认使用作者的 推荐使用此环境变量
18. `NOTIFY_TELEGRAM_BOT_TOKEN=6232***********Niz9c` [可选]作为通知TelegramBot的Token(通知事件:1.无可用`user_authorization`;2.`BOT_TOKEN`关联的BOT触发风控)
19. `NOTIFY_TELEGRAM_USER_ID=10******35` [可选]`NOTIFY_TELEGRAM_BOT_TOKEN`关联的`Telegram-Bot`推送至该变量关联的`Telegram-User`(**`NOTIFY_TELEGRAM_BOT_TOKEN`不为空时该变量也不可为空**)
20. `PROXY_URL=http://127.0.0.1:10801` [可选]代理(仅支持http)
## Advanced Configuration
## 进阶配置
### Configuring Multiple Bots
### 配置多机器人
1. Before deployment, create a `data/config/bot_config.json` file in the same directory as the `docker`/`docker-compose` deployment
2. Write the `json` file, `bot_config.json` format as follows
1. 部署前在`docker`/`docker-compose`部署同级目录下创建`data/config/bot_config.json`文件
2. 编写该`json`文件,`bot_config.json`格式如下
```shell
[
{
"proxySecret": "123", // API request key (PROXY_SECRET) (Note: this key must exist in the environment variable PROXY_SECRET for this Bot to be matched!)
"cozeBotId": "12***************31", // Bot ID managed by coze
"model": ["gpt-3.5","gpt-3.5-16k"], // Model names (array format) (if the model in the request does not match any in this json, an exception will be thrown)
"channelId": "12***************56" // [Optional] Discord channel ID (the bot must be in the server where this channel is located) (currently this parameter is only used to keep the bot active)
"proxySecret": "123", // 接口请求密钥(PROXY_SECRET)(注意:此密钥在环境变量PROXY_SECRET中存在时该Bot才可以被匹配到!)
"cozeBotId": "12***************31", // coze托管的机器人ID
"model": ["gpt-3.5","gpt-3.5-16k"], // 模型名称(数组格式)(与请求参数中的model对应,如请求中的model在该json中未匹配到则会抛出异常)
"channelId": "12***************56" // [可选]discord频道ID(机器人必须在此频道所在的服务器)(目前版本下该参数仅用来活跃机器人)
},
{
"proxySecret": "456",
@ -230,41 +233,41 @@ Render can directly deploy Docker images without needing to fork the repository:
]
```
3. Restart the service
3. 重启服务
> When this json configuration is present, the bot will be matched through the [request key] carried in the request header and the [`model`] in the request body.
> If multiple matches are found, one will be randomly selected. The configuration is very flexible and can be adjusted according to your needs.
> 当有此json配置时,会通过请求头携带的[请求密钥]+请求体中的[`model`]联合匹配此配置中的`cozeBotId`
> 若匹配到多个则随机选择一个。配置很灵活,可以根据自己的需求进行配置。
For services deployed on third-party platforms (such as `zeabur`) that need [configuring multiple bots], please refer to [issue#30](https://github.com/deanxv/coze-discord-proxy/issues/30)
第三方平台(如: `zeabur`)部署的服务需要[配置多机器人]请参考[issue#30](https://github.com/deanxv/coze-discord-proxy/issues/30)
## Limitations
## 限制
Current details of coze's free and paid subscriptions: https://www.coze.com/docs/guides/subscription?_lang=en
目前的coze的免费及收费订阅详情:https://www.coze.com/docs/guides/subscription?_lang=zh
You can configure multiple discord users `Authorization` (refer to [Environment Variables](#environment-variables) `USER_AUTHORIZATION`) or [configure multiple bots](#configuring-multiple-bots) to stack request counts and balance load.
可配置多discord用户`Authorization`(参考[环境变量](#环境变量)`USER_AUTHORIZATION`)或[配置多机器人](#配置多机器人)实现叠加请求次数及请求负载均衡。
## Q&A
Q: How should I configure for high concurrency?
Q: 并发量高时应如何配置?
A: First, [configure multiple bots](#configuring-multiple-bots) to serve as response bots. Secondly, prepare multiple discord accounts to serve as request load and invite them into the same server, obtain the `Authorization` for each account, separate them with commas, and configure them in the environment variable `USER_AUTHORIZATION`. Each request will then pick one discord account to initiate the conversation, effectively achieving load balancing.
A: 首先为服务[配置多机器人](#配置多机器人)用来作响应bot的负载,其次准备多个discord账号用来作请求负载并邀请进同一个服务器,获取每个账号的`Authorization`英文逗号分隔配置在环境变量`USER_AUTHORIZATION`中,此时每次请求都会从多个discord账号中取出一个发起对话,有效实现负载均衡。
## ⭐ Star History
[![Star History Chart](https://api.star-history.com/svg?repos=deanxv/coze-discord-proxy&type=Date)](https://star-history.com/#deanxv/coze-discord-proxy&Date)
## Related
## 相关
[GPT-Content-Audit](https://github.com/deanxv/gpt-content-audit): An aggregation of Openai, Alibaba Cloud, Baidu Intelligent Cloud, Qiniu Cloud, and other open platforms, providing content audit services aligned with `openai` request formats.
[GPT-Content-Audit](https://github.com/deanxv/gpt-content-audit):聚合Openai、阿里云、百度智能云、七牛云等开放平台提供与`openai`请求格式对齐的内容审核前置服务。
## Others
## 其他
**Open source is not easy, if you refer to this project or base your project on it, could you please mention this project in your project documentation? Thank you!**
**开源不易,若你参考此项目或基于此项目二开可否麻烦在你的项目文档中标识此项目呢?谢谢你!**
Java: https://github.com/oddfar/coze-discord (Currently unavailable)
Java: https://github.com/oddfar/coze-discord (目前不可用)
## References
## 引用
Coze Official Website: https://www.coze.com
Coze 官网 : https://www.coze.com
Discord Development Address: https://discord.com/developers/applications
Discord 开发地址 : https://discord.com/developers/applications