@aws/chat-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

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 postMessage to 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

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 acknowlegded by a user disclaimerAcknowledged N/A

TODO: Provide full list of events

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?: boolean

Readme

Keywords

none

Package Sidebar

Install

npm i @aws/chat-client

Weekly Downloads

7,522

Version

0.1.10

License

Apache-2.0

Unpacked Size

6.59 MB

Total Files

60

Last publish

Collaborators

  • ege0zcan
  • rtarcr
  • imykhai
  • saurisha
  • gkeller
  • viktorsaws
  • rahmaniaam
  • aws-language-server-runtimes-team