Class: OxAiWorkers::Assistant::Sysop

Inherits:
Object
  • Object
show all
Includes:
ModuleBase
Defined in:
lib/oxaiworkers/assistant/sysop.rb

Instance Attribute Summary

Attributes included from ModuleBase

#capabilities, #description, #id, #iterator, #role, #title

Attributes included from LoadI18n

#locale

Instance Method Summary collapse

Methods included from ModuleBase

#add_file, #add_image, #add_task, #execute, #init_worker, #replace_context, #run_task, #task=

Methods included from LoadI18n

#store_locale, #with_locale

Constructor Details

#initialize(current_dir: nil, delayed: false, model: nil) ⇒ Sysop

Returns a new instance of Sysop.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/oxaiworkers/assistant/sysop.rb', line 8

def initialize(current_dir: nil, delayed: false, model: nil)
  store_locale

  with_locale do
    @id = 'sysop'
    @role = I18n.t('oxaiworkers.assistant.sysop.role')
    @description = I18n.t('oxaiworkers.assistant.sysop.description')
    @capabilities = I18n.t('oxaiworkers.assistant.sysop.capabilities').split(',').map(&:strip)
    @title = I18n.t('oxaiworkers.assistant.sysop.title')
  end

  @iterator = Iterator.new(
    worker: init_worker(delayed:, model:),
    role: @role,
    tools: [Tool::Eval.new(only: :sh, current_dir:),
            Tool::FileSystem.new(only: %i[read_file write_to_file], current_dir:)],
    locale: @locale,
    on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) },
    on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) }
  )
end