public ConversationMemory(String botId, Integer botVersion) { this.botId = botId; this.botVersion = botVersion; ConversationOutput conversationOutput = new ConversationOutput(); this.conversationOutputs.add(conversationOutput); this.currentStep = new ConversationStep(conversationOutput); this.previousSteps = new Stack<>(); }
IConversationStep startNextStep(ConversationOutput conversationOutput) { ((ConversationStep) currentStep).conversationStepNumber = previousSteps.size(); previousSteps.push(currentStep); if (conversationOutput == null) { conversationOutput = new ConversationOutput(); } conversationOutputs.add(conversationOutput); currentStep = new ConversationStep(conversationOutput); return currentStep; }
private static List<IConversationMemory.IConversationStep> iterateRedoCache(List<ConversationMemorySnapshot.ConversationStepSnapshot> redoSteps) { List<IConversationMemory.IConversationStep> conversationSteps = new LinkedList<>(); for (ConversationMemorySnapshot.ConversationStepSnapshot redoStep : redoSteps) { IConversationMemory.IWritableConversationStep conversationStep = new ConversationStep(new ConversationOutput()); conversationSteps.add(conversationStep); for (ConversationMemorySnapshot.PackageRunSnapshot packageRunSnapshot : redoStep.getPackages()) { for (ConversationMemorySnapshot.ResultSnapshot resultSnapshot : packageRunSnapshot.getLifecycleTasks()) { Data data = new Data(resultSnapshot.getKey(), resultSnapshot.getResult(), resultSnapshot.getPossibleResults(), resultSnapshot.getTimestamp(), resultSnapshot.isPublic()); conversationStep.storeData(data); } } } return conversationSteps; }