mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 06:20:27 +00:00
fix: support for Spark Lite model (#1526)
* fix: Support for Spark Lite model * fix: fix panic * fix: fix xunfei version config --------- Co-authored-by: JustSong <39998050+songquanpeng@users.noreply.github.com> Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
@@ -67,26 +67,28 @@ func SetupContextForSelectedChannel(c *gin.Context, channel *model.Channel, mode
|
||||
c.Set(ctxkey.BaseURL, channel.GetBaseURL())
|
||||
cfg, _ := channel.LoadConfig()
|
||||
// this is for backward compatibility
|
||||
switch channel.Type {
|
||||
case channeltype.Azure:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = channel.Other
|
||||
}
|
||||
case channeltype.Xunfei:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = channel.Other
|
||||
}
|
||||
case channeltype.Gemini:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = channel.Other
|
||||
}
|
||||
case channeltype.AIProxyLibrary:
|
||||
if cfg.LibraryID == "" {
|
||||
cfg.LibraryID = channel.Other
|
||||
}
|
||||
case channeltype.Ali:
|
||||
if cfg.Plugin == "" {
|
||||
cfg.Plugin = channel.Other
|
||||
if channel.Other != nil {
|
||||
switch channel.Type {
|
||||
case channeltype.Azure:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = *channel.Other
|
||||
}
|
||||
case channeltype.Xunfei:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = *channel.Other
|
||||
}
|
||||
case channeltype.Gemini:
|
||||
if cfg.APIVersion == "" {
|
||||
cfg.APIVersion = *channel.Other
|
||||
}
|
||||
case channeltype.AIProxyLibrary:
|
||||
if cfg.LibraryID == "" {
|
||||
cfg.LibraryID = *channel.Other
|
||||
}
|
||||
case channeltype.Ali:
|
||||
if cfg.Plugin == "" {
|
||||
cfg.Plugin = *channel.Other
|
||||
}
|
||||
}
|
||||
}
|
||||
c.Set(ctxkey.Config, cfg)
|
||||
|
Reference in New Issue
Block a user