diff --git a/dto/openai_request.go b/dto/openai_request.go index ab2810c77..5e40d5472 100644 --- a/dto/openai_request.go +++ b/dto/openai_request.go @@ -817,7 +817,10 @@ type OpenAIResponsesRequest struct { User string `json:"user,omitempty"` MaxToolCalls uint `json:"max_tool_calls,omitempty"` Prompt json.RawMessage `json:"prompt,omitempty"` - EnableThinking json.RawMessage `json:"enable_thinking,omitempty"` + // qwen + EnableThinking json.RawMessage `json:"enable_thinking,omitempty"` + // perplexity + Preset json.RawMessage `json:"preset,omitempty"` } func (r *OpenAIResponsesRequest) GetTokenCountMeta() *types.TokenCountMeta { diff --git a/relay/channel/perplexity/adaptor.go b/relay/channel/perplexity/adaptor.go index 43e39b12e..fc31a603e 100644 --- a/relay/channel/perplexity/adaptor.go +++ b/relay/channel/perplexity/adaptor.go @@ -10,6 +10,7 @@ import ( "github.com/QuantumNous/new-api/relay/channel" "github.com/QuantumNous/new-api/relay/channel/openai" relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" @@ -42,6 +43,9 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) { } func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) { + if info.RelayMode == relayconstant.RelayModeResponses { + return fmt.Sprintf("%s/v1/responses", info.ChannelBaseUrl), nil + } return fmt.Sprintf("%s/chat/completions", info.ChannelBaseUrl), nil } @@ -71,8 +75,7 @@ func (a *Adaptor) ConvertEmbeddingRequest(c *gin.Context, info *relaycommon.Rela } func (a *Adaptor) ConvertOpenAIResponsesRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.OpenAIResponsesRequest) (any, error) { - // TODO implement me - return nil, errors.New("not implemented") + return request, nil } func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, requestBody io.Reader) (any, error) {