|
|
@@ -34,9 +34,14 @@ type ClaudeConvertInfo struct {
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
- RelayFormatOpenAI = "openai"
|
|
|
- RelayFormatClaude = "claude"
|
|
|
- RelayFormatGemini = "gemini"
|
|
|
+ RelayFormatOpenAI = "openai"
|
|
|
+ RelayFormatClaude = "claude"
|
|
|
+ RelayFormatGemini = "gemini"
|
|
|
+ RelayFormatOpenAIResponses = "openai_responses"
|
|
|
+ RelayFormatOpenAIAudio = "openai_audio"
|
|
|
+ RelayFormatOpenAIImage = "openai_image"
|
|
|
+ RelayFormatRerank = "rerank"
|
|
|
+ RelayFormatEmbedding = "embedding"
|
|
|
)
|
|
|
|
|
|
type RerankerInfo struct {
|
|
|
@@ -143,6 +148,7 @@ func GenRelayInfoClaude(c *gin.Context) *RelayInfo {
|
|
|
func GenRelayInfoRerank(c *gin.Context, req *dto.RerankRequest) *RelayInfo {
|
|
|
info := GenRelayInfo(c)
|
|
|
info.RelayMode = relayconstant.RelayModeRerank
|
|
|
+ info.RelayFormat = RelayFormatRerank
|
|
|
info.RerankerInfo = &RerankerInfo{
|
|
|
Documents: req.Documents,
|
|
|
ReturnDocuments: req.GetReturnDocuments(),
|
|
|
@@ -150,9 +156,25 @@ func GenRelayInfoRerank(c *gin.Context, req *dto.RerankRequest) *RelayInfo {
|
|
|
return info
|
|
|
}
|
|
|
|
|
|
+func GenRelayInfoOpenAIAudio(c *gin.Context) *RelayInfo {
|
|
|
+ info := GenRelayInfo(c)
|
|
|
+ info.RelayFormat = RelayFormatOpenAIAudio
|
|
|
+ return info
|
|
|
+}
|
|
|
+
|
|
|
+func GenRelayInfoEmbedding(c *gin.Context) *RelayInfo {
|
|
|
+ info := GenRelayInfo(c)
|
|
|
+ info.RelayFormat = RelayFormatEmbedding
|
|
|
+ return info
|
|
|
+}
|
|
|
+
|
|
|
func GenRelayInfoResponses(c *gin.Context, req *dto.OpenAIResponsesRequest) *RelayInfo {
|
|
|
info := GenRelayInfo(c)
|
|
|
info.RelayMode = relayconstant.RelayModeResponses
|
|
|
+ info.RelayFormat = RelayFormatOpenAIResponses
|
|
|
+
|
|
|
+ info.SupportStreamOptions = false
|
|
|
+
|
|
|
info.ResponsesUsageInfo = &ResponsesUsageInfo{
|
|
|
BuiltInTools: make(map[string]*BuildInToolInfo),
|
|
|
}
|
|
|
@@ -175,6 +197,19 @@ func GenRelayInfoResponses(c *gin.Context, req *dto.OpenAIResponsesRequest) *Rel
|
|
|
return info
|
|
|
}
|
|
|
|
|
|
+func GenRelayInfoGemini(c *gin.Context) *RelayInfo {
|
|
|
+ info := GenRelayInfo(c)
|
|
|
+ info.RelayFormat = RelayFormatGemini
|
|
|
+ info.ShouldIncludeUsage = false
|
|
|
+ return info
|
|
|
+}
|
|
|
+
|
|
|
+func GenRelayInfoImage(c *gin.Context) *RelayInfo {
|
|
|
+ info := GenRelayInfo(c)
|
|
|
+ info.RelayFormat = RelayFormatOpenAIImage
|
|
|
+ return info
|
|
|
+}
|
|
|
+
|
|
|
func GenRelayInfo(c *gin.Context) *RelayInfo {
|
|
|
channelType := c.GetInt("channel_type")
|
|
|
channelId := c.GetInt("channel_id")
|
|
|
@@ -243,10 +278,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
|
|
|
if streamSupportedChannels[info.ChannelType] {
|
|
|
info.SupportStreamOptions = true
|
|
|
}
|
|
|
- // responses 模式不支持 StreamOptions
|
|
|
- if relayconstant.RelayModeResponses == info.RelayMode {
|
|
|
- info.SupportStreamOptions = false
|
|
|
- }
|
|
|
return info
|
|
|
}
|
|
|
|