IBot bot = botFactory.getBot(environment, conversationMemory.getBotId(), conversationMemory.getBotVersion()); if (bot == null) { String msg = "Bot not deployed (environment=%s, conversationId=%s, version=%s)"; msg = String.format(msg, environment, conversationMemory.getBotId(), conversationMemory.getBotVersion()); response.resume(new NotFoundException(msg)); return;
public static ConversationMemorySnapshot convertConversationMemory(IConversationMemory conversationMemory) { ConversationMemorySnapshot snapshot = new ConversationMemorySnapshot(); if (conversationMemory.getUserId() != null) { snapshot.setUserId(conversationMemory.getUserId()); } if (conversationMemory.getConversationId() != null) { snapshot.setConversationId(conversationMemory.getConversationId()); } snapshot.setBotId(conversationMemory.getBotId()); snapshot.setBotVersion(conversationMemory.getBotVersion()); snapshot.setConversationState(conversationMemory.getConversationState()); for (IConversationMemory.IConversationStep redoStep : conversationMemory.getRedoCache()) { ConversationMemorySnapshot.ConversationStepSnapshot redoStepSnapshot = iterateConversationStep(redoStep); snapshot.getRedoCache().push(redoStepSnapshot); } for (int i = conversationMemory.getAllSteps().size() - 1; i >= 0; i--) { IConversationMemory.IConversationStep conversationStep = conversationMemory.getAllSteps().get(i); snapshot.getConversationSteps().add(iterateConversationStep(conversationStep)); } snapshot.getConversationOutputs().addAll(conversationMemory.getConversationOutputs()); snapshot.getConversationProperties().putAll(conversationMemory.getConversationProperties()); return snapshot; }