openai: tweak v1/responses to conform better (#13736)

* openai: tweak v1/responses to conform better

* openai: provide better error for image URLs

* lint
This commit is contained in:
Devon Rifkin
2026-01-15 15:46:36 -08:00
committed by GitHub
parent 80f3f1bc25
commit 38eac40d56
4 changed files with 335 additions and 78 deletions

View File

@@ -630,6 +630,10 @@ func nameFromToolCallID(messages []Message, toolCallID string) string {
// decodeImageURL decodes a base64 data URI into raw image bytes.
func decodeImageURL(url string) (api.ImageData, error) {
if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
return nil, errors.New("image URLs are not currently supported, please use base64 encoded data instead")
}
types := []string{"jpeg", "jpg", "png", "webp"}
// Support blank mime type to match /api/chat's behavior of taking just unadorned base64