ollama_chat 0.0.84 → 0.0.85
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 +24 -0
- data/README.md +4 -2
- data/Rakefile +1 -1
- data/lib/ollama_chat/chat.rb +13 -4
- data/lib/ollama_chat/dialog.rb +21 -0
- data/lib/ollama_chat/follow_chat.rb +1 -1
- data/lib/ollama_chat/input_content.rb +9 -0
- data/lib/ollama_chat/personae_management.rb +1 -1
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +3 -3
- data/spec/ollama_chat/chat_spec.rb +12 -4
- 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: 4a9e61c3d789441bb11ee79fe2ec63f219cc8d938845a7dc6fe9c8f6d012d5bb
|
|
4
|
+
data.tar.gz: f453e609568a6df073fbaf865860fa1c919419b728c309ae0e19e97dc09d6b52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24fadb41107daee4f625bb3d80743c8323624da545e6386b07ef25da5be3974afa2b0759a8db86d44eea04c9b156b92400e6a348d6bd9aae3dd71791939533bd
|
|
7
|
+
data.tar.gz: 7c43765e2da1f09781b6a8b0af70ea562cdec22fbdb4c92ab7f4eca033fdd3b9f79a55cbe3d7c3e91684c771a29cca95c76f26c44b7871cf9e142c3d0ca12179
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-29 v0.0.85
|
|
4
|
+
|
|
5
|
+
- Added `list` and `rename` subcommands to the `/collection` command, allowing
|
|
6
|
+
users to display available collections and rename them via the
|
|
7
|
+
`rename_collection` method in `lib/ollama_chat/dialog.rb`.
|
|
8
|
+
- Enhanced the `/collection` command to be optional; running `/collection`
|
|
9
|
+
without arguments now displays collection statistics by invoking the
|
|
10
|
+
`collection_stats` method.
|
|
11
|
+
- Updated `README.md` to reflect new command options and adjusted help text for
|
|
12
|
+
the `/collection` command.
|
|
13
|
+
- Modified tests in `spec/ollama_chat/chat_spec.rb` to accommodate new command
|
|
14
|
+
options and collection handling.
|
|
15
|
+
- Adjusted `regexp` and `complete` configurations in `lib/ollama_chat/chat.rb`
|
|
16
|
+
for the `/collection` command.
|
|
17
|
+
- Updated the `documentrix` dependency from **0.0.4** to **0.1.0**.
|
|
18
|
+
- Introduced progress feedback in `lib/ollama_chat/input_content.rb` within the
|
|
19
|
+
`provide_file_set_content` method, displaying `count/total` for batch
|
|
20
|
+
processing or just `count` for interactive mode.
|
|
21
|
+
- Optimized persona loading logic to skip setting a default persona if the
|
|
22
|
+
conversation already contains messages, while retaining fallbacks from
|
|
23
|
+
command-line options for new conversations.
|
|
24
|
+
- Fixed the warning condition in `OllamaChat::FollowChat` by correcting the
|
|
25
|
+
success check in `lib/ollama_chat/follow_chat.rb`.
|
|
26
|
+
|
|
3
27
|
## 2026-03-26 v0.0.84
|
|
4
28
|
|
|
5
29
|
- Added `OllamaChat::Utils::ValueFormatter` with helper `format_bytes` in
|
data/README.md
CHANGED
|
@@ -209,8 +209,10 @@ The following commands can be given inside the chat, if prefixed by a `/`:
|
|
|
209
209
|
├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
|
|
210
210
|
│ /load │ │ path │ load conversation messages │
|
|
211
211
|
├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
|
|
212
|
-
│ /collection │ change
|
|
213
|
-
│ │ clear
|
|
212
|
+
│ /collection │ change │ │ display, clear (current), change, list, or rename │
|
|
213
|
+
│ │ clear │ │ collection │
|
|
214
|
+
│ │ list │ │ │
|
|
215
|
+
│ │ rename │ │ │
|
|
214
216
|
├──────────────────┼────────────────────┼──────────────────┼──────────────────────────────────────────────────────────┤
|
|
215
217
|
│ /persona │ add │ │ manage and load/play personae for roleplay │
|
|
216
218
|
│ │ delete │ │ │
|
data/Rakefile
CHANGED
|
@@ -42,7 +42,7 @@ GemHadar do
|
|
|
42
42
|
|
|
43
43
|
dependency 'excon', '~> 1.0'
|
|
44
44
|
dependency 'ollama-ruby', '~> 1.21'
|
|
45
|
-
dependency 'documentrix', '>= 0.0
|
|
45
|
+
dependency 'documentrix', '>= 0.1.0'
|
|
46
46
|
dependency 'unix_socks', '~> 0.3'
|
|
47
47
|
dependency 'rss', '~> 0.3'
|
|
48
48
|
dependency 'term-ansicolor', '~> 1.11'
|
data/lib/ollama_chat/chat.rb
CHANGED
|
@@ -479,11 +479,12 @@ class OllamaChat::Chat
|
|
|
479
479
|
|
|
480
480
|
command(
|
|
481
481
|
name: :collection,
|
|
482
|
-
regexp: %r(^/collection(?:\s+(clear|change))?$),
|
|
483
|
-
complete: [ 'collection', %w[ clear change ] ],
|
|
484
|
-
|
|
482
|
+
regexp: %r(^/collection(?:\s+(clear|change|list|rename))?$),
|
|
483
|
+
complete: [ 'collection', %w[ clear change list rename ] ],
|
|
484
|
+
optional: true,
|
|
485
|
+
help: 'display, clear (current), change, list, or rename collection'
|
|
485
486
|
) do |subcommand|
|
|
486
|
-
case subcommand
|
|
487
|
+
case subcommand
|
|
487
488
|
when 'clear'
|
|
488
489
|
loop do
|
|
489
490
|
tags = @documents.tags.add('[EXIT]').add('[ALL]')
|
|
@@ -509,6 +510,14 @@ class OllamaChat::Chat
|
|
|
509
510
|
end
|
|
510
511
|
when 'change'
|
|
511
512
|
choose_collection(@documents.collection)
|
|
513
|
+
when 'list'
|
|
514
|
+
current_collection = @documents.collection
|
|
515
|
+
puts @documents.collections.
|
|
516
|
+
map { |c| current_collection == c ? bold { c } : c }
|
|
517
|
+
when 'rename'
|
|
518
|
+
rename_collection(@documents.collection)
|
|
519
|
+
when nil
|
|
520
|
+
collection_stats
|
|
512
521
|
end
|
|
513
522
|
:next
|
|
514
523
|
end
|
data/lib/ollama_chat/dialog.rb
CHANGED
|
@@ -135,6 +135,27 @@ module OllamaChat::Dialog
|
|
|
135
135
|
info
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
+
# Rename an existing collection to a new, user‑supplied name.
|
|
139
|
+
#
|
|
140
|
+
# This helper prompts the user to provide a new name for the collection
|
|
141
|
+
# identified by <code>current_collection</code>. It then renames the current
|
|
142
|
+
# collection to have the new_name and switches to it.
|
|
143
|
+
#
|
|
144
|
+
# @param current_collection [Symbol] the current collection name
|
|
145
|
+
def rename_collection(current_collection)
|
|
146
|
+
prompt = 'Rename collection %s to: ' % current_collection
|
|
147
|
+
if new_collection = ask?(prompt:).full?(:to_sym)
|
|
148
|
+
begin
|
|
149
|
+
@documents.rename_collection(new_collection)
|
|
150
|
+
STDOUT.puts "Renamed current collection #{current_collection} to #{new_collection}."
|
|
151
|
+
rescue
|
|
152
|
+
STDERR.puts "Renaming to #{new_collection} failed, it already exists."
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
STDOUT.puts "Renaming cancelled."
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
138
159
|
# The change_system_prompt method allows the user to select or enter a new
|
|
139
160
|
# system prompt for the chat session.
|
|
140
161
|
# It provides an interactive chooser when multiple prompts match the given
|
|
@@ -161,7 +161,16 @@ module OllamaChat::InputContent
|
|
|
161
161
|
# @yield [filename] the block that processes each filename
|
|
162
162
|
# @return [String] the concatenated result of the block applied to each file
|
|
163
163
|
def provide_file_set_content(patterns, all: false, &block)
|
|
164
|
+
total = 0
|
|
165
|
+
all and file_set_each(patterns, all:) { total += 1 }
|
|
166
|
+
count = 0
|
|
164
167
|
file_set_each(patterns, all:).each_with_object('') do |filename, result|
|
|
168
|
+
count += 1
|
|
169
|
+
if all
|
|
170
|
+
STDOUT.puts "Handling File (#{bold{count}}/#{bold{total}}):"
|
|
171
|
+
else
|
|
172
|
+
STDOUT.puts "Handling File (#{bold{count}}):"
|
|
173
|
+
end
|
|
165
174
|
result << ("%s:\n\n%s\n\n" % [ filename, block.(filename) ])
|
|
166
175
|
end.full?
|
|
167
176
|
end
|
|
@@ -40,7 +40,7 @@ module OllamaChat::PersonaeManagement
|
|
|
40
40
|
# playing the persona file if it exists.
|
|
41
41
|
def setup_persona_from_opts
|
|
42
42
|
@default_persona and return
|
|
43
|
-
@
|
|
43
|
+
@messages.size > 0 and return
|
|
44
44
|
if persona = @opts[?p].full? { Pathname.new(_1) }
|
|
45
45
|
if persona.extname == '.md'
|
|
46
46
|
pathname = persona
|
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.85 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.85".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]
|
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
|
35
35
|
s.add_development_dependency(%q<utils>.freeze, [">= 0".freeze])
|
|
36
36
|
s.add_runtime_dependency(%q<excon>.freeze, ["~> 1.0".freeze])
|
|
37
37
|
s.add_runtime_dependency(%q<ollama-ruby>.freeze, ["~> 1.21".freeze])
|
|
38
|
-
s.add_runtime_dependency(%q<documentrix>.freeze, [">= 0.0
|
|
38
|
+
s.add_runtime_dependency(%q<documentrix>.freeze, [">= 0.1.0".freeze])
|
|
39
39
|
s.add_runtime_dependency(%q<unix_socks>.freeze, ["~> 0.3".freeze])
|
|
40
40
|
s.add_runtime_dependency(%q<rss>.freeze, ["~> 0.3".freeze])
|
|
41
41
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.11".freeze])
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
describe OllamaChat::Chat, protect_env: true do
|
|
2
|
+
let :collection do
|
|
3
|
+
"test-#{Random.hex}"
|
|
4
|
+
end
|
|
5
|
+
|
|
2
6
|
let :argv do
|
|
3
|
-
chat_default_config(%w[ -C
|
|
7
|
+
chat_default_config(%w[ -C ] << collection)
|
|
4
8
|
end
|
|
5
9
|
|
|
6
10
|
before do
|
|
@@ -153,6 +157,10 @@ describe OllamaChat::Chat, protect_env: true do
|
|
|
153
157
|
expect(chat).to receive(:info)
|
|
154
158
|
expect(STDOUT).to receive(:puts).with(/./)
|
|
155
159
|
expect(chat.handle_input("/collection change")).to eq :next
|
|
160
|
+
expect(STDOUT).to receive(:puts).with(array_including(:default))
|
|
161
|
+
expect(chat.handle_input("/collection list")).to eq :next
|
|
162
|
+
expect(chat).to receive(:rename_collection).with(collection.to_sym)
|
|
163
|
+
expect(chat.handle_input("/collection rename")).to eq :next
|
|
156
164
|
end
|
|
157
165
|
|
|
158
166
|
it 'returns :next when input is "/info"' do
|
|
@@ -358,7 +366,7 @@ describe OllamaChat::Chat, protect_env: true do
|
|
|
358
366
|
connect_to_ollama_server(instantiate: false)
|
|
359
367
|
|
|
360
368
|
let :argv do
|
|
361
|
-
chat_default_config(%w[ -C
|
|
369
|
+
chat_default_config(%w[ -C ] << collection << '-c' << asset('conversation.json'))
|
|
362
370
|
end
|
|
363
371
|
|
|
364
372
|
it 'dispays the last exchange of the converstation' do
|
|
@@ -396,7 +404,7 @@ describe OllamaChat::Chat, protect_env: true do
|
|
|
396
404
|
connect_to_ollama_server(instantiate: false)
|
|
397
405
|
|
|
398
406
|
let :argv do
|
|
399
|
-
chat_default_config(%w[ -C
|
|
407
|
+
chat_default_config(%w[ -C ] << collection << '-D' << asset('example.html'))
|
|
400
408
|
end
|
|
401
409
|
|
|
402
410
|
it 'Adds documents passed to app via -D option' do
|
|
@@ -421,7 +429,7 @@ describe OllamaChat::Chat, protect_env: true do
|
|
|
421
429
|
it 'can display collection_stats' do
|
|
422
430
|
chat
|
|
423
431
|
expect(STDOUT).to receive(:puts).with(
|
|
424
|
-
"Current Collection\n Name: \e[
|
|
432
|
+
"Current Collection\n Name: \e[1m#{collection}\e[0m\n #Embeddings: 0\n #Tags: 0\n Tags: \n"
|
|
425
433
|
)
|
|
426
434
|
expect(chat.collection_stats).to be_nil
|
|
427
435
|
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.
|
|
4
|
+
version: 0.0.85
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -169,14 +169,14 @@ dependencies:
|
|
|
169
169
|
requirements:
|
|
170
170
|
- - ">="
|
|
171
171
|
- !ruby/object:Gem::Version
|
|
172
|
-
version: 0.0
|
|
172
|
+
version: 0.1.0
|
|
173
173
|
type: :runtime
|
|
174
174
|
prerelease: false
|
|
175
175
|
version_requirements: !ruby/object:Gem::Requirement
|
|
176
176
|
requirements:
|
|
177
177
|
- - ">="
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: 0.0
|
|
179
|
+
version: 0.1.0
|
|
180
180
|
- !ruby/object:Gem::Dependency
|
|
181
181
|
name: unix_socks
|
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|