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
- sendMessage
- regenerateResponse
- updateRobotaConfig
- getRobotaConfig
- upgradeToTemplate
- getTemplateManager
- activate
- deactivate
- getHistory
- clearHistory
- save
- load
- getStats
- updateConfig
Constructors
constructor
• new ChatInstance(metadata, config, robota): ChatInstance
Parameters
| Name | Type |
|---|---|
metadata | ChatMetadata |
config | ChatConfig |
robota | Robota |
Returns
Defined in
Properties
metadata
• Readonly metadata: ChatMetadata
Implementation of
IChatInstance.metadata
Defined in
config
• Readonly config: ChatConfig
Implementation of
IChatInstance.config
Defined in
robota
• Readonly robota: Robota
Implementation of
IChatInstance.robota
Defined in
Methods
sendMessage
▸ sendMessage(content): Promise<string>
Send a message and get AI response
Parameters
| Name | Type |
|---|---|
content | string |
Returns
Promise<string>
Implementation of
IChatInstance.sendMessage
Defined in
regenerateResponse
▸ regenerateResponse(): Promise<string>
Regenerate the last response
Returns
Promise<string>
Implementation of
IChatInstance.regenerateResponse
Defined in
updateRobotaConfig
▸ updateRobotaConfig(config): Promise<void>
Update robota configuration
Parameters
| Name | Type |
|---|---|
config | AgentConfig |
Returns
Promise<void>
Implementation of
IChatInstance.updateRobotaConfig
Defined in
getRobotaConfig
▸ getRobotaConfig(): AgentConfig
Get current robota configuration
Returns
AgentConfig
Implementation of
IChatInstance.getRobotaConfig
Defined in
upgradeToTemplate
▸ upgradeToTemplate(templateName): Promise<void>
Upgrade to use an agent template
Parameters
| Name | Type |
|---|---|
templateName | string |
Returns
Promise<void>
Implementation of
IChatInstance.upgradeToTemplate
Defined in
getTemplateManager
▸ getTemplateManager(): TemplateManager
Get template manager instance
Returns
Implementation of
IChatInstance.getTemplateManager
Defined in
activate
▸ activate(): void
Activate this chat session
Returns
void
Implementation of
IChatInstance.activate
Defined in
deactivate
▸ deactivate(): void
Deactivate this chat session
Returns
void
Implementation of
IChatInstance.deactivate
Defined in
getHistory
▸ getHistory(): Message[]
Get conversation history - delegate to Robota
Returns
Message[]
Implementation of
IChatInstance.getHistory
Defined in
clearHistory
▸ clearHistory(): void
Clear conversation history - delegate to Robota
Returns
void
Implementation of
IChatInstance.clearHistory
Defined in
save
▸ save(): Promise<void>
Save chat state
Returns
Promise<void>
Implementation of
IChatInstance.save
Defined in
load
▸ load(): Promise<void>
Load chat state
Returns
Promise<void>
Implementation of
IChatInstance.load
Defined in
getStats
▸ getStats(): ChatStats
Get chat statistics
Returns
Implementation of
IChatInstance.getStats
Defined in
updateConfig
▸ updateConfig(config): void
Update chat configuration
Parameters
| Name | Type |
|---|---|
config | Partial<ChatConfig> |
Returns
void
Implementation of
IChatInstance.updateConfig