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
f0b024eb
authored
Aug 02, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: enhance ConvertGeminiRequest to set default role and handle YouTube video MIME type
parent
adc69404
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
relay/channel/gemini/adaptor.go
+16
-0
relay/channel/vertex/adaptor.go
+2
-1
No files found.
relay/channel/gemini/adaptor.go
View file @
f0b024eb
...
...
@@ -21,6 +21,22 @@ type Adaptor struct {
}
func
(
a
*
Adaptor
)
ConvertGeminiRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
*
dto
.
GeminiChatRequest
)
(
any
,
error
)
{
if
len
(
request
.
Contents
)
>
0
{
for
i
,
content
:=
range
request
.
Contents
{
if
i
==
0
{
if
request
.
Contents
[
0
]
.
Role
==
""
{
request
.
Contents
[
0
]
.
Role
=
"user"
}
}
for
_
,
part
:=
range
content
.
Parts
{
if
part
.
FileData
!=
nil
{
if
part
.
FileData
.
MimeType
==
""
&&
strings
.
Contains
(
part
.
FileData
.
FileUri
,
"www.youtube.com"
)
{
part
.
FileData
.
MimeType
=
"video/webm"
}
}
}
}
}
return
request
,
nil
}
...
...
relay/channel/vertex/adaptor.go
View file @
f0b024eb
...
...
@@ -45,7 +45,8 @@ type Adaptor struct {
}
func
(
a
*
Adaptor
)
ConvertGeminiRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
*
dto
.
GeminiChatRequest
)
(
any
,
error
)
{
return
request
,
nil
geminiAdaptor
:=
gemini
.
Adaptor
{}
return
geminiAdaptor
.
ConvertGeminiRequest
(
c
,
info
,
request
)
}
func
(
a
*
Adaptor
)
ConvertClaudeRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
*
dto
.
ClaudeRequest
)
(
any
,
error
)
{
...
...
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