ollama_chat 0.0.52 → 0.0.53
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 +14 -0
- data/README.md +1 -0
- data/lib/ollama_chat/chat.rb +2 -0
- data/lib/ollama_chat/env_config.rb +12 -0
- data/lib/ollama_chat/information.rb +1 -0
- data/lib/ollama_chat/input_content.rb +28 -0
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30525dbd5fcb884ff5a7a978f59e06c77b051a16007938f3eb12770b869aa6f2
|
|
4
|
+
data.tar.gz: 906f22197039173a58bc242b9ff7108842e9d5ec453cf2a77adb589352367fb1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8be84b4c4e4902cdab557f81b8fdf9729fa5ec7c54c585aa8c8a3f2a76585fcc6e6344f454af579f24676252bf5dd1234664b3304f6086f9bdb9c5ecf31b92a
|
|
7
|
+
data.tar.gz: '0827fa2a548405d5e9208fa0c181220dd7955360882dfa3d7311756aa611594f544ac4fedb89bf9a1f0ef90be98fd952ff61bbe336749715f610a0eec9215a20'
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-01-07 v0.0.53
|
|
4
|
+
|
|
5
|
+
- Added `/compose` command functionality to compose content using an external
|
|
6
|
+
editor
|
|
7
|
+
- Introduced `OllamaChat::EnvConfig::EDITOR?` and
|
|
8
|
+
`OllamaChat::EnvConfig::EDITOR!` methods for editor configuration access
|
|
9
|
+
- Implemented `compose` method in `InputContent` module using `Tempfile` for
|
|
10
|
+
temporary file handling
|
|
11
|
+
- Added `EDITOR` configuration with default value of `vim` or `vi` if available
|
|
12
|
+
- Updated help text to include the new `/compose` command
|
|
13
|
+
- Added graceful error handling for editor failures, returning `nil` and
|
|
14
|
+
printing error to `STDERR`
|
|
15
|
+
- Required `tempfile` gem for temporary file handling functionality
|
|
16
|
+
|
|
3
17
|
## 2026-01-06 v0.0.52
|
|
4
18
|
|
|
5
19
|
- Enabled verbose context generation to provide real-time feedback during
|
data/README.md
CHANGED
|
@@ -180,6 +180,7 @@ The following commands can be given inside the chat, if prefixed by a `/`:
|
|
|
180
180
|
/links [clear] display (or clear) links used in the chat
|
|
181
181
|
/save filename store conversation messages
|
|
182
182
|
/load filename load conversation messages
|
|
183
|
+
/compose compose content using an EDITOR
|
|
183
184
|
/input [pattern] select and read content from a file (default: **/*)
|
|
184
185
|
/context [pattern...] collect context with glob patterns
|
|
185
186
|
/output filename save last response to filename
|
data/lib/ollama_chat/chat.rb
CHANGED
|
@@ -30,6 +30,18 @@ module OllamaChat
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
EDITOR = set do
|
|
34
|
+
description 'Editor to use'
|
|
35
|
+
|
|
36
|
+
default do
|
|
37
|
+
if editor = %w[ vim vi ].find { `which #{_1}`.full?(:chomp) }
|
|
38
|
+
editor
|
|
39
|
+
else
|
|
40
|
+
warn 'Need an editor command configured via env var "EDITOR"'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
33
45
|
DIFF_TOOL = set do
|
|
34
46
|
description 'Diff tool to apply changes with'
|
|
35
47
|
|
|
@@ -147,6 +147,7 @@ module OllamaChat::Information
|
|
|
147
147
|
/links [clear] display (or clear) links used in the chat
|
|
148
148
|
/save filename store conversation messages
|
|
149
149
|
/load filename load conversation messages
|
|
150
|
+
/compose compose content using an EDITOR
|
|
150
151
|
/input [pattern] select and read content from a file (default: **/*)
|
|
151
152
|
/context [pattern...] collect context with glob patterns
|
|
152
153
|
/output filename save last response to filename
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'tempfile'
|
|
2
|
+
|
|
1
3
|
# A module that provides input content processing functionality for OllamaChat.
|
|
2
4
|
#
|
|
3
5
|
# The InputContent module encapsulates methods for reading and returning
|
|
@@ -88,4 +90,30 @@ module OllamaChat::InputContent
|
|
|
88
90
|
end
|
|
89
91
|
end
|
|
90
92
|
end
|
|
93
|
+
|
|
94
|
+
# The compose method opens an editor to compose content.
|
|
95
|
+
#
|
|
96
|
+
# This method checks for a configured editor and opens a temporary file in
|
|
97
|
+
# that editor for the user to compose content. Upon successful editing, it
|
|
98
|
+
# reads the content from the temporary file and returns it. If the editor
|
|
99
|
+
# fails or no editor is configured, appropriate error messages are displayed
|
|
100
|
+
# and nil is returned.
|
|
101
|
+
#
|
|
102
|
+
# @return [ String, nil ] the composed content if successful, nil otherwise
|
|
103
|
+
def compose
|
|
104
|
+
unless editor = OllamaChat::EnvConfig::EDITOR?
|
|
105
|
+
STDERR.puts "Editor reqired for compose, set env var "\
|
|
106
|
+
"#{OllamaChat::EnvConfig::EDITOR!.env_var.inspect}."
|
|
107
|
+
return
|
|
108
|
+
end
|
|
109
|
+
Tempfile.open do |tmp|
|
|
110
|
+
system %{#{editor} #{tmp.path.inspect}}
|
|
111
|
+
if $?.success?
|
|
112
|
+
return File.read(tmp.path)
|
|
113
|
+
else
|
|
114
|
+
STDERR.puts "Editor failed to edit #{tmp.path.inspect}."
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
nil
|
|
118
|
+
end
|
|
91
119
|
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.53 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.53".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]
|