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
3db78818
authored
Jul 30, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'RedwindA-fix/gemini-native-sse' into alpha
parents
28ededaf
1bb8a314
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
2 deletions
+4
-2
relay/channel/api_request.go
+1
-1
relay/channel/gemini/adaptor.go
+1
-0
relay/common/relay_info.go
+1
-0
relay/helper/stream_scanner.go
+1
-1
No files found.
relay/channel/api_request.go
View file @
3db78818
...
...
@@ -223,7 +223,7 @@ func doRequest(c *gin.Context, req *http.Request, info *common.RelayInfo) (*http
helper
.
SetEventStreamHeaders
(
c
)
// 处理流式请求的 ping 保活
generalSettings
:=
operation_setting
.
GetGeneralSetting
()
if
generalSettings
.
PingIntervalEnabled
{
if
generalSettings
.
PingIntervalEnabled
&&
!
info
.
DisablePing
{
pingInterval
:=
time
.
Duration
(
generalSettings
.
PingIntervalSeconds
)
*
time
.
Second
stopPinger
=
startPingKeepAlive
(
c
,
pingInterval
)
// 使用defer确保在任何情况下都能停止ping goroutine
...
...
relay/channel/gemini/adaptor.go
View file @
3db78818
...
...
@@ -173,6 +173,7 @@ 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
)
{
if
info
.
RelayMode
==
constant
.
RelayModeGemini
{
if
info
.
IsStream
{
info
.
DisablePing
=
true
return
GeminiTextGenerationStreamHandler
(
c
,
info
,
resp
)
}
else
{
return
GeminiTextGenerationHandler
(
c
,
info
,
resp
)
...
...
relay/common/relay_info.go
View file @
3db78818
...
...
@@ -88,6 +88,7 @@ type RelayInfo struct {
BaseUrl
string
SupportStreamOptions
bool
ShouldIncludeUsage
bool
DisablePing
bool
// 是否禁止向下游发送自定义 Ping
IsModelMapped
bool
ClientWs
*
websocket
.
Conn
TargetWs
*
websocket
.
Conn
...
...
relay/helper/stream_scanner.go
View file @
3db78818
...
...
@@ -54,7 +54,7 @@ func StreamScannerHandler(c *gin.Context, resp *http.Response, info *relaycommon
)
generalSettings
:=
operation_setting
.
GetGeneralSetting
()
pingEnabled
:=
generalSettings
.
PingIntervalEnabled
pingEnabled
:=
generalSettings
.
PingIntervalEnabled
&&
!
info
.
DisablePing
pingInterval
:=
time
.
Duration
(
generalSettings
.
PingIntervalSeconds
)
*
time
.
Second
if
pingInterval
<=
0
{
pingInterval
=
DefaultPingInterval
...
...
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