Constructors
constructor
- new ChatMessage(params): ChatMessage
Parameters
- params: {
content: string | ChatContent[];
createdAt?: number;
id?: string;
interrupted?: boolean;
role: ChatRole;
}Optional
createdAt?: number
Optional
id?: string
Optional
interrupted?: boolean
Properties
createdAt
createdAt: number
Optional
hash
hash?: Uint8Array
interrupted
interrupted: boolean
Readonly
type
type: "message" = ...
Accessors
textContent
- get textContent(): undefined | string
Returns undefined | string
Methods
toJSON
- toJSON(excludeTimestamp?): JSONValue
Parameters
- excludeTimestamp: boolean = false
Returns JSONValue
toJSONContent
- toJSONContent(): JSONValue[]
Returns JSONValue[]
Static
create
- create(params): ChatMessage
Parameters
- params: {
content: string | ChatContent[];
createdAt?: number;
id?: string;
interrupted?: boolean;
role: ChatRole;
}Optional
createdAt?: number
Optional
id?: string
Optional
interrupted?: boolean
Returns a single string with all text parts of the message joined by new lines. If no string content is present, returns
null
.