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
69598b84
authored
Oct 18, 2025
by
Seefs
Committed by
GitHub
Oct 18, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2061 from QuantumNous/fix-gemini-batch-embedding-token-count
fix: gemini batch embedding token not counted
parents
616a0261
400014d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
+12
-1
relay/helper/valid_request.go
+12
-1
No files found.
relay/helper/valid_request.go
View file @
69598b84
...
...
@@ -22,8 +22,10 @@ func GetAndValidateRequest(c *gin.Context, format types.RelayFormat) (request dt
case
types
.
RelayFormatOpenAI
:
request
,
err
=
GetAndValidateTextRequest
(
c
,
relayMode
)
case
types
.
RelayFormatGemini
:
if
strings
.
Contains
(
c
.
Request
.
URL
.
Path
,
":embedContent"
)
||
strings
.
Contains
(
c
.
Request
.
URL
.
Path
,
":batchEmbedContents"
)
{
if
strings
.
Contains
(
c
.
Request
.
URL
.
Path
,
":embedContent"
)
{
request
,
err
=
GetAndValidateGeminiEmbeddingRequest
(
c
)
}
else
if
strings
.
Contains
(
c
.
Request
.
URL
.
Path
,
":batchEmbedContents"
)
{
request
,
err
=
GetAndValidateGeminiBatchEmbeddingRequest
(
c
)
}
else
{
request
,
err
=
GetAndValidateGeminiRequest
(
c
)
}
...
...
@@ -319,3 +321,12 @@ func GetAndValidateGeminiEmbeddingRequest(c *gin.Context) (*dto.GeminiEmbeddingR
}
return
request
,
nil
}
func
GetAndValidateGeminiBatchEmbeddingRequest
(
c
*
gin
.
Context
)
(
*
dto
.
GeminiBatchEmbeddingRequest
,
error
)
{
request
:=
&
dto
.
GeminiBatchEmbeddingRequest
{}
err
:=
common
.
UnmarshalBodyReusable
(
c
,
request
)
if
err
!=
nil
{
return
nil
,
err
}
return
request
,
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