Skip to content

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

NameType
converstationStateConversationState

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:22

Properties

messages

messages: Message[]

Implementation of

ConversationState.messages

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:19

Methods

addInputs

addInputs(inputs): void

Add content to the conversation.

Parameters

NameType
inputsInput[]

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

NameType
messageMessage

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

NameType
outputsOutput[]

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

DefaultConversationState

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

NameType
base64?string

Returns

DefaultConversationState

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

NameType
json?string

Returns

DefaultConversationState

Defined in

aisbreaker-js/packages/aisbreaker-api-js/src/utils/ConversationStateUtils.ts:34

Released under the MIT License.