ollama_chat 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1136200c7d140c7f9509710887e6e0c490336046306a7447ef61dc11f523622
4
- data.tar.gz: d9275c4b1b86ba2ac94e7a4d6956c87899481abd34d1471e6d77be7c21ef810b
3
+ metadata.gz: cc5f503ab89f249029f367c0bbd92e26494f7ebaaa1514b90fe20160c099b51f
4
+ data.tar.gz: f13c4a61429743b6265fb8b2fa836f58966e4cccf9092d311daa28cade51f8e9
5
5
  SHA512:
6
- metadata.gz: 8dee06aacfff1af99076ae81d509f913a61f539071553f6f86af96b3ee0fb3d1c63f39307d85525ff0f14a382ef44bc35132e7930b10589f062b6a40973cc8e3
7
- data.tar.gz: b0388f8ac5e679f3ffec9e28008a4f9558d2b09c3c73ebedd58b6821fb6cca62dd25aa16712c29ff36c5117cfbd77bf55f5c48b2412993aa70e650fae1326217
6
+ metadata.gz: 4560b3a2cc81610c3fca8c5f24167957a32b1c0521e241aa77fb87b701decbd3640eb04e9f63a487a668f78de077d733e1a0fb1b60ba8a08b0e0f06b5c82bd96
7
+ data.tar.gz: 12c982a3250583e5bb689941fe680b8632a9f3526d1e6548e261e5e7ffe738649c8f9d98bb07224faa5fbf5745bb0eb9d4988aae647e50f5075b121e1ca534f4
data/CHANGES.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-12-09 v0.0.43
4
+
5
+ - Added retry logic in `interact_with_user` method to handle
6
+ `Ollama::Errors::BadRequestError` when in think mode
7
+ - Introduced `think_loud` switch with associated UI commands and logic in
8
+ `chat.rb`
9
+ - Implemented `OllamaChat::ThinkControl` module in
10
+ `lib/ollama_chat/think_control.rb` with methods `think`, `choose_think_mode`,
11
+ `think?`, and `think_show`
12
+ - Updated `ollama-ruby` dependency from version **1.14** to **1.16**
13
+ - Simplified think mode handling and updated related tests
14
+ - Added string modes support for think feature allowing values `"low"`,
15
+ `"medium"`, `"high"`
16
+ - Modified `FollowChat` to conditionally append thinking annotations based on
17
+ `think_loud.on?`
18
+ - Updated documentation comments to follow new tagging conventions for method
19
+ returns and attribute accessors
20
+ - Updated `default_config.yml` to set `think_loud: true` by default
21
+ - Modified information display to include `think_loud.show`
22
+ - Adjusted tests to mock `think_loud` and verify annotation handling
23
+ - Updated `follow_chat_spec.rb` to stub `think_loud?` instead of
24
+ `think_loud.on?`
25
+
3
26
  ## 2025-12-03 v0.0.42
4
27
 
5
28
  - Updated `ollama-ruby` gem dependency from version **1.7** to **1.14**
data/README.md CHANGED
@@ -170,7 +170,8 @@ The following commands can be given inside the chat, if prefixed by a `/`:
170
170
  /info show information for current session
171
171
  /config output current configuration ("/Users/flori/.config/ollama_chat/config.yml")
172
172
  /document_policy pick a scan policy for document references
173
- /think enable ollama think setting for models
173
+ /think choose ollama think mode setting for models
174
+ /think_loud enable to think out loud instead of silently
174
175
  /import source import the source's content
175
176
  /summarize [n] source summarize the source's content in n words
176
177
  /embedding toggle embedding paused or not
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ GemHadar do
37
37
  )
38
38
 
39
39
  dependency 'excon', '~> 1.0'
40
- dependency 'ollama-ruby', '~> 1.14'
40
+ dependency 'ollama-ruby', '~> 1.16'
41
41
  dependency 'documentrix', '~> 0.0', '>= 0.0.2'
