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
7cec111b
authored
Mar 06, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: error NotifyRootUser #812
parent
c4ca4af8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
relay/helper/stream_scanner.go
+3
-0
service/channel.go
+2
-2
No files found.
relay/helper/stream_scanner.go
View file @
7cec111b
...
@@ -15,10 +15,13 @@ import (
...
@@ -15,10 +15,13 @@ import (
)
)
func
StreamScannerHandler
(
c
*
gin
.
Context
,
resp
*
http
.
Response
,
info
*
relaycommon
.
RelayInfo
,
dataHandler
func
(
data
string
)
bool
)
{
func
StreamScannerHandler
(
c
*
gin
.
Context
,
resp
*
http
.
Response
,
info
*
relaycommon
.
RelayInfo
,
dataHandler
func
(
data
string
)
bool
)
{
if
resp
==
nil
{
if
resp
==
nil
{
return
return
}
}
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
streamingTimeout
:=
time
.
Duration
(
constant
.
StreamingTimeout
)
*
time
.
Second
streamingTimeout
:=
time
.
Duration
(
constant
.
StreamingTimeout
)
*
time
.
Second
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"o1"
)
||
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"o3"
)
{
if
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"o1"
)
||
strings
.
HasPrefix
(
info
.
UpstreamModelName
,
"o3"
)
{
// twice timeout for thinking model
// twice timeout for thinking model
...
...
service/channel.go
View file @
7cec111b
...
@@ -15,14 +15,14 @@ func DisableChannel(channelId int, channelName string, reason string) {
...
@@ -15,14 +15,14 @@ func DisableChannel(channelId int, channelName string, reason string) {
model
.
UpdateChannelStatusById
(
channelId
,
common
.
ChannelStatusAutoDisabled
,
reason
)
model
.
UpdateChannelStatusById
(
channelId
,
common
.
ChannelStatusAutoDisabled
,
reason
)
subject
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被禁用"
,
channelName
,
channelId
)
subject
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被禁用"
,
channelName
,
channelId
)
content
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被禁用,原因:%s"
,
channelName
,
channelId
,
reason
)
content
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被禁用,原因:%s"
,
channelName
,
channelId
,
reason
)
NotifyRootUser
(
subject
,
content
,
dto
.
NotifyTypeChannelUpdate
)
NotifyRootUser
(
dto
.
NotifyTypeChannelUpdate
,
subject
,
content
)
}
}
func
EnableChannel
(
channelId
int
,
channelName
string
)
{
func
EnableChannel
(
channelId
int
,
channelName
string
)
{
model
.
UpdateChannelStatusById
(
channelId
,
common
.
ChannelStatusEnabled
,
""
)
model
.
UpdateChannelStatusById
(
channelId
,
common
.
ChannelStatusEnabled
,
""
)
subject
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被启用"
,
channelName
,
channelId
)
subject
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被启用"
,
channelName
,
channelId
)
content
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被启用"
,
channelName
,
channelId
)
content
:=
fmt
.
Sprintf
(
"通道「%s」(#%d)已被启用"
,
channelName
,
channelId
)
NotifyRootUser
(
subject
,
content
,
dto
.
NotifyTypeChannelUpdate
)
NotifyRootUser
(
dto
.
NotifyTypeChannelUpdate
,
subject
,
content
)
}
}
func
ShouldDisableChannel
(
channelType
int
,
err
*
dto
.
OpenAIErrorWithStatusCode
)
bool
{
func
ShouldDisableChannel
(
channelType
int
,
err
*
dto
.
OpenAIErrorWithStatusCode
)
bool
{
...
...
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