Function: serializeMessages()
serializeMessages(
messages):string
Defined in: react/src/utils/serialize-messages.ts:21
Serialize chat messages to a string format for useBaleybot
Converts messages to "USER: ..." or "ASSISTANT: ..." format, filtering to only user and assistant messages.
Parameters
messages
Array of chat messages to serialize
Returns
string
Serialized string representation of the conversation
Example
const serialized = serializeMessages([
{ role: 'user', content: 'Hello' },
{ role: 'assistant', content: 'Hi there!' }
]);
// Returns: "USER: Hello\nASSISTANT: Hi there!"