Skip to content

sessions / Exports / ChatInstance

Class: ChatInstance

Simple ChatInstance implementation - wrapper around Robota

Focuses on the core purpose: managing a single AI agent instance within a session context. Delegates conversation management to Robota.

Implements

  • ChatInstance

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ChatInstance(metadata, config, robota): ChatInstance

Parameters

NameType
metadataChatMetadata
configChatConfig
robotaRobota

Returns

ChatInstance

Defined in

chat/chat-instance.ts:24

Properties

metadata

Readonly metadata: ChatMetadata

Implementation of

IChatInstance.metadata

Defined in

chat/chat-instance.ts:19


config

Readonly config: ChatConfig

Implementation of

IChatInstance.config

Defined in

chat/chat-instance.ts:20


robota

Readonly robota: Robota

Implementation of

IChatInstance.robota

Defined in

chat/chat-instance.ts:21

Methods

sendMessage

sendMessage(content): Promise<string>

Send a message and get AI response

Parameters

NameType
contentstring

Returns

Promise<string>

Implementation of

IChatInstance.sendMessage

Defined in

chat/chat-instance.ts:38


regenerateResponse

regenerateResponse(): Promise<string>

Regenerate the last response

Returns

Promise<string>

Implementation of

IChatInstance.regenerateResponse

Defined in

chat/chat-instance.ts:52


updateRobotaConfig

updateRobotaConfig(config): Promise<void>

Update robota configuration

Parameters

NameType
configAgentConfig

Returns

Promise<void>

Implementation of

IChatInstance.updateRobotaConfig

Defined in

chat/chat-instance.ts:66


getRobotaConfig

getRobotaConfig(): AgentConfig

Get current robota configuration

Returns

AgentConfig

Implementation of

IChatInstance.getRobotaConfig

Defined in

chat/chat-instance.ts:79


upgradeToTemplate

upgradeToTemplate(templateName): Promise<void>

Upgrade to use an agent template

Parameters

NameType
templateNamestring

Returns

Promise<void>

Implementation of

IChatInstance.upgradeToTemplate

Defined in

chat/chat-instance.ts:86


getTemplateManager

getTemplateManager(): TemplateManager

Get template manager instance

Returns

TemplateManager

Implementation of

IChatInstance.getTemplateManager

Defined in

chat/chat-instance.ts:99


activate

activate(): void

Activate this chat session

Returns

void

Implementation of

IChatInstance.activate

Defined in

chat/chat-instance.ts:106


deactivate

deactivate(): void

Deactivate this chat session

Returns

void

Implementation of

IChatInstance.deactivate

Defined in

chat/chat-instance.ts:114


getHistory

getHistory(): Message[]

Get conversation history - delegate to Robota

Returns

Message[]

Implementation of

IChatInstance.getHistory

Defined in

chat/chat-instance.ts:121


clearHistory

clearHistory(): void

Clear conversation history - delegate to Robota

Returns

void

Implementation of

IChatInstance.clearHistory

Defined in

chat/chat-instance.ts:128


save

save(): Promise<void>

Save chat state

Returns

Promise<void>

Implementation of

IChatInstance.save

Defined in

chat/chat-instance.ts:137


load

load(): Promise<void>

Load chat state

Returns

Promise<void>

Implementation of

IChatInstance.load

Defined in

chat/chat-instance.ts:145


getStats

getStats(): ChatStats

Get chat statistics

Returns

ChatStats

Implementation of

IChatInstance.getStats

Defined in

chat/chat-instance.ts:153


updateConfig

updateConfig(config): void

Update chat configuration

Parameters

NameType
configPartial<ChatConfig>

Returns

void

Implementation of

IChatInstance.updateConfig

Defined in

chat/chat-instance.ts:165

Released under the MIT License.