mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-04 00:03:59 +00:00
fix: CORE_REGISTER_TOOL fallback to raw string on unmarshal error
Previously the wrapper silently ignored json.Unmarshal errors and returned nil, causing tools returning raw JSON strings (via C ABI bridge's json.Marshal) to appear as empty map[] to the agent.
This commit is contained in:
@ -279,7 +279,9 @@ func go_core_dispatch(methodID C.int, ctx unsafe.Pointer, s1, s2, s3 *C.char, i1
|
|||||||
if err != nil { return nil, err }
|
if err != nil { return nil, err }
|
||||||
if r == "" { return nil, nil }
|
if r == "" { return nil, nil }
|
||||||
var res map[string]interface{}
|
var res map[string]interface{}
|
||||||
json.Unmarshal([]byte(r), &res)
|
if err := json.Unmarshal([]byte(r), &res); err != nil {
|
||||||
|
return r, nil
|
||||||
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
})
|
})
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user