Commit 7b5d4067 by CaIon

refactor(openai_image): replace json.Marshal with common.Marshal for improved serialization #1961

parent b89f9296
...@@ -74,14 +74,15 @@ func (r ImageRequest) MarshalJSON() ([]byte, error) { ...@@ -74,14 +74,15 @@ func (r ImageRequest) MarshalJSON() ([]byte, error) {
return nil, err return nil, err
} }
// 不能合并ExtraFields!!!!!!!!
// 合并 ExtraFields // 合并 ExtraFields
for k, v := range r.Extra { //for k, v := range r.Extra {
if _, exists := baseMap[k]; !exists { // if _, exists := baseMap[k]; !exists {
baseMap[k] = v // baseMap[k] = v
} // }
} //}
return json.Marshal(baseMap) return common.Marshal(baseMap)
} }
func GetJSONFieldNames(t reflect.Type) map[string]struct{} { func GetJSONFieldNames(t reflect.Type) map[string]struct{} {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment