feat(providers): add vision/image support to CodexProvider
Add multipart content support for messages with Media attachments in CodexProvider (OAuth). This enables vision-capable models like gpt-5.2 to process images when using OAuth authentication. Changes: - Check for msg.Media in user messages - Build ResponseInputMessageContentListParam with text + image parts - Use ResponseInputImageParam with ImageURL and auto detail level This mirrors the existing vision support in openai_compat/provider.go and completes the vision pipeline for OAuth users (PR #1020 only updated openai_compat). Fixes: OAuth users couldn't use vision despite PR #1020 adding support
This commit is contained in:
parent
bea238c337
commit
5e393ab5bd
1 changed files with 20 additions and 0 deletions
|
|
@ -224,6 +224,26 @@ func buildCodexParams(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} else if len(msg.Media) > 0 {
|
||||||
|
// Multipart content: text + images for vision-capable models
|
||||||
|
contentParts := make(responses.ResponseInputMessageContentListParam, 0, 1+len(msg.Media))
|
||||||
|
if msg.Content != "" {
|
||||||
|
contentParts = append(contentParts, responses.ResponseInputContentParamOfInputText(msg.Content))
|
||||||
|
}
|
||||||
|
for _, mediaURL := range msg.Media {
|
||||||
|
contentParts = append(contentParts, responses.ResponseInputContentUnionParam{
|
||||||
|
OfInputImage: &responses.ResponseInputImageParam{
|
||||||
|
ImageURL: openai.Opt(mediaURL),
|
||||||
|
Detail: responses.ResponseInputImageDetailAuto,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
inputItems = append(inputItems, responses.ResponseInputItemUnionParam{
|
||||||
|
OfMessage: &responses.EasyInputMessageParam{
|
||||||
|
Role: responses.EasyInputMessageRoleUser,
|
||||||
|
Content: responses.EasyInputMessageContentUnionParam{OfInputItemContentList: contentParts},
|
||||||
|
},
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
inputItems = append(inputItems, responses.ResponseInputItemUnionParam{
|
inputItems = append(inputItems, responses.ResponseInputItemUnionParam{
|
||||||
OfMessage: &responses.EasyInputMessageParam{
|
OfMessage: &responses.EasyInputMessageParam{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue