• Stefy Lanza (nextime / spora )'s avatar
    text: stop flattening image content to a placeholder (fixes vision over the API) · 361cba6d
    Stefy Lanza (nextime / spora ) authored
    ChatMessage.convert_content_array_to_string ran at parse time (mode=before) and
    unconditionally joined any multipart content list into a string, replacing each
    image_url part with the literal text "[image_url content]". That destroyed the
    image before text.py's vision pipeline (_vision_ok / _normalize_vision_content,
    which the backend's mmproj/MTMDChatHandler consume) ever saw it — so a vision
    model (e.g. lisa = Gemma-4 + mmproj) received only text and answered "no image
    attached", and agents looped retrying. text.py's end-to-end vision handling was
    effectively dead code because content was always pre-stringified.
    
    Now flatten only TEXT-ONLY multipart arrays (the KiloCode case); preserve the
    list whenever it carries an image_url (or any non-text part) so the multimodal
    backend receives the image. Non-vision models still degrade to the placeholder
    downstream (text.py:1439), and text-only/plain-string paths are unchanged.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
    361cba6d
textrequest.py 7.56 KB