mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-20 01:16:36 +08:00
增加对于gemini-exp-1114模型的支持,映射到v1beta
feat(gemini): add support for gemini-exp-1114 model - Add gemini-exp-1114 to ModelList in constant.go - Update GetRequestURL in adaptor.go to use v1beta API version for gemini-exp-1114 - Keep backward compatibility for other models This change enables the use of the experimental gemini-exp-1114 model by correctly routing its requests to the v1beta API endpoint while maintaining existing functionality for other models.
This commit is contained in:
parent
320e6ec5a4
commit
5d96f7b2cc
@ -30,8 +30,16 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
|
||||
}
|
||||
|
||||
func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
||||
var version string
|
||||
|
||||
// 为特定模型指定版本
|
||||
switch info.UpstreamModelName {
|
||||
case "gemini-exp-1114":
|
||||
version = "v1beta"
|
||||
default:
|
||||
// 从映射中获取模型名称对应的版本,如果找不到就使用 info.ApiVersion 或默认的版本 "v1"
|
||||
version, beta := constant.GeminiModelMap[info.UpstreamModelName]
|
||||
var beta bool
|
||||
version, beta = constant.GeminiModelMap[info.UpstreamModelName]
|
||||
if !beta {
|
||||
if info.ApiVersion != "" {
|
||||
version = info.ApiVersion
|
||||
@ -39,6 +47,7 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
||||
version = "v1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
action := "generateContent"
|
||||
if info.IsStream {
|
||||
|
@ -7,6 +7,7 @@ const (
|
||||
var ModelList = []string{
|
||||
"gemini-1.0-pro-latest", "gemini-1.0-pro-001", "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", "gemini-ultra",
|
||||
"gemini-1.0-pro-vision-latest", "gemini-1.0-pro-vision-001", "gemini-1.5-pro-exp-0827", "gemini-1.5-flash-exp-0827",
|
||||
"gemini-exp-1114",
|
||||
}
|
||||
|
||||
var ChannelName = "google gemini"
|
||||
|
Loading…
Reference in New Issue
Block a user