thinking property

  1. @override
String? get thinking
override

Get thinking/reasoning content (for providers that support it)

Implementation

@override
String? get thinking {
  final content = _rawResponse['content'] as List?;
  if (content == null || content.isEmpty) return null;

  // Collect all thinking blocks (including redacted thinking)
  final thinkingBlocks = <String>[];

  for (final block in content) {
    final blockType = block['type'] as String?;
    if (blockType == 'thinking') {
      final thinkingText = block['thinking'] as String?;
      if (thinkingText != null && thinkingText.isNotEmpty) {
        thinkingBlocks.add(thinkingText);
      }
    } else if (blockType == 'redacted_thinking') {
      // For redacted thinking, we can't show the content but we can indicate it exists
      // The actual encrypted data is in the 'data' field but should not be displayed
      thinkingBlocks
          .add('[Redacted thinking content - encrypted for safety]');
    }
  }

  return thinkingBlocks.isEmpty ? null : thinkingBlocks.join('\n\n');
}