Skip to content

Commit 8782f8e

Browse files
authored
HLD updates for new Spright chat capabilities: welcome and disclaimer (#2799)
# Pull Request ## 🤨 Rationale We would like to unify as much of the chat implementation as practical across Angular and Blazor. These are two components that have Blazor implementations in an application codebase that we want in an Angular codebase too, so we want to introduce them to Spright: a welcome screen and a disclaimer at the bottom of the conversation. (Older Figma designs for illustration only) **Welcome** <img width="380" height="624" alt="chat-welcome-login" src="https://github.com/user-attachments/assets/c67b88eb-0afd-4996-85fa-5fa941758258" /> **Disclaimer** <img width="557" height="24" alt="chat-disclaimer" src="https://github.com/user-attachments/assets/2d44e960-4915-48a2-bdd4-eb418e57ea24" /> ## 👩‍💻 Implementation Update the chat component HLD with an implementation proposal for these components. ## 🧪 Testing N/A ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
1 parent 40ed93a commit 8782f8e

4 files changed

Lines changed: 62 additions & 7 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Spec updates for new chat components",
4+
"packageName": "@ni/spright-components",
5+
"email": "jattasNI@users.noreply.github.com",
6+
"dependentChangeType": "none"
7+
}

packages/spright-components/src/chat/specs/README.md

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This spec describes a set of components that can be used to compose a chat inter
99
- inbound
1010
- system
1111
- outbound
12+
- welcome
1213
- chat conversation: a layout component that allows slotting messages and an input
1314

1415
### Background
@@ -47,7 +48,7 @@ The message component will allow slotting arbitrary content, but any efforts to
4748

4849
The all Spright chat messages have the following slot elements.
4950

50-
1. `default` slot displays arbitrary slotted content. For example: text, rich text, buttons, images, or a spinner.
51+
1. `default` slot displays arbitrary slotted content. For example: text, rich text, buttons, images, a spinner, or welcome content.
5152

5253
The components also contains the following features:
5354

@@ -74,12 +75,22 @@ All end text buttons must meet the following criteria
7475
1. The `apperance` attribute is set to `block`
7576
1. The buttons only have text
7677

78+
##### Welcome message features
79+
80+
1. Centered horizontally within a conversation, similar to system messages
81+
1. Displays an image to brand the chat experience
82+
1. Displays client-provided title (e.g. "Welcome to Nigel™ AI") and subtitle (e.g. "Chat below to get started", "Log in to get started") text
83+
1. Allows content to be added in the default slot for purposes including:
84+
- If the user is not logged in, slot a button or anchor button to launch the external login process
85+
- If the user is logged in, slot buttons offering suggested outbound messages
86+
7787
#### Chat conversation
7888

7989
1. Lays out messages vertically based on their order.
8090
1. Displays a vertical scrollbar if there are more messages than fit in the height allocated to the conversation.
8191
1. Includes a slot to place a toolbar (and its content such as buttons or menu buttons) on top of the conversation.
8292
1. Includes a slot to place an input component below the messages.
93+
1. Includes a slot for a legal disclaimer below that.
8394
1. Only appearance of its own is to set a background color.
8495

8596
#### Chat input
@@ -111,6 +122,10 @@ These components are competing against possible implementations within applicati
111122

112123
![ ](spec-images/chat-conversation.png)
113124

125+
**Screenshot of Figma design of chat welcome message when login is visible (light mode)**
126+
127+
![ ](spec-images/chat-welcome-login.png)
128+
114129
**Screenshot of Figma design of chat input component (light mode)**
115130

116131
![ ](spec-images/chat-input.png)
@@ -119,6 +134,10 @@ These components are competing against possible implementations within applicati
119134

120135
![ ](spec-images/chat-pane.png)
121136

137+
**Screenshot of Figma design of chat disclaimer (light mode)**
138+
139+
![ ](spec-images/chat-disclaimer.png)
140+
122141
---
123142

