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
837f5556
authored
Sep 11, 2025
by
huanghejian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: improve nova config
parent
b10ed4b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletions
+34
-1
relay/channel/aws/dto.go
+34
-1
No files found.
relay/channel/aws/dto.go
View file @
837f5556
...
...
@@ -75,7 +75,7 @@ func convertToNovaRequest(req *dto.GeneralOpenAIRequest) *NovaRequest {
}
// 设置推理配置
if
req
.
MaxTokens
!=
0
||
(
req
.
Temperature
!=
nil
&&
*
req
.
Temperature
!=
0
)
||
req
.
TopP
!=
0
{
if
req
.
MaxTokens
!=
0
||
(
req
.
Temperature
!=
nil
&&
*
req
.
Temperature
!=
0
)
||
req
.
TopP
!=
0
||
req
.
TopK
!=
0
||
req
.
Stop
!=
nil
{
novaReq
.
InferenceConfig
=
&
NovaInferenceConfig
{}
if
req
.
MaxTokens
!=
0
{
novaReq
.
InferenceConfig
.
MaxTokens
=
int
(
req
.
MaxTokens
)
...
...
@@ -86,7 +86,40 @@ func convertToNovaRequest(req *dto.GeneralOpenAIRequest) *NovaRequest {
if
req
.
TopP
!=
0
{
novaReq
.
InferenceConfig
.
TopP
=
req
.
TopP
}
if
req
.
TopK
!=
0
{
novaReq
.
InferenceConfig
.
TopK
=
req
.
TopK
}
if
req
.
Stop
!=
nil
{
if
stopSequences
:=
parseStopSequences
(
req
.
Stop
);
len
(
stopSequences
)
>
0
{
novaReq
.
InferenceConfig
.
StopSequences
=
stopSequences
}
}
}
return
novaReq
}
// parseStopSequences 解析停止序列,支持字符串或字符串数组
func
parseStopSequences
(
stop
any
)
[]
string
{
if
stop
==
nil
{
return
nil
}
switch
v
:=
stop
.
(
type
)
{
case
string
:
if
v
!=
""
{
return
[]
string
{
v
}
}
case
[]
string
:
return
v
case
[]
interface
{}
:
var
sequences
[]
string
for
_
,
item
:=
range
v
{
if
str
,
ok
:=
item
.
(
string
);
ok
&&
str
!=
""
{
sequences
=
append
(
sequences
,
str
)
}
}
return
sequences
}
return
nil
}
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