🖥️
carter-js V2
  • carter-js
  • 💬Conversation
    • Say
    • Interactions
    • Opener
    • History
  • 🎱Skills
    • Basics
  • Other Features
    • Response Times
    • Personalise
  • More
    • Changelog
    • Further Reading
    • carter-py
Powered by GitBook
On this page
  1. Conversation

History

Go back and see what you and your character have been through together

During each interaction with your agent (through carter.say() and carter.opener(), carter-js will log the interaction to the Carter object's history property. This property stores an array of all the interactions with your Carter agent while your program is running, the most recent being at the start of the array. You can access these in a couple of ways.

// Assuming you have created a Carter object called carter

// Access the latest interaction
const lastInteraction = carter.history[0]
// OR
const lastInteraction = carter.latest()

// Access a specific entry
const interaction = carter.history[7]

// Loop through interactions and log the results
for (const interactions of carter.history) {
    console.log(interaction.payload.query)
    console.log(interaction.data.output.text)
}

carter-js will not log an interaction in history if it is unsuccessful.

Conversation Entries

The Carter.history array stores an array of ConversationEntry objects.

ConversationEntry {
    isoTimestamp,
    interaction
}

interaction: An CarterInteraction or a CarterOpenerInteraction object.

PreviousOpenerNextBasics

Last updated 2 years ago

isoTimestamp: A timestamp string in format.

💬
ISO 8601