Class: RubyCoded::Chat::App

Inherits:
Object
  • Object
show all
Includes:
EventDispatch, LoginHandler, OAuthHandler
Defined in:
lib/ruby_coded/chat/app.rb,
lib/ruby_coded/chat/app/login_handler.rb,
lib/ruby_coded/chat/app/oauth_handler.rb,
lib/ruby_coded/chat/app/event_dispatch.rb

Overview

Main class for the AI chat interface

Defined Under Namespace

Modules: EventDispatch, LoginHandler, OAuthHandler

Constant Summary collapse

IDLE_POLL_TIMEOUT =
0.016
STREAMING_POLL_TIMEOUT =
0.05

Constants included from EventDispatch

EventDispatch::LOGIN_ACTIONS, EventDispatch::PLAN_ACTIONS

Instance Method Summary collapse

Constructor Details

#initialize(model:, user_config: nil, auth_manager: nil, fallback_from_model: nil) ⇒ App

Returns a new instance of App.



32
33
34
35
36
37
38
39
40
# File 'lib/ruby_coded/chat/app.rb', line 32

def initialize(model:, user_config: nil, auth_manager: nil, fallback_from_model: nil)
  @model = model
  @user_config = user_config
  @auth_manager = auth_manager
  @fallback_from_model = fallback_from_model
  apply_plugin_extensions!
  build_components!
  announce_model_fallback
end

Instance Method Details

#build_components!Object



42
43
44
45
46
47
48
# File 'lib/ruby_coded/chat/app.rb', line 42

def build_components!
  @state = State.new(model: @model)
  @credentials_store = Auth::CredentialsStore.new(user_config: @user_config)
  @llm_bridge = create_bridge
  @input_handler = InputHandler.new(@state)
  @command_handler = build_command_handler
end

#runObject



53
54
55
56
57
58
# File 'lib/ruby_coded/chat/app.rb', line 53

def run
  RatatuiRuby.run do |tui|
    init_tui(tui)
    run_event_loop
  end
end