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
Modules: Common Classes: DatabaseStateSelector, StateSelector
Instance Attribute Summary collapse
-
#document_policy ⇒ OllamaChat::StateSelector
readonly
The document_policy reader returns the document policy selector for the chat session.
-
#think_mode ⇒ OllamaChat::StateSelector
readonly
The think_mode reader returns the think mode selector for the chat session.
-
#voices ⇒ OllamaChat::StateSelector
readonly
The voices reader returns the voice selector for the chat session.
Instance Method Summary collapse
-
#setup_state_selectors(config) ⇒ Object
Sets up state selectors for document policy and think mode based on the provided configuration.
Instance Attribute Details
#document_policy ⇒ OllamaChat::StateSelector (readonly)
The document_policy reader returns the document policy selector for the chat session.
226 227 228 |
# File 'lib/ollama_chat/state_selectors.rb', line 226 def document_policy @document_policy end |
#think_mode ⇒ OllamaChat::StateSelector (readonly)
The think_mode reader returns the think mode selector for the chat session.
232 233 234 |
# File 'lib/ollama_chat/state_selectors.rb', line 232 def think_mode @think_mode end |
#voices ⇒ OllamaChat::StateSelector (readonly)
The voices reader returns the voice selector for the chat session.
238 239 240 |
# File 'lib/ollama_chat/state_selectors.rb', line 238 def voices @voices end |
Instance Method Details
#setup_state_selectors(config) ⇒ Object
Sets up state selectors for document policy and think mode based on the provided configuration.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/ollama_chat/state_selectors.rb', line 245 def setup_state_selectors(config) @document_policy = DatabaseStateSelector.new( chat: self, attribute: :document_policy, name: 'Document policy', states: OllamaChat::Parsing::DOCUMENT_POLICY_STATES, off: OllamaChat::Parsing::DOCUMENT_POLICY_STATES[0, 1], ) @think_mode = DatabaseStateSelector.new( chat: self, attribute: :think_mode, name: 'Think mode', states: OllamaChat::ThinkControl::THINK_MODE_STATES, off: OllamaChat::ThinkControl::THINK_MODE_STATES[0, 1], ) @voices = DatabaseStateSelector.new( chat: self, attribute: :current_voice, name: 'Voice', states: config.voice.list, allow_empty: true ) end |