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
76753cea
authored
Aug 07, 2025
by
IcedTangerine
Committed by
GitHub
Aug 07, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1519 from feitianbubu/pr/fix-qwen3-thinking-test
feat: enable thinking mode on ali thinking model
parents
c4666934
ea7fd987
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
controller/channel-test.go
+1
-1
relay/channel/ali/adaptor.go
+9
-3
relay/common/relay_info.go
+3
-0
No files found.
controller/channel-test.go
View file @
76753cea
...
...
@@ -275,7 +275,7 @@ func testChannel(channel *model.Channel, testModel string) testResult {
Quota
:
quota
,
Content
:
"模型测试"
,
UseTimeSeconds
:
int
(
consumedTime
),
IsStream
:
false
,
IsStream
:
info
.
IsStream
,
Group
:
info
.
UsingGroup
,
Other
:
other
,
})
...
...
relay/channel/ali/adaptor.go
View file @
76753cea
...
...
@@ -3,6 +3,7 @@ package ali
import
(
"errors"
"fmt"
"github.com/gin-gonic/gin"
"io"
"net/http"
"one-api/dto"
...
...
@@ -11,8 +12,7 @@ import (
relaycommon
"one-api/relay/common"
"one-api/relay/constant"
"one-api/types"
"github.com/gin-gonic/gin"
"strings"
)
type
Adaptor
struct
{
...
...
@@ -65,7 +65,13 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
if
request
==
nil
{
return
nil
,
errors
.
New
(
"request is nil"
)
}
// docs: https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=2712216
// fix: InternalError.Algo.InvalidParameter: The value of the enable_thinking parameter is restricted to True.
if
strings
.
Contains
(
request
.
Model
,
"thinking"
)
{
request
.
EnableThinking
=
true
request
.
Stream
=
true
info
.
IsStream
=
true
}
// fix: ali parameter.enable_thinking must be set to false for non-streaming calls
if
!
info
.
IsStream
{
request
.
EnableThinking
=
false
...
...
relay/common/relay_info.go
View file @
76753cea
...
...
@@ -225,6 +225,9 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
userId
:=
common
.
GetContextKeyInt
(
c
,
constant
.
ContextKeyUserId
)
tokenUnlimited
:=
common
.
GetContextKeyBool
(
c
,
constant
.
ContextKeyTokenUnlimited
)
startTime
:=
common
.
GetContextKeyTime
(
c
,
constant
.
ContextKeyRequestStartTime
)
if
startTime
.
IsZero
()
{
startTime
=
time
.
Now
()
}
// firstResponseTime = time.Now() - 1 second
apiType
,
_
:=
common
.
ChannelType2APIType
(
channelType
)
...
...
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