saveAntecedentResponses

fun saveAntecedentResponses(context: Context)

Samples

import ai.flowstorm.common.monitoring.performance.PerformanceSpan
import ai.flowstorm.core.Context
import ai.flowstorm.core.Response
import ai.flowstorm.core.Scope
import ai.flowstorm.core.model.Turn
import ai.flowstorm.core.nlp.pipeline.PipelineComponent
import ai.flowstorm.core.nlp.pipeline.PipelineScope
import ai.flowstorm.core.type.DateTime
import ai.flowstorm.core.type.IntMutableList
fun main() { 
   //sampleStart 
   with(context) {
        with (scopeAttributes) {
            if (session.turns.isNotEmpty()) {
                antecedentUserResponse = session.turns.last().input.transcript.text
                antecedentBotSpeech = session.turns.last().responseItems.map { it.text }.joinToString(" ")
                utteranceRepeated = (antecedentUserResponse == input.transcript.text)
            }
            if (session.turns.size > 1) {
                preAntecedentUserResponse = session.turns[session.turns.size - 2].input.transcript.text
                preAntecedentBotSpeech = session.turns[session.turns.size - 2].responseItems.map { it.text }.joinToString(" ")
            }
        }
    } 
   //sampleEnd
}