feat: support xinference rerank to jina format

This commit is contained in:
1808837298@qq.com
2025-03-16 21:06:29 +08:00
parent 53b3599827
commit d1c62a583d
9 changed files with 85 additions and 22 deletions

View File

@@ -33,6 +33,10 @@ const (
RelayFormatClaude = "claude"
)
type RerankerInfo struct {
Documents []any
}
type RelayInfo struct {
ChannelType int
ChannelId int
@@ -78,6 +82,7 @@ type RelayInfo struct {
SendResponseCount int
ThinkingContentInfo
ClaudeConvertInfo
*RerankerInfo
}
// 定义支持流式选项的通道类型
@@ -111,6 +116,15 @@ func GenRelayInfoClaude(c *gin.Context) *RelayInfo {
return info
}
func GenRelayInfoRerank(c *gin.Context, documents []any) *RelayInfo {
info := GenRelayInfo(c)
info.RelayMode = relayconstant.RelayModeRerank
info.RerankerInfo = &RerankerInfo{
Documents: documents,
}
return info
}
func GenRelayInfo(c *gin.Context) *RelayInfo {
channelType := c.GetInt("channel_type")
channelId := c.GetInt("channel_id")