Class: Ruboty::OpenAIChat::Actions::RememberProfile

Inherits:
Base
  • Object
show all
Defined in:
lib/ruboty/openai_chat/actions/remember_profile.rb

Constant Summary

Constants inherited from Base

Base::NAMESPACE, Base::PROFILE_KEY

Instance Attribute Summary

Attributes inherited from Base

#message

Instance Method Summary collapse

Methods inherited from Base

#client, #initialize, #memory, #openai_model, #pretexts, #robot

Constructor Details

This class inherits a constructor from Ruboty::OpenAIChat::Actions::Base

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ruboty/openai_chat/actions/remember_profile.rb', line 9

def call
  new_profile = message[:body].strip
  memory.namespace(NAMESPACE)[PROFILE_KEY] = new_profile

  message.reply("Remembered the profile.")
rescue StandardError => e
  message.reply(e.message, code: true)
  raise e if ENV["OPENAI_CHAT_DEBUG"]

  true
end