mirror of
https://github.com/githubhjs/CLIProxyAPIPlus.git
synced 2026-07-11 17:15:52 +00:00
Fix Kiro tool schema defaults
This commit is contained in:
@@ -314,7 +314,7 @@ func ConvertOpenAIToolsToKiroFormat(tools []map[string]interface{}) []KiroToolWr
|
|||||||
|
|
||||||
name := kirocommon.GetString(fn, "name")
|
name := kirocommon.GetString(fn, "name")
|
||||||
description := kirocommon.GetString(fn, "description")
|
description := kirocommon.GetString(fn, "description")
|
||||||
parameters := fn["parameters"]
|
parameters := ensureKiroInputSchema(fn["parameters"])
|
||||||
|
|
||||||
if name == "" {
|
if name == "" {
|
||||||
continue
|
continue
|
||||||
@@ -368,4 +368,4 @@ func ConvertClaudeToolUseToOpenAI(toolUseID, toolName string, input map[string]i
|
|||||||
// LogStreamEvent logs a streaming event for debugging
|
// LogStreamEvent logs a streaming event for debugging
|
||||||
func LogStreamEvent(eventType, data string) {
|
func LogStreamEvent(eventType, data string) {
|
||||||
log.Debugf("kiro-openai: stream event type=%s, data_len=%d", eventType, len(data))
|
log.Debugf("kiro-openai: stream event type=%s, data_len=%d", eventType, len(data))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -381,6 +381,16 @@ func shortenToolNameIfNeeded(name string) string {
|
|||||||
return name[:limit]
|
return name[:limit]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ensureKiroInputSchema(parameters interface{}) interface{} {
|
||||||
|
if parameters != nil {
|
||||||
|
return parameters
|
||||||
|
}
|
||||||
|
return map[string]interface{}{
|
||||||
|
"type": "object",
|
||||||
|
"properties": map[string]interface{}{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// convertOpenAIToolsToKiro converts OpenAI tools to Kiro format
|
// convertOpenAIToolsToKiro converts OpenAI tools to Kiro format
|
||||||
func convertOpenAIToolsToKiro(tools gjson.Result) []KiroToolWrapper {
|
func convertOpenAIToolsToKiro(tools gjson.Result) []KiroToolWrapper {
|
||||||
var kiroTools []KiroToolWrapper
|
var kiroTools []KiroToolWrapper
|
||||||
@@ -401,7 +411,12 @@ func convertOpenAIToolsToKiro(tools gjson.Result) []KiroToolWrapper {
|
|||||||
|
|
||||||
name := fn.Get("name").String()
|
name := fn.Get("name").String()
|
||||||
description := fn.Get("description").String()
|
description := fn.Get("description").String()
|
||||||
parameters := fn.Get("parameters").Value()
|
parametersResult := fn.Get("parameters")
|
||||||
|
var parameters interface{}
|
||||||
|
if parametersResult.Exists() && parametersResult.Type != gjson.Null {
|
||||||
|
parameters = parametersResult.Value()
|
||||||
|
}
|
||||||
|
parameters = ensureKiroInputSchema(parameters)
|
||||||
|
|
||||||
// Shorten tool name if it exceeds 64 characters (common with MCP tools)
|
// Shorten tool name if it exceeds 64 characters (common with MCP tools)
|
||||||
originalName := name
|
originalName := name
|
||||||
|
|||||||
Reference in New Issue
Block a user