ollama_chat 0.0.139 → 0.0.141
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 +56 -0
- data/Rakefile +1 -1
- data/lib/ollama_chat/compaction.rb +1 -4
- data/lib/ollama_chat/follow_chat.rb +4 -4
- data/lib/ollama_chat/invidious.rb +27 -6
- data/lib/ollama_chat/ollama_chat_config/default_config.yml +2 -2
- data/lib/ollama_chat/session_management.rb +1 -1
- data/lib/ollama_chat/tool_call_processor.rb +60 -26
- data/lib/ollama_chat/tools/execute_shell.rb +26 -19
- data/lib/ollama_chat/tools/generate_image.rb +1 -1
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +3 -3
- data/spec/ollama_chat/invidious_spec.rb +22 -0
- data/spec/ollama_chat/tool_call_processor_spec.rb +27 -0
- 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: 2e928fba1669bde0639cbaba045d872c71f3630dc5ca2b00fec128dfe1217836
|
|
4
|
+
data.tar.gz: e781850be5059fd1bc79ba476557c49841177ce1965106d538f689b80a7fba70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2adcab92a8314bf93d0e322e63413321c49a85f1ecd8d6df63a70b32ed5a98bd1df6c5996302c1e2cdd4eed74d4bde4c6213596f3d16ab543c7803b29f94726f
|
|
7
|
+
data.tar.gz: 289d236ebec4be3474931ca20eeeebb8161f57260638cd19f366145fd08eb0be24b261cf1c1037b2c064c5133ca5cf209df39d937125b92903877878865c4cbe
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-11-06 v0.0.141
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
- Replaced `Tins::Duration#to_s` with `to_human(style: :abbrev)` in
|
|
8
|
+
`follow_chat.rb`, `session_management.rb`, `tool_call_processor.rb`, and
|
|
9
|
+
`generate_image.rb` to produce compact duration strings (e.g., `45s`,
|
|
10
|
+
`1m30s`) for terminal stats and JSON results.
|
|
11
|
+
- Replaced hand-rolled duration formatting in `compaction.rb` with
|
|
12
|
+
`Tins::Duration#to_human` for compaction TTS reports.
|
|
13
|
+
- Updated `execute_shell` tool description to instruct the LLM to separate
|
|
14
|
+
multi-command scripts with newlines and indentation rather than semicolons
|
|
15
|
+
for improved readability in the review editor.
|
|
16
|
+
- Added an early-return guard in `ToolCallProcessor#handle` to skip tool
|
|
17
|
+
execution when `chat.tools_support.off?`, emitting a `tools_disabled` JSON
|
|
18
|
+
result per tool call to provide proper error feedback to the LLM.
|
|
19
|
+
|
|
20
|
+
### Fixes
|
|
21
|
+
|
|
22
|
+
- Set `default: false` for `get_time` and `get_location` tools in
|
|
23
|
+
`default_config.yml`, as these values are already injected into runtime info
|
|
24
|
+
each turn, making default enablement redundant.
|
|
25
|
+
|
|
26
|
+
### Build & CI
|
|
27
|
+
|
|
28
|
+
- Bumped `tins` dependency to **~> 1.62** in `Rakefile` and
|
|
29
|
+
`ollama_chat.gemspec`.
|
|
30
|
+
|
|
31
|
+
### Testing
|
|
32
|
+
|
|
33
|
+
- Added a spec example in `tool_call_processor_spec.rb` verifying that
|
|
34
|
+
`#handle` returns the expected `tools_disabled` error and message when tool
|
|
35
|
+
support is disabled.
|
|
36
|
+
|
|
37
|
+
## 2026-11-02 v0.0.140
|
|
38
|
+
|
|
39
|
+
### Improvements
|
|
40
|
+
|
|
41
|
+
- Accept Invidious instance URLs for video transcripts. `fetch_video_info` now
|
|
42
|
+
delegates ID extraction to `extract_video_id`, which supports standard
|
|
43
|
+
YouTube URLs and watch, embed, and shorts paths on the configured Invidious
|
|
44
|
+
instance via `invidious_pattern`.
|
|
45
|
+
- Extract the confirmation gate logic in `ToolCallProcessor` into a private
|
|
46
|
+
`confirm_tool` method, returning a `[confirmed, resolve]` tuple to simplify
|
|
47
|
+
the `handle` method.
|
|
48
|
+
- In `ExecuteShell`, pressing `C-c` at the `📝 Instructions:` prompt now
|
|
49
|
+
re-prompts the user for the y/n/i/a/d choice instead of submitting a blank
|
|
50
|
+
instruction.
|
|
51
|
+
- Updated the instruction prompt in `ExecuteShell` to display a `(C-c ⇨
|
|
52
|
+
cancel)` escape hint.
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
|
|
56
|
+
- Added a spec context verifying that an Invidious instance watch URL correctly
|
|
57
|
+
extracts the video ID and produces a transcript.
|
|
58
|
+
|
|
3
59
|
## 2026-10-30 v0.0.139
|
|
4
60
|
|
|
5
61
|
### Features
|
data/Rakefile
CHANGED
|
@@ -49,7 +49,7 @@ GemHadar do
|
|
|
49
49
|
dependency 'reverse_markdown', '~> 3.0'
|
|
50
50
|
dependency 'kramdown-ansi', '~> 0.9'
|
|
51
51
|
dependency 'complex_config', '~> 0.22', '>= 0.22.2'
|
|
52
|
-
dependency 'tins', '~> 1.
|
|
52
|
+
dependency 'tins', '~> 1.62'
|
|
53
53
|
dependency 'search_ui', '>= 0.2'
|
|
54
54
|
dependency 'amatch', '~> 0.4'
|
|
55
55
|
dependency 'pdf-reader', '~> 2.0'
|
|
@@ -322,10 +322,7 @@ module OllamaChat::Compaction
|
|
|
322
322
|
Context: #{result.context_before} → #{result.context_after}
|
|
323
323
|
Stored total: #{result.stored_total}
|
|
324
324
|
EOT
|
|
325
|
-
|
|
326
|
-
duration_string = duration.format(
|
|
327
|
-
duration.minutes? ? '%M minutes and %u seconds' : '%u seconds'
|
|
328
|
-
)
|
|
325
|
+
duration_string = Tins::Duration.new(duration).to_human
|
|
329
326
|
speak(
|
|
330
327
|
'Compressed conversation context from %.0f percent to %.0f percent in %s.' % [
|
|
331
328
|
100 * result.context_filled_before,
|
|
@@ -245,14 +245,14 @@ class OllamaChat::FollowChat
|
|
|
245
245
|
eval_duration = response.eval_duration.to_f / 1e9
|
|
246
246
|
prompt_eval_duration = response.prompt_eval_duration.to_f / 1e9
|
|
247
247
|
{
|
|
248
|
-
eval_duration: Tins::Duration.new(eval_duration).
|
|
248
|
+
eval_duration: Tins::Duration.new(eval_duration).to_human(style: :abbrev),
|
|
249
249
|
eval_count: response.eval_count.to_i,
|
|
250
250
|
eval_rate: "%.2f t/s" % (response.eval_count.to_i / eval_duration),
|
|
251
|
-
prompt_eval_duration: Tins::Duration.new(prompt_eval_duration).
|
|
251
|
+
prompt_eval_duration: Tins::Duration.new(prompt_eval_duration).to_human(style: :abbrev),
|
|
252
252
|
prompt_eval_count: response.prompt_eval_count.to_i,
|
|
253
253
|
prompt_eval_rate: "%.2f t/s" % (response.prompt_eval_count.to_i / prompt_eval_duration),
|
|
254
|
-
total_duration: Tins::Duration.new(response.total_duration / 1e9).
|
|
255
|
-
load_duration: Tins::Duration.new(response.load_duration / 1e9).
|
|
254
|
+
total_duration: Tins::Duration.new(response.total_duration / 1e9).to_human(style: :abbrev),
|
|
255
|
+
load_duration: Tins::Duration.new(response.load_duration / 1e9).to_human(style: :abbrev),
|
|
256
256
|
}
|
|
257
257
|
end
|
|
258
258
|
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
# companion instance.
|
|
3
3
|
#
|
|
4
4
|
# Only activates when OC::OLLAMA::CHAT::INVIDIOUS::URL is set.
|
|
5
|
-
#
|
|
5
|
+
# Accepts standard YouTube URLs and watch URLs on the configured
|
|
6
|
+
# Invidious instance. Unmatched URLs and unconfigured environments
|
|
7
|
+
# return nil.
|
|
6
8
|
#
|
|
7
9
|
# @example Fetching video info for a YouTube watch URL
|
|
8
10
|
# text = OllamaChat::Invidious.fetch_video_info(
|
|
@@ -30,18 +32,18 @@ module OllamaChat
|
|
|
30
32
|
# 3. GET the matched track's baseUrl → timedtext XML
|
|
31
33
|
# 4. Extract <text> elements via Nokogiri → plain text
|
|
32
34
|
#
|
|
33
|
-
# @param url [String]
|
|
35
|
+
# @param url [String] a YouTube or Invidious instance watch URL
|
|
34
36
|
# @param chat [OllamaChat::Chat] the chat instance (for HTTP
|
|
35
37
|
# middleware)
|
|
36
38
|
# @return [StringIO, nil] video info + transcript as a text IO,
|
|
37
|
-
# or nil if
|
|
39
|
+
# or nil if URL unmatched, Invidious not configured, or
|
|
38
40
|
# video details unavailable
|
|
39
41
|
def fetch_video_info(url, chat:)
|
|
40
42
|
invidious_url = OC::OLLAMA::CHAT::INVIDIOUS::URL? or return
|
|
41
|
-
|
|
43
|
+
base = invidious_url.to_s
|
|
44
|
+
video_id = extract_video_id(url, base) or return
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
key = OC::OLLAMA::CHAT::INVIDIOUS::COMPANION_KEY
|
|
46
|
+
key = OC::OLLAMA::CHAT::INVIDIOUS::COMPANION_KEY
|
|
45
47
|
|
|
46
48
|
# Step 1: POST /companion/youtubei/v1/player
|
|
47
49
|
player_response = nil
|
|
@@ -157,6 +159,25 @@ module OllamaChat
|
|
|
157
159
|
def format_duration(seconds)
|
|
158
160
|
Tins::Duration.new(seconds).to_s
|
|
159
161
|
end
|
|
162
|
+
|
|
163
|
+
# Extracts the 11-character video ID from a YouTube or Invidious
|
|
164
|
+
# instance watch URL.
|
|
165
|
+
#
|
|
166
|
+
# @param url [String] the source URL
|
|
167
|
+
# @param base [String] the configured Invidious base URL
|
|
168
|
+
# @return [String, nil] the video ID
|
|
169
|
+
def extract_video_id(url, base)
|
|
170
|
+
url[YOUTUBE_URLS, 1] || url[invidious_pattern(base), 1]
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Builds a regex for watch/embed/shorts paths on the configured
|
|
174
|
+
# Invidious instance.
|
|
175
|
+
#
|
|
176
|
+
# @param base [String] the Invidious instance base URL
|
|
177
|
+
# @return [Regexp]
|
|
178
|
+
def invidious_pattern(base)
|
|
179
|
+
/\A#{Regexp.escape(base)}\/(?:watch\?v=|embed\/|shorts\/)([\w-]{11})/
|
|
180
|
+
end
|
|
160
181
|
end
|
|
161
182
|
end
|
|
162
183
|
end
|
|
@@ -582,10 +582,10 @@ tools:
|
|
|
582
582
|
require_confirmation: true
|
|
583
583
|
get_time:
|
|
584
584
|
result_display_timeout: 3
|
|
585
|
-
default:
|
|
585
|
+
default: false
|
|
586
586
|
get_location:
|
|
587
587
|
result_display_timeout: 3
|
|
588
|
-
default:
|
|
588
|
+
default: false
|
|
589
589
|
list_directory:
|
|
590
590
|
default: true
|
|
591
591
|
require_confirmation: false
|
|
@@ -737,7 +737,7 @@ module OllamaChat::SessionManagement
|
|
|
737
737
|
elsif selector
|
|
738
738
|
now = Time.now
|
|
739
739
|
sessions = session_query.order(Sequel.desc(:updated_at)).map { |session|
|
|
740
|
-
duration = session.age(now:)
|
|
740
|
+
duration = session.age(now:).to_human(style: :abbrev)
|
|
741
741
|
es = session.estimate_tokens
|
|
742
742
|
count = session.count_messages
|
|
743
743
|
locked = if pid = session.locked?
|
|
@@ -33,6 +33,19 @@ class OllamaChat::ToolCallProcessor
|
|
|
33
33
|
def handle(response)
|
|
34
34
|
return unless response.message.ask_and_send(:tool_calls)
|
|
35
35
|
|
|
36
|
+
if chat.tools_support.off?
|
|
37
|
+
response.message.tool_calls.each do |tool_call|
|
|
38
|
+
name = tool_call.function.name
|
|
39
|
+
@results[name] << JSON(
|
|
40
|
+
error: 'tools_disabled',
|
|
41
|
+
message: 'Tool support is disabled. ' \
|
|
42
|
+
'Ask the user to re-enable with `/tools on`.'
|
|
43
|
+
)
|
|
44
|
+
chat.log(:warn, 'Tool call ignored: tools disabled',
|
|
45
|
+
data: { tool: name })
|
|
46
|
+
end
|
|
47
|
+
return
|
|
48
|
+
end
|
|
36
49
|
tools_used = {}
|
|
37
50
|
|
|
38
51
|
response.message.tool_calls.each do |tool_call|
|
|
@@ -61,33 +74,9 @@ class OllamaChat::ToolCallProcessor
|
|
|
61
74
|
next
|
|
62
75
|
end
|
|
63
76
|
feedback(?\n, output:)
|
|
64
|
-
confirmed = :implicit
|
|
65
|
-
resolve = nil
|
|
66
77
|
function = JSON.pretty_generate(tool_call.function)
|
|
67
78
|
chat.log(:info, "Tool call received", data: { tool: name, function: })
|
|
68
|
-
|
|
69
|
-
feedback(
|
|
70
|
-
("I want to execute tool %s\n%s\n" % [ bold { name }, italic { function }, ]),
|
|
71
|
-
type: :alarm
|
|
72
|
-
)
|
|
73
|
-
prompt = '❓ Allow ✅[y]es / ⛔️[n]o / 📝[i]nstruct? '
|
|
74
|
-
answer = chat.confirm?(prompt:)&.to_s&.downcase
|
|
75
|
-
resolve = 'You **MUST** ask the user for instructions on how to proceed!!!'
|
|
76
|
-
case answer
|
|
77
|
-
when 'y'
|
|
78
|
-
confirmed = :explicit
|
|
79
|
-
when 'n'
|
|
80
|
-
confirmed = :denied
|
|
81
|
-
else
|
|
82
|
-
confirmed = :denied
|
|
83
|
-
instr = chat.ask?(prompt: '📝 Instructions: ')&.strip
|
|
84
|
-
resolve = instr.full? || resolve
|
|
85
|
-
end
|
|
86
|
-
else
|
|
87
|
-
feedback(
|
|
88
|
-
"Executing tool %s\n%s" % [ bold { name }, italic { function }, ]
|
|
89
|
-
)
|
|
90
|
-
end
|
|
79
|
+
confirmed, resolve = confirm_tool(name, function)
|
|
91
80
|
start = Time.now
|
|
92
81
|
result = nil
|
|
93
82
|
case confirmed
|
|
@@ -132,7 +121,7 @@ class OllamaChat::ToolCallProcessor
|
|
|
132
121
|
warn: ,
|
|
133
122
|
size: es.bytes_formatted,
|
|
134
123
|
tokens: es.tokens_formatted,
|
|
135
|
-
duration: Tins::Duration.new(Time.now - start).
|
|
124
|
+
duration: Tins::Duration.new(Time.now - start).to_human(style: :abbrev),
|
|
136
125
|
}
|
|
137
126
|
end
|
|
138
127
|
|
|
@@ -173,4 +162,49 @@ class OllamaChat::ToolCallProcessor
|
|
|
173
162
|
def clear!
|
|
174
163
|
@results.clear
|
|
175
164
|
end
|
|
165
|
+
|
|
166
|
+
private
|
|
167
|
+
|
|
168
|
+
# Prompts the user for confirmation on a tool call that requires it.
|
|
169
|
+
# Returns a `[confirmed, resolve]` tuple where `confirmed` is one of
|
|
170
|
+
# `:implicit`, `:explicit`, `:denied` and `resolve` is an optional
|
|
171
|
+
# instruction string for the LLM.
|
|
172
|
+
#
|
|
173
|
+
# @param name [String] the tool name
|
|
174
|
+
# @param function [String] pretty-printed JSON of the tool call
|
|
175
|
+
# @return [Array(Symbol, String?)]
|
|
176
|
+
def confirm_tool(name, function)
|
|
177
|
+
confirmed = :implicit
|
|
178
|
+
resolve = nil
|
|
179
|
+
|
|
180
|
+
1.times do
|
|
181
|
+
if chat.tool_function(name).require_confirmation?
|
|
182
|
+
feedback(
|
|
183
|
+
("I want to execute tool %s\n%s\n" % [ bold { name }, italic { function }, ]),
|
|
184
|
+
type: :alarm
|
|
185
|
+
)
|
|
186
|
+
prompt = '❓ Allow ✅[y]es / ⛔️[n]o / 📝[i]nstruct? '
|
|
187
|
+
answer = chat.confirm?(prompt:)&.to_s&.downcase
|
|
188
|
+
resolve = 'You **MUST** ask the user for instructions on how to proceed!!!'
|
|
189
|
+
case answer
|
|
190
|
+
when 'y'
|
|
191
|
+
confirmed = :explicit
|
|
192
|
+
when 'n'
|
|
193
|
+
confirmed = :denied
|
|
194
|
+
else
|
|
195
|
+
confirmed = :denied
|
|
196
|
+
instr = chat.ask?(prompt: '📝 Instructions (C-c ⇨ cancel): ')
|
|
197
|
+
instr.nil? and redo
|
|
198
|
+
instr = instr&.strip
|
|
199
|
+
resolve = instr.full? || resolve
|
|
200
|
+
end
|
|
201
|
+
else
|
|
202
|
+
feedback(
|
|
203
|
+
"Executing tool %s\n%s" % [ bold { name }, italic { function }, ]
|
|
204
|
+
)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
[confirmed, resolve]
|
|
209
|
+
end
|
|
176
210
|
end
|
|
@@ -45,6 +45,9 @@ class OllamaChat::Tools::ExecuteShell
|
|
|
45
45
|
then a mandatory y/n/i/a confirm prompt gates execution.
|
|
46
46
|
Answering a remembers the command for the session
|
|
47
47
|
(skips editor and confirm on repeat).
|
|
48
|
+
For multi-command scripts, separate commands with newlines
|
|
49
|
+
and proper intendation rather than `;` for readability
|
|
50
|
+
in the review editor.
|
|
48
51
|
Last resort: use ONLY when no dedicated tool covers
|
|
49
52
|
the task (e.g. `git commit`, `bundle install`, `make`).
|
|
50
53
|
Prefer `execute_grep`, `list_directory`, `read_file`,
|
|
@@ -102,25 +105,29 @@ class OllamaChat::Tools::ExecuteShell
|
|
|
102
105
|
y once · n cancel · i instruct me · a always (pager) · d always (direct)
|
|
103
106
|
|
|
104
107
|
EOT
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
1.times do
|
|
109
|
+
answer = chat.confirm?(
|
|
110
|
+
prompt: '❓ Allow ✅[y]es / ⛔️[n]o / 📝[i]nstruct / 🔁[a]lways / 📄[d]irect? '
|
|
111
|
+
)&.to_s&.downcase
|
|
112
|
+
|
|
113
|
+
case answer
|
|
114
|
+
when 'y'
|
|
115
|
+
# proceed to execution
|
|
116
|
+
when 'a'
|
|
117
|
+
self.class.always_allowed[command] = :always
|
|
118
|
+
when 'd'
|
|
119
|
+
self.class.always_allowed[command] = :direct
|
|
120
|
+
when 'n'
|
|
121
|
+
raise OllamaChat::ToolFunctionArgumentError,
|
|
122
|
+
"Shell command cancelled by user: #{command}"
|
|
123
|
+
else
|
|
124
|
+
instr = chat.ask?(prompt: '📝 Instructions (C-c ⇨ cancel): ')
|
|
125
|
+
instr.nil? and redo
|
|
126
|
+
instr = instr&.strip
|
|
127
|
+
resolve = instr.full? || 'You **MUST** ask the user for instructions!'
|
|
128
|
+
raise OllamaChat::ToolFunctionArgumentError,
|
|
129
|
+
"User instruct: #{resolve} (command: #{command})"
|
|
130
|
+
end
|
|
124
131
|
end
|
|
125
132
|
end
|
|
126
133
|
end
|
|
@@ -101,7 +101,7 @@ class OllamaChat::Tools::GenerateImage
|
|
|
101
101
|
message: ,
|
|
102
102
|
url: view_url,
|
|
103
103
|
prompt: ,
|
|
104
|
-
duration: Tins::Duration.new(Time.now - started).
|
|
104
|
+
duration: Tins::Duration.new(Time.now - started).to_human(style: :abbrev),
|
|
105
105
|
}.to_json
|
|
106
106
|
rescue => e
|
|
107
107
|
chat.log(:error, e, data: { tool: name, prompt: })
|
data/lib/ollama_chat/version.rb
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# by hand; it is rewritten on every `rake version` invocation.
|
|
6
6
|
module OllamaChat
|
|
7
7
|
# The current version of the OllamaChat gem as a String.
|
|
8
|
-
VERSION = '0.0.
|
|
8
|
+
VERSION = '0.0.141'
|
|
9
9
|
VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
|
|
10
10
|
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
|
|
11
11
|
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.
|
|
2
|
+
# stub: ollama_chat 0.0.141 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.141".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.9".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.62".freeze])
|
|
47
47
|
s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0.2".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])
|
|
@@ -232,6 +232,28 @@ describe OllamaChat::Invidious do
|
|
|
232
232
|
)
|
|
233
233
|
expect(result).not_to be_nil
|
|
234
234
|
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
context 'with an Invidious instance watch URL' do
|
|
238
|
+
let :tracks do
|
|
239
|
+
[
|
|
240
|
+
track(label: 'English', language_code: 'en',
|
|
241
|
+
base_url: 'https://www.youtube.com/api/timedtext' \
|
|
242
|
+
'?v=MmpZ5Db9JXi&lang=en'),
|
|
243
|
+
]
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
it 'extracts the video ID correctly' do
|
|
247
|
+
stub_player(tracks:)
|
|
248
|
+
expect(chat).to receive(:get_url)
|
|
249
|
+
.with(anything, remember: false)
|
|
250
|
+
.and_yield(StringIO.new(xml_content))
|
|
251
|
+
|
|
252
|
+
result = described_class.fetch_video_info(
|
|
253
|
+
'https://invidious.gate.ping.de/watch?v=MmpZ5Db9JXi', chat:
|
|
254
|
+
)
|
|
255
|
+
expect(result).not_to be_nil
|
|
256
|
+
end
|
|
235
257
|
end
|
|
236
258
|
end
|
|
237
259
|
end
|
|
@@ -48,4 +48,31 @@ describe OllamaChat::ToolCallProcessor do
|
|
|
48
48
|
expect(processor.results).to be_empty
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
describe '#handle' do
|
|
53
|
+
let :tool_call do
|
|
54
|
+
double('tool_call', function: double('function', name: 'roll_dice'))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
let :message do
|
|
58
|
+
double('message', ask_and_send: true, tool_calls: [tool_call])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
let :response do
|
|
62
|
+
double('response', message:)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context 'when tools support is disabled' do
|
|
66
|
+
before do
|
|
67
|
+
allow(chat.tools_support).to receive(:off?).and_return(true)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'returns a tools_disabled result per tool call without executing' do
|
|
71
|
+
processor.handle(response)
|
|
72
|
+
data = JSON.parse(processor.results['roll_dice'].first)
|
|
73
|
+
expect(data['error']).to eq('tools_disabled')
|
|
74
|
+
expect(data['message']).to include('/tools on')
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
51
78
|
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.141
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -287,14 +287,14 @@ dependencies:
|
|
|
287
287
|
requirements:
|
|
288
288
|
- - "~>"
|
|
289
289
|
- !ruby/object:Gem::Version
|
|
290
|
-
version: '1.
|
|
290
|
+
version: '1.62'
|
|
291
291
|
type: :runtime
|
|
292
292
|
prerelease: false
|
|
293
293
|
version_requirements: !ruby/object:Gem::Requirement
|
|
294
294
|
requirements:
|
|
295
295
|
- - "~>"
|
|
296
296
|
- !ruby/object:Gem::Version
|
|
297
|
-
version: '1.
|
|
297
|
+
version: '1.62'
|
|
298
298
|
- !ruby/object:Gem::Dependency
|
|
299
299
|
name: search_ui
|
|
300
300
|
requirement: !ruby/object:Gem::Requirement
|