Class: OxAiWorkers::Assistant::Localizer
- Inherits:
-
Object
- Object
- OxAiWorkers::Assistant::Localizer
- Includes:
- ModuleBase
- Defined in:
- lib/oxaiworkers/assistant/localizer.rb
Instance Attribute Summary
Attributes included from ModuleBase
#capabilities, #description, #id, #iterator, #role, #title
Attributes included from LoadI18n
Instance Method Summary collapse
-
#initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english', current_dir: nil) ⇒ Localizer
constructor
A new instance of Localizer.
Methods included from ModuleBase
#add_file, #add_image, #add_task, #execute, #init_worker, #replace_context, #run_task, #task=
Methods included from LoadI18n
Constructor Details
#initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english', current_dir: nil) ⇒ Localizer
Returns a new instance of Localizer.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/oxaiworkers/assistant/localizer.rb', line 8 def initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english', current_dir: nil) store_locale with_locale do @id = 'localizer' @role = format(I18n.t('oxaiworkers.assistant.localizer.role'), source_lang: source) @description = I18n.t('oxaiworkers.assistant.localizer.description') @capabilities = I18n.t('oxaiworkers.assistant.localizer.capabilities').split(',').map(&:strip) @title = I18n.t('oxaiworkers.assistant.localizer.title') end @iterator = Iterator.new( worker: init_worker(delayed:, model:), role: @role, tools: [Tool::Eval.new(current_dir:), Tool::FileSystem.new(current_dir:)], locale: @locale, on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) }, on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) } ) @iterator.add_context(format(I18n.t('oxaiworkers.assistant.localizer.source'), source_lang: source)) @iterator.add_context(format(I18n.t('oxaiworkers.assistant.localizer.locale'), target_lang: language, locale:)) end |