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
2ba55243
authored
Sep 27, 2025
by
Seefs
Committed by
GitHub
Sep 27, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1888 from seefs001/feature/gemini-urlcontext
feat: gemini urlContext
parents
8482b794
23c1bd47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
dto/gemini.go
+1
-0
relay/channel/gemini/relay-gemini.go
+10
-0
No files found.
dto/gemini.go
View file @
2ba55243
...
...
@@ -251,6 +251,7 @@ type GeminiChatTool struct {
GoogleSearchRetrieval
any
`json:"googleSearchRetrieval,omitempty"`
CodeExecution
any
`json:"codeExecution,omitempty"`
FunctionDeclarations
any
`json:"functionDeclarations,omitempty"`
URLContext
any
`json:"urlContext,omitempty"`
}
type
GeminiChatGenerationConfig
struct
{
...
...
relay/channel/gemini/relay-gemini.go
View file @
2ba55243
...
...
@@ -245,6 +245,7 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
functions
:=
make
([]
dto
.
FunctionRequest
,
0
,
len
(
textRequest
.
Tools
))
googleSearch
:=
false
codeExecution
:=
false
urlContext
:=
false
for
_
,
tool
:=
range
textRequest
.
Tools
{
if
tool
.
Function
.
Name
==
"googleSearch"
{
googleSearch
=
true
...
...
@@ -254,6 +255,10 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
codeExecution
=
true
continue
}
if
tool
.
Function
.
Name
==
"urlContext"
{
urlContext
=
true
continue
}
if
tool
.
Function
.
Parameters
!=
nil
{
params
,
ok
:=
tool
.
Function
.
Parameters
.
(
map
[
string
]
interface
{})
...
...
@@ -281,6 +286,11 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
GoogleSearch
:
make
(
map
[
string
]
string
),
})
}
if
urlContext
{
geminiTools
=
append
(
geminiTools
,
dto
.
GeminiChatTool
{
URLContext
:
make
(
map
[
string
]
string
),
})
}
if
len
(
functions
)
>
0
{
geminiTools
=
append
(
geminiTools
,
dto
.
GeminiChatTool
{
FunctionDeclarations
:
functions
,
...
...
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