mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-12-16 04:55:57 +08:00
Compare commits
6 Commits
v0.6.0-alp
...
v0.6.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
614c2e0442 | ||
|
|
eac6a0b9aa | ||
|
|
b747cdbc6f | ||
|
|
6b27d6659a | ||
|
|
dc5b781191 | ||
|
|
c880b4a9a3 |
2
.github/workflows/linux-release.yml
vendored
2
.github/workflows/linux-release.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Build Backend (amd64)
|
- name: Build Backend (amd64)
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
|
go build -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
|
||||||
|
|
||||||
- name: Build Backend (arm64)
|
- name: Build Backend (arm64)
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/macos-release.yml
vendored
2
.github/workflows/macos-release.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-X 'one-api/common.Version=$(git describe --tags)'" -o one-api-macos
|
go build -ldflags "-X 'github.com/songquanpeng/one-api/common.Version=$(git describe --tags)'" -o one-api-macos
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|||||||
2
.github/workflows/windows-release.yml
vendored
2
.github/workflows/windows-release.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o one-api.exe
|
go build -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(git describe --tags)'" -o one-api.exe
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
|
|||||||
+ [x] [360 智脑](https://ai.360.cn)
|
+ [x] [360 智脑](https://ai.360.cn)
|
||||||
+ [x] [腾讯混元大模型](https://cloud.tencent.com/document/product/1729)
|
+ [x] [腾讯混元大模型](https://cloud.tencent.com/document/product/1729)
|
||||||
+ [x] [Moonshot AI](https://platform.moonshot.cn/)
|
+ [x] [Moonshot AI](https://platform.moonshot.cn/)
|
||||||
|
+ [x] [百川大模型](https://platform.baichuan-ai.com)
|
||||||
+ [ ] [字节云雀大模型](https://www.volcengine.com/product/ark) (WIP)
|
+ [ ] [字节云雀大模型](https://www.volcengine.com/product/ark) (WIP)
|
||||||
+ [ ] [MINIMAX](https://api.minimax.chat/) (WIP)
|
+ [ ] [MINIMAX](https://api.minimax.chat/) (WIP)
|
||||||
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
|
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const (
|
|||||||
ChannelTypeTencent = 23
|
ChannelTypeTencent = 23
|
||||||
ChannelTypeGemini = 24
|
ChannelTypeGemini = 24
|
||||||
ChannelTypeMoonshot = 25
|
ChannelTypeMoonshot = 25
|
||||||
|
ChannelTypeBaichuan = 26
|
||||||
)
|
)
|
||||||
|
|
||||||
var ChannelBaseURLs = []string{
|
var ChannelBaseURLs = []string{
|
||||||
@@ -93,6 +94,7 @@ var ChannelBaseURLs = []string{
|
|||||||
"https://hunyuan.cloud.tencent.com", // 23
|
"https://hunyuan.cloud.tencent.com", // 23
|
||||||
"https://generativelanguage.googleapis.com", // 24
|
"https://generativelanguage.googleapis.com", // 24
|
||||||
"https://api.moonshot.cn", // 25
|
"https://api.moonshot.cn", // 25
|
||||||
|
"https://api.baichuan-ai.com", // 26
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -8,12 +8,24 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UnmarshalBodyReusable(c *gin.Context, v any) error {
|
const KeyRequestBody = "key_request_body"
|
||||||
|
|
||||||
|
func GetRequestBody(c *gin.Context) ([]byte, error) {
|
||||||
|
requestBody, _ := c.Get(KeyRequestBody)
|
||||||
|
if requestBody != nil {
|
||||||
|
return requestBody.([]byte), nil
|
||||||
|
}
|
||||||
requestBody, err := io.ReadAll(c.Request.Body)
|
requestBody, err := io.ReadAll(c.Request.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = c.Request.Body.Close()
|
_ = c.Request.Body.Close()
|
||||||
|
c.Set(KeyRequestBody, requestBody)
|
||||||
|
return requestBody.([]byte), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UnmarshalBodyReusable(c *gin.Context, v any) error {
|
||||||
|
requestBody, err := GetRequestBody(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
loggerDEBUG = "DEBUG"
|
||||||
loggerINFO = "INFO"
|
loggerINFO = "INFO"
|
||||||
loggerWarn = "WARN"
|
loggerWarn = "WARN"
|
||||||
loggerError = "ERR"
|
loggerError = "ERR"
|
||||||
@@ -55,6 +56,10 @@ func SysError(s string) {
|
|||||||
_, _ = fmt.Fprintf(gin.DefaultErrorWriter, "[SYS] %v | %s \n", t.Format("2006/01/02 - 15:04:05"), s)
|
_, _ = fmt.Fprintf(gin.DefaultErrorWriter, "[SYS] %v | %s \n", t.Format("2006/01/02 - 15:04:05"), s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Debug(ctx context.Context, msg string) {
|
||||||
|
logHelper(ctx, loggerDEBUG, msg)
|
||||||
|
}
|
||||||
|
|
||||||
func Info(ctx context.Context, msg string) {
|
func Info(ctx context.Context, msg string) {
|
||||||
logHelper(ctx, loggerINFO, msg)
|
logHelper(ctx, loggerINFO, msg)
|
||||||
}
|
}
|
||||||
@@ -67,6 +72,10 @@ func Error(ctx context.Context, msg string) {
|
|||||||
logHelper(ctx, loggerError, msg)
|
logHelper(ctx, loggerError, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Debugf(ctx context.Context, format string, a ...any) {
|
||||||
|
Debug(ctx, fmt.Sprintf(format, a...))
|
||||||
|
}
|
||||||
|
|
||||||
func Infof(ctx context.Context, format string, a ...any) {
|
func Infof(ctx context.Context, format string, a ...any) {
|
||||||
Info(ctx, fmt.Sprintf(format, a...))
|
Info(ctx, fmt.Sprintf(format, a...))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/songquanpeng/one-api/relay/channel/ai360"
|
"github.com/songquanpeng/one-api/relay/channel/ai360"
|
||||||
|
"github.com/songquanpeng/one-api/relay/channel/baichuan"
|
||||||
"github.com/songquanpeng/one-api/relay/channel/moonshot"
|
"github.com/songquanpeng/one-api/relay/channel/moonshot"
|
||||||
"github.com/songquanpeng/one-api/relay/constant"
|
"github.com/songquanpeng/one-api/relay/constant"
|
||||||
"github.com/songquanpeng/one-api/relay/helper"
|
"github.com/songquanpeng/one-api/relay/helper"
|
||||||
@@ -98,6 +99,17 @@ func init() {
|
|||||||
Parent: nil,
|
Parent: nil,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
for _, modelName := range baichuan.ModelList {
|
||||||
|
openAIModels = append(openAIModels, OpenAIModels{
|
||||||
|
Id: modelName,
|
||||||
|
Object: "model",
|
||||||
|
Created: 1626777600,
|
||||||
|
OwnedBy: "baichuan",
|
||||||
|
Permission: permission,
|
||||||
|
Root: modelName,
|
||||||
|
Parent: nil,
|
||||||
|
})
|
||||||
|
}
|
||||||
openAIModelsMap = make(map[string]OpenAIModels)
|
openAIModelsMap = make(map[string]OpenAIModels)
|
||||||
for _, model := range openAIModels {
|
for _, model := range openAIModels {
|
||||||
openAIModelsMap[model.Id] = model
|
openAIModelsMap[model.Id] = model
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/songquanpeng/one-api/common"
|
||||||
"github.com/songquanpeng/one-api/common/config"
|
"github.com/songquanpeng/one-api/common/config"
|
||||||
"github.com/songquanpeng/one-api/common/helper"
|
"github.com/songquanpeng/one-api/common/helper"
|
||||||
"github.com/songquanpeng/one-api/common/logger"
|
"github.com/songquanpeng/one-api/common/logger"
|
||||||
@@ -13,6 +15,7 @@ import (
|
|||||||
"github.com/songquanpeng/one-api/relay/controller"
|
"github.com/songquanpeng/one-api/relay/controller"
|
||||||
"github.com/songquanpeng/one-api/relay/model"
|
"github.com/songquanpeng/one-api/relay/model"
|
||||||
"github.com/songquanpeng/one-api/relay/util"
|
"github.com/songquanpeng/one-api/relay/util"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -38,6 +41,10 @@ func relay(c *gin.Context, relayMode int) *model.ErrorWithStatusCode {
|
|||||||
func Relay(c *gin.Context) {
|
func Relay(c *gin.Context) {
|
||||||
ctx := c.Request.Context()
|
ctx := c.Request.Context()
|
||||||
relayMode := constant.Path2RelayMode(c.Request.URL.Path)
|
relayMode := constant.Path2RelayMode(c.Request.URL.Path)
|
||||||
|
if config.DebugEnabled {
|
||||||
|
requestBody, _ := common.GetRequestBody(c)
|
||||||
|
logger.Debugf(ctx, "request body: %s", string(requestBody))
|
||||||
|
}
|
||||||
bizErr := relay(c, relayMode)
|
bizErr := relay(c, relayMode)
|
||||||
if bizErr == nil {
|
if bizErr == nil {
|
||||||
return
|
return
|
||||||
@@ -50,8 +57,8 @@ func Relay(c *gin.Context) {
|
|||||||
go processChannelRelayError(ctx, channelId, channelName, bizErr)
|
go processChannelRelayError(ctx, channelId, channelName, bizErr)
|
||||||
requestId := c.GetString(logger.RequestIdKey)
|
requestId := c.GetString(logger.RequestIdKey)
|
||||||
retryTimes := config.RetryTimes
|
retryTimes := config.RetryTimes
|
||||||
if !shouldRetry(bizErr.StatusCode) {
|
if !shouldRetry(c, bizErr.StatusCode) {
|
||||||
logger.Errorf(ctx, "relay error happen, but status code is %d, won't retry in this case", bizErr.StatusCode)
|
logger.Errorf(ctx, "relay error happen, status code is %d, won't retry in this case", bizErr.StatusCode)
|
||||||
retryTimes = 0
|
retryTimes = 0
|
||||||
}
|
}
|
||||||
for i := retryTimes; i > 0; i-- {
|
for i := retryTimes; i > 0; i-- {
|
||||||
@@ -65,6 +72,8 @@ func Relay(c *gin.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
middleware.SetupContextForSelectedChannel(c, channel, originalModel)
|
middleware.SetupContextForSelectedChannel(c, channel, originalModel)
|
||||||
|
requestBody, err := common.GetRequestBody(c)
|
||||||
|
c.Request.Body = io.NopCloser(bytes.NewBuffer(requestBody))
|
||||||
bizErr = relay(c, relayMode)
|
bizErr = relay(c, relayMode)
|
||||||
if bizErr == nil {
|
if bizErr == nil {
|
||||||
return
|
return
|
||||||
@@ -85,7 +94,10 @@ func Relay(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldRetry(statusCode int) bool {
|
func shouldRetry(c *gin.Context, statusCode int) bool {
|
||||||
|
if _, ok := c.Get("specific_channel_id"); ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if statusCode == http.StatusTooManyRequests {
|
if statusCode == http.StatusTooManyRequests {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func responseAIProxyLibrary2OpenAI(response *LibraryResponse) *openai.TextRespon
|
|||||||
FinishReason: "stop",
|
FinishReason: "stop",
|
||||||
}
|
}
|
||||||
fullTextResponse := openai.TextResponse{
|
fullTextResponse := openai.TextResponse{
|
||||||
Id: helper.GetUUID(),
|
Id: fmt.Sprintf("chatcmpl-%s", helper.GetUUID()),
|
||||||
Object: "chat.completion",
|
Object: "chat.completion",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Choices: []openai.TextResponseChoice{choice},
|
Choices: []openai.TextResponseChoice{choice},
|
||||||
@@ -66,7 +66,7 @@ func documentsAIProxyLibrary(documents []LibraryDocument) *openai.ChatCompletion
|
|||||||
choice.Delta.Content = aiProxyDocuments2Markdown(documents)
|
choice.Delta.Content = aiProxyDocuments2Markdown(documents)
|
||||||
choice.FinishReason = &constant.StopFinishReason
|
choice.FinishReason = &constant.StopFinishReason
|
||||||
return &openai.ChatCompletionsStreamResponse{
|
return &openai.ChatCompletionsStreamResponse{
|
||||||
Id: helper.GetUUID(),
|
Id: fmt.Sprintf("chatcmpl-%s", helper.GetUUID()),
|
||||||
Object: "chat.completion.chunk",
|
Object: "chat.completion.chunk",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Model: "",
|
Model: "",
|
||||||
@@ -78,7 +78,7 @@ func streamResponseAIProxyLibrary2OpenAI(response *LibraryStreamResponse) *opena
|
|||||||
var choice openai.ChatCompletionsStreamResponseChoice
|
var choice openai.ChatCompletionsStreamResponseChoice
|
||||||
choice.Delta.Content = response.Content
|
choice.Delta.Content = response.Content
|
||||||
return &openai.ChatCompletionsStreamResponse{
|
return &openai.ChatCompletionsStreamResponse{
|
||||||
Id: helper.GetUUID(),
|
Id: fmt.Sprintf("chatcmpl-%s", helper.GetUUID()),
|
||||||
Object: "chat.completion.chunk",
|
Object: "chat.completion.chunk",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Model: response.Model,
|
Model: response.Model,
|
||||||
|
|||||||
7
relay/channel/baichuan/constants.go
Normal file
7
relay/channel/baichuan/constants.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package baichuan
|
||||||
|
|
||||||
|
var ModelList = []string{
|
||||||
|
"Baichuan2-Turbo",
|
||||||
|
"Baichuan2-Turbo-192k",
|
||||||
|
"Baichuan-Text-Embedding",
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/songquanpeng/one-api/common"
|
"github.com/songquanpeng/one-api/common"
|
||||||
"github.com/songquanpeng/one-api/relay/channel"
|
"github.com/songquanpeng/one-api/relay/channel"
|
||||||
"github.com/songquanpeng/one-api/relay/channel/ai360"
|
"github.com/songquanpeng/one-api/relay/channel/ai360"
|
||||||
|
"github.com/songquanpeng/one-api/relay/channel/baichuan"
|
||||||
"github.com/songquanpeng/one-api/relay/channel/moonshot"
|
"github.com/songquanpeng/one-api/relay/channel/moonshot"
|
||||||
"github.com/songquanpeng/one-api/relay/model"
|
"github.com/songquanpeng/one-api/relay/model"
|
||||||
"github.com/songquanpeng/one-api/relay/util"
|
"github.com/songquanpeng/one-api/relay/util"
|
||||||
@@ -84,6 +85,8 @@ func (a *Adaptor) GetModelList() []string {
|
|||||||
return ai360.ModelList
|
return ai360.ModelList
|
||||||
case common.ChannelTypeMoonshot:
|
case common.ChannelTypeMoonshot:
|
||||||
return moonshot.ModelList
|
return moonshot.ModelList
|
||||||
|
case common.ChannelTypeBaichuan:
|
||||||
|
return baichuan.ModelList
|
||||||
default:
|
default:
|
||||||
return ModelList
|
return ModelList
|
||||||
}
|
}
|
||||||
@@ -97,6 +100,8 @@ func (a *Adaptor) GetChannelName() string {
|
|||||||
return "360"
|
return "360"
|
||||||
case common.ChannelTypeMoonshot:
|
case common.ChannelTypeMoonshot:
|
||||||
return "moonshot"
|
return "moonshot"
|
||||||
|
case common.ChannelTypeBaichuan:
|
||||||
|
return "baichuan"
|
||||||
default:
|
default:
|
||||||
return "openai"
|
return "openai"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,8 +118,10 @@ type ImageResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ChatCompletionsStreamResponseChoice struct {
|
type ChatCompletionsStreamResponseChoice struct {
|
||||||
|
Index int `json:"index"`
|
||||||
Delta struct {
|
Delta struct {
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
Role string `json:"role,omitempty"`
|
||||||
} `json:"delta"`
|
} `json:"delta"`
|
||||||
FinishReason *string `json:"finish_reason,omitempty"`
|
FinishReason *string `json:"finish_reason,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ func responseXunfei2OpenAI(response *ChatResponse) *openai.TextResponse {
|
|||||||
FinishReason: constant.StopFinishReason,
|
FinishReason: constant.StopFinishReason,
|
||||||
}
|
}
|
||||||
fullTextResponse := openai.TextResponse{
|
fullTextResponse := openai.TextResponse{
|
||||||
|
Id: fmt.Sprintf("chatcmpl-%s", helper.GetUUID()),
|
||||||
Object: "chat.completion",
|
Object: "chat.completion",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Choices: []openai.TextResponseChoice{choice},
|
Choices: []openai.TextResponseChoice{choice},
|
||||||
@@ -92,6 +93,7 @@ func streamResponseXunfei2OpenAI(xunfeiResponse *ChatResponse) *openai.ChatCompl
|
|||||||
choice.FinishReason = &constant.StopFinishReason
|
choice.FinishReason = &constant.StopFinishReason
|
||||||
}
|
}
|
||||||
response := openai.ChatCompletionsStreamResponse{
|
response := openai.ChatCompletionsStreamResponse{
|
||||||
|
Id: fmt.Sprintf("chatcmpl-%s", helper.GetUUID()),
|
||||||
Object: "chat.completion.chunk",
|
Object: "chat.completion.chunk",
|
||||||
Created: helper.GetTimestamp(),
|
Created: helper.GetTimestamp(),
|
||||||
Model: "SparkDesk",
|
Model: "SparkDesk",
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ func RelayTextHelper(c *gin.Context) *model.ErrorWithStatusCode {
|
|||||||
var requestBody io.Reader
|
var requestBody io.Reader
|
||||||
if meta.APIType == constant.APITypeOpenAI {
|
if meta.APIType == constant.APITypeOpenAI {
|
||||||
// no need to convert request for openai
|
// no need to convert request for openai
|
||||||
if isModelMapped {
|
shouldResetRequestBody := isModelMapped || meta.ChannelType == common.ChannelTypeBaichuan // frequency_penalty 0 is not acceptable for baichuan
|
||||||
|
if shouldResetRequestBody {
|
||||||
jsonStr, err := json.Marshal(textRequest)
|
jsonStr, err := json.Marshal(textRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return openai.ErrorWrapper(err, "json_marshal_failed", http.StatusInternalServerError)
|
return openai.ErrorWrapper(err, "json_marshal_failed", http.StatusInternalServerError)
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ export const CHANNEL_OPTIONS = {
|
|||||||
value: 23,
|
value: 23,
|
||||||
color: 'default'
|
color: 'default'
|
||||||
},
|
},
|
||||||
|
26: {
|
||||||
|
key: 26,
|
||||||
|
text: '百川大模型',
|
||||||
|
value: 23,
|
||||||
|
color: 'default'
|
||||||
|
},
|
||||||
8: {
|
8: {
|
||||||
key: 8,
|
key: 8,
|
||||||
text: '自定义渠道',
|
text: '自定义渠道',
|
||||||
|
|||||||
@@ -145,6 +145,18 @@ const typeConfig = {
|
|||||||
},
|
},
|
||||||
modelGroup: "google gemini",
|
modelGroup: "google gemini",
|
||||||
},
|
},
|
||||||
|
25: {
|
||||||
|
input: {
|
||||||
|
models: ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k'],
|
||||||
|
},
|
||||||
|
modelGroup: "moonshot",
|
||||||
|
},
|
||||||
|
26: {
|
||||||
|
input: {
|
||||||
|
models: ['Baichuan2-Turbo', 'Baichuan2-Turbo-192k', 'Baichuan-Text-Embedding'],
|
||||||
|
},
|
||||||
|
modelGroup: "baichuan",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export { defaultConfig, typeConfig };
|
export { defaultConfig, typeConfig };
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const CHANNEL_OPTIONS = [
|
|||||||
{ key: 19, text: '360 智脑', value: 19, color: 'blue' },
|
{ key: 19, text: '360 智脑', value: 19, color: 'blue' },
|
||||||
{ key: 25, text: 'Moonshot AI', value: 25, color: 'black' },
|
{ key: 25, text: 'Moonshot AI', value: 25, color: 'black' },
|
||||||
{ key: 23, text: '腾讯混元', value: 23, color: 'teal' },
|
{ key: 23, text: '腾讯混元', value: 23, color: 'teal' },
|
||||||
|
{ key: 26, text: '百川大模型', value: 26, color: 'orange' },
|
||||||
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' },
|
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' },
|
||||||
{ key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
|
{ key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' },
|
||||||
{ key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },
|
{ key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ const EditChannel = () => {
|
|||||||
case 25:
|
case 25:
|
||||||
localModels = ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k'];
|
localModels = ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k'];
|
||||||
break;
|
break;
|
||||||
|
case 26:
|
||||||
|
localModels = ['Baichuan2-Turbo', 'Baichuan2-Turbo-192k', 'Baichuan-Text-Embedding'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setInputs((inputs) => ({ ...inputs, models: localModels }));
|
setInputs((inputs) => ({ ...inputs, models: localModels }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user