Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1d32327d
authored
Oct 10, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pplx channel
parent
3cc60f22
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
10 deletions
+28
-10
dto/openai_request.go
+6
-0
relay/channel/perplexity/adaptor.go
+5
-9
relay/channel/perplexity/constants.go
+1
-0
relay/channel/perplexity/relay-perplexity.go
+7
-0
web/src/components/table/channels/modals/EditChannelModal.jsx
+1
-1
web/src/constants/channel.constants.js
+5
-0
web/src/helpers/render.jsx
+3
-0
No files found.
dto/openai_request.go
View file @
1d32327d
...
@@ -87,6 +87,12 @@ type GeneralOpenAIRequest struct {
...
@@ -87,6 +87,12 @@ type GeneralOpenAIRequest struct {
WebSearch
json
.
RawMessage
`json:"web_search,omitempty"`
WebSearch
json
.
RawMessage
`json:"web_search,omitempty"`
// doubao,zhipu_v4
// doubao,zhipu_v4
THINKING
json
.
RawMessage
`json:"thinking,omitempty"`
THINKING
json
.
RawMessage
`json:"thinking,omitempty"`
// pplx Params
SearchDomainFilter
json
.
RawMessage
`json:"search_domain_filter,omitempty"`
SearchRecencyFilter
string
`json:"search_recency_filter,omitempty"`
ReturnImages
bool
`json:"return_images,omitempty"`
ReturnRelatedQuestions
bool
`json:"return_related_questions,omitempty"`
SearchMode
string
`json:"search_mode,omitempty"`
}
}
func
(
r
*
GeneralOpenAIRequest
)
GetTokenCountMeta
()
*
types
.
TokenCountMeta
{
func
(
r
*
GeneralOpenAIRequest
)
GetTokenCountMeta
()
*
types
.
TokenCountMeta
{
...
...
relay/channel/perplexity/adaptor.go
View file @
1d32327d
...
@@ -22,10 +22,9 @@ func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dt
...
@@ -22,10 +22,9 @@ func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dt
return
nil
,
errors
.
New
(
"not implemented"
)
return
nil
,
errors
.
New
(
"not implemented"
)
}
}
func
(
a
*
Adaptor
)
ConvertClaudeRequest
(
*
gin
.
Context
,
*
relaycommon
.
RelayInfo
,
*
dto
.
ClaudeRequest
)
(
any
,
error
)
{
func
(
a
*
Adaptor
)
ConvertClaudeRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
req
*
dto
.
ClaudeRequest
)
(
any
,
error
)
{
//TODO implement me
adaptor
:=
openai
.
Adaptor
{}
panic
(
"implement me"
)
return
adaptor
.
ConvertClaudeRequest
(
c
,
info
,
req
)
return
nil
,
nil
}
}
func
(
a
*
Adaptor
)
ConvertAudioRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
dto
.
AudioRequest
)
(
io
.
Reader
,
error
)
{
func
(
a
*
Adaptor
)
ConvertAudioRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
dto
.
AudioRequest
)
(
io
.
Reader
,
error
)
{
...
@@ -80,11 +79,8 @@ func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, request
...
@@ -80,11 +79,8 @@ func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, request
}
}
func
(
a
*
Adaptor
)
DoResponse
(
c
*
gin
.
Context
,
resp
*
http
.
Response
,
info
*
relaycommon
.
RelayInfo
)
(
usage
any
,
err
*
types
.
NewAPIError
)
{
func
(
a
*
Adaptor
)
DoResponse
(
c
*
gin
.
Context
,
resp
*
http
.
Response
,
info
*
relaycommon
.
RelayInfo
)
(
usage
any
,
err
*
types
.
NewAPIError
)
{
if
info
.
IsStream
{
adaptor
:=
openai
.
Adaptor
{}
usage
,
err
=
openai
.
OaiStreamHandler
(
c
,
info
,
resp
)
usage
,
err
=
adaptor
.
DoResponse
(
c
,
resp
,
info
)
}
else
{
usage
,
err
=
openai
.
OpenaiHandler
(
c
,
info
,
resp
)
}
return
return
}
}
...
...
relay/channel/perplexity/constants.go
View file @
1d32327d
...
@@ -2,6 +2,7 @@ package perplexity
...
@@ -2,6 +2,7 @@ package perplexity
var
ModelList
=
[]
string
{
var
ModelList
=
[]
string
{
"llama-3-sonar-small-32k-chat"
,
"llama-3-sonar-small-32k-online"
,
"llama-3-sonar-large-32k-chat"
,
"llama-3-sonar-large-32k-online"
,
"llama-3-8b-instruct"
,
"llama-3-70b-instruct"
,
"mixtral-8x7b-instruct"
,
"llama-3-sonar-small-32k-chat"
,
"llama-3-sonar-small-32k-online"
,
"llama-3-sonar-large-32k-chat"
,
"llama-3-sonar-large-32k-online"
,
"llama-3-8b-instruct"
,
"llama-3-70b-instruct"
,
"mixtral-8x7b-instruct"
,
"sonar"
,
"sonar-pro"
,
"sonar-reasoning"
,
}
}
var
ChannelName
=
"perplexity"
var
ChannelName
=
"perplexity"
relay/channel/perplexity/relay-perplexity.go
View file @
1d32327d
...
@@ -17,5 +17,12 @@ func requestOpenAI2Perplexity(request dto.GeneralOpenAIRequest) *dto.GeneralOpen
...
@@ -17,5 +17,12 @@ func requestOpenAI2Perplexity(request dto.GeneralOpenAIRequest) *dto.GeneralOpen
Temperature
:
request
.
Temperature
,
Temperature
:
request
.
Temperature
,
TopP
:
request
.
TopP
,
TopP
:
request
.
TopP
,
MaxTokens
:
request
.
GetMaxTokens
(),
MaxTokens
:
request
.
GetMaxTokens
(),
FrequencyPenalty
:
request
.
FrequencyPenalty
,
PresencePenalty
:
request
.
PresencePenalty
,
SearchDomainFilter
:
request
.
SearchDomainFilter
,
SearchRecencyFilter
:
request
.
SearchRecencyFilter
,
ReturnImages
:
request
.
ReturnImages
,
ReturnRelatedQuestions
:
request
.
ReturnRelatedQuestions
,
SearchMode
:
request
.
SearchMode
,
}
}
}
}
web/src/components/table/channels/modals/EditChannelModal.jsx
View file @
1d32327d
...
@@ -91,7 +91,7 @@ const REGION_EXAMPLE = {
...
@@ -91,7 +91,7 @@ const REGION_EXAMPLE = {
// 支持并且已适配通过接口获取模型列表的渠道类型
// 支持并且已适配通过接口获取模型列表的渠道类型
const
MODEL_FETCHABLE_TYPES
=
new
Set
([
const
MODEL_FETCHABLE_TYPES
=
new
Set
([
1
,
4
,
14
,
34
,
17
,
26
,
24
,
47
,
25
,
20
,
23
,
31
,
35
,
40
,
42
,
48
,
43
,
1
,
4
,
14
,
34
,
17
,
26
,
2
7
,
2
4
,
47
,
25
,
20
,
23
,
31
,
35
,
40
,
42
,
48
,
43
,
]);
]);
function
type2secretPrompt
(
type
)
{
function
type2secretPrompt
(
type
)
{
...
...
web/src/constants/channel.constants.js
View file @
1d32327d
...
@@ -89,6 +89,11 @@ export const CHANNEL_OPTIONS = [
...
@@ -89,6 +89,11 @@ export const CHANNEL_OPTIONS = [
label
:
'智谱 GLM-4V'
,
label
:
'智谱 GLM-4V'
,
},
},
{
{
value
:
27
,
color
:
'blue'
,
label
:
'Perplexity'
,
},
{
value
:
24
,
value
:
24
,
color
:
'orange'
,
color
:
'orange'
,
label
:
'Google Gemini'
,
label
:
'Google Gemini'
,
...
...
web/src/helpers/render.jsx
View file @
1d32327d
...
@@ -54,6 +54,7 @@ import {
...
@@ -54,6 +54,7 @@ import {
FastGPT
,
FastGPT
,
Kling
,
Kling
,
Jimeng
,
Jimeng
,
Perplexity
,
}
from
'@lobehub/icons'
;
}
from
'@lobehub/icons'
;
import
{
import
{
...
@@ -309,6 +310,8 @@ export function getChannelIcon(channelType) {
...
@@ -309,6 +310,8 @@ export function getChannelIcon(channelType) {
return
<
Xinference
.
Color
size=
{
iconSize
}
/>;
return
<
Xinference
.
Color
size=
{
iconSize
}
/>;
case
25
:
// Moonshot
case
25
:
// Moonshot
return
<
Moonshot
size=
{
iconSize
}
/>;
return
<
Moonshot
size=
{
iconSize
}
/>;
case
27
:
// Perplexity
return
<
Perplexity
.
Color
size=
{
iconSize
}
/>;
case
20
:
// OpenRouter
case
20
:
// OpenRouter
return
<
OpenRouter
size=
{
iconSize
}
/>;
return
<
OpenRouter
size=
{
iconSize
}
/>;
case
19
:
// 360 智脑
case
19
:
// 360 智脑
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment