Class: FuncBot::Bots::History

Inherits:
Object
  • Object
show all
Defined in:
lib/func_bot/bots/history.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHistory

Returns a new instance of History.



6
7
8
# File 'lib/func_bot/bots/history.rb', line 6

def initialize
  @messages = []
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



4
5
6
# File 'lib/func_bot/bots/history.rb', line 4

def messages
  @messages
end

Instance Method Details

#chronicle(role, prompt, name = nil) ⇒ Object



10
11
12
# File 'lib/func_bot/bots/history.rb', line 10

def chronicle(role, prompt, name = nil)
  messages << Message.new(role, prompt, name)
end

#payloadObject



14
15
16
# File 'lib/func_bot/bots/history.rb', line 14

def payload
  messages.map(&:data)
end