Module: AssistantConversationMessageReplayable

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

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)


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

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