mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 07:43:41 +08:00 
			
		
		
		
	feat: add Xunfei V2 channel support and update related configurations
This commit is contained in:
		@@ -16,6 +16,7 @@ import (
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/stepfun"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/togetherai"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/xai"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/adaptor/xunfeiv2"
 | 
			
		||||
	"github.com/songquanpeng/one-api/relay/channeltype"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -36,6 +37,7 @@ var CompatibleChannels = []int{
 | 
			
		||||
	channeltype.SiliconFlow,
 | 
			
		||||
	channeltype.XAI,
 | 
			
		||||
	channeltype.BaiduV2,
 | 
			
		||||
	channeltype.XunfeiV2,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func GetCompatibleChannelMeta(channelType int) (string, []string) {
 | 
			
		||||
@@ -72,6 +74,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
 | 
			
		||||
		return "xai", xai.ModelList
 | 
			
		||||
	case channeltype.BaiduV2:
 | 
			
		||||
		return "baiduv2", baiduv2.ModelList
 | 
			
		||||
	case channeltype.XunfeiV2:
 | 
			
		||||
		return "xunfeiv2", xunfeiv2.ModelList
 | 
			
		||||
	default:
 | 
			
		||||
		return "openai", ModelList
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								relay/adaptor/xunfeiv2/constants.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								relay/adaptor/xunfeiv2/constants.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
package xunfeiv2
 | 
			
		||||
 | 
			
		||||
// https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html#_3-%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E
 | 
			
		||||
 | 
			
		||||
var ModelList = []string{
 | 
			
		||||
	"lite",
 | 
			
		||||
	"generalv3",
 | 
			
		||||
	"pro-128k",
 | 
			
		||||
	"generalv3.5",
 | 
			
		||||
	"max-32k",
 | 
			
		||||
	"4.0Ultra",
 | 
			
		||||
}
 | 
			
		||||
@@ -49,5 +49,6 @@ const (
 | 
			
		||||
	XAI
 | 
			
		||||
	Replicate
 | 
			
		||||
	BaiduV2
 | 
			
		||||
	XunfeiV2
 | 
			
		||||
	Dummy
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,7 @@ var ChannelBaseURLs = []string{
 | 
			
		||||
	"https://api.x.ai",                          // 45
 | 
			
		||||
	"https://api.replicate.com/v1/models/",      // 46
 | 
			
		||||
	"https://qianfan.baidubce.com",              // 47
 | 
			
		||||
	"https://spark-api-open.xf-yun.com",         // 48
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user