coze chat proxy
v0.0.5
modeltoken和id(COZE_BOT_ID) ,此bot為被coze託管的bot。token(BOT_TOKEN) ,此bot為向bot-01發送與接收bot-01返回的消息。Send Messages , Read Message History等)並邀請進服務器,記錄服務器ID( GUILD_ID ) 。token ,即bot-01的token ,點擊完成後在discord的服務器中可看到bot-01在線並可以@使用。.env文件(環境變量優先生效),並啟動本項目。LOG_LEVEL:info日誌等級,默認info
SERVER_PORT:8080服務端口,,默認8080
BOT_CONFIG:bot.json discord-bot配置文件,默認bot.json
AUTH_TOKEN : 123456請求頭校驗的值(前後端統一),配置此參數後,每次發起請求時請求頭加上Authorization參數,即header中添加Authorization:Bearer 123456 ,默認1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ
.env文件配置上述字段 [
{
"model": "gpt-3.5-turbo", // bot模型可自定义,与请求接口保持一致 可自定义
"bot_token": "MTI************", //见如何使用.3
"coze_bot_id": "120**********", //见如何使用.2
"guild_id": "103************", //见如何使用.4
"channel_id": "120*********" //在所在服务器 创建频道 记录id
},
{
"model": "dall-e-3", // bot模型可自定义,与请求接口保持一致 可自定义
"bot_token": "MTI************", //见如何使用.3
"coze_bot_id": "120**********", //见如何使用.2
"guild_id": "103************", //见如何使用.4
"channel_id": "120*********" //在所在服务器 创建频道 记录id
}
]
mkdir -p $PWD/coze-chat-proxy
docker run -itd --name=coze-chat-proxy -p 8080:8080 -v $PWD/coze-chat-proxy:/data:/app/data -v $PWD/coze-chat-proxy/log:/app/log -e AUTH_TOKEN=<AUTH_TOKEN>
registry.cn-hangzhou.aliyuncs.com/aurorax/coze-chat-proxy:<tag>
$PWD/coze-chat-proxy/data目錄下bot.json並重啟容器 http://<ip>:<port>/v1/chat/completions
curl --location --request POST 'http://127.0.0.1:8080/v1/chat/completions'
--header 'Authorization: Bearer ****'
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)'
--header 'Content-Type: application/json'
--data-raw '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "西红柿炒钢丝球怎么做?"
}
],
"stream": false,
}'
http://<ip>:<port>/v1/images/generations
curl --location --request POST 'http://127.0.0.1:8080/v1/images/generations'
--header 'Authorization: Bearer ****'
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)'
--header 'Content-Type: application/json'
--data-raw '{
"model": "dall-e-3",
"prompt": "A cute dog",
"n": 1,
"size": "1024x1024"
}'