ollama_chat 0.0.37 → 0.0.39
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/.utilsrc +0 -1
- data/CHANGES.md +23 -0
- data/Rakefile +1 -1
- data/lib/ollama_chat/conversation.rb +3 -0
- data/lib/ollama_chat/message_list.rb +0 -4
- data/lib/ollama_chat/message_output.rb +24 -19
- 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: 1889968881db471ab1e18058241170ca20b6b0c4933b5f230796b61100d3fc65
|
|
4
|
+
data.tar.gz: 9c62ba5958195194cdb562d041d62785304928eab15849e4cb562a3e3fbb9e60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e02db941ef17c62a5dc8107fc189ea3fe13f20ba4936d22245f3f732e84bf9c697b98a33372300d0f3270aff4e0d7cbb93971d3c4d8a0cdeb246e308b27ef631
|
|
7
|
+
data.tar.gz: 31e70f4b3b9c4cd2ab990f41b4642818de01127b3c5ad700172a9a030cca86e27189287c4a4fbdbf6eeb46f5546cf77da847f1f331d14ea83f9e242673312c92
|
data/.utilsrc
CHANGED
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2025-11-14 v0.0.39
|
|
4
|
+
|
|
5
|
+
- Updated `tins` dependency version from `~> 1.41` to `~> 1.47` in `Rakefile` and `ollama_chat.gemspec`
|
|
6
|
+
- Updated clipboard command to use `ctc` for cross-platform support, which acts
|
|
7
|
+
as a wrapper to copy stdin to the clipboard
|
|
8
|
+
|
|
9
|
+
## 2025-11-11 v0.0.38
|
|
10
|
+
|
|
11
|
+
- Added `ask?` method call to confirm overwriting existing files when saving
|
|
12
|
+
conversations
|
|
13
|
+
- Modified `save_conversation` in `OllamaChat::Conversation` to prompt before
|
|
14
|
+
overwriting
|
|
15
|
+
- Removed explicit file existence check from `MessageList#save_conversation`
|
|
16
|
+
- Both `/save` and `/output` commands now support overwrite confirmation
|
|
17
|
+
- Replace `write_file_unless_exist` method with `attempt_to_write_file`
|
|
18
|
+
- Add user confirmation prompt before overwriting existing files
|
|
19
|
+
- Update method documentation to reflect new overwrite behavior
|
|
20
|
+
- Modify file writing logic to use `attempt_to_write_file` instead of direct
|
|
21
|
+
write
|
|
22
|
+
- Update `output` method to check return value of `attempt_to_write_file`
|
|
23
|
+
before printing success message
|
|
24
|
+
- Removed `xdg` gem from the list of dependencies in `code_indexer` block
|
|
25
|
+
|
|
3
26
|
## 2025-10-31 v0.0.37
|
|
4
27
|
|
|
5
28
|
- Refactored system prompt selection logic to use `case`/`when` statement
|
data/Rakefile
CHANGED
|
@@ -47,7 +47,7 @@ GemHadar do
|
|
|
47
47
|
dependency 'reverse_markdown', '~> 3.0'
|
|
48
48
|
dependency 'kramdown-ansi', '~> 0.2'
|
|
49
49
|
dependency 'complex_config', '~> 0.22', '>= 0.22.2'
|
|
50
|
-
dependency 'tins', '~> 1.
|
|
50
|
+
dependency 'tins', '~> 1.47'
|
|
51
51
|
dependency 'search_ui', '~> 0.0'
|
|
52
52
|
dependency 'amatch', '~> 0.4'
|
|
53
53
|
dependency 'pdf-reader', '~> 2.0'
|
|
@@ -24,6 +24,9 @@ module OllamaChat::Conversation
|
|
|
24
24
|
# @example Save conversation with explicit filename
|
|
25
25
|
# chat.save_conversation('conversations/2023-10-15_my_session.json')
|
|
26
26
|
def save_conversation(filename)
|
|
27
|
+
File.exist?(filename) &&
|
|
28
|
+
ask?(prompt: "File #{filename.inspect} already exists, overwrite? (y/n) ") !~ /\Ay/i and
|
|
29
|
+
return
|
|
27
30
|
if messages.save_conversation(filename)
|
|
28
31
|
STDOUT.puts "Saved conversation to #{filename.inspect}."
|
|
29
32
|
else
|
|
@@ -124,10 +124,6 @@ class OllamaChat::MessageList
|
|
|
124
124
|
#
|
|
125
125
|
# @return [ OllamaChat::MessageList ] self
|
|
126
126
|
def save_conversation(filename)
|
|
127
|
-
if File.exist?(filename)
|
|
128
|
-
STDERR.puts "File #{filename.inspect} already exists. Choose another filename."
|
|
129
|
-
return
|
|
130
|
-
end
|
|
131
127
|
File.open(filename, ?w) do |output|
|
|
132
128
|
output.puts JSON(@messages)
|
|
133
129
|
end
|
|
@@ -43,18 +43,16 @@ module OllamaChat::MessageOutput
|
|
|
43
43
|
|
|
44
44
|
# The output method writes the last assistant message to a file.
|
|
45
45
|
#
|
|
46
|
-
# @param filename [ String ] the path to the file where the
|
|
46
|
+
# @param filename [ String ] the path to the file where the last assistant
|
|
47
|
+
# message should be written
|
|
47
48
|
#
|
|
48
|
-
# @return [ Chat ] returns self
|
|
49
|
-
#
|
|
50
|
-
# @see write_file_unless_exist
|
|
51
|
-
#
|
|
52
|
-
# @note If no assistant message is available, an error message is printed to stderr.
|
|
49
|
+
# @return [ OllamaChat::Chat ] returns self
|
|
53
50
|
def output(filename)
|
|
54
51
|
if message = @messages.last and message.role == 'assistant'
|
|
55
52
|
begin
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if attempt_to_write_file(filename, message)
|
|
54
|
+
STDOUT.puts "Last response was written to #{filename.inspect}."
|
|
55
|
+
end
|
|
58
56
|
self
|
|
59
57
|
rescue => e
|
|
60
58
|
STDERR.puts "Writing to #{filename.inspect}, caused #{e.class}: #{e}."
|
|
@@ -66,22 +64,29 @@ module OllamaChat::MessageOutput
|
|
|
66
64
|
|
|
67
65
|
private
|
|
68
66
|
|
|
69
|
-
# The
|
|
70
|
-
#
|
|
67
|
+
# The attempt_to_write_file method handles writing content to a file with
|
|
68
|
+
# overwrite confirmation.
|
|
71
69
|
#
|
|
72
|
-
#
|
|
70
|
+
# This method checks if a file already exists and prompts the user for
|
|
71
|
+
# confirmation before overwriting it. If the user declines or if the file
|
|
72
|
+
# doesn't exist, the method returns early without writing. Otherwise, it
|
|
73
|
+
# opens the file in write mode and writes the message content to it.
|
|
74
|
+
#
|
|
75
|
+
# @param filename [ String ] the path to the file where the content should be written
|
|
73
76
|
# @param message [ Ollama::Message ] the message object containing the content to write
|
|
74
77
|
#
|
|
75
|
-
# @return [ TrueClass ] if the file was successfully
|
|
76
|
-
# @return [ nil ] if the
|
|
77
|
-
def
|
|
78
|
-
if File.exist?(filename)
|
|
79
|
-
|
|
78
|
+
# @return [ TrueClass ] returns true if the file was successfully written
|
|
79
|
+
# @return [ nil ] returns nil if the user chose not to overwrite or if an error occurred
|
|
80
|
+
def attempt_to_write_file(filename, message)
|
|
81
|
+
if !File.exist?(filename) ||
|
|
82
|
+
ask?(prompt: "File #{filename.inspect} already exists, overwrite? (y/n) ") =~ /\Ay/i
|
|
83
|
+
then
|
|
84
|
+
File.open(filename, ?w) do |output|
|
|
85
|
+
output.write(message.content)
|
|
86
|
+
end
|
|
87
|
+
else
|
|
80
88
|
return
|
|
81
89
|
end
|
|
82
|
-
File.open(filename, ?w) do |output|
|
|
83
|
-
output.write(message.content)
|
|
84
|
-
end
|
|
85
90
|
true
|
|
86
91
|
end
|
|
87
92
|
end
|
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.39 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.39".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]
|
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
|
43
43
|
s.add_runtime_dependency(%q<reverse_markdown>.freeze, ["~> 3.0".freeze])
|
|
44
44
|
s.add_runtime_dependency(%q<kramdown-ansi>.freeze, ["~> 0.2".freeze])
|
|
45
45
|
s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.22".freeze, ">= 0.22.2".freeze])
|
|
46
|
-
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.
|
|
46
|
+
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.47".freeze])
|
|
47
47
|
s.add_runtime_dependency(%q<search_ui>.freeze, ["~> 0.0".freeze])
|
|
48
48
|
s.add_runtime_dependency(%q<amatch>.freeze, ["~> 0.4".freeze])
|
|
49
49
|
s.add_runtime_dependency(%q<pdf-reader>.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.39
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -293,14 +293,14 @@ dependencies:
|
|
|
293
293
|
requirements:
|
|
294
294
|
- - "~>"
|
|
295
295
|
- !ruby/object:Gem::Version
|
|
296
|
-
version: '1.
|
|
296
|
+
version: '1.47'
|
|
297
297
|
type: :runtime
|
|
298
298
|
prerelease: false
|
|
299
299
|
version_requirements: !ruby/object:Gem::Requirement
|
|
300
300
|
requirements:
|
|
301
301
|
- - "~>"
|
|
302
302
|
- !ruby/object:Gem::Version
|
|
303
|
-
version: '1.
|
|
303
|
+
version: '1.47'
|
|
304
304
|
- !ruby/object:Gem::Dependency
|
|
305
305
|
name: search_ui
|
|
306
306
|
requirement: !ruby/object:Gem::Requirement
|