ollama_chat 0.0.97 → 0.0.98

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: 83e62a371bea41c14f117fc546d3acf8e8a22d6c7f3be71a06f5dbb9f76a0201
4
- data.tar.gz: 1348fecdb529bd12784e3843fcee09228d422db9f82a06554e6cf1923d318971
3
+ metadata.gz: 3794355ad924879293253f68420d41eb6e5bc4e766d20fbb9292dea3f9905372
4
+ data.tar.gz: 907e863402ec2bb4a225dc21a47751b69bf2f3b72e8776bd9eeba70f275a5f72
5
5
  SHA512:
6
- metadata.gz: f53884d1050759f8d32731f872e3746f92fc3b9747ecfdb12015bafc39cd98dd1e3fc977c831f116a7b95ece70fd8fc2cbfc760803d06207a2cf49584138a6de
7
- data.tar.gz: 78144c20b98504852ce74ce33709b9a5592865d9fc75c49edc5cb23ce93a767275d5f090c38d77450be6e503b5b37cdbe895650b25f0e07f91cb118d8a7f59dc
6
+ metadata.gz: e8cfbc674eaa28164c9599686db526d70c7aeb1076ce9b2b6d160fb220f712c376a06df3dd41a55e327c26c965c8e06e049ade22dd886bd3c8555967e0658865
7
+ data.tar.gz: 42da21a93f2295cd0cdbc01c8ad4bd2a12a93fb017c00e086336f46b2a358f29dea2b87a454298673c1d913404b1cf472682d1c7d56f3c82d961a0f40a8b63ed
data/CHANGES.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-07-09 v0.0.98
4
+
5
+ ### Added
6
+
7
+ - Implemented `prefill_prompt` getter and setter in `lib/ollama_chat/chat.rb`
8
+ with accompanying YARD documentation.
9
+
10
+ ### Changed
11
+
12
+ - Updated `lib/ollama_chat/commands.rb` to persist the result of
13
+ `suggest_prompts` as `self.prefill_prompt`, allowing prefilled prompts to be
14
+ stored in history for reuse and modification.
15
+ - Refactored call sites in `lib/ollama_chat/chat.rb`,
16
+ `lib/ollama_chat/commands.rb`, and `lib/ollama_chat/personae_management.rb`
17
+ to use the `self.prefill_prompt` interface instead of the `@prefill_prompt`
18
+ instance variable.
19
+ - Wrapped the output of the `info` subcommand in `use_pager` within
20
+ `lib/ollama_chat/commands.rb`.
21
+ - Added a confirmation message to the `import` subcommand in
22
+ `lib/ollama_chat/commands.rb`.
23
+ - Refined the description of the `directory_structure` tool in
24
+ `lib/ollama_chat/tools/directory_structure.rb` to include warnings regarding
25
+ token usage and the exponential growth of nodes relative to the `max_depth`
26
+ parameter.
27
+
3
28
  ## 2026-07-06 v0.0.97
4
29
 
5
30
  ### New Features
@@ -302,6 +302,18 @@ class OllamaChat::Chat
302
302
  !!@parse_content
303
303
  end
304
304
 
305
+ # Returns whether there is a prompt waiting to be prefilled into the input buffer.
306
+ #
307
+ # @return [Boolean] true if a prefill prompt exists and is not empty, false otherwise
308
+ def prefill_prompt
309
+ @prefill_prompt.full?
310
+ end
311
+
312
+ # Sets the content to be prefilled into the next user input prompt.
313
+ #
314
+ # @param prefill_prompt [String, nil] The text to prefill, or nil to clear it
315
+ attr_writer :prefill_prompt
316
+
305
317
  # Handles user input commands and processes chat interactions.
306
318
  #
307
319
  # @param content [String] The input content to process
@@ -388,10 +400,10 @@ class OllamaChat::Chat
388
400
  tools_were_called and type = :tool_input
389
401
  unless tools_were_called
390
402
  content = enable_command_completion do
391
- if prefill_prompt = @prefill_prompt.full?
403
+ if prefill_prompt
392
404
  Reline.pre_input_hook = -> {
393
405
  Reline.insert_text prefill_prompt.gsub(/\n*\z/, '')
394
- @prefill_prompt = nil
406
+ self.prefill_prompt = nil
395
407
  }
396
408
  else
397
409
  Reline.pre_input_hook = nil
@@ -536,14 +536,16 @@ module OllamaChat::Commands
536
536
  end
537
537
  when 'suggest'
538
538
  opts = go_command('e', opts)
539
- prompt = suggest_prompts(edit: opts[?e]) and next prompt
539
+ if prompt = suggest_prompts(edit: opts[?e])
540
+ self.prefill_prompt = prompt
541
+ end
540
542
  when nil, '-e'
541
543
  if prompt = choose_prompt(prompt: 'Which template shall guide the next response? %s').full?(&:to_s)
542
544
  if subcommand
543
545
  prompt = edit_text(prompt)
544
546
  next prompt
545
547
  else
546
- @prefill_prompt = prompt
548
+ self.prefill_prompt = prompt
547
549
  end
548
550
  end
549
551
  end
@@ -734,13 +736,16 @@ module OllamaChat::Commands
734
736
  }
735
737
  case subcommand
736
738
  when 'info'
737
- puts json_to_yaml.(data)
739
+ use_pager do |output|
740
+ output.puts json_to_yaml.(data)
741
+ end
738
742
  :next
739
743
  when 'load'
740
744
  disable_content_parsing
741
745
  data
742
746
  when 'import'
743
- import_persona_from_json(data)
747
+ persona_name = import_persona_from_json(data)
748
+ STDOUT.puts "Imported character as persona %s." % persona_name.to_s.inspect
744
749
  :next
745
750
  end
746
751
  end
@@ -269,7 +269,7 @@ module OllamaChat::PersonaeManagement
269
269
  persona = choose_persona(prompt: "Which persona's path do you need? %s") or return
270
270
  path = persona_name_to_pathname(persona).to_s
271
271
  perform_copy_to_clipboard(text: path, edit: false)
272
- no_prefill or @prefill_prompt = path
272
+ no_prefill or self.prefill_prompt = path
273
273
  path
274
274
  end
275
275
 
@@ -29,7 +29,9 @@ class OllamaChat::Tools::DirectoryStructure
29
29
  Tree viewer – Returns JSON describing files/folders under path up to
30
30
  max_depth (<= height of the tree), optionally only files ending with
31
31
  suffix, e. g. rb for ruby files. Handy for locating resources or
32
- presenting a project layout.
32
+ presenting a project layout. Limit the required tokens by using the
33
+ max_depth parameter if possible, because the number of nodes in a
34
+ tree can grow exponentially with its height.
33
35
  EOT
34
36
  parameters: Tool::Function::Parameters.new(
35
37
  type: 'object',
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.97'
3
+ VERSION = '0.0.98'
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/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.97 ruby lib
2
+ # stub: ollama_chat 0.0.98 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.97".freeze
6
+ s.version = "0.0.98".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]
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.97
4
+ version: 0.0.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank