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
23c1bd47
authored
Sep 27, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: gemini urlContext
parent
e6525eea
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 @
23c1bd47
...
@@ -251,6 +251,7 @@ type GeminiChatTool struct {
...
@@ -251,6 +251,7 @@ type GeminiChatTool struct {
GoogleSearchRetrieval
any
`json:"googleSearchRetrieval,omitempty"`
GoogleSearchRetrieval
any
`json:"googleSearchRetrieval,omitempty"`
CodeExecution
any
`json:"codeExecution,omitempty"`
CodeExecution
any
`json:"codeExecution,omitempty"`
FunctionDeclarations
any
`json:"functionDeclarations,omitempty"`
FunctionDeclarations
any
`json:"functionDeclarations,omitempty"`
URLContext
any
`json:"urlContext,omitempty"`
}
}
type
GeminiChatGenerationConfig
struct
{
type
GeminiChatGenerationConfig
struct
{
...
...
relay/channel/gemini/relay-gemini.go
View file @
23c1bd47
...
@@ -245,6 +245,7 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
...
@@ -245,6 +245,7 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
functions
:=
make
([]
dto
.
FunctionRequest
,
0
,
len
(
textRequest
.
Tools
))
functions
:=
make
([]
dto
.
FunctionRequest
,
0
,
len
(
textRequest
.
Tools
))
googleSearch
:=
false
googleSearch
:=
false
codeExecution
:=
false
codeExecution
:=
false
urlContext
:=
false
for
_
,
tool
:=
range
textRequest
.
Tools
{
for
_
,
tool
:=
range
textRequest
.
Tools
{
if
tool
.
Function
.
Name
==
"googleSearch"
{
if
tool
.
Function
.
Name
==
"googleSearch"
{
googleSearch
=
true
googleSearch
=
true
...
@@ -254,6 +255,10 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
...
@@ -254,6 +255,10 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
codeExecution
=
true
codeExecution
=
true
continue
continue
}
}
if
tool
.
Function
.
Name
==
"urlContext"
{
urlContext
=
true
continue
}
if
tool
.
Function
.
Parameters
!=
nil
{
if
tool
.
Function
.
Parameters
!=
nil
{
params
,
ok
:=
tool
.
Function
.
Parameters
.
(
map
[
string
]
interface
{})
params
,
ok
:=
tool
.
Function
.
Parameters
.
(
map
[
string
]
interface
{})
...
@@ -281,6 +286,11 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
...
@@ -281,6 +286,11 @@ func CovertGemini2OpenAI(c *gin.Context, textRequest dto.GeneralOpenAIRequest, i
GoogleSearch
:
make
(
map
[
string
]
string
),
GoogleSearch
:
make
(
map
[
string
]
string
),
})
})
}
}
if
urlContext
{
geminiTools
=
append
(
geminiTools
,
dto
.
GeminiChatTool
{
URLContext
:
make
(
map
[
string
]
string
),
})
}
if
len
(
functions
)
>
0
{
if
len
(
functions
)
>
0
{
geminiTools
=
append
(
geminiTools
,
dto
.
GeminiChatTool
{
geminiTools
=
append
(
geminiTools
,
dto
.
GeminiChatTool
{
FunctionDeclarations
:
functions
,
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