124143
## Design
@@ -139,6 +158,10 @@ These components are competing against possible implementations within applicati
139158
<nimble-spinner></nimble-spinner>
140159
</spright-chat-message-system>
141160
<spright-chat-input slot="input></spright-chat-input>
161+
<span slot="end">
162+
<span>AI-generated content may be incorrect.</span>
163+
<a href="...">View terms and conditions</a>
164+
</span>
142165
</spright-chat-conversation>
143166
```
144167
@@ -157,6 +180,18 @@ const richText = document.querySelector('#welcome');
157180
richText.markdown = 'Welcome **Homer**, how can I help?';
158181
```
159182
183+
#### Welcome message example
184+
185+
```html
186+
<spright-chat-conversation>
187+
<spright-chat-message-welcome title="Welcome to Nigel AI" subtitle="Log in to get started">
188+
<nimble-anchor-button appearance="block" appearance-variant="primary" href="/login">
189+
Login
190+
</nimble-anchor-button>
191+
</spright-chat-message-welcome>
192+
</spright-chat-conversation>
193+
```
194+
160195
#### Prompt buttons message example
161196
162197
@@ -195,6 +230,7 @@ Message components will be created with the following names:
195230
- `spright-chat-message-inbound`
196231
- `spright-chat-message-outbound`
197232
- `spright-chat-message-system`
233+
- `spright-chat-message-welcome`
198234
199235
##### Messages common API
200236
@@ -209,10 +245,8 @@ All message types will share the following API:
209245
- A message will grow its height to fit its content, with no maximum height.
210246
- Clients could override this behavior but we don't anticipate use cases for doing so when the message is used within a conversation
211247
- _Slots_
212-
- `footer-actions`
213-
- Action buttons to display after the main content.
214248
- `end`
215-
- Buttons with text that are displayed at the bottom after any action buttons.
249+
- Buttons with text that are displayed at the bottom after any other content.
216250
- `(default)`
217251
- arbitrary content can be added to the default slot to be displayed within the message
218252
@@ -221,8 +255,15 @@ All message types will share the following API:
221255
- _Slots_
222256
- `footer-actions`
223257
- Action buttons to display after the main content.
224-
- `end`
225-
- Buttons with text that are displayed at the bottom after any action buttons.
258+
259+
##### Welcome message additional API
260+
261+
- _Props/Attrs_
262+
- `title` - string attribute for the primary welcome message
263+
- `subtitle` - string attribute for a secondary welcome message. Naming is aligned with `nimble-dialog`
264+
- _Slots_
265+
- `brand-icon` slot can be used to customize the brand image. By default it will display a new icon `spright-icon-nigel-chat` which is a theme-aware custom icon (a custom element that derives from `IconSvg`)
266+
- default slot can be used to provide content below the icon, title, and subtitle. For example, a login button or suggested outbound messages.
226267
227268
#### Conversation
228269
@@ -242,6 +283,7 @@ All message types will share the following API:
242283
- chat messages are added to the default slot. The DOM order of the messages controls their screen order within the conversation (earlier DOM order => earlier message => top of the conversation)
243284
- a single chat input can optionally be added to the `input` slot. It will be placed below the messages
244285
- a toolbar can optionally be added to the `toolbar` slot. The toolbar will be displayed above the messages. The toolbar content can be buttons or menus used for actions like starting a new conversation, copying all messages, or other conversation-level operations.
286+
- chat disclaimer content can optionally be added to the `end` slot. It will be placed below the input. The slot will apply color and font size styles to text and anchor content to match the visual design spec. See [the existing Blazor implementation](https://dev.azure.com/ni/DevCentral/_git/ASW?path=/Source/MeasurementServices/AiAssistants/Controls/Components/ChatbotViewFooter.razor) for reference.
245287
246288
#### Input
247289
@@ -309,6 +351,12 @@ A message is simply a `div` which will styled with background / border / rounded
309351
</template>
310352
```
311353
354+
##### Welcome message
355+
356+
The template will include an `svg` element to render the image. The image requires different svg contents for dark and light themes (they use different gradient parameters). The gradient content will be specified in a new design token.
357+
358+
We can use [the existing Blazor implementation](https://dev.azure.com/ni/DevCentral/_git/ASW?path=/Source/MeasurementServices/AiAssistants/Controls/Components/StartPage.razor) and [images](https://dev.azure.com/ni/DevCentral/_git/ASW?path=/Source/MeasurementServices/AiAssistants/NigelLocalService/wwwroot/Images/two-chat-sparkle_green_DarkUI_48x48.svg) for reference.
359+
312360
#### Conversation
313361
314362
Other than setting a background, a conversation has no appearance of its own and simply contains the default slot for messages and the input slot for the chat input, along with wrapper `div`s for layout purposes.
@@ -434,7 +482,7 @@ On mobile, typing a newline in the input will be difficult as most on-screen key
434482

435483
### Globalization
436484

437-
Most content is provided by applications so they are responsible for localization. For the input component "Send" and "Stop" button titles and accessible labels we will add label provider strings. These supply default labels which applications can localize or replace with custom labels. These will be added to a new Spright chat label provider.
485+
Most content is provided by applications so they are responsible for localization. For components with user-visible text we will add label provider strings. These supply default labels which applications can localize or replace with custom labels. These will be added to a new Spright chat label provider.
438486

439487
Defining the behavior for RTL languages is initially out of scope. But the API can easily be extended to support changing the layout for an RTL language when that is desired.
440488

12.8 KB
Loading
64.4 KB
Loading

0 commit comments

Comments
 (0)