mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-07 09:13:42 +08:00
Compare commits
4 Commits
v0.6.11-al
...
v0.6.11-pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6916debf66 | ||
|
|
53da209134 | ||
|
|
517f6ad211 | ||
|
|
10aba11f18 |
@@ -163,4 +163,4 @@ var UserContentRequestProxy = env.String("USER_CONTENT_REQUEST_PROXY", "")
|
||||
var UserContentRequestTimeout = env.Int("USER_CONTENT_REQUEST_TIMEOUT", 30)
|
||||
|
||||
var EnforceIncludeUsage = env.Bool("ENFORCE_INCLUDE_USAGE", false)
|
||||
var TestPrompt = env.String("TEST_PROMPT", "Print your model name exactly and do not output without any other text.")
|
||||
var TestPrompt = env.String("TEST_PROMPT", "Output only your specific model name with no additional text.")
|
||||
|
||||
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/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/doubao"
|
||||
"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)
|
||||
case channeltype.BaiduV2:
|
||||
return baiduv2.GetRequestURL(meta)
|
||||
case channeltype.AliBailian:
|
||||
return alibailian.GetRequestURL(meta)
|
||||
default:
|
||||
return GetFullRequestURL(meta.BaseURL, meta.RequestURLPath, meta.ChannelType), nil
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package openai
|
||||
|
||||
import (
|
||||
"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/baiduv2"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/deepseek"
|
||||
@@ -79,6 +80,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
|
||||
return "xunfeiv2", xunfeiv2.ModelList
|
||||
case channeltype.OpenRouter:
|
||||
return "openrouter", openrouter.ModelList
|
||||
case channeltype.AliBailian:
|
||||
return "alibailian", alibailian.ModelList
|
||||
default:
|
||||
return "openai", ModelList
|
||||
}
|
||||
|
||||
@@ -50,5 +50,6 @@ const (
|
||||
Replicate
|
||||
BaiduV2
|
||||
XunfeiV2
|
||||
AliBailian
|
||||
Dummy
|
||||
)
|
||||
|
||||
@@ -50,6 +50,7 @@ var ChannelBaseURLs = []string{
|
||||
"https://api.replicate.com/v1/models/", // 46
|
||||
"https://qianfan.baidubce.com", // 47
|
||||
"https://spark-api-open.xf-yun.com", // 48
|
||||
"https://dashscope.aliyuncs.com", // 49
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -490,7 +490,6 @@ const ChannelsTable = () => {
|
||||
onClick={() => {
|
||||
sortChannel('balance');
|
||||
}}
|
||||
hidden={!showDetail}
|
||||
>
|
||||
{t('channel.table.balance')}
|
||||
</Table.HeaderCell>
|
||||
@@ -499,6 +498,7 @@ const ChannelsTable = () => {
|
||||
onClick={() => {
|
||||
sortChannel('priority');
|
||||
}}
|
||||
hidden={!showDetail}
|
||||
>
|
||||
{t('channel.table.priority')}
|
||||
</Table.HeaderCell>
|
||||
@@ -538,7 +538,7 @@ const ChannelsTable = () => {
|
||||
basic
|
||||
/>
|
||||
</Table.Cell>
|
||||
<Table.Cell hidden={!showDetail}>
|
||||
<Table.Cell>
|
||||
<Popup
|
||||
trigger={
|
||||
<span
|
||||
@@ -554,7 +554,7 @@ const ChannelsTable = () => {
|
||||
basic
|
||||
/>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<Table.Cell hidden={!showDetail}>
|
||||
<Popup
|
||||
trigger={
|
||||
<Input
|
||||
|
||||
@@ -28,7 +28,14 @@ export const CHANNEL_OPTIONS = [
|
||||
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>相关模型',
|
||||
},
|
||||
{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,
|
||||
text: '讯飞星火认知',
|
||||
|
||||
@@ -122,11 +122,11 @@ const Dashboard = () => {
|
||||
? new Date(Math.min(...dates.map((d) => new Date(d))))
|
||||
: new Date();
|
||||
|
||||
// 确保至少显示5天的数据
|
||||
const fiveDaysAgo = new Date();
|
||||
fiveDaysAgo.setDate(fiveDaysAgo.getDate() - 4); // -4是因为包含今天
|
||||
if (minDate > fiveDaysAgo) {
|
||||
minDate = fiveDaysAgo;
|
||||
// 确保至少显示7天的数据
|
||||
const sevenDaysAgo = new Date();
|
||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 6); // -6是因为包含今天
|
||||
if (minDate > sevenDaysAgo) {
|
||||
minDate = sevenDaysAgo;
|
||||
}
|
||||
|
||||
// 生成所有日期
|
||||
@@ -164,11 +164,11 @@ const Dashboard = () => {
|
||||
? new Date(Math.min(...dates.map((d) => new Date(d))))
|
||||
: new Date();
|
||||
|
||||
// 确保至少显示5天的数据
|
||||
const fiveDaysAgo = new Date();
|
||||
fiveDaysAgo.setDate(fiveDaysAgo.getDate() - 4); // -4是因为包含今天
|
||||
if (minDate > fiveDaysAgo) {
|
||||
minDate = fiveDaysAgo;
|
||||
// 确保至少显示7天的数据
|
||||
const sevenDaysAgo = new Date();
|
||||
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 6); // -6是因为包含今天
|
||||
if (minDate > sevenDaysAgo) {
|
||||
minDate = sevenDaysAgo;
|
||||
}
|
||||
|
||||
// 生成所有日期
|
||||
|
||||
Reference in New Issue
Block a user