Class: UserMessageDecorator
- Inherits:
-
EventDecorator
- Object
- Draper::Decorator
- ApplicationDecorator
- EventDecorator
- UserMessageDecorator
- Defined in:
- app/decorators/user_message_decorator.rb
Overview
Decorates user_message events 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 EventDecorator
EventDecorator::ERROR_ICON, EventDecorator::RETURN_ARROW, EventDecorator::TOOL_ICON
Instance Method Summary collapse
-
#render_basic ⇒ Hash
Structured user message data ‘:user, content: String`.
-
#render_debug ⇒ Hash
Verbose output plus token count for debugging ‘:user, content: String, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.
-
#render_verbose ⇒ Hash
Structured user message with nanosecond timestamp ‘:user, content: String, timestamp: Integer|nil`.
Methods inherited from EventDecorator
Instance Method Details
#render_basic ⇒ Hash
Returns structured user message data ‘:user, content: String`.
9 10 11 |
# File 'app/decorators/user_message_decorator.rb', line 9 def render_basic {role: :user, content: content} end |
#render_debug ⇒ Hash
Returns verbose output plus token count for debugging ‘:user, content: String, timestamp: Integer|nil, tokens: Integer, estimated: Boolean`.
21 22 23 |
# File 'app/decorators/user_message_decorator.rb', line 21 def render_debug render_verbose.merge(token_info) end |
#render_verbose ⇒ Hash
Returns structured user message with nanosecond timestamp ‘:user, content: String, timestamp: Integer|nil`.
15 16 17 |
# File 'app/decorators/user_message_decorator.rb', line 15 def render_verbose {role: :user, content: content, timestamp: } end |