@aws/chat-client v0.1.15
Q Chat Client
This package contains a chat client for the Q Language Server, that can be embedded in a webview. It uses MynahUI to render a web based chat interface.
Communication
The chat client communicates with the host application (e.g., an IDE extension) through postMessage requests to the webview:
- When the host application sends a request, the client processes the message and sends it to the UI
- When an event is triggered in the UI, the client sends a message through
postMessageto the host application that rendered the chat client
Usage
To use the chat client, embed it in a webview within your application and handle the postMessage communication as needed. Chat client is based on inbound (from a destination to the chat client) and outbound events (from the chat client to a destination). Events consist of command and params:
interface SomeEvent {
command: string;
params: SomeOptions;
}Inbound events
| Name | Description | command | params |
|---|---|---|---|
| sendChatPrompt response | Provides response to sendChatPrompt request | aws/chat/sendChatPrompt | ChatResult |
| openTab request | Request to open tab (creates tab if no tabId provided) | aws/chat/openTab | requestID - ID shared between the webview and vscode client, OpenTabParams |
| sendToPrompt | Request to send selection to prompt | sendToPrompt | SendToPromptParams |
| genericCommand | Request to execute generic command | genericCommand | GenericCommandParams |
| errorMessage | Request to show error in chat UI | errorMessage | ErrorParams |
| chatOptions | Configures chat startup options | chatOptions | ChatOptions |
| chatUpdate | Updates existing chat messages | aws/chat/sendChatUpdate | ChatUpdateParams |
| contextCommand | Sends context commands to the UI | aws/chat/sendContextCommands | ContextCommandParams |
| listConversations response | Provides response with list of history conversations to the UI | aws/chat/listConversations | ListConversationsResult |
| conversationClick response | Provides response to conversation click or action, specifying action execution result | aws/chat/conversationClick | ConversationClickResult |
| getSerializedChat request | Request to get serialized chat | aws/chat/getSerializedChat | GetSerializedChatParams |
| chatOptionsUpdate | Sends chat options update request from server | aws/chat/chatOptionsUpdate | ChatOptionsUpdateParams |
Outbound events
| Name | Description | command | params |
|---|---|---|---|
| openTab response | Provides response to openTab request | aws/chat/openTab | requestID - ID shared between the webview and vscode client, UiMessageResultParams with result of type OpenTabResult |
| disclaimerAcknowledged | Notifies destination that legal disclaimer was acknowledged by a user | disclaimerAcknowledged | N/A |
| sendChatPrompt | Sends a chat prompt to the server | aws/chat/sendChatPrompt | ChatParams |
| sendQuickActionCommand | Sends a quick action command | aws/chat/quickAction | QuickActionParams |
| tabAdded | Notifies when a tab is added | aws/chat/tabAdd | TabAddParams |
| tabChanged | Notifies when a tab is changed | aws/chat/tabChange | TabChangeParams |
| tabRemoved | Notifies when a tab is removed | aws/chat/tabRemove | TabRemoveParams |
| insertToCursorPosition | Requests to insert code at cursor position | insertToCursorPosition | InsertToCursorPositionParams |
| copyToClipboard | Requests to copy code to clipboard | copyToClipboard | CopyCodeToClipboardParams |
| authFollowUpClicked | Notifies when an auth follow-up is clicked | authFollowUpClicked | AuthFollowUpClickedParams |
| followUpClicked | Notifies when a follow-up suggestion is clicked | aws/chat/followUpClick | FollowUpClickParams |
| sendFeedback | Sends user feedback | aws/chat/feedback | FeedbackParams |
| linkClick | Notifies when a link is clicked | aws/chat/linkClick | LinkClickParams |
| sourceLinkClick | Notifies when a source link is clicked | aws/chat/sourceLinkClick | SourceLinkClickParams |
| infoLinkClick | Notifies when an info link is clicked | aws/chat/infoLinkClick | InfoLinkClickParams |
| uiReady | Notifies when the UI is ready | aws/chat/ready | N/A |
| chatPromptOptionAcknowledged | Notifies when a chat prompt option is acknowledged | chatPromptOptionAcknowledged | ChatPromptOptionAcknowledgedParams |
| createPrompt | Requests to create a prompt | aws/chat/createPrompt | CreatePromptParams |
| fileClick | Notifies when a file is clicked | aws/chat/fileClick | FileClickParams |
| listConversations | Requests to list conversations with filter provided | aws/chat/listConversations | ListConversationsParams |
| conversationClick | Notifies when a conversation is clicked | aws/chat/conversationClick | ConversationClickParams |
| tabBarAction | Notifies when a tab bar action is requested | aws/chat/tabBarAction | TabBarActionParams |
| getSerializedChat response | Provides response to getSerializedChat request | aws/chat/getSerializedChat | GetSerializedChatResult |
Configuration
Configuration can be passed as an explicit parameter when creating chat inside of webview, for example:
amazonQChat.createChat(acquireVsCodeApi(), configuration);Configuration values:
// Configures quick actions
quickActionCommands?: QuickActionCommandGroup[]
// Configures chat client not to show legal disclaimer as it has already been acknowledged before
disclaimerAcknowledged?: boolean6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
5 months ago
8 months ago
9 months ago
7 months ago
1 year ago
7 months ago
1 year ago
7 months ago
8 months ago
8 months ago
7 months ago
1 year ago
7 months ago
1 year ago
1 year ago
1 year ago