Skip to content

@sqlrooms/ai / createBlockContextItem

Function: createBlockContextItem()

createBlockContextItem(fields): object

Create and validate a block-scoped AI run context item.

The returned item is parsed through BlockAiRunContextItemSchema so omitted optional fields are normalized consistently with stored chat context.

Parameters

ParameterType
fields{ id: string; blockDocumentId: string; blockId: string; blockType: string; blockInstanceId?: string; panelId?: string; title: string; subtitle?: string; }
fields.idstring
fields.blockDocumentIdstring
fields.blockIdstring
fields.blockTypestring
fields.blockInstanceId?string
fields.panelId?string
fields.titlestring
fields.subtitle?string

Returns

object

NameType
idstring
titlestring
type?string
subtitle?string
kind"block"
blockDocumentIdstring
blockIdstring
blockTypestring
blockInstanceId?string
panelId?string