✨ feat: support lingyiwanwu (#115)
This commit is contained in:
parent
b99281e05e
commit
670c673964
@ -199,6 +199,7 @@ const (
|
||||
ChannelTypeMistral = 30
|
||||
ChannelTypeGroq = 31
|
||||
ChannelTypeBedrock = 32
|
||||
ChannelTypeLingyi = 33
|
||||
)
|
||||
|
||||
var ChannelBaseURLs = []string{
|
||||
@ -235,6 +236,7 @@ var ChannelBaseURLs = []string{
|
||||
"https://api.mistral.ai", //30
|
||||
"https://api.groq.com/openai", //31
|
||||
"", //32
|
||||
"https://api.lingyiwanwu.com", //33
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -195,6 +195,13 @@ func init() {
|
||||
"gemma-7b-it": {[]float64{0.05, 0.05}, ChannelTypeGroq},
|
||||
// $0.27/$0.27 /1M Tokens 0.00027$ / 1k tokens
|
||||
"mixtral-8x7b-32768": {[]float64{0.135, 0.135}, ChannelTypeGroq},
|
||||
|
||||
// 2.5 元 / 1M tokens 0.0025 / 1k tokens
|
||||
"yi-34b-chat-0205": {[]float64{0.1786, 0.1786}, ChannelTypeLingyi},
|
||||
// 12 元 / 1M tokens 0.012 / 1k tokens
|
||||
"yi-34b-chat-200k": {[]float64{0.8571, 0.8571}, ChannelTypeLingyi},
|
||||
// 6 元 / 1M tokens 0.006 / 1k tokens
|
||||
"yi-vl-plus": {[]float64{0.4286, 0.4286}, ChannelTypeLingyi},
|
||||
}
|
||||
|
||||
ModelRatio = make(map[string][]float64)
|
||||
|
@ -60,6 +60,7 @@ func init() {
|
||||
common.ChannelTypeMoonshot: "Moonshot",
|
||||
common.ChannelTypeMistral: "Mistral",
|
||||
common.ChannelTypeGroq: "Groq",
|
||||
common.ChannelTypeLingyi: "Lingyiwanwu",
|
||||
}
|
||||
}
|
||||
|
||||
|
36
providers/lingyi/base.go
Normal file
36
providers/lingyi/base.go
Normal file
@ -0,0 +1,36 @@
|
||||
package lingyi
|
||||
|
||||
import (
|
||||
"one-api/common/requester"
|
||||
"one-api/model"
|
||||
"one-api/providers/base"
|
||||
"one-api/providers/openai"
|
||||
)
|
||||
|
||||
// 定义供应商工厂
|
||||
type LingyiProviderFactory struct{}
|
||||
|
||||
// 创建 LingyiProvider
|
||||
// https://platform.lingyiwanwu.com/docs#-create-chat-completion
|
||||
func (f LingyiProviderFactory) Create(channel *model.Channel) base.ProviderInterface {
|
||||
return &LingyiProvider{
|
||||
OpenAIProvider: openai.OpenAIProvider{
|
||||
BaseProvider: base.BaseProvider{
|
||||
Config: getConfig(),
|
||||
Channel: channel,
|
||||
Requester: requester.NewHTTPRequester(*channel.Proxy, openai.RequestErrorHandle),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getConfig() base.ProviderConfig {
|
||||
return base.ProviderConfig{
|
||||
BaseURL: "https://api.lingyiwanwu.com",
|
||||
ChatCompletions: "/v1/chat/completions",
|
||||
}
|
||||
}
|
||||
|
||||
type LingyiProvider struct {
|
||||
openai.OpenAIProvider
|
||||
}
|
@ -107,6 +107,12 @@ export const CHANNEL_OPTIONS = {
|
||||
value: 32,
|
||||
color: 'orange'
|
||||
},
|
||||
33: {
|
||||
key: 33,
|
||||
text: '零一万物',
|
||||
value: 33,
|
||||
color: 'primary'
|
||||
},
|
||||
24: {
|
||||
key: 24,
|
||||
text: 'Azure Speech',
|
||||
|
@ -226,6 +226,13 @@ const typeConfig = {
|
||||
key: '按照如下格式输入:Region|AccessKeyID|SecretAccessKey|SessionToken 其中SessionToken可不填空'
|
||||
},
|
||||
modelGroup: 'Anthropic'
|
||||
},
|
||||
33: {
|
||||
input: {
|
||||
models: ['yi-34b-chat-0205', 'yi-34b-chat-200k', 'yi-vl-plus'],
|
||||
test_model: 'yi-34b-chat-0205'
|
||||
},
|
||||
modelGroup: 'Lingyiwanwu'
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user