ollama_chat 0.0.17 → 0.0.18
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 +4 -4
- data/CHANGES.md +20 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/ollama_chat/chat.rb +11 -0
- data/lib/ollama_chat/dialog.rb +24 -1
- data/lib/ollama_chat/information.rb +1 -0
- data/lib/ollama_chat/ollama_chat_config/default_config.yml +1 -1
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b9fa311f0d8759e37629d79db604ca81c344699e18203efd60f4b3361eb95f0
|
4
|
+
data.tar.gz: '0727224708a9fb941a6572322793f0161fc21cee945ed08642fd41707c26d57f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba5167d27ca64037115b36fc77c405e85311f1595fb771835b3c55429305b2e6304e7064c30e08f57fb8d97e99ccda818cc45cb43681c25b42e120c30d9feb64
|
7
|
+
data.tar.gz: 43b994f34e3e161b49c989dfec1df0d02f6debb710c7a078902d3872b2bebea2fc3606481ef5d36142afba36b9a60a5daa80630663f2ef5614d30674e4329c1e
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2025-07-31 v0.0.18
|
4
|
+
|
5
|
+
* **Added /prompt command**: The `/prompt` command was added to the list of
|
6
|
+
supported commands, allowing users to prefill their input with text from
|
7
|
+
predefined prompts.
|
8
|
+
+ Integrated prompt handling in `lib/ollama_chat/chat.rb`, where a new case
|
9
|
+
statement for `/prompt` sets up prefill functionality.
|
10
|
+
+ Implemented prompt selection using the `choose_prompt` method in
|
11
|
+
`lib/ollama_chat/dialog.rb`.
|
12
|
+
+ Set up input hooks using `Reline.pre_input_hook` to insert selected prompts
|
13
|
+
before user input.
|
14
|
+
* **Improved user interaction**:
|
15
|
+
- Added model size display during model selection via the `model_with_size`
|
16
|
+
method in `lib/ollama_chat/dialog.rb`.
|
17
|
+
- Updated model selection logic to include formatted sizes in the display.
|
18
|
+
* **Optimized voice list generation**: In
|
19
|
+
`lib/ollama_chat/ollama_chat_config/default_config.yml`, updated the voice
|
20
|
+
list generation logic to use a more efficient method of retrieving voice
|
21
|
+
names.
|
22
|
+
|
3
23
|
## 2025-07-14 v0.0.17
|
4
24
|
|
5
25
|
* Implement Pager Support for List Command
|
data/README.md
CHANGED
@@ -131,6 +131,7 @@ The following commands can be given inside the chat, if prefixed by a `/`:
|
|
131
131
|
/drop [n] drop the last n exchanges, defaults to 1
|
132
132
|
/model change the model
|
133
133
|
/system [show] change/show system prompt
|
134
|
+
/prompt prefill user prompt with preset prompts
|
134
135
|
/regenerate the last answer message
|
135
136
|
/collection [clear|change] change (default) collection or clear
|
136
137
|
/info show information for current session
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.18
|
data/lib/ollama_chat/chat.rb
CHANGED
@@ -159,6 +159,9 @@ class OllamaChat::Chat
|
|
159
159
|
end
|
160
160
|
@messages.show_system_prompt
|
161
161
|
:next
|
162
|
+
when %r(^/prompt)
|
163
|
+
@prefill_prompt = choose_prompt
|
164
|
+
:next
|
162
165
|
when %r(^/regenerate$)
|
163
166
|
if content = messages.second_last&.content
|
164
167
|
content.gsub!(/\nConsider these chunks for your answer.*\z/, '')
|
@@ -350,6 +353,14 @@ class OllamaChat::Chat
|
|
350
353
|
input_prompt = bold { color(172) { message_type(@images) + " user" } } + bold { "> " }
|
351
354
|
begin
|
352
355
|
content = enable_command_completion do
|
356
|
+
if prefill_prompt = @prefill_prompt.full?
|
357
|
+
Reline.pre_input_hook = -> {
|
358
|
+
Reline.insert_text prefill_prompt.gsub(/\n*\z/, '')
|
359
|
+
@prefill_prompt = nil
|
360
|
+
}
|
361
|
+
else
|
362
|
+
Reline.pre_input_hook = nil
|
363
|
+
end
|
353
364
|
Reline.readline(input_prompt, true)&.chomp
|
354
365
|
end
|
355
366
|
rescue Interrupt
|
data/lib/ollama_chat/dialog.rb
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
module OllamaChat::Dialog
|
2
|
+
private def model_with_size(model)
|
3
|
+
result = model.name
|
4
|
+
formatted_size = Term::ANSIColor.bold {
|
5
|
+
Tins::Unit.format(model.size, unit: ?B, prefix: 1024, format: '%.1f %U')
|
6
|
+
}
|
7
|
+
result.singleton_class.class_eval do
|
8
|
+
define_method(:to_s) { "%s %s" % [ model.name, formatted_size ] }
|
9
|
+
end
|
10
|
+
result
|
11
|
+
end
|
12
|
+
|
2
13
|
def choose_model(cli_model, current_model)
|
3
14
|
selector = if cli_model =~ /\A\?+(.*)\z/
|
4
15
|
cli_model = ''
|
5
16
|
Regexp.new($1)
|
6
17
|
end
|
7
|
-
models = ollama.tags.models.
|
18
|
+
models = ollama.tags.models.sort_by(&:name).map { |m| model_with_size(m) }
|
8
19
|
selector and models = models.grep(selector)
|
9
20
|
model = if cli_model == ''
|
10
21
|
OllamaChat::Utils::Chooser.choose(models) || current_model
|
@@ -92,6 +103,18 @@ module OllamaChat::Dialog
|
|
92
103
|
@messages.set_system_prompt(system)
|
93
104
|
end
|
94
105
|
|
106
|
+
def choose_prompt
|
107
|
+
prompts = config.prompts.attribute_names
|
108
|
+
prompts.unshift('[EXIT]')
|
109
|
+
case chosen = OllamaChat::Utils::Chooser.choose(prompts)
|
110
|
+
when '[EXIT]', nil
|
111
|
+
STDOUT.puts "Exiting chooser."
|
112
|
+
return
|
113
|
+
when *prompts
|
114
|
+
config.prompts.send(chosen)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
95
118
|
def change_voice
|
96
119
|
chosen = OllamaChat::Utils::Chooser.choose(config.voice.list)
|
97
120
|
@current_voice = chosen.full? || config.voice.default
|
@@ -72,6 +72,7 @@ module OllamaChat::Information
|
|
72
72
|
/drop [n] drop the last n exchanges, defaults to 1
|
73
73
|
/model change the model
|
74
74
|
/system [show] change/show system prompt
|
75
|
+
/prompt prefill user prompt with preset prompts
|
75
76
|
/regenerate the last answer message
|
76
77
|
/collection [clear|change] change (default) collection or clear
|
77
78
|
/info show information for current session
|
@@ -32,7 +32,7 @@ system_prompts:
|
|
32
32
|
voice:
|
33
33
|
enabled: false
|
34
34
|
default: Samantha
|
35
|
-
list: <%= `say -v ? 2>/dev/null`.lines.map {
|
35
|
+
list: <%= `say -v ? 2>/dev/null`.lines.map { |l| l.force_encoding('ASCII-8BIT'); l[/^(.+?)\s+[a-z]{2}_[a-zA-Z0-9]{2,}/, 1] }.uniq.sort.to_s %>
|
36
36
|
markdown: true
|
37
37
|
stream: true
|
38
38
|
document_policy: importing
|
data/lib/ollama_chat/version.rb
CHANGED
data/ollama_chat.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ollama_chat 0.0.
|
2
|
+
# stub: ollama_chat 0.0.18 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ollama_chat".freeze
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.18".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]
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.specification_version = 4
|
26
26
|
|
27
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.
|
27
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.23".freeze])
|
28
28
|
s.add_development_dependency(%q<all_images>.freeze, ["~> 0.6".freeze])
|
29
29
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
|
30
30
|
s.add_development_dependency(%q<kramdown>.freeze, ["~> 2.0".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.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '1.
|
18
|
+
version: '1.23'
|
19
19
|
type: :development
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '1.
|
25
|
+
version: '1.23'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: all_images
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|