mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 09:16:36 +08:00
feat: add AliBailian adaptor and update channel options
This commit is contained in:
parent
517f6ad211
commit
53da209134
20
relay/adaptor/alibailian/constants.go
Normal file
20
relay/adaptor/alibailian/constants.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package alibailian
|
||||||
|
|
||||||
|
// https://help.aliyun.com/zh/model-studio/getting-started/models
|
||||||
|
|
||||||
|
var ModelList = []string{
|
||||||
|
"qwen-turbo",
|
||||||
|
"qwen-plus",
|
||||||
|
"qwen-long",
|
||||||
|
"qwen-max",
|
||||||
|
"qwen-coder-plus",
|
||||||
|
"qwen-coder-plus-latest",
|
||||||
|
"qwen-coder-turbo",
|
||||||
|
"qwen-coder-turbo-latest",
|
||||||
|
"qwen-mt-plus",
|
||||||
|
"qwen-mt-turbo",
|
||||||
|
"qwq-32b-preview",
|
||||||
|
|
||||||
|
"deepseek-r1",
|
||||||
|
"deepseek-v3",
|
||||||
|
}
|
19
relay/adaptor/alibailian/main.go
Normal file
19
relay/adaptor/alibailian/main.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package alibailian
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/songquanpeng/one-api/relay/meta"
|
||||||
|
"github.com/songquanpeng/one-api/relay/relaymode"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetRequestURL(meta *meta.Meta) (string, error) {
|
||||||
|
switch meta.Mode {
|
||||||
|
case relaymode.ChatCompletions:
|
||||||
|
return fmt.Sprintf("%s/compatible-mode/v1/chat/completions", meta.BaseURL), nil
|
||||||
|
case relaymode.Embeddings:
|
||||||
|
return fmt.Sprintf("%s/compatible-mode/v1/embeddings", meta.BaseURL), nil
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("unsupported relay mode %d for ali bailian", meta.Mode)
|
||||||
|
}
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor"
|
"github.com/songquanpeng/one-api/relay/adaptor"
|
||||||
|
"github.com/songquanpeng/one-api/relay/adaptor/alibailian"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/baiduv2"
|
"github.com/songquanpeng/one-api/relay/adaptor/baiduv2"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/doubao"
|
"github.com/songquanpeng/one-api/relay/adaptor/doubao"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/minimax"
|
"github.com/songquanpeng/one-api/relay/adaptor/minimax"
|
||||||
@ -56,6 +57,8 @@ func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error) {
|
|||||||
return novita.GetRequestURL(meta)
|
return novita.GetRequestURL(meta)
|
||||||
case channeltype.BaiduV2:
|
case channeltype.BaiduV2:
|
||||||
return baiduv2.GetRequestURL(meta)
|
return baiduv2.GetRequestURL(meta)
|
||||||
|
case channeltype.AliBailian:
|
||||||
|
return alibailian.GetRequestURL(meta)
|
||||||
default:
|
default:
|
||||||
return GetFullRequestURL(meta.BaseURL, meta.RequestURLPath, meta.ChannelType), nil
|
return GetFullRequestURL(meta.BaseURL, meta.RequestURLPath, meta.ChannelType), nil
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package openai
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/ai360"
|
"github.com/songquanpeng/one-api/relay/adaptor/ai360"
|
||||||
|
"github.com/songquanpeng/one-api/relay/adaptor/alibailian"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/baichuan"
|
"github.com/songquanpeng/one-api/relay/adaptor/baichuan"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/baiduv2"
|
"github.com/songquanpeng/one-api/relay/adaptor/baiduv2"
|
||||||
"github.com/songquanpeng/one-api/relay/adaptor/deepseek"
|
"github.com/songquanpeng/one-api/relay/adaptor/deepseek"
|
||||||
@ -79,6 +80,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
|
|||||||
return "xunfeiv2", xunfeiv2.ModelList
|
return "xunfeiv2", xunfeiv2.ModelList
|
||||||
case channeltype.OpenRouter:
|
case channeltype.OpenRouter:
|
||||||
return "openrouter", openrouter.ModelList
|
return "openrouter", openrouter.ModelList
|
||||||
|
case channeltype.AliBailian:
|
||||||
|
return "alibailian", alibailian.ModelList
|
||||||
default:
|
default:
|
||||||
return "openai", ModelList
|
return "openai", ModelList
|
||||||
}
|
}
|
||||||
|
@ -50,5 +50,6 @@ const (
|
|||||||
Replicate
|
Replicate
|
||||||
BaiduV2
|
BaiduV2
|
||||||
XunfeiV2
|
XunfeiV2
|
||||||
|
AliBailian
|
||||||
Dummy
|
Dummy
|
||||||
)
|
)
|
||||||
|
@ -50,6 +50,7 @@ var ChannelBaseURLs = []string{
|
|||||||
"https://api.replicate.com/v1/models/", // 46
|
"https://api.replicate.com/v1/models/", // 46
|
||||||
"https://qianfan.baidubce.com", // 47
|
"https://qianfan.baidubce.com", // 47
|
||||||
"https://spark-api-open.xf-yun.com", // 48
|
"https://spark-api-open.xf-yun.com", // 48
|
||||||
|
"https://dashscope.aliyuncs.com", // 49
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -28,7 +28,14 @@ export const CHANNEL_OPTIONS = [
|
|||||||
color: 'blue',
|
color: 'blue',
|
||||||
tip: '请前往<a href="https://console.bce.baidu.com/iam/#/iam/apikey/list" target="_blank">此处</a>获取 API Key,注意本渠道仅支持<a target="_blank" href="https://cloud.baidu.com/doc/WENXINWORKSHOP/s/em4tsqo3v">推理服务 V2</a>相关模型',
|
tip: '请前往<a href="https://console.bce.baidu.com/iam/#/iam/apikey/list" target="_blank">此处</a>获取 API Key,注意本渠道仅支持<a target="_blank" href="https://cloud.baidu.com/doc/WENXINWORKSHOP/s/em4tsqo3v">推理服务 V2</a>相关模型',
|
||||||
},
|
},
|
||||||
{key: 17, text: '阿里通义千问', value: 17, color: 'orange'},
|
{
|
||||||
|
key: 17,
|
||||||
|
text: '阿里通义千问',
|
||||||
|
value: 17,
|
||||||
|
color: 'orange',
|
||||||
|
tip: '如需使用阿里云百炼,请使用<strong>阿里云百炼</strong>渠道',
|
||||||
|
},
|
||||||
|
{key: 49, text: '阿里云百炼', value: 49, color: 'orange'},
|
||||||
{
|
{
|
||||||
key: 18,
|
key: 18,
|
||||||
text: '讯飞星火认知',
|
text: '讯飞星火认知',
|
||||||
|
Loading…
Reference in New Issue
Block a user