-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SuZhou-Joe <[email protected]>
- Loading branch information
1 parent
ecf353e
commit c6adc00
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# CHANGELOG | ||
|
||
Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
|
||
### 📈 Features/Enhancements | ||
|
||
- Add support for registerMessageParser ([#5](https://github.com/opensearch-project/dashboards-assistant/pull/5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# `registerMessageParser` — Register your customized parser logic into Chatbot. | ||
|
||
**Interaction** refers to a question-answer pair in Chatbot application. In most cases, an interaction consists of two messages: an `Input` message and an `Output` message. However, as the Chatbot evolves to become more powerful, it may display new messages such as visualizations, data explorers, or data grids. Therefore, it is crucial to implement a mechanism that allows other plugins to register their customized parser logic based on each interaction body. | ||
|
||
|
||
## API | ||
|
||
### registerMessageParser | ||
|
||
``` | ||
dashboardAssistant.registerMessageParser({ | ||
id: "foo_parser", | ||
parserProvider: async (interaction, messageParserHelper) => { | ||
if (interaction.additional_info?.visualizationId) { | ||
messageParserHelper.addMessage({ | ||
contentType: "visualization", | ||
content: interaction.additional_info.visualizationId | ||
}) | ||
} | ||
} | ||
}) | ||
``` |