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
Attributes included from LoadI18n
Instance Method Summary collapse
-
#initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english') ⇒ Localizer
constructor
A new instance of Localizer.
Methods included from ModuleBase
#add_response, #execute, #init_worker, #task=
Methods included from LoadI18n
Constructor Details
#initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english') ⇒ Localizer
Returns a new instance of Localizer.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/oxaiworkers/assistant/localizer.rb', line 8 def initialize(delayed: false, model: nil, language: 'русский', locale: :ru, source: 'english') store_locale @iterator = Iterator.new( worker: init_worker(delayed: delayed, model: model), role: format(I18n.t('oxaiworkers.assistant.localizer.role'), language), tools: [Tool::Eval.new, Tool::FileSystem.new], locale: @locale, on_inner_monologue: ->(text:) { puts "monologue: #{text}".colorize(:yellow) }, on_outer_voice: ->(text:) { puts "voice: #{text}".colorize(:green) }, on_action_request: ->(text:) { puts "action: #{text}".colorize(:red) }, on_summarize: ->(text:) { puts "summary: #{text}".colorize(:blue) } ) @iterator.add_context(format(I18n.t('oxaiworkers.assistant.localizer.source'), source)) @iterator.add_context(format(I18n.t('oxaiworkers.assistant.localizer.locale'), language, locale)) end |