Module: OllamaChat::MessageFormat
- Included in:
- Chat, FollowChat, MessageList
- Defined in:
- lib/ollama_chat/message_format.rb
Instance Method Summary collapse
-
#message_type(images) ⇒ String
The message_type method determines the appropriate message icon based on whether images are present.
-
#talk_annotate(&block) ⇒ String?
The talk_annotate method processes a string output by a block and conditionally adds annotation.
-
#think_annotate(&block) ⇒ String?
The think_annotate method processes a string and conditionally annotates it with a thinking emoji if the think feature is enabled.
Instance Method Details
#message_type(images) ⇒ String
The message_type method determines the appropriate message icon based on whether images are present.
8 9 10 |
# File 'lib/ollama_chat/message_format.rb', line 8 def (images) images.present? ? ? |
#talk_annotate(&block) ⇒ String?
The talk_annotate method processes a string output by a block and conditionally adds annotation.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ollama_chat/message_format.rb', line 32 def talk_annotate(&block) string = block.() string.to_s.size == 0 and return if @chat.think.on? "💬\n#{string}\n" else string end end |
#think_annotate(&block) ⇒ String?
The think_annotate method processes a string and conditionally annotates it with a thinking emoji if the think feature is enabled.
18 19 20 21 22 23 24 |
# File 'lib/ollama_chat/message_format.rb', line 18 def think_annotate(&block) string = block.() string.to_s.size == 0 and return if @chat.think.on? "💭\n#{string}\n" end end |