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
f2dbdbc4
authored
Aug 09, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update relay-text to conditionally include usage based on StreamOptions #696
parent
8c4f0e69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
relay/relay-text.go
+4
-6
No files found.
relay/relay-text.go
View file @
f2dbdbc4
...
...
@@ -140,10 +140,10 @@ func TextHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
returnPreConsumedQuota
(
c
,
relayInfo
,
userQuota
,
preConsumedQuota
)
}
}()
includeUsage
:=
fals
e
includeUsage
:=
tru
e
// 判断用户是否需要返回使用情况
if
textRequest
.
StreamOptions
!=
nil
&&
textRequest
.
StreamOptions
.
IncludeUsage
{
includeUsage
=
t
ru
e
if
textRequest
.
StreamOptions
!=
nil
{
includeUsage
=
t
extRequest
.
StreamOptions
.
IncludeUsag
e
}
// 如果不支持StreamOptions,将StreamOptions设置为nil
...
...
@@ -158,9 +158,7 @@ func TextHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
}
}
if
includeUsage
{
relayInfo
.
ShouldIncludeUsage
=
true
}
relayInfo
.
ShouldIncludeUsage
=
includeUsage
adaptor
:=
GetAdaptor
(
relayInfo
.
ApiType
)
if
adaptor
==
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