Module: RubyLLM::TopSecret::Patches::ActsAsChat
- Defined in:
- lib/ruby_llm/top_secret/patches/acts_as_chat.rb
Overview
Patch for ActiveRecord::ChatMethods#complete that persists the restored response content to the database.
When filtering is active via RubyLLM::TopSecret.with_filtering (or automatically via ActsAsFilteredChat), the default persistence callback (on_end_message) fires inside Chat#complete before restoration occurs, saving filtered content. This patch updates the persisted assistant message with the restored content afterward.
Instance Method Summary collapse
Instance Method Details
#complete ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ruby_llm/top_secret/patches/acts_as_chat.rb', line 20 def complete(...) response = super @message.update!(content: response.content) response end |