Module: OllamaChat::StateSelectors

Included in:
Chat
Defined in:
lib/ollama_chat/state_selectors.rb

Overview

A module that provides state selection functionality for OllamaChat.

The StateSelectors module encapsulates the StateSelector class, which manages configurable states with selection and display capabilities. It is used to handle various settings in the chat application such as document policies and think modes, allowing users to dynamically configure different aspects of the chat session behavior.

Defined Under Namespace

Classes: StateSelector

Instance Method Summary collapse

Instance Method Details

#setup_state_selectors(config) ⇒ Object

Sets up state selectors for document policy and think mode based on the provided configuration.

Parameters:

  • config (ComplexConfig::Settings)

    the configuration object containing settings for document policy and think mode



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/ollama_chat/state_selectors.rb', line 126

def setup_state_selectors(config)
  @document_policy = StateSelector.new(
    name: 'Document policy',
    default: config.document_policy,
    states: %w[ embedding ignoring importing summarizing ],
    off: %w[ ignoring ],
  )
  @think_mode = StateSelector.new(
    name: 'Think mode',
    default: config.think.mode,
    states: %w[ enabled disabled low medium high ],
    off: %w[ disabled ],
  )
  @voices = StateSelector.new(
    name: 'Voice',
    default: config.voice.default,
    states: config.voice.list,
    allow_empty: true
  )
end