Class: RubyCoded::Chat::Renderer

Inherits:
Object
  • Object
show all
Includes:
ChatPanel, ChatPanelInput, ChatPanelThinking, ModelSelector, PlanClarifier, PlanClarifierLayout, StatusBar
Defined in:
lib/ruby_coded/chat/renderer.rb,
lib/ruby_coded/chat/renderer/chat_panel.rb,
lib/ruby_coded/chat/renderer/status_bar.rb,
lib/ruby_coded/chat/renderer/model_selector.rb,
lib/ruby_coded/chat/renderer/plan_clarifier.rb,
lib/ruby_coded/chat/renderer/chat_panel_input.rb,
lib/ruby_coded/chat/renderer/chat_panel_thinking.rb,
lib/ruby_coded/chat/renderer/plan_clarifier_layout.rb

Overview

This class manages the rendering of the UI elements

Defined Under Namespace

Modules: ChatPanel, ChatPanelInput, ChatPanelThinking, ModelSelector, PlanClarifier, PlanClarifierLayout, StatusBar

Constant Summary

Constants included from ChatPanelInput

ChatPanelInput::INPUT_PREFIX

Constants included from ChatPanelThinking

ChatPanelThinking::MAX_THINKING_MESSAGES, ChatPanelThinking::THINK_CLOSE, ChatPanelThinking::THINK_OPEN, ChatPanelThinking::TOOL_ROLES

Instance Method Summary collapse

Constructor Details

#initialize(tui, state) ⇒ Renderer

Returns a new instance of Renderer.



23
24
25
26
# File 'lib/ruby_coded/chat/renderer.rb', line 23

def initialize(tui, state)
  @tui = tui
  @state = state
end

Instance Method Details

#drawObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ruby_coded/chat/renderer.rb', line 28

def draw
  @tui.clear

  @tui.draw do |frame|
    chat_area, status_area, input_area = main_layout(frame)
    render_chat_panel(frame, chat_area)
    render_status_bar(frame, status_area)
    render_input_panel(frame, input_area)
    render_model_selector(frame, chat_area) if @state.model_select?
    render_plan_clarifier(frame, chat_area) if @state.plan_clarification?
    render_plugin_overlays(frame, chat_area, input_area)
  end
end