Class: RubyCoded::Chat::Renderer

Inherits:
Object
  • Object
show all
Includes:
ChatPanel, ChatPanelCache, ChatPanelFormatting, ChatPanelInput, ChatPanelLayout, ChatPanelSections, ChatPanelThinking, ChatPanelThinkingRender, LoginFlow, LoginFlowLayout, ModelSelector, PlanClarifier, PlanClarifierLayout, RichText, StatusBar
Defined in:
lib/ruby_coded/chat/renderer.rb,
lib/ruby_coded/chat/renderer/rich_text.rb,
lib/ruby_coded/chat/renderer/chat_panel.rb,
lib/ruby_coded/chat/renderer/login_flow.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_cache.rb,
lib/ruby_coded/chat/renderer/chat_panel_input.rb,
lib/ruby_coded/chat/renderer/rich_text_inline.rb,
lib/ruby_coded/chat/renderer/chat_panel_layout.rb,
lib/ruby_coded/chat/renderer/login_flow_layout.rb,
lib/ruby_coded/chat/renderer/chat_panel_sections.rb,
lib/ruby_coded/chat/renderer/chat_panel_thinking.rb,
lib/ruby_coded/chat/renderer/chat_panel_formatting.rb,
lib/ruby_coded/chat/renderer/plan_clarifier_layout.rb,
lib/ruby_coded/chat/renderer/chat_panel_thinking_render.rb

Overview

This class manages the rendering of the UI elements

Defined Under Namespace

Modules: ChatPanel, ChatPanelCache, ChatPanelFormatting, ChatPanelInput, ChatPanelLayout, ChatPanelSections, ChatPanelThinking, ChatPanelThinkingRender, LoginFlow, LoginFlowLayout, ModelSelector, PlanClarifier, PlanClarifierLayout, RichText, RichTextInline, 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

Constants included from ChatPanel

ChatPanel::STICKY_HEADER_HEIGHT, ChatPanel::STICKY_HEADER_TITLE

Constants included from ChatPanelFormatting

ChatPanelFormatting::USER_LABEL

Constants included from RichText

RichText::BASE_TEXT_STYLES

Instance Method Summary collapse

Methods included from RichText

#base_text_style, #code_block_style, #code_language_line, #inline_code_style, #merge_style, #parse_rich_line, #parse_rich_text, #rich_line_for, #rich_line_plain, #rich_text_lines, #rich_text_plain, #toggle_code_fence

Methods included from RichTextInline

#append_bold_span!, #append_code_span!, #append_italic_span!, #append_styled_span!, #inline_spans, #next_inline_marker

Constructor Details

#initialize(tui, state) ⇒ Renderer

Returns a new instance of Renderer.



39
40
41
42
# File 'lib/ruby_coded/chat/renderer.rb', line 39

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

Instance Method Details

#drawObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/ruby_coded/chat/renderer.rb', line 44

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_overlays(frame, chat_area, input_area)
  end
end