-
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.
feat: change implementation of basic_input_output to built-in parser (#…
…10) * feat: change implementation of basic_input_output to built-in parser Signed-off-by: SuZhou-Joe <[email protected]> * feat: update CHANGELOG Signed-off-by: SuZhou-Joe <[email protected]> * feat: enable build input-output message Signed-off-by: SuZhou-Joe <[email protected]> * feat: sort interactions Signed-off-by: SuZhou-Joe <[email protected]> * feat: remove useless code Signed-off-by: SuZhou-Joe <[email protected]> * feat: use parent_interaction_id as traceId Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]>
- Loading branch information
1 parent
b8e311d
commit fefd99c
Showing
8 changed files
with
99 additions
and
69 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
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,28 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { IInput, IOutput } from '../../common/types/chat_saved_object_attributes'; | ||
import { Interaction } from '../types'; | ||
|
||
export const BasicInputOutputParser = { | ||
order: 0, | ||
id: 'output_message', | ||
async parserProvider(interaction: Interaction) { | ||
const inputItem: IInput = { | ||
type: 'input', | ||
contentType: 'text', | ||
content: interaction.input, | ||
}; | ||
const outputItems: IOutput[] = [ | ||
{ | ||
type: 'output', | ||
contentType: 'markdown', | ||
content: interaction.response, | ||
traceId: interaction.parent_interaction_id, | ||
}, | ||
]; | ||
return [inputItem, ...outputItems]; | ||
}, | ||
}; |
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
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
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
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
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
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