Docs
Code Rabbit
Cloudflare
AG Grid
Netlify
Neon
WorkOS
Clerk
Convex
Electric
Sentry
Prisma
Strapi
Unkey
UI.dev
Code Rabbit
Cloudflare
AG Grid
Netlify
Neon
WorkOS
Clerk
Convex
Electric
Sentry
Prisma
Strapi
Unkey
UI.dev
Class References
Function References
Interface References
Type Alias References
Variable References
Function References

normalizeToUIMessage

Function: normalizeToUIMessage()

ts
function normalizeToUIMessage(message, generateId): UIMessage;
function normalizeToUIMessage(message, generateId): UIMessage;

Defined in: activities/chat/messages.ts:257

Normalize a message (UIMessage or ModelMessage) to a UIMessage Ensures the message has an ID and createdAt timestamp

Parameters

message

Either a UIMessage or ModelMessage

UIMessage | ModelMessage< | string | ContentPart<unknown, unknown, unknown, unknown, unknown>[] | null>

generateId

() => string

Function to generate a message ID if needed

Returns

UIMessage

A UIMessage with guaranteed id and createdAt