Module: AssistantConversationMessageReplayable

Extended by:
ActiveSupport::Concern
Included in:
AssistantConversation
Defined in:
app/models/concerns/assistant_conversation_message_replayable.rb

Overview

Concern mixed into a model: assistant conversation message replayable.

Instance Method Summary collapse

Instance Method Details

#has_thinking_history?Boolean

True when any assistant message in this conversation contains thinking data.
Used by ChatService to force thinking mode on subsequent turns so Anthropic
doesn't reject the request for missing thinking blocks.

Returns:

  • (Boolean)


10
11
12
13
14
# File 'app/models/concerns/assistant_conversation_message_replayable.rb', line 10

def has_thinking_history?
  assistant_messages.where(role: 'assistant')
                    .where.not(thinking_text: nil)
                    .exists?
end