aisbreaker-api-js - v0.1.15 / utils/ConversationStateUtils / DefaultConversationState
Class: DefaultConversationState
utils/ConversationStateUtils.DefaultConversationState
Helper class to store and retrieve messages of a conversation,
The messages are stored in memory and can be imported from/exported to a JSON string or a base64-encoded JSON string of a ConversationState object.
Implements
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new DefaultConversationState(converstationState
)
Construct from a base64 string which contains a ConversationState
Parameters
Name | Type |
---|---|
converstationState | ConversationState |
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:22
Properties
messages
• messages: Message
[]
Implementation of
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:19
Methods
addInputs
▸ addInputs(inputs
): void
Add content to the conversation.
Parameters
Name | Type |
---|---|
inputs | Input [] |
Returns
void
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:100
addMessage
▸ addMessage(message
): void
Add content to the conversation.
Parameters
Name | Type |
---|---|
message | Message |
Returns
void
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:93
addOutputs
▸ addOutputs(outputs
): void
Add content to the conversation.
Parameters
Name | Type |
---|---|
outputs | Output [] |
Returns
void
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:108
getMessages
▸ getMessages(): Message
[]
Get content from the conversaton.
Returns
Message
[]
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:88
toBase64
▸ toBase64(): string
Export to JSON string of a ConversationState object
Returns
string
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:77
toJSON
▸ toJSON(): string
Export to JSON string of a ConversationState object
Returns
string
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:69
empty
▸ Static
empty(): DefaultConversationState
Create a new/empty ConversationState
Returns
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:27
fromBase64
▸ Static
fromBase64(base64?
): DefaultConversationState
Import from base64-encode JSON string of a ConversationState object.
Parameters
Name | Type |
---|---|
base64? | string |
Returns
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:53
fromJSON
▸ Static
fromJSON(json?
): DefaultConversationState
Import from JSON string of a ConversationState object.
Parameters
Name | Type |
---|---|
json? | string |
Returns
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:34