Class: Jambots::Renderers::CliRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/jambots/renderers/cli_renderer.rb

Instance Method Summary collapse

Instance Method Details

#render(conversation, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jambots/renderers/cli_renderer.rb', line 8

def render(conversation, &block)
  spinner.auto_spin
  message = block.call
  spinner.success
  print_line(role_header(message[:role]))
  puts pastel.magenta(message[:content])
  print_line("#{conversation.key}   ")
rescue Jambots::ChatClientError => e
  spinner.success
  warn "ERROR: #{e.message}"
  exit(1)
end