for (Map.Entry<String, String> e : topInputs.entrySet())
topTask.setSlotValueScript(e.getKey(), e.getValue(), "init agent");
if ( ! user.isGuest()) {
int userId = user.getId();
Slot userSlot = topTask.getType().getSlotIfExists("user");
if ((userSlot != null) && userSlot.isInput() && !topInputs.containsKey("user")) {
if (userSlot.getType().equals("string"))
topTask.setSlotValue("user", Integer.toString(userId));
else if (userSlot.getType().equals("number"))
topTask.setSlotValue("user", userId);
}
}
Slot lastConvSlot = topTask.getType().getSlotIfExists("lastConversation");
if ((lastConvSlot != null) &&
lastConvSlot.isInput() &&
lastConvSlot.getType().equals("number") &&
!topInputs.containsKey("lastConversation")) {
Conversation c = user.getLastConversation(id);
topTask.setSlotValue("lastConversation", c==null ? null : c.getStart());
}