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
3401abe4
authored
Aug 27, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(relay-gemini): update media handling in candidate content processing
parent
61f2aa54
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
relay/channel/gemini/relay-gemini.go
+10
-1
No files found.
relay/channel/gemini/relay-gemini.go
View file @
3401abe4
...
...
@@ -749,7 +749,16 @@ func responseGeminiChat2OpenAI(c *gin.Context, response *dto.GeminiChatResponse)
var
texts
[]
string
var
toolCalls
[]
dto
.
ToolCallResponse
for
_
,
part
:=
range
candidate
.
Content
.
Parts
{
if
part
.
FunctionCall
!=
nil
{
if
part
.
InlineData
!=
nil
{
// 媒体内容
if
strings
.
HasPrefix
(
part
.
InlineData
.
MimeType
,
"image"
)
{
imgText
:=
""
texts
=
append
(
texts
,
imgText
)
}
else
{
// 其他媒体类型,直接显示链接
texts
=
append
(
texts
,
fmt
.
Sprintf
(
"[media](data:%s;base64,%s)"
,
part
.
InlineData
.
MimeType
,
part
.
InlineData
.
Data
))
}
}
else
if
part
.
FunctionCall
!=
nil
{
choice
.
FinishReason
=
constant
.
FinishReasonToolCalls
if
call
:=
getResponseToolCall
(
&
part
);
call
!=
nil
{
toolCalls
=
append
(
toolCalls
,
*
call
)
...
...
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