lastUserInputFromMessages
function lastUserInputFromMessages(messages): UserContent | null;Map the last user turn in a CF UIMessage[] to runtime UserInputContent.
Text parts → TextPart; file parts (images / documents / audio uploaded via the
CF chat client) → FilePart carrying the part’s URL, so multimodal input reaches
the model instead of being dropped. A text-only turn collapses to a plain string.
Returns null when the last user turn carries no usable content.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”UserContent | null