Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions constant/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const (
ChannelTypeDoubaoVideo = 54
ChannelTypeSora = 55
ChannelTypeReplicate = 56
ChannelTypeStreamLake = 57

@coderabbitai coderabbitai Bot Jan 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add missing entry to ChannelTypeNames map.

The ChannelTypeNames map (lines 123-177) is missing an entry for ChannelTypeStreamLake. This causes GetChannelTypeName(constant.ChannelTypeStreamLake) to return "Unknown" instead of the proper channel name.

🔎 Proposed fix

Add the following entry to the ChannelTypeNames map after line 176:

 	ChannelTypeSora:           "Sora",
 	ChannelTypeReplicate:      "Replicate",
+	ChannelTypeStreamLake:     "StreamLake",
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ChannelTypeStreamLake = 57
ChannelTypeSora: "Sora",
ChannelTypeReplicate: "Replicate",
ChannelTypeStreamLake: "StreamLake",
}
🤖 Prompt for AI Agents
In constant/channel.go around line 57 (ChannelTypeStreamLake) and the
ChannelTypeNames map at lines ~123-177, the map lacks an entry for
ChannelTypeStreamLake causing GetChannelTypeName(constant.ChannelTypeStreamLake)
to return "Unknown"; add a map entry mapping constant.ChannelTypeStreamLake to
the proper name (e.g., "StreamLake") inside the ChannelTypeNames map (place it
after the existing entries, around line 176) so the lookup returns the correct
channel name.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChannelTypeNames 这个里面还没加呢

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seefs001 是的,您说得对!ChannelTypeNames 映射中确实还缺少 ChannelTypeStreamLake 的条目。

请在 ChannelTypeNames 映射中添加以下条目(大约在第176行之后):

ChannelTypeStreamLake:     "StreamLake",

这样 GetChannelTypeName(constant.ChannelTypeStreamLake) 就会返回 "StreamLake" 而不是 "Unknown" 了。

ChannelTypeDummy // this one is only for count, do not add any channel after this

)
Expand Down Expand Up @@ -116,6 +117,7 @@ var ChannelBaseURLs = []string{
"https://ark.cn-beijing.volces.com", //54
"https://api.openai.com", //55
"https://api.replicate.com", //56
"https://wanqing.streamlakeapi.com/api/gateway/v1/endpoints", //57
}

var ChannelTypeNames = map[int]string{
Expand Down
100 changes: 100 additions & 0 deletions relay/channel/streamlake/adaptor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package streamlake

import (
"errors"
"fmt"
"io"
"net/http"
"strings"

"github.com/QuantumNous/new-api/constant"
"github.com/QuantumNous/new-api/dto"
"github.com/QuantumNous/new-api/relay/channel"
"github.com/QuantumNous/new-api/relay/channel/openai"
relaycommon "github.com/QuantumNous/new-api/relay/common"
"github.com/QuantumNous/new-api/types"

"github.com/gin-gonic/gin"
)

type Adaptor struct {
}

func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dto.GeminiChatRequest) (any, error) {
//TODO implement me
return nil, errors.New("not implemented")
}

func (a *Adaptor) ConvertClaudeRequest(c *gin.Context, info *relaycommon.RelayInfo, req *dto.ClaudeRequest) (any, error) {
//TODO implement me
return nil, errors.New("not implemented")
}

func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.AudioRequest) (io.Reader, error) {
//TODO implement me
return nil, errors.New("not supported")
}

func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.ImageRequest) (any, error) {
//TODO implement me
return nil, errors.New("not implemented")
}

func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
}

func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
if info == nil {
return "", errors.New("streamlake adaptor: relay info is nil")
}
if info.ChannelBaseUrl == "" {
info.ChannelBaseUrl = constant.ChannelBaseURLs[constant.ChannelTypeStreamLake]
}
requestPath := info.RequestURLPath
if requestPath == "" {
return info.ChannelBaseUrl, nil
}
requestPath = strings.TrimPrefix(requestPath, "/v1")
return relaycommon.GetFullRequestURL(info.ChannelBaseUrl, requestPath, info.ChannelType), nil
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
channel.SetupApiRequestHeader(info, c, req)
req.Set("Authorization", fmt.Sprintf("Bearer %s", info.ApiKey))
return nil
}

func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayInfo, request *dto.GeneralOpenAIRequest) (any, error) {
return request, nil
}

func (a *Adaptor) ConvertOpenAIResponsesRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.OpenAIResponsesRequest) (any, error) {
// TODO implement me
return nil, errors.New("not implemented")
}

func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, requestBody io.Reader) (any, error) {
return channel.DoApiRequest(a, c, info, requestBody)
}

func (a *Adaptor) ConvertRerankRequest(c *gin.Context, relayMode int, request dto.RerankRequest) (any, error) {
return request, nil
}

func (a *Adaptor) ConvertEmbeddingRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.EmbeddingRequest) (any, error) {
return request, nil
}

func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo) (usage any, err *types.NewAPIError) {
adaptor := openai.Adaptor{}
usage, err = adaptor.DoResponse(c, resp, info)
return
}

func (a *Adaptor) GetModelList() []string {
return ModelList
}

func (a *Adaptor) GetChannelName() string {
return ChannelName
}
9 changes: 9 additions & 0 deletions relay/channel/streamlake/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package streamlake

var ModelList = []string{
"KAT-Coder-Exp-72B-1010",
"KAT-Coder-Pro-V1",
"KAT-Coder-Air-V1",
}

var ChannelName = "StreamLake"
5 changes: 5 additions & 0 deletions web/src/constants/channel.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ export const CHANNEL_OPTIONS = [
color: 'blue',
label: 'Replicate',
},
{
value: 57,
color: 'blue',
label: 'StreamLake',
Comment on lines +188 to +190

Copilot AI Jan 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is inconsistent with the surrounding code. The array items should use 2 spaces for indentation, but this entry uses 4 spaces. This breaks the consistent formatting pattern used throughout the file.

Suggested change
value: 57,
color: 'blue',
label: 'StreamLake',
value: 57,
color: 'blue',
label: 'StreamLake',

Copilot uses AI. Check for mistakes.
},
];

export const MODEL_TABLE_PAGE_SIZE = 10;