mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 04:10:51 +08:00
Merge pull request #1422 from dannycreations/feat-gemini-cli-claude-mime
feat(gemini-cli): support image content in Claude request conversion
This commit is contained in:
@@ -116,6 +116,19 @@ func ConvertClaudeRequestToCLI(modelName string, inputRawJSON []byte, _ bool) []
|
|||||||
part, _ = sjson.Set(part, "functionResponse.name", funcName)
|
part, _ = sjson.Set(part, "functionResponse.name", funcName)
|
||||||
part, _ = sjson.Set(part, "functionResponse.response.result", responseData)
|
part, _ = sjson.Set(part, "functionResponse.response.result", responseData)
|
||||||
contentJSON, _ = sjson.SetRaw(contentJSON, "parts.-1", part)
|
contentJSON, _ = sjson.SetRaw(contentJSON, "parts.-1", part)
|
||||||
|
|
||||||
|
case "image":
|
||||||
|
source := contentResult.Get("source")
|
||||||
|
if source.Get("type").String() == "base64" {
|
||||||
|
mimeType := source.Get("media_type").String()
|
||||||
|
data := source.Get("data").String()
|
||||||
|
if mimeType != "" && data != "" {
|
||||||
|
part := `{"inlineData":{"mime_type":"","data":""}}`
|
||||||
|
part, _ = sjson.Set(part, "inlineData.mime_type", mimeType)
|
||||||
|
part, _ = sjson.Set(part, "inlineData.data", data)
|
||||||
|
contentJSON, _ = sjson.SetRaw(contentJSON, "parts.-1", part)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user