Class: UserMessageDecorator
- Inherits:
-
MessageDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- MessageDecorator
- UserMessageDecorator
- Defined in:
- app/decorators/user_message_decorator.rb
Overview
Decorates user_message records for display in the TUI. Basic mode returns role and content. Verbose mode adds a timestamp. Debug mode adds token count (exact when counted, estimated when not).
Constant Summary
Constants inherited from MessageDecorator
MessageDecorator::ERROR_ICON, MessageDecorator::MIDDLE_TRUNCATION_MARKER, MessageDecorator::RETURN_ARROW, MessageDecorator::TOOL_ICON
Instance Method Summary collapse
-
#render_basic ⇒ Hash
Structured user message data ‘:user, content: String`.
-
#render_brain ⇒ String
User message for the analytical brain, middle-truncated if very long (preserves intent at start and conclusion at end).
-
#render_debug ⇒ Hash
Verbose output plus token count for debugging.
-
#render_verbose ⇒ Hash
Structured user message with nanosecond timestamp.
Methods inherited from MessageDecorator
Instance Method Details
#render_basic ⇒ Hash
Returns structured user message data ‘:user, content: String`.
8 9 10 |
# File 'app/decorators/user_message_decorator.rb', line 8 def render_basic {role: :user, content: content} end |
#render_brain ⇒ String
Returns user message for the analytical brain, middle-truncated if very long (preserves intent at start and conclusion at end).
24 25 26 |
# File 'app/decorators/user_message_decorator.rb', line 24 def render_brain "User: #{truncate_middle(content)}" end |
#render_debug ⇒ Hash
Returns verbose output plus token count for debugging.
18 19 20 |
# File 'app/decorators/user_message_decorator.rb', line 18 def render_debug render_verbose.merge(token_info) end |
#render_verbose ⇒ Hash
Returns structured user message with nanosecond timestamp.
13 14 15 |
# File 'app/decorators/user_message_decorator.rb', line 13 def render_verbose {role: :user, content: content, timestamp: } end |