fix(translator): simplify tool response handling and adjust JSON schema updates in Gemini modules

This commit is contained in:
Luis Pater
2025-11-05 22:48:50 +08:00
parent a318dff8b0
commit 2a73d8c4a3
6 changed files with 10 additions and 22 deletions

View File

@@ -143,17 +143,11 @@ func ConvertOpenAIResponsesRequestToGemini(modelName string, inputRawJSON []byte
}
functionResponse, _ = sjson.Set(functionResponse, "functionResponse.name", functionName)
// Also set response.name to align with docs/convert-2.md
functionResponse, _ = sjson.Set(functionResponse, "functionResponse.response.name", functionName)
// Parse output JSON string and set as response content
if output != "" {
outputResult := gjson.Parse(output)
if outputResult.IsObject() {
functionResponse, _ = sjson.SetRaw(functionResponse, "functionResponse.response.content", outputResult.String())
} else {
functionResponse, _ = sjson.Set(functionResponse, "functionResponse.response.content", output)
}
functionResponse, _ = sjson.Set(functionResponse, "functionResponse.response.result", outputResult.Raw)
}
functionContent, _ = sjson.SetRaw(functionContent, "parts.-1", functionResponse)