Class ChatMessage
One message in a conversation, as data. Not a VisualElement — hand a sequence of these to messages and it builds the tree.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class ChatMessage
Remarks
A message carries either plain content or a list of parts. When parts is set it wins, and content is ignored.
Fields
attachments
Labels of the files the message was sent with. Shown as chips inside a user bubble.
Declaration
public IEnumerable<string> attachments
Field Value
| Type | Description |
|---|---|
| IEnumerable<string> |
content
The message's plain text, used when parts is null.
Declaration
public string content
Field Value
| Type | Description |
|---|---|
| string |
contextItems
Labels of the context entries the message was sent with. Shown as chips inside a user bubble.
Declaration
public IEnumerable<string> contextItems
Field Value
| Type | Description |
|---|---|
| IEnumerable<string> |
createdAt
When the backend recorded the message. Two of these bracket a turn, which is where the elapsed-to-answer figure comes from when durationMs is absent.
Declaration
public DateTime? createdAt
Field Value
| Type | Description |
|---|---|
| DateTime? |
durationMs
How long the answer took, in milliseconds, as reported by the backend. This always wins over the gap derived from createdAt.
Declaration
public int durationMs
Field Value
| Type | Description |
|---|---|
| int |
id
Stable identifier. Used to decide which message is streaming.
Declaration
public string id
Field Value
| Type | Description |
|---|---|
| string |
parts
The message's pieces. Null for a plain-text message.
Declaration
public IEnumerable<ChatMessagePart> parts
Field Value
| Type | Description |
|---|---|
| IEnumerable<ChatMessagePart> |
role
Who authored the message.
Declaration
public ChatRole role
Field Value
| Type | Description |
|---|---|
| ChatRole |
unknownDuration
The value a duration takes when it was never measured. Kept out of every elapsed display.
Declaration
public const int unknownDuration = -1
Field Value
| Type | Description |
|---|---|
| int |