controllers/session.rb in nano-bots-1.1.2 vs controllers/session.rb in nano-bots-1.2.0
- old
+ new
@@ -61,10 +61,11 @@
return unless instruction
behavior = Logic::Helpers::Hash.fetch(@cartridge, %i[behaviors boot]) || {}
@state[:history] << {
+ at: Time.now,
who: 'user',
mode: mode.to_s,
input: instruction,
message: instruction
}
@@ -76,10 +77,11 @@
def evaluate_and_print(message, mode:)
behavior = Logic::Helpers::Hash.fetch(@cartridge, %i[behaviors interaction]) || {}
@state[:history] << {
+ at: Time.now,
who: 'user',
mode: mode.to_s,
input: message,
message: Components::Adapter.apply(
Logic::Cartridge::Interaction.input(@cartridge, mode.to_sym, message), @cartridge
@@ -157,10 +159,13 @@
output[:message] = Components::Adapter.apply(output[:message], @cartridge)
event[:output] = (output[:message]).to_s
end
end
- @state[:history] << event if feedback[:should_be_stored]
+ if feedback[:should_be_stored]
+ event[:at] = Time.now
+ @state[:history] << event
+ end
if event[:output] && ((!feedback[:finished] && streaming) || (!streaming && feedback[:finished]))
self.print(color ? Rainbow(event[:output]).send(color) : event[:output])
end