mirror of
https://github.com/linux-do/new-api.git
synced 2025-10-11 18:13:41 +08:00
Squashed commit of the following:
commit 5a6a0df45dee3dfbf2f65591a79fe5f2b74a49e6 Author: Akarin <jimmyshjj@gmail.com> Date: Thu May 16 14:05:28 2024 +0800 Revert "Update docker-image-amd64.yml" This reverts commit 581343a78783bbd779e65b476e125af0e2b64ce5. commit a0aec1bd030da2c6b25d9541199d598f16813a60 Merge: 5b46c7d 58abb38 Author: Jiayun Shen <jimmyshjj@gmail.com> Date: Thu May 16 06:46:51 2024 +0800 Merge branch 'main' of https://github.com/jimmyshjj/new-api commit 58abb3864a89294d82f812cda9fe49ccf7e2dd91 Merge: 7d2c02693858c3
Author: Akarin <jimmyshjj@gmail.com> Date: Thu May 16 06:46:00 2024 +0800 Merge branch 'Calcium-Ion:main' into main commit 5b46c7dd8e6132d2be3b59c7b2ed6a4b84b93cef Author: Jiayun Shen <jimmyshjj@gmail.com> Date: Thu May 16 06:45:00 2024 +0800 Update constants.go Remove replaced Baidu models commit 7d2c02679cd90b8b53f4145f83969b980a8c2095 Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 23:40:50 2024 +0800 Update adaptor.go - Normalize model name to lowercase Baidu's official model names may include mixed case letters, but their model APIs are case-sensitive and accept only lowercase. To ensure compatibility, the default behavior has been updated to convert model names to lowercase before constructing API requests. commit 6bc168a39d9a6194d66f2f32b175e56de9295b2e Merge: bb9fecd 910e76a Author: Jiayun Shen <jimmyshjj@gmail.com> Date: Wed May 15 21:51:52 2024 +0800 Merge branch 'main' of https://github.com/jimmyshjj/new-api commit 910e76ac94d7f5dca6254abb4d0669cbb762e724 Merge: 581343aff044de
Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 21:51:13 2024 +0800 Merge branch 'Calcium-Ion:main' into main commit bb9fecd5bf2bd9f1859a4017e7e68f80bdb6685a Author: Jiayun Shen <jimmyshjj@gmail.com> Date: Wed May 15 21:50:08 2024 +0800 update Baidu and 360 models Add Baidu and 360 new models. Add Baidu completion ratio commit 581343a78783bbd779e65b476e125af0e2b64ce5 Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 19:41:34 2024 +0800 Update docker-image-amd64.yml commit de17e2d95eec80f1eeae66e82dec4e9601cdee43 Merge: 046f653a3b3e6c
Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 19:22:09 2024 +0800 Merge branch 'Calcium-Ion:main' into main commit 046f6537913ae8ad8ecf21019b64c0379331b3fd Merge: 4164d517b58305
Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 15:32:38 2024 +0800 Merge branch 'Calcium-Ion:main' into main commit 4164d51207808283a18ca2728241fd5cddc4855f Merge: ef35b07c222bc8
Author: Akarin <jimmyshjj@gmail.com> Date: Wed May 15 11:19:13 2024 +0800 Merge branch 'Calcium-Ion:main' into main commit ef35b072824b5095ecd2d1ed7ca9fa11673da2c4 Author: Jiayun Shen <jimmyshjj@gmail.com> Date: Tue May 14 19:17:32 2024 +0800 Update adaptor.go Update frequently used model names from Baidu official docs and support custom models
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"one-api/relay/channel"
|
||||
relaycommon "one-api/relay/common"
|
||||
"one-api/relay/constant"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Adaptor struct {
|
||||
@@ -33,8 +34,24 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant"
|
||||
case "BLOOMZ-7B":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/bloomz_7b1"
|
||||
case "ERNIE-4.0-8K":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro"
|
||||
case "ERNIE-3.5-8K":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions"
|
||||
case "ERNIE-Speed-8K":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_speed"
|
||||
case "ERNIE-Character-8K":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-char-8k"
|
||||
case "ERNIE-Functions-8K":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-func-8k"
|
||||
case "ERNIE-Lite-8K-0922":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant"
|
||||
case "Yi-34B-Chat":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/yi_34b_chat"
|
||||
case "Embedding-V1":
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/embeddings/embedding-v1"
|
||||
default:
|
||||
fullRequestURL = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/" + strings.ToLower(info.UpstreamModelName)
|
||||
}
|
||||
var accessToken string
|
||||
var err error
|
||||
|
@@ -1,11 +1,19 @@
|
||||
package baidu
|
||||
|
||||
var ModelList = []string{
|
||||
"ERNIE-Bot-4",
|
||||
"ERNIE-Bot-8K",
|
||||
"ERNIE-Bot",
|
||||
"ERNIE-Speed",
|
||||
"ERNIE-Bot-turbo",
|
||||
"ERNIE-3.5-8K",
|
||||
"ERNIE-4.0-8K",
|
||||
"ERNIE-Speed-8K",
|
||||
"ERNIE-Speed-128K",
|
||||
"ERNIE-Lite-8K",
|
||||
"ERNIE-Tiny-8K",
|
||||
"ERNIE-Character-8K",
|
||||
"ERNIE-Functions-8K",
|
||||
//"ERNIE-Bot-4",
|
||||
//"ERNIE-Bot-8K",
|
||||
//"ERNIE-Bot",
|
||||
//"ERNIE-Speed",
|
||||
//"ERNIE-Bot-turbo",
|
||||
"Embedding-V1",
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user