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
24739afb
authored
Jul 15, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: openai response time
parent
917c1690
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
relay/channel/openai/relay-openai.go
+1
-0
relay/common/relay_info.go
+8
-0
No files found.
relay/channel/openai/relay-openai.go
View file @
24739afb
...
...
@@ -40,6 +40,7 @@ func OpenaiStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.
go
func
()
{
for
scanner
.
Scan
()
{
info
.
SetFirstResponseTime
()
ticker
.
Reset
(
time
.
Duration
(
constant
.
StreamingTimeout
)
*
time
.
Second
)
data
:=
scanner
.
Text
()
if
len
(
data
)
<
6
{
// ignore blank line or wrong format
...
...
relay/common/relay_info.go
View file @
24739afb
...
...
@@ -17,6 +17,7 @@ type RelayInfo struct {
TokenUnlimited
bool
StartTime
time
.
Time
FirstResponseTime
time
.
Time
setFirstResponse
bool
ApiType
int
IsStream
bool
RelayMode
int
...
...
@@ -83,6 +84,13 @@ func (info *RelayInfo) SetIsStream(isStream bool) {
info
.
IsStream
=
isStream
}
func
(
info
*
RelayInfo
)
SetFirstResponseTime
()
{
if
!
info
.
setFirstResponse
{
info
.
FirstResponseTime
=
time
.
Now
()
info
.
setFirstResponse
=
true
}
}
type
TaskRelayInfo
struct
{
ChannelType
int
ChannelId
int
...
...
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