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
497fdba3
authored
Sep 11, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化 ImageRequest 的 JSON 序列化,避免覆盖合并 ExtraFields
parent
451076fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
dto/openai_image.go
+5
-3
No files found.
dto/openai_image.go
View file @
497fdba3
...
...
@@ -64,19 +64,21 @@ func (r ImageRequest) MarshalJSON() ([]byte, error) {
// 将已定义字段转为 map
type
Alias
ImageRequest
alias
:=
Alias
(
r
)
base
,
err
:=
js
on
.
Marshal
(
alias
)
base
,
err
:=
comm
on
.
Marshal
(
alias
)
if
err
!=
nil
{
return
nil
,
err
}
var
baseMap
map
[
string
]
json
.
RawMessage
if
err
:=
js
on
.
Unmarshal
(
base
,
&
baseMap
);
err
!=
nil
{
if
err
:=
comm
on
.
Unmarshal
(
base
,
&
baseMap
);
err
!=
nil
{
return
nil
,
err
}
// 合并 ExtraFields
for
k
,
v
:=
range
r
.
Extra
{
baseMap
[
k
]
=
v
if
_
,
exists
:=
baseMap
[
k
];
!
exists
{
baseMap
[
k
]
=
v
}
}
return
json
.
Marshal
(
baseMap
)
...
...
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