mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-06-01 03:10:36 +08:00
refactor: simplify inputMap initialization logic
Apply code review feedback from gemini-code-assist: - Initialize inputMap upfront instead of using nested if blocks - Combine Exists() and IsObject() checks into single condition - Remove redundant nil check
This commit is contained in:
@@ -670,18 +670,12 @@ func buildAssistantMessageFromOpenAI(msg gjson.Result) KiroAssistantResponseMess
|
||||
toolName := part.Get("name").String()
|
||||
inputData := part.Get("input")
|
||||
|
||||
var inputMap map[string]interface{}
|
||||
if inputData.Exists() {
|
||||
if inputData.IsObject() {
|
||||
inputMap = make(map[string]interface{})
|
||||
inputData.ForEach(func(key, value gjson.Result) bool {
|
||||
inputMap[key.String()] = value.Value()
|
||||
return true
|
||||
})
|
||||
}
|
||||
}
|
||||
if inputMap == nil {
|
||||
inputMap = make(map[string]interface{})
|
||||
inputMap := make(map[string]interface{})
|
||||
if inputData.Exists() && inputData.IsObject() {
|
||||
inputData.ForEach(func(key, value gjson.Result) bool {
|
||||
inputMap[key.String()] = value.Value()
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
toolUses = append(toolUses, KiroToolUse{
|
||||
|
||||
Reference in New Issue
Block a user