@nanahoshi/mona-ui 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat/package.json +4 -0
- package/docs/api/chat.json +1 -0
- package/docs/api/chat.md +212 -0
- package/docs/api/i18n.json +1 -1
- package/docs/api/i18n.md +34 -0
- package/docs/api/index.json +1 -1
- package/docs/api/locales.json +1 -1
- package/docs/api/locales.md +14 -14
- package/docs/chat.md +480 -0
- package/docs/manifest.json +1 -1
- package/fesm2022/nanahoshi-mona-ui-chat.mjs +1230 -0
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +37 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +19 -0
- package/i18n/catalogs/en-US.messages.json +19 -0
- package/llms.txt +6 -1
- package/locales/ar-sa/ar-sa.messages.json +19 -0
- package/locales/de-de/de-de.messages.json +19 -0
- package/locales/es-es/es-es.messages.json +19 -0
- package/locales/fr-fr/fr-fr.messages.json +19 -0
- package/locales/id-id/id-id.messages.json +19 -0
- package/locales/it-it/it-it.messages.json +19 -0
- package/locales/ja-jp/ja-jp.messages.json +19 -0
- package/locales/ko-kr/ko-kr.messages.json +19 -0
- package/locales/pl-pl/pl-pl.messages.json +19 -0
- package/locales/pt-br/pt-br.messages.json +19 -0
- package/locales/ru-ru/ru-ru.messages.json +19 -0
- package/locales/tr-tr/tr-tr.messages.json +19 -0
- package/locales/zh-cn/zh-cn.messages.json +19 -0
- package/locales/zh-tw/zh-tw.messages.json +19 -0
- package/package.json +5 -1
- package/types/nanahoshi-mona-ui-chat.d.ts +424 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +43 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +19 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"links":{"CHAT_DEFAULT_MESSAGES":"chat","ChatAttachment":"chat","ChatAttachmentTemplateContext":"chat","ChatAttachmentTemplateDirective":"chat","ChatComponent":"chat","ChatEmptyTemplateDirective":"chat","ChatMessage":"chat","ChatMessageStatus":"chat","ChatMessageTemplateContext":"chat","ChatMessageTemplateDirective":"chat","ChatSendEvent":"chat","ChatUser":"chat","MonaChatMessages":"i18n"},"name":"chat","pages":[{"path":"chat","title":"Chat"}],"symbols":[{"description":"A conversation: its messages, by day, with the user's at the end and others' at the start beside their avatar, and a\nmessage box below them. Enter sends a message, Shift+Enter starts a new line, and files can go with it. The chat\nemits what the user sends through `send`, and shows what you give it in `messages`, so add the message there.\n\nIt keeps to the newest message while the user is reading there, and offers a button to the new ones when they've\nscrolled up. Messages from others are announced as they arrive, and a reply that streams in once it's done. While\none streams, the Send button stops it. Suggested replies sit above the message box, and who's typing below the\nmessages.","kind":"component","name":"ChatComponent","selector":"mona-chat","inputs":[{"defaultValue":"\"\"","description":"The file types the file picker offers, as its `accept` attribute takes them, such as\n`\"image/*,.pdf\"`. Every type when empty.","name":"accept","type":"string"},{"defaultValue":"false","description":"Shows a button that attaches files to the message, through the file picker. The files go out with\nthe message in `send`; upload them, and give the message its `attachments`.","name":"allowFiles","type":"boolean"},{"alias":"aria-label","defaultValue":"\"\"","description":"The chat's name, such as \"Support chat\", which names its list of messages. \"Messages\" when empty.","name":"ariaLabel","type":"string"},{"alias":"class","defaultValue":"\"\"","description":"Additional CSS classes merged onto the host element via `tailwind-merge`, such as a height: the chat\nis 32rem tall by default.","name":"userClass","type":"string"},{"defaultValue":"false","description":"Disables the message box, its buttons and the suggested replies, such as while the chat is offline.\nThe messages can still be read and scrolled.","name":"disabled","type":"boolean"},{"defaultValue":"\"\"","description":"The text in the message box. Bind it two-way, `[(draft)]`, to keep a draft per conversation, or to\ntell others the user is typing.","name":"draft","twoWay":true,"type":"string"},{"defaultValue":"[]","description":"The messages, oldest first. Give each an `id`, so one replaced with a copy, as a reply streaming in\nis, stays the same message.","name":"messages","type":"Iterable<ChatMessage>"},{"defaultValue":"\"\"","description":"The message box's placeholder. \"Type a message\" in the locale when empty.","name":"placeholder","type":"string"},{"defaultValue":"[]","description":"Replies the user can send with a press, shown above the message box while no reply is streaming\nin. Pressing one emits `send` with its text.","name":"suggestions","type":"readonly string[]"},{"defaultValue":"{ hour: \"numeric\", minute: \"2-digit\" }","description":"How the time under each run of messages is formatted, in the locale.","name":"timeFormat","type":"Intl.DateTimeFormatOptions"},{"defaultValue":"[]","description":"The people typing, shown below the messages: \"Ana is typing\", or how many for more than three.","name":"typing","type":"readonly ChatUser[]"},{"description":"The user: messages whose author has their `id` are theirs, shown at the end without a name.","name":"user","required":true,"type":"ChatUser"}],"methods":[{"description":"Moves focus to the message box.","name":"focus","signature":"focus(): void"}],"outputs":[{"description":"Emitted with a message of the user's that couldn't be sent, when they press its Retry button. Send\nit again, and set its `status`.","name":"retry","type":"ChatMessage"},{"description":"Emitted with what the user sends: a message's text, trimmed, and its files, or a suggested reply\nthey press. Add the message to `messages` to show it.","name":"send","type":"ChatSendEvent"},{"description":"Emitted when the user presses Stop while a reply streams in. Stop it, and set its `streaming` to\n`false`.","name":"stop","type":"void"}],"properties":[],"page":{"path":"chat","title":"Chat"}},{"description":"Template for each file sent with a message, in place of its picture, name and size, such as a preview of a document.\nThe file is the template's implicit value (`let-attachment`), with its message (`let-message=\"message\"`) and whether\nthat's the user's own (`let-mine=\"mine\"`).","kind":"directive","name":"ChatAttachmentTemplateDirective","selector":"ng-template[monaChatAttachmentTemplate]","templateContext":{"members":[{"description":"The file (`let-attachment`).","name":"$implicit","type":"ChatAttachment"},{"description":"The message it was sent with (`let-message=\"message\"`).","name":"message","type":"ChatMessage"},{"description":"Whether it's on the user's own message (`let-mine=\"mine\"`).","name":"mine","type":"boolean"}],"type":"ChatAttachmentTemplateContext"},"inputs":[],"methods":[],"outputs":[],"properties":[],"page":{"path":"chat","title":"Chat"}},{"description":"Template for a chat with no messages, in place of \"No messages yet\", such as a greeting from an assistant. It sits in\nthe middle of the messages' space; the suggested replies stay below it.","kind":"directive","name":"ChatEmptyTemplateDirective","selector":"ng-template[monaChatEmptyTemplate]","inputs":[],"methods":[],"outputs":[],"properties":[],"page":{"path":"chat","title":"Chat"}},{"description":"Template for each message's content, inside its bubble, in place of its text, such as text rendered from Markdown.\nThe message is the template's implicit value (`let-message`), with whether it's the user's own (`let-mine=\"mine\"`).\nThe files sent with it, its status and the caret of a message that's streaming stay where they are.","kind":"directive","name":"ChatMessageTemplateDirective","selector":"ng-template[monaChatMessageTemplate]","templateContext":{"members":[{"description":"The message (`let-message`).","name":"$implicit","type":"ChatMessage"},{"description":"Whether it's the user's own message (`let-mine=\"mine\"`).","name":"mine","type":"boolean"}],"type":"ChatMessageTemplateContext"},"inputs":[],"methods":[],"outputs":[],"properties":[],"page":{"path":"chat","title":"Chat"}},{"description":"","kind":"constant","name":"CHAT_DEFAULT_MESSAGES","signature":"const CHAT_DEFAULT_MESSAGES: MonaChatMessages;","page":{"path":"chat","title":"Chat"}},{"description":"A file sent with a message.","extends":[],"kind":"interface","methods":[],"name":"ChatAttachment","properties":[{"description":"The file's name.","name":"name","readonly":true,"type":"string"},{"description":"The file's size in bytes, shown after its name.","name":"size","optional":true,"readonly":true,"type":"number"},{"description":"The file's media type, such as `\"image/png\"`. An image with a `url` shows as a picture.","name":"type","optional":true,"readonly":true,"type":"string"},{"description":"Where to get the file. With it, the file's name is a link to it.","name":"url","optional":true,"readonly":true,"type":"string"}],"page":{"path":"chat","title":"Chat"},"usedBy":["ChatAttachmentTemplateContext","ChatAttachmentTemplateDirective","ChatMessage"]},{"description":"The context of a `monaChatAttachmentTemplate`: the file, as `let-attachment`.","extends":[],"kind":"interface","methods":[],"name":"ChatAttachmentTemplateContext","properties":[{"description":"The file (`let-attachment`).","name":"$implicit","readonly":true,"type":"ChatAttachment"},{"description":"The message it was sent with (`let-message=\"message\"`).","name":"message","readonly":true,"type":"ChatMessage"},{"description":"Whether it's on the user's own message (`let-mine=\"mine\"`).","name":"mine","readonly":true,"type":"boolean"}],"page":{"path":"chat","title":"Chat"}},{"description":"A message in a chat.","extends":[],"kind":"interface","methods":[],"name":"ChatMessage","properties":[{"description":"Files sent with the message, listed under its text.","name":"attachments","optional":true,"readonly":true,"type":"readonly ChatAttachment[]"},{"description":"Who sent it. A message whose author has the user's `id` is the user's own.","name":"author","readonly":true,"type":"ChatUser"},{"description":"What identifies the message, so one that's replaced with a copy, as a reply streaming in is, stays the same\nmessage: it keeps its place, and is announced once. Without it, a message is its own identity.","name":"id","optional":true,"readonly":true,"type":"unknown"},{"description":"Where a message of the user's stands. A message without one has been sent.","name":"status","optional":true,"readonly":true,"type":"ChatMessageStatus"},{"description":"Whether the message's text is still coming in, as a reply from an assistant streams. It shows a caret at the end,\nand is announced when it's done. While a message streams, the Send button stops it.","name":"streaming","optional":true,"readonly":true,"type":"boolean"},{"description":"What it says. Line breaks show as written.","name":"text","optional":true,"readonly":true,"type":"string"},{"description":"When it was sent, shown under the last message of a run and used to put the day above the first.","name":"timestamp","optional":true,"readonly":true,"type":"Date"}],"page":{"path":"chat","title":"Chat"},"usedBy":["ChatAttachmentTemplateContext","ChatAttachmentTemplateDirective","ChatComponent","ChatMessageTemplateContext","ChatMessageTemplateDirective"]},{"description":"The context of a `monaChatMessageTemplate`: the message, as `let-message`.","extends":[],"kind":"interface","methods":[],"name":"ChatMessageTemplateContext","properties":[{"description":"The message (`let-message`).","name":"$implicit","readonly":true,"type":"ChatMessage"},{"description":"Whether it's the user's own message (`let-mine=\"mine\"`).","name":"mine","readonly":true,"type":"boolean"}],"page":{"path":"chat","title":"Chat"}},{"description":"What the user sends: their message's text, trimmed, and the files they attached to it.","extends":[],"kind":"interface","methods":[],"name":"ChatSendEvent","properties":[{"description":"The files attached to the message, in the order they were picked.","name":"files","readonly":true,"type":"readonly File[]"},{"description":"The message's text, trimmed. It's empty for a message of files alone.","name":"text","readonly":true,"type":"string"}],"page":{"path":"chat","title":"Chat"},"usedBy":["ChatComponent"]},{"description":"Someone taking part in a chat: the user, or someone they're talking to, a person or an assistant.","extends":[],"kind":"interface","methods":[],"name":"ChatUser","properties":[{"description":"A picture of them, shown beside their messages. Without one, their initials are.","name":"avatarUrl","optional":true,"readonly":true,"type":"string"},{"description":"What tells them apart: two messages whose authors have the same `id` are from the same person.","name":"id","readonly":true,"type":"unknown"},{"description":"Their name, shown above their messages and read with each one.","name":"name","readonly":true,"type":"string"}],"page":{"path":"chat","title":"Chat"},"usedBy":["ChatComponent","ChatMessage"]},{"description":"Where a message of the user's stands: `\"sending\"`, shown faded with \"Sending\" under it, `\"sent\"`, or `\"failed\"`,\nwith \"Not sent\" and a Retry button under it.","kind":"type","name":"ChatMessageStatus","signature":"type ChatMessageStatus = \"failed\" | \"sending\" | \"sent\";","page":{"path":"chat","title":"Chat"},"usedBy":["ChatMessage"]}]}
|
package/docs/api/chat.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# `@nanahoshi/mona-ui/chat`
|
|
2
|
+
|
|
3
|
+
Everything `@nanahoshi/mona-ui/chat` exports.
|
|
4
|
+
|
|
5
|
+
**Guides:** [Chat](../chat.md)
|
|
6
|
+
|
|
7
|
+
## `ChatComponent`
|
|
8
|
+
|
|
9
|
+
Component.
|
|
10
|
+
|
|
11
|
+
A conversation: its messages, by day, with the user's at the end and others' at the start beside their avatar, and a
|
|
12
|
+
message box below them. Enter sends a message, Shift+Enter starts a new line, and files can go with it. The chat
|
|
13
|
+
emits what the user sends through `send`, and shows what you give it in `messages`, so add the message there.
|
|
14
|
+
|
|
15
|
+
It keeps to the newest message while the user is reading there, and offers a button to the new ones when they've
|
|
16
|
+
scrolled up. Messages from others are announced as they arrive, and a reply that streams in once it's done. While
|
|
17
|
+
one streams, the Send button stops it. Suggested replies sit above the message box, and who's typing below the
|
|
18
|
+
messages.
|
|
19
|
+
|
|
20
|
+
**Selector:** `mona-chat`
|
|
21
|
+
|
|
22
|
+
### Inputs
|
|
23
|
+
|
|
24
|
+
| Name | Type | Default | Description |
|
|
25
|
+
| --- | --- | --- | --- |
|
|
26
|
+
| `accept` | `string` | `""` | The file types the file picker offers, as its `accept` attribute takes them, such as `"image/*,.pdf"`. Every type when empty. |
|
|
27
|
+
| `allowFiles` | `boolean` | `false` | Shows a button that attaches files to the message, through the file picker. The files go out with the message in `send`; upload them, and give the message its `attachments`. |
|
|
28
|
+
| `aria-label` | `string` | `""` | The chat's name, such as "Support chat", which names its list of messages. "Messages" when empty. |
|
|
29
|
+
| `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`, such as a height: the chat is 32rem tall by default. |
|
|
30
|
+
| `disabled` | `boolean` | `false` | Disables the message box, its buttons and the suggested replies, such as while the chat is offline. The messages can still be read and scrolled. |
|
|
31
|
+
| `draft` (two-way) | `string` | `""` | The text in the message box. Bind it two-way, `[(draft)]`, to keep a draft per conversation, or to tell others the user is typing. |
|
|
32
|
+
| `messages` | `Iterable<ChatMessage>` | `[]` | The messages, oldest first. Give each an `id`, so one replaced with a copy, as a reply streaming in is, stays the same message. |
|
|
33
|
+
| `placeholder` | `string` | `""` | The message box's placeholder. "Type a message" in the locale when empty. |
|
|
34
|
+
| `suggestions` | `readonly string[]` | `[]` | Replies the user can send with a press, shown above the message box while no reply is streaming in. Pressing one emits `send` with its text. |
|
|
35
|
+
| `timeFormat` | `Intl.DateTimeFormatOptions` | `{ hour: "numeric", minute: "2-digit" }` | How the time under each run of messages is formatted, in the locale. |
|
|
36
|
+
| `typing` | `readonly ChatUser[]` | `[]` | The people typing, shown below the messages: "Ana is typing", or how many for more than three. |
|
|
37
|
+
| `user` (required) | `ChatUser` | — | The user: messages whose author has their `id` are theirs, shown at the end without a name. |
|
|
38
|
+
|
|
39
|
+
### Outputs
|
|
40
|
+
|
|
41
|
+
| Name | Type | Description |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| `draftChange` | `string` | Emitted when `draft` changes. |
|
|
44
|
+
| `retry` | `ChatMessage` | Emitted with a message of the user's that couldn't be sent, when they press its Retry button. Send it again, and set its `status`. |
|
|
45
|
+
| `send` | `ChatSendEvent` | Emitted with what the user sends: a message's text, trimmed, and its files, or a suggested reply they press. Add the message to `messages` to show it. |
|
|
46
|
+
| `stop` | `void` | Emitted when the user presses Stop while a reply streams in. Stop it, and set its `streaming` to `false`. |
|
|
47
|
+
|
|
48
|
+
### Methods
|
|
49
|
+
|
|
50
|
+
| Signature | Description |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `focus(): void` | Moves focus to the message box. |
|
|
53
|
+
|
|
54
|
+
## `ChatAttachmentTemplateDirective`
|
|
55
|
+
|
|
56
|
+
Directive.
|
|
57
|
+
|
|
58
|
+
Template for each file sent with a message, in place of its picture, name and size, such as a preview of a document.
|
|
59
|
+
The file is the template's implicit value (`let-attachment`), with its message (`let-message="message"`) and whether
|
|
60
|
+
that's the user's own (`let-mine="mine"`).
|
|
61
|
+
|
|
62
|
+
**Selector:** `ng-template[monaChatAttachmentTemplate]`
|
|
63
|
+
|
|
64
|
+
### Template context
|
|
65
|
+
|
|
66
|
+
| Name | Type | Description |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| `$implicit` | `ChatAttachment` | The file (`let-attachment`). |
|
|
69
|
+
| `message` | `ChatMessage` | The message it was sent with (`let-message="message"`). |
|
|
70
|
+
| `mine` | `boolean` | Whether it's on the user's own message (`let-mine="mine"`). |
|
|
71
|
+
|
|
72
|
+
## `ChatEmptyTemplateDirective`
|
|
73
|
+
|
|
74
|
+
Directive.
|
|
75
|
+
|
|
76
|
+
Template for a chat with no messages, in place of "No messages yet", such as a greeting from an assistant. It sits in
|
|
77
|
+
the middle of the messages' space; the suggested replies stay below it.
|
|
78
|
+
|
|
79
|
+
**Selector:** `ng-template[monaChatEmptyTemplate]`
|
|
80
|
+
|
|
81
|
+
## `ChatMessageTemplateDirective`
|
|
82
|
+
|
|
83
|
+
Directive.
|
|
84
|
+
|
|
85
|
+
Template for each message's content, inside its bubble, in place of its text, such as text rendered from Markdown.
|
|
86
|
+
The message is the template's implicit value (`let-message`), with whether it's the user's own (`let-mine="mine"`).
|
|
87
|
+
The files sent with it, its status and the caret of a message that's streaming stay where they are.
|
|
88
|
+
|
|
89
|
+
**Selector:** `ng-template[monaChatMessageTemplate]`
|
|
90
|
+
|
|
91
|
+
### Template context
|
|
92
|
+
|
|
93
|
+
| Name | Type | Description |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `$implicit` | `ChatMessage` | The message (`let-message`). |
|
|
96
|
+
| `mine` | `boolean` | Whether it's the user's own message (`let-mine="mine"`). |
|
|
97
|
+
|
|
98
|
+
## `CHAT_DEFAULT_MESSAGES`
|
|
99
|
+
|
|
100
|
+
Constant.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const CHAT_DEFAULT_MESSAGES: MonaChatMessages;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## `ChatAttachment`
|
|
107
|
+
|
|
108
|
+
Interface.
|
|
109
|
+
|
|
110
|
+
A file sent with a message.
|
|
111
|
+
|
|
112
|
+
### Properties
|
|
113
|
+
|
|
114
|
+
| Name | Type | Description |
|
|
115
|
+
| --- | --- | --- |
|
|
116
|
+
| `name` (read-only) | `string` | The file's name. |
|
|
117
|
+
| `size?` (read-only) | `number` | The file's size in bytes, shown after its name. |
|
|
118
|
+
| `type?` (read-only) | `string` | The file's media type, such as `"image/png"`. An image with a `url` shows as a picture. |
|
|
119
|
+
| `url?` (read-only) | `string` | Where to get the file. With it, the file's name is a link to it. |
|
|
120
|
+
|
|
121
|
+
**Used by:** [`ChatAttachmentTemplateContext`](chat.md#chatattachmenttemplatecontext), [`ChatAttachmentTemplateDirective`](chat.md#chatattachmenttemplatedirective), [`ChatMessage`](chat.md#chatmessage)
|
|
122
|
+
|
|
123
|
+
## `ChatAttachmentTemplateContext`
|
|
124
|
+
|
|
125
|
+
Interface.
|
|
126
|
+
|
|
127
|
+
The context of a `monaChatAttachmentTemplate`: the file, as `let-attachment`.
|
|
128
|
+
|
|
129
|
+
### Properties
|
|
130
|
+
|
|
131
|
+
| Name | Type | Description |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| `$implicit` (read-only) | `ChatAttachment` | The file (`let-attachment`). |
|
|
134
|
+
| `message` (read-only) | `ChatMessage` | The message it was sent with (`let-message="message"`). |
|
|
135
|
+
| `mine` (read-only) | `boolean` | Whether it's on the user's own message (`let-mine="mine"`). |
|
|
136
|
+
|
|
137
|
+
## `ChatMessage`
|
|
138
|
+
|
|
139
|
+
Interface.
|
|
140
|
+
|
|
141
|
+
A message in a chat.
|
|
142
|
+
|
|
143
|
+
### Properties
|
|
144
|
+
|
|
145
|
+
| Name | Type | Description |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `attachments?` (read-only) | `readonly ChatAttachment[]` | Files sent with the message, listed under its text. |
|
|
148
|
+
| `author` (read-only) | `ChatUser` | Who sent it. A message whose author has the user's `id` is the user's own. |
|
|
149
|
+
| `id?` (read-only) | `unknown` | What identifies the message, so one that's replaced with a copy, as a reply streaming in is, stays the same message: it keeps its place, and is announced once. Without it, a message is its own identity. |
|
|
150
|
+
| `status?` (read-only) | `ChatMessageStatus` | Where a message of the user's stands. A message without one has been sent. |
|
|
151
|
+
| `streaming?` (read-only) | `boolean` | Whether the message's text is still coming in, as a reply from an assistant streams. It shows a caret at the end, and is announced when it's done. While a message streams, the Send button stops it. |
|
|
152
|
+
| `text?` (read-only) | `string` | What it says. Line breaks show as written. |
|
|
153
|
+
| `timestamp?` (read-only) | `Date` | When it was sent, shown under the last message of a run and used to put the day above the first. |
|
|
154
|
+
|
|
155
|
+
**Used by:** [`ChatAttachmentTemplateContext`](chat.md#chatattachmenttemplatecontext), [`ChatAttachmentTemplateDirective`](chat.md#chatattachmenttemplatedirective), [`ChatComponent`](chat.md#chatcomponent), [`ChatMessageTemplateContext`](chat.md#chatmessagetemplatecontext), [`ChatMessageTemplateDirective`](chat.md#chatmessagetemplatedirective)
|
|
156
|
+
|
|
157
|
+
## `ChatMessageTemplateContext`
|
|
158
|
+
|
|
159
|
+
Interface.
|
|
160
|
+
|
|
161
|
+
The context of a `monaChatMessageTemplate`: the message, as `let-message`.
|
|
162
|
+
|
|
163
|
+
### Properties
|
|
164
|
+
|
|
165
|
+
| Name | Type | Description |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `$implicit` (read-only) | `ChatMessage` | The message (`let-message`). |
|
|
168
|
+
| `mine` (read-only) | `boolean` | Whether it's the user's own message (`let-mine="mine"`). |
|
|
169
|
+
|
|
170
|
+
## `ChatSendEvent`
|
|
171
|
+
|
|
172
|
+
Interface.
|
|
173
|
+
|
|
174
|
+
What the user sends: their message's text, trimmed, and the files they attached to it.
|
|
175
|
+
|
|
176
|
+
### Properties
|
|
177
|
+
|
|
178
|
+
| Name | Type | Description |
|
|
179
|
+
| --- | --- | --- |
|
|
180
|
+
| `files` (read-only) | `readonly File[]` | The files attached to the message, in the order they were picked. |
|
|
181
|
+
| `text` (read-only) | `string` | The message's text, trimmed. It's empty for a message of files alone. |
|
|
182
|
+
|
|
183
|
+
**Used by:** [`ChatComponent`](chat.md#chatcomponent)
|
|
184
|
+
|
|
185
|
+
## `ChatUser`
|
|
186
|
+
|
|
187
|
+
Interface.
|
|
188
|
+
|
|
189
|
+
Someone taking part in a chat: the user, or someone they're talking to, a person or an assistant.
|
|
190
|
+
|
|
191
|
+
### Properties
|
|
192
|
+
|
|
193
|
+
| Name | Type | Description |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `avatarUrl?` (read-only) | `string` | A picture of them, shown beside their messages. Without one, their initials are. |
|
|
196
|
+
| `id` (read-only) | `unknown` | What tells them apart: two messages whose authors have the same `id` are from the same person. |
|
|
197
|
+
| `name` (read-only) | `string` | Their name, shown above their messages and read with each one. |
|
|
198
|
+
|
|
199
|
+
**Used by:** [`ChatComponent`](chat.md#chatcomponent), [`ChatMessage`](chat.md#chatmessage)
|
|
200
|
+
|
|
201
|
+
## `ChatMessageStatus`
|
|
202
|
+
|
|
203
|
+
Type alias.
|
|
204
|
+
|
|
205
|
+
Where a message of the user's stands: `"sending"`, shown faded with "Sending" under it, `"sent"`, or `"failed"`,
|
|
206
|
+
with "Not sent" and a Retry button under it.
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
type ChatMessageStatus = "failed" | "sending" | "sent";
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Used by:** [`ChatMessage`](chat.md#chatmessage)
|