42
42
  dependency 'unix_socks', '~> 0.1'
43
43
  dependency 'rss', '~> 0.3'
@@ -40,6 +40,7 @@ class OllamaChat::Chat
40
40
  include OllamaChat::SourceFetching
41
41
  include OllamaChat::WebSearching
42
42
  include OllamaChat::Dialog
43
+ include OllamaChat::ThinkControl
43
44
  include OllamaChat::Information
44
45
  include OllamaChat::MessageOutput
45
46
  include OllamaChat::Clipboard
@@ -80,6 +81,7 @@ class OllamaChat::Chat
80
81
  @opts = go 'f:u:m:s:c:C:D:MESVh', argv
81
82
  @opts[?h] and exit usage
82
83
  @opts[?V] and exit version
84
+ @messages = OllamaChat::MessageList.new(self)
83
85
  @ollama_chat_config = OllamaChat::OllamaChatConfig.new(@opts[?f])
84
86
  self.config = @ollama_chat_config.config
85
87
  setup_switches(config)
@@ -98,9 +100,9 @@ class OllamaChat::Chat
98
100
  @document_policy = config.document_policy
99
101
  @model = choose_model(@opts[?m], config.model.name)
100
102
  @model_options = Ollama::Options[config.model.options]
103
+ @think = config.think
101
104
  model_system = pull_model_unless_present(@model, @model_options)
102
105
  embedding_enabled.set(config.embedding.enabled && !@opts[?E])
103
- @messages = OllamaChat::MessageList.new(self)
104
106
  if @opts[?c]
105
107
  messages.load_conversation(@opts[?c])
106
108
  else
@@ -305,7 +307,10 @@ class OllamaChat::Chat
305
307
  choose_document_policy
306
308
  :next
307
309
  when %r(^/think$)
308
- think.toggle
310
+ choose_think_mode
311
+ :next
312
+ when %r(^/think_loud$)
313
+ think_loud.toggle
309
314
  :next
310
315
  when %r(^/import\s+(.+))
311
316
  @parse_content = false
@@ -601,14 +606,27 @@ class OllamaChat::Chat
601
606
  messages:,
602
607
  voice: (@current_voice if voice.on?)
603
608
  )
604
- ollama.chat(
605
- model: @model,
606
- messages: ,
607
- options: @model_options,
608
- stream: stream.on?,
609
- think: think.on?,
610
- &handler
611
- )
609
+ begin
610
+ retried = false
611
+ ollama.chat(
612
+ model: @model,
613
+ messages: ,
614
+ options: @model_options,
615
+ stream: stream.on?,
616
+ think: ,
617
+ &handler
618
+ )
619
+ rescue Ollama::Errors::BadRequestError
620
+ if think? && !retried
621
+ STDOUT.puts "#{bold('Error')}: in think mode, switch thinking off and retry."
622
+ sleep 1
623
+ @think = false
624
+ retried = true
625
+ retry
626
+ else
627
+ raise
628
+ end
629
+ end
612
630
  if embedding.on? && !records.empty?
613
631
  STDOUT.puts "", records.map { |record|
614
632
  link = if record.source =~ %r(\Ahttps?://)
@@ -686,8 +704,6 @@ class OllamaChat::Chat
686
704
  #
687
705
  # @param document_list [Array<String>] List of document paths or URLs to process
688
706
  #
689
- # @return [void]
690
- #
691
707
  # @example Adding local files
692
708
  # add_documents_from_argv(['/path/to/file1.txt', '/path/to/file2.pdf'])
693
709
  #
@@ -91,7 +91,7 @@ class OllamaChat::FollowChat
91
91
  @messages << Message.new(
92
92
  role: 'assistant',
93
93
  content: '',
94
- thinking: ('' if @chat.think.on?)
94
+ thinking: ('' if @chat.think?)
95
95
  )
96
96
  @user = message_type(@messages.last.images) + " " +
97
97
  bold { color(111) { 'assistant:' } }
@@ -106,7 +106,7 @@ class OllamaChat::FollowChat
106
106
  # and thinking
107
107
  def update_last_message(response)
108
108
  @messages.last.content << response.message&.content
109
- if @chat.think.on? and response_thinking = response.message&.thinking.full?
109
+ if @chat.think_loud? and response_thinking = response.message&.thinking.full?
110
110
  @messages.last.thinking << response_thinking
111
111
  end
112
112
  end
@@ -122,12 +122,12 @@ class OllamaChat::FollowChat
122
122
  content, thinking = @messages.last.content, @messages.last.thinking
123
123
  if @chat.markdown.on?
124
124
  content = talk_annotate { @chat.kramdown_ansi_parse(content) }
125
- if @chat.think.on?
126
- thinking = think_annotate { @chat.kramdown_ansi_parse(content) }
125
+ if @chat.think_loud?
126
+ thinking = think_annotate { @chat.kramdown_ansi_parse(thinking) }
127
127
  end
128
128
  else
129
129
  content = talk_annotate { content }
130
- @chat.think.on? and thinking = think_annotate { @messages.last.thinking.full? }
130
+ @chat.think? and thinking = think_annotate { thinking }
131
131
  end
132
132
  @output.print(*([
133
133
  clear_screen, move_home, @user, ?\n, thinking, content
@@ -99,7 +99,8 @@ module OllamaChat::Information
99
99
  end
100
100
  markdown.show
101
101
  stream.show
102
- think.show
102
+ think_show
103
+ think_loud.show
103
104
  location.show
104
105
  voice.show
105
106
  if @voice.on?
@@ -136,7 +137,8 @@ module OllamaChat::Information
136
137
  /info show information for current session
137
138
  /config output current configuration (#{@ollama_chat_config.filename.to_s.inspect})
138
139
  /document_policy pick a scan policy for document references
139
- /think enable ollama think setting for models
140
+ /think choose ollama think mode setting for models
141
+ /think_loud enable to think out loud instead of silently
140
142
  /import source import the source's content
141
143
  /summarize [n] source summarize the source's content in n words
142
144
  /embedding toggle embedding paused or not
@@ -34,7 +34,7 @@ module OllamaChat::MessageFormat
34
34
  def think_annotate(&block)
35
35
  string = block.()
36
36
  string.to_s.size == 0 and return
37
- if @chat.think.on?
37
+ if @chat.think?
38
38
  "💭\n#{string}\n"
39
39
  end
40
40
  end
@@ -48,7 +48,7 @@ module OllamaChat::MessageFormat
48
48
  def talk_annotate(&block)
49
49
  string = block.()
50
50
  string.to_s.size == 0 and return
51
- if @chat.think.on?
51
+ if @chat.think?
52
52
  "💬\n#{string}\n"
53
53
  else
54
54
  string
@@ -344,7 +344,7 @@ class OllamaChat::MessageList
344
344
  when 'system' then 213
345
345
  else 210
346
346
  end
347
- thinking = if @chat.think.on?
347
+ thinking = if @chat.think?
348
348
  think_annotate do
349
349
  message.thinking.full? { @chat.markdown.on? ? @chat.kramdown_ansi_parse(_1) : _1 }
350
350
  end
@@ -42,6 +42,7 @@ markdown: true
42
42
  stream: true
43
43
  document_policy: importing
44
44
  think: false
45
+ think_loud: true
45
46
  embedding:
46
47
  enabled: true
47
48
  paused: false
@@ -40,8 +40,6 @@ module OllamaChat::Switches
40
40
 
41
41
  # The show method outputs the current value of the message to standard
42
42
  # output.
43
- #
44
- # @return [ void ]
45
43
  def show
46
44
  STDOUT.puts @msg[value]
47
45
  end
@@ -137,17 +135,17 @@ module OllamaChat::Switches
137
135
  # @return [ OllamaChat::Switches::Switch ] the stream switch instance
138
136
  attr_reader :stream
139
137
 
140
- # The think method returns the current state of the thinking switch.
141
- #
142
- # @return [ OllamaChat::Switches::Switch ] the thinking switch instance
143
- attr_reader :think
144
-
145
138
  # The markdown attribute reader returns the markdown switch object.
146
139
  # The voice reader returns the voice switch instance.
147
140
  #
148
141
  # @return [ OllamaChat::Switches::Switch ] the markdown switch instance
149
142
  attr_reader :markdown
150
143
 
144
+ # The think_loud method returns the current state of the think loud switch.
145
+ #
146
+ # @return [ OllamaChat::Switches::Switch ] the think loud switch instance
147
+ attr_reader :think_loud
148
+
151
149
  # The voice reader returns the voice switch instance.
152
150
  #
153
151
  # @return [ OllamaChat::Switches::Switch ] the voice switch instance
@@ -193,11 +191,11 @@ module OllamaChat::Switches
193
191
  }
194
192
  )
195
193
 
196
- @think = Switch.new(
197
- value: config.think,
194
+ @think_loud = Switch.new(
195
+ value: config.think_loud,
198
196
  msg: {
199
- true => "Thinking enabled.",
200
- false => "Thinking disabled.",
197
+ true => "Thinking out loud, show thinking annotations.",
198
+ false => "Thinking silently, don't show thinking annotations.",
201
199
  }
202
200
  )
203
201
 
@@ -0,0 +1,64 @@
1
+ # A module that provides thinking control functionality for OllamaChat.
2
+ #
3
+ # The ThinkControl module encapsulates methods for managing the 'think' mode
4
+ # setting in OllamaChat sessions. It handles the selection of different
5
+ # thinking modes, checking the current state, and displaying the current
6
+ # think mode status.
7
+ module OllamaChat::ThinkControl
8
+ # The think method returns the current state of the think mode.
9
+ #
10
+ # @return [ true, false, String ] the think mode
11
+ attr_reader :think
12
+
13
+ # The choose_think_mode method presents a menu to select a think mode.
14
+ #
15
+ # This method displays available think modes to the user and sets the
16
+ # selected mode as the current think mode for the chat session.
17
+ def choose_think_mode
18
+ think_modes = %w[ off on low medium high [EXIT] ]
19
+ case chosen = OllamaChat::Utils::Chooser.choose(think_modes)
20
+ when '[EXIT]', nil
21
+ STDOUT.puts "Exiting chooser."
22
+ when 'off'
23
+ @think = false
24
+ when 'on'
25
+ @think = true
26
+ when 'low', 'medium', 'high'
27
+ @think = chosen
28
+ end
29
+ end
30
+
31
+ # The think? method checks if the think mode is enabled.
32
+ #
33
+ # @return [ TrueClass, FalseClass ] true if think mode is enabled, false
34
+ # otherwise
35
+ def think?
36
+ !!think
37
+ end
38
+
39
+ # The think_mode method returns the current think mode status as a string.
40
+ #
41
+ # @return [ String ] returns 'enabled' if think mode is true, the think mode
42
+ # value if it's a string, or 'disabled' if think mode is false or nil
43
+ def think_mode
44
+ think == true ? 'enabled' : think || 'disabled'
45
+ end
46
+
47
+ # The think_show method displays the current think mode status.
48
+ #
49
+ # This method checks the current think mode setting and outputs a message
50
+ # indicating whether think mode is enabled, disabled, or set to a specific
51
+ # mode level (low, medium, high).
52
+ def think_show
53
+ STDOUT.puts "Think mode is #{bold(think_mode)}."
54
+ end
55
+
56
+ # The think_loud? method checks if both think mode and think loud mode are
57
+ # enabled.
58
+ #
59
+ # @return [ TrueClass, FalseClass ] true if think mode is enabled and think
60
+ # loud mode is on, false otherwise
61
+ def think_loud?
62
+ think? && think_loud.on?
63
+ end
64
+ end
@@ -19,8 +19,6 @@ class OllamaChat::Utils::CacheFetcher
19
19
  # The initialize method sets up the cache instance variable for the object.
20
20
  #
21
21
  # @param cache [ Object ] the cache object to be stored
22
- #
23
- # @return [ void ]
24
22
  def initialize(cache)
25
23
  @cache = cache
26
24
  end
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.42'
3
+ VERSION = '0.0.43'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/lib/ollama_chat.rb CHANGED
@@ -25,6 +25,7 @@ require 'ollama_chat/parsing'
25
25
  require 'ollama_chat/source_fetching'
26
26
  require 'ollama_chat/web_searching'
27
27
  require 'ollama_chat/dialog'
28
+ require 'ollama_chat/think_control'
28
29
  require 'ollama_chat/information'
29
30
  require 'ollama_chat/message_output'
30
31
  require 'ollama_chat/clipboard'
data/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.42 ruby lib
2
+ # stub: ollama_chat 0.0.43 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.42".freeze
6
+ s.version = "0.0.43".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = "The app provides a command-line interface (CLI) to an Ollama AI model,\nallowing users to engage in text-based conversations and generate\nhuman-like responses. Users can import data from local files or web pages,\nwhich are then processed through three different modes: fully importing the\ncontent into the conversation context, summarizing the information for\nconcise reference, or storing it in an embedding vector database for later\nretrieval based on the conversation.\n".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_chat".freeze, "ollama_chat_send".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
- s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
+ s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
17
17
  s.homepage = "https://github.com/flori/ollama_chat".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "OllamaChat - A command-line interface (CLI) for interacting with an Ollama AI model.".freeze, "--main".freeze, "README.md".freeze]
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
34
34
  s.add_development_dependency(%q<context_spook>.freeze, [">= 0".freeze])
35
35
  s.add_runtime_dependency(%q<excon>.freeze, ["~> 1.0".freeze])
36
- s.add_runtime_dependency(%q<ollama-ruby>.freeze, ["~> 1.14".freeze])
36
+ s.add_runtime_dependency(%q<ollama-ruby>.freeze, ["~> 1.16".freeze])
37
37
  s.add_runtime_dependency(%q<documentrix>.freeze, ["~> 0.0".freeze, ">= 0.0.2".freeze])
38
38
  s.add_runtime_dependency(%q<unix_socks>.freeze, ["~> 0.1".freeze])
39
39
  s.add_runtime_dependency(%q<rss>.freeze, ["~> 0.3".freeze])
@@ -312,7 +312,8 @@ describe OllamaChat::Chat, protect_env: true do
312
312
  Streaming|
313
313
  Location|
314
314
  Document\ policy|
315
- Thinking|
315
+ Think\ mode|
316
+ Thinking\ out\ loud|
316
317
  Voice\ output|
317
318
  Currently\ selected\ search\ engine|
318
319
  Conversation\ length
@@ -8,7 +8,8 @@ describe OllamaChat::FollowChat do
8
8
  end
9
9
 
10
10
  let :chat do
11
- double('Chat', markdown: double(on?: false), think: double(on?: false), debug: false)
11
+ double('Chat', markdown: double(on?: false), think_loud?: true,
12
+ think?: false, debug: false)
12
13
  end
13
14
 
14
15
  let :follow_chat do
@@ -103,7 +103,7 @@ describe OllamaChat::MessageList do
103
103
 
104
104
  it 'shows nothing when the last message is by the assistant' do
105
105
  list = described_class.new(chat)
106
- allow(chat).to receive(:think).and_return(double(on?: false))
106
+ allow(chat).to receive(:think?).and_return(false)
107
107
  allow(chat).to receive(:markdown).and_return(double(on?: false))
108
108
  list << Ollama::Message.new(role: 'assistant', content: 'hello')
109
109
  expect(STDOUT).to receive(:puts).
@@ -119,7 +119,7 @@ describe OllamaChat::MessageList do
119
119
  end
120
120
 
121
121
  it "shows last N messages when N is larger than available messages" do
122
- allow(chat).to receive(:think).and_return(double(on?: false))
122
+ allow(chat).to receive(:think?).and_return(false)
123
123
  allow(chat).to receive(:markdown).and_return(double(on?: false))
124
124
  list = described_class.new(chat)
125
125
  list << Ollama::Message.new(role: 'system', content: 'hello')
@@ -139,8 +139,7 @@ describe OllamaChat::MessageList do
139
139
  it 'can show last message' do
140
140
  expect(chat).to receive(:markdown).
141
141
  and_return(double(on?: true)).at_least(:once)
142
- expect(chat).to receive(:think).
143
- and_return(double(on?: false)).at_least(:once)
142
+ expect(chat).to receive(:think?).and_return(false).at_least(:once)
144
143
  expect(STDOUT).to receive(:puts).
145
144
  with("📨 \e[1m\e[38;5;213msystem\e[0m\e[0m:\nhello\n")
146
145
  list.show_last
@@ -149,8 +148,7 @@ describe OllamaChat::MessageList do
149
148
  it 'can list conversations without thinking' do
150
149
  expect(chat).to receive(:markdown).
151
150
  and_return(double(on?: true)).at_least(:once)
152
- expect(chat).to receive(:think).
153
- and_return(double(on?: false)).at_least(:once)
151
+ expect(chat).to receive(:think?).and_return(false).at_least(:once)
154
152
  list << Ollama::Message.new(role: 'user', content: 'world')
155
153
  expect(STDOUT).to receive(:puts).
156
154
  with(
@@ -163,8 +161,7 @@ describe OllamaChat::MessageList do
163
161
  it 'can list conversations with thinking' do
164
162
  expect(chat).to receive(:markdown).
165
163
  and_return(double(on?: true)).at_least(:once)
166
- expect(chat).to receive(:think).
167
- and_return(double(on?: true)).at_least(:once)
164
+ expect(chat).to receive(:think?).and_return(true).at_least(:once)
168
165
  expect(STDOUT).to receive(:puts).
169
166
  with(
170
167
  "📨 \e[1m\e[38;5;213msystem\e[0m\e[0m:\n" \
@@ -190,8 +187,7 @@ describe OllamaChat::MessageList do
190
187
  it 'can list conversations' do
191
188
  expect(chat).to receive(:markdown).
192
189
  and_return(double(on?: true)).at_least(:once)
193
- expect(chat).to receive(:think).
194
- and_return(double(on?: false)).at_least(:once)
190
+ expect(chat).to receive(:think?).and_return(false).at_least(:once)
195
191
  list << Ollama::Message.new(role: 'user', content: 'world')
196
192
  list.list_conversation
197
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.42
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '1.14'
144
+ version: '1.16'
145
145
  type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '1.14'
151
+ version: '1.16'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: documentrix
154
154
  requirement: !ruby/object:Gem::Requirement
@@ -406,6 +406,7 @@ extra_rdoc_files:
406
406
  - lib/ollama_chat/server_socket.rb
407
407
  - lib/ollama_chat/source_fetching.rb
408
408
  - lib/ollama_chat/switches.rb
409
+ - lib/ollama_chat/think_control.rb
409
410
  - lib/ollama_chat/utils.rb
410
411
  - lib/ollama_chat/utils/cache_fetcher.rb
411
412
  - lib/ollama_chat/utils/chooser.rb
@@ -445,6 +446,7 @@ files:
445
446
  - lib/ollama_chat/server_socket.rb
446
447
  - lib/ollama_chat/source_fetching.rb
447
448
  - lib/ollama_chat/switches.rb
449
+ - lib/ollama_chat/think_control.rb
448
450
  - lib/ollama_chat/utils.rb
449
451
  - lib/ollama_chat/utils/cache_fetcher.rb
450
452
  - lib/ollama_chat/utils/chooser.rb