ollama_chat 0.0.94 → 0.0.95
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 +95 -42
- data/README.md +9 -5
- data/lib/ollama_chat/chat.rb +1 -0
- data/lib/ollama_chat/commands.rb +156 -38
- data/lib/ollama_chat/information.rb +0 -4
- data/lib/ollama_chat/input_content.rb +1 -1
- data/lib/ollama_chat/oc.rb +0 -7
- data/lib/ollama_chat/ollama_chat_config/default_config.yml +1 -1
- data/lib/ollama_chat/parsing.rb +50 -21
- data/lib/ollama_chat/personae_management.rb +4 -4
- data/lib/ollama_chat/session_management.rb +1 -3
- data/lib/ollama_chat/tools/compute_bmi.rb +0 -2
- data/lib/ollama_chat/tools/roll_dice.rb +10 -1
- data/lib/ollama_chat/utils/png_metadata_extractor.rb +111 -0
- data/lib/ollama_chat/utils/utf8_converter.rb +13 -0
- data/lib/ollama_chat/utils.rb +2 -1
- data/lib/ollama_chat/version.rb +1 -1
- data/ollama_chat.gemspec +5 -5
- data/spec/assets/miyu.png +0 -0
- data/spec/ollama_chat/parsing_spec.rb +1 -1
- data/spec/ollama_chat/tools/directory_structure_spec.rb +1 -1
- data/spec/ollama_chat/tools/roll_dice_spec.rb +6 -1
- data/spec/ollama_chat/utils/png_metadata_extractor_spec.rb +122 -0
- metadata +8 -5
- data/lib/ollama_chat/utils/png_character_extractor.rb +0 -65
- data/spec/ollama_chat/utils/png_character_extractor_spec.rb +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5ae8b473c0dfaba1476f7890f8d1e04244db7f19c9dd9d563a845d9a5798a5f
|
|
4
|
+
data.tar.gz: 6e0f053ce8c5f9bbe97d5e04d3819fbee2ef9857f6b4c9d6bc4d76fe7e12dffa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e514fe65a9e3ccddef894cfe92fdff0e17a1c9ca639994ab54edcd573b219cca6c50774640cd966e8adc4d3232071abacc193c8dd795f9ed6be6460109b62df
|
|
7
|
+
data.tar.gz: 681c439ba46ee38cce5201696e40dda4dc6f6d2291c505e420c7fa2d63899ffd0e82068e94c6f8509f170e6843480924c969730c328a3c6a92b00702115de994
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-06-29 v0.0.95
|
|
4
|
+
|
|
5
|
+
### New Features & Enhancements
|
|
6
|
+
|
|
7
|
+
- **PNG Metadata Extraction**:
|
|
8
|
+
- Implemented `OllamaChat::Utils::PNGMetadataExtractor` to support
|
|
9
|
+
extraction of characters, prompts, and workflows from `tEXt` chunks.
|
|
10
|
+
- Added support for Automatic1111 Stable Diffusion WebUI parameters via
|
|
11
|
+
`parse_a1111_parameters`.
|
|
12
|
+
- Consolidated metadata extraction logic into a new `parse_png` method
|
|
13
|
+
within `OllamaChat::Parsing`.
|
|
14
|
+
- Introduced `OllamaChat::Utils::UTF8Converter` to ensure safe UTF-8
|
|
15
|
+
encoding across the system.
|
|
16
|
+
- **Tool Improvements**:
|
|
17
|
+
- Enhanced the `roll_dice` tool by adding a human-readable `message` field
|
|
18
|
+
to its JSON output and increasing the `result_display_timeout` in
|
|
19
|
+
`default_config.yml`.
|
|
20
|
+
- **Command Interface**:
|
|
21
|
+
- Overhauled help texts for numerous commands (including `/model`,
|
|
22
|
+
`/system`, `/tools`, `/session`, `/prompt`, and `/persona`) using
|
|
23
|
+
squiggly heredocs for better formatting and clarity.
|
|
24
|
+
- Added comprehensive YARD documentation to the `OllamaChat::Commands`
|
|
25
|
+
module.
|
|
26
|
+
|
|
27
|
+
### Bug Fixes & Refactoring
|
|
28
|
+
|
|
29
|
+
- **Stability & Logic**:
|
|
30
|
+
- Updated `OllamaChat::InputContent#all_file_set` to filter out directories
|
|
31
|
+
using `.select(&:file?)` and return a `Set`.
|
|
32
|
+
- Improved session name validation in
|
|
33
|
+
`lib/ollama_chat/session_management.rb` by replacing `.nil?` with
|
|
34
|
+
`.blank?`.
|
|
35
|
+
- Added `io.rewind` within an `ensure` block in the PNG extraction logic to
|
|
36
|
+
prevent read errors.
|
|
37
|
+
- **Cleanup**:
|
|
38
|
+
- Removed the unused `json` dependency from `compute_bmi`.
|
|
39
|
+
- Removed the `PATCH_TOOL` definition and its corresponding documentation
|
|
40
|
+
in `README.md`.
|
|
41
|
+
- Pruned redundant convenience methods `extract_prompt` and
|
|
42
|
+
`extract_workflow` from `OllamaChat::Utils::PNGMetadataExtractor`.
|
|
43
|
+
|
|
44
|
+
### Documentation & CI
|
|
45
|
+
|
|
46
|
+
- **README Updates**:
|
|
47
|
+
- Expanded the available tools table to include `delete_file`, `move_file`,
|
|
48
|
+
`eval_ruby`, `get_ghr`, and `get_jira_issue`.
|
|
49
|
+
- Refined descriptions for the **Knowledge** category, specifically
|
|
50
|
+
distinguishing between `retrieve_document_snippets` and `file_context`.
|
|
51
|
+
- **CI/CD**:
|
|
52
|
+
- Optimized dependency installation in `.all_images.yml` by replacing
|
|
53
|
+
`getconf _NPROCESSORS_ONLN` with `nproc` for better parallel job
|
|
54
|
+
compatibility.
|
|
55
|
+
|
|
3
56
|
## 2026-06-22 v0.0.94
|
|
4
57
|
|
|
5
58
|
### Added
|
|
@@ -110,7 +163,7 @@
|
|
|
110
163
|
|
|
111
164
|
- **Model Option Profiles**: Added support for model option profiles, including
|
|
112
165
|
a new `profile` column in the database with a composite unique index on
|
|
113
|
-
`[:model_name, :profile]`.
|
|
166
|
+
`[:model_name, :profile]`.
|
|
114
167
|
- Enhanced `OllamaChat::ModelHandling` methods (`get_stored_model_options`,
|
|
115
168
|
`store_model_options`) to support a `profile` parameter.
|
|
116
169
|
- Implemented `choose_profile_for_model` for interactive profile selection.
|
|
@@ -126,20 +179,20 @@
|
|
|
126
179
|
|
|
127
180
|
### Enhancements & Refactoring
|
|
128
181
|
|
|
129
|
-
- **Command Standardization**:
|
|
182
|
+
- **Command Standardization**:
|
|
130
183
|
- Standardized the use of the `-e` flag for editing across multiple
|
|
131
184
|
commands: `/input`, `/regenerate`, `/pipe`, `/output`, `/copy`, and
|
|
132
185
|
`/paste`.
|
|
133
186
|
- Replaced "Flags:" with "Options:" in help text for several chat commands.
|
|
134
187
|
- Added a specific editor hook using `edit_text` for the `/input` command
|
|
135
188
|
to allow editing imported content.
|
|
136
|
-
- **Code Architecture**:
|
|
189
|
+
- **Code Architecture**:
|
|
137
190
|
- Extracted all chat command definitions into a new separate module
|
|
138
191
|
`OllamaChat::Commands` located in `lib/ollama_chat/commands.rb`.
|
|
139
192
|
- Updated `OllamaChat::Chat` and the main library entry point to utilize
|
|
140
193
|
this new module instead of inline definitions or
|
|
141
194
|
`OllamaChat::CommandConcern`.
|
|
142
|
-
- **Message Output**:
|
|
195
|
+
- **Message Output**:
|
|
143
196
|
- Enhanced `OllamaChat::MessageOutput#pipe` and `#output` to accept an
|
|
144
197
|
`edit` parameter.
|
|
145
198
|
- Refactored `OllamaChat::MessageOutput#attempt_to_write_file` to receive
|
|
@@ -282,42 +335,42 @@
|
|
|
282
335
|
## 2026-04-02 v0.0.86
|
|
283
336
|
|
|
284
337
|
- Updated `play_persona_prompt` in `lib/ollama_chat/personae_management.rb` to
|
|
285
|
-
include “(no need to read the file)” in the roleplay prompt template string.
|
|
286
|
-
- Added `optional: true` to the `/links` command in `lib/ollama_chat/chat.rb`.
|
|
338
|
+
include “(no need to read the file)” in the roleplay prompt template string.
|
|
339
|
+
- Added `optional: true` to the `/links` command in `lib/ollama_chat/chat.rb`.
|
|
287
340
|
- Made the `edit` subcommand of `/revise` optional by adding `optional: true`
|
|
288
|
-
to its command definition in `lib/ollama_chat/chat.rb`.
|
|
289
|
-
- Added a `backup` subcommand for persona management:
|
|
341
|
+
to its command definition in `lib/ollama_chat/chat.rb`.
|
|
342
|
+
- Added a `backup` subcommand for persona management:
|
|
290
343
|
- Updated the `:persona` command regex and completion options in
|
|
291
|
-
`lib/ollama_chat/chat.rb`.
|
|
292
|
-
- Added a case handler to invoke the new `backup_persona` method.
|
|
344
|
+
`lib/ollama_chat/chat.rb`.
|
|
345
|
+
- Added a case handler to invoke the new `backup_persona` method.
|
|
293
346
|
- Implemented `backup_persona` in `lib/ollama_chat/personae_management.rb`
|
|
294
|
-
with YARD documentation.
|
|
295
|
-
- Removed the redundant assignment `persona = persona` in `edit_persona`.
|
|
347
|
+
with YARD documentation.
|
|
348
|
+
- Removed the redundant assignment `persona = persona` in `edit_persona`.
|
|
296
349
|
- Fixed the rescue exception class name in the `use_model` block of
|
|
297
350
|
`lib/ollama_chat/chat.rb`, changing from `OllamaChatError::UnknownModelError`
|
|
298
|
-
to `OllamaChat::UnknownModelError`.
|
|
351
|
+
to `OllamaChat::UnknownModelError`.
|
|
299
352
|
- Ensured float division for duration calculations in `FollowChat` by
|
|
300
353
|
converting operands to float in the `eval_stats` method of
|
|
301
|
-
`lib/ollama_chat/follow_chat.rb`.
|
|
354
|
+
`lib/ollama_chat/follow_chat.rb`.
|
|
302
355
|
- Used `Pathname.new(file).expand_path.directory?` for tilde expansion in
|
|
303
|
-
directory checks in `lib/ollama_chat/parsing.rb`.
|
|
304
|
-
- Refactored command registration formatting in `lib/ollama_chat/chat.rb`.
|
|
356
|
+
directory checks in `lib/ollama_chat/parsing.rb`.
|
|
357
|
+
- Refactored command registration formatting in `lib/ollama_chat/chat.rb`.
|
|
305
358
|
- Added YARD documentation to the `OllamaChat::CommandConcern::Command` class
|
|
306
|
-
in `lib/ollama_chat/command_concern.rb`.
|
|
359
|
+
in `lib/ollama_chat/command_concern.rb`.
|
|
307
360
|
- Removed the deprecated `-d` flag from the `/input` command in
|
|
308
|
-
`lib/ollama_chat/chat.rb`.
|
|
309
|
-
- Removed tag support from `parse_content`:
|
|
361
|
+
`lib/ollama_chat/chat.rb`.
|
|
362
|
+
- Removed tag support from `parse_content`:
|
|
310
363
|
- Updated `OllamaChat::Chat` to call `parse_content` without expecting a
|
|
311
|
-
`tags` array.
|
|
312
|
-
- Simplified handling of `@parse_content`.
|
|
313
|
-
- Removed tag recognition logic from `OllamaChat::Parsing`.
|
|
314
|
-
- Changed `parse_content` to return a single `String`.
|
|
315
|
-
- Deleted tag‑specific example from the spec.
|
|
316
|
-
- Updated the `file_context` tool description for accuracy.
|
|
317
|
-
- Added an interactive loop to enable/disable tools:
|
|
364
|
+
`tags` array.
|
|
365
|
+
- Simplified handling of `@parse_content`.
|
|
366
|
+
- Removed tag recognition logic from `OllamaChat::Parsing`.
|
|
367
|
+
- Changed `parse_content` to return a single `String`.
|
|
368
|
+
- Deleted tag‑specific example from the spec.
|
|
369
|
+
- Updated the `file_context` tool description for accuracy.
|
|
370
|
+
- Added an interactive loop to enable/disable tools:
|
|
318
371
|
- Wrapped `enable_tool` and `disable_tool` in a `loop do` in
|
|
319
|
-
`lib/ollama_chat/tool_calling.rb`.
|
|
320
|
-
- Modified `select_tools` to place `[EXIT]` at the start.
|
|
372
|
+
`lib/ollama_chat/tool_calling.rb`.
|
|
373
|
+
- Modified `select_tools` to place `[EXIT]` at the start.
|
|
321
374
|
- Handled user choice with `choose(select_tools)`
|
|
322
375
|
and exited on `[EXIT]` or `nil`.
|
|
323
376
|
|
|
@@ -348,24 +401,24 @@
|
|
|
348
401
|
## 2026-03-26 v0.0.84
|
|
349
402
|
|
|
350
403
|
- Added `OllamaChat::Utils::ValueFormatter` with helper `format_bytes` in
|
|
351
|
-
`lib/ollama_chat/utils/value_formatter.rb`.
|
|
352
|
-
- Added `require 'ollama_chat/utils/value_formatter'` where needed.
|
|
404
|
+
`lib/ollama_chat/utils/value_formatter.rb`.
|
|
405
|
+
- Added `require 'ollama_chat/utils/value_formatter'` where needed.
|
|
353
406
|
- Updated `write_file`, `patch_file`, `paste_from_clipboard` to use
|
|
354
|
-
`format_bytes` for byte‑size messages.
|
|
407
|
+
`format_bytes` for byte‑size messages.
|
|
355
408
|
- Implemented new tool `RetrieveDocumentSnippets` in
|
|
356
409
|
`lib/ollama_chat/tools/retrieve_document_snippets.rb` and its spec
|
|
357
|
-
`spec/ollama_chat/tools/retrieve_document_snippets_spec.rb`.
|
|
410
|
+
`spec/ollama_chat/tools/retrieve_document_snippets_spec.rb`.
|
|
358
411
|
- Updated `default_config.yml` to enable `retrieve_document_snippets` by
|
|
359
|
-
default.
|
|
412
|
+
default.
|
|
360
413
|
- Rewrote tool payloads to include a `message` key for `browse`, `search_web`,
|
|
361
|
-
`paste_from_clipboard`, `resolve_tag`, and others.
|
|
362
|
-
- `browse` now returns `"Opened \"<url>\" in browser."` or a failure message.
|
|
414
|
+
`paste_from_clipboard`, `resolve_tag`, and others.
|
|
415
|
+
- `browse` now returns `"Opened \"<url>\" in browser."` or a failure message.
|
|
363
416
|
- Refactored `confirm?` in `lib/ollama_chat/dialog.rb` to accept keyword `yes:`
|
|
364
417
|
for a confirmation regex and display a coloured emoji matching the response
|
|
365
|
-
or timeout/default.
|
|
366
|
-
- Updated all calls to `confirm?` to use `yes: /\Ay/i` syntax.
|
|
418
|
+
or timeout/default.
|
|
419
|
+
- Updated all calls to `confirm?` to use `yes: /\Ay/i` syntax.
|
|
367
420
|
- Updated `lib/ollama_chat/message_output.rb` to add `yes:` keyword to
|
|
368
|
-
`confirm?` calls and refine the emoji shown when a file already exists.
|
|
421
|
+
`confirm?` calls and refine the emoji shown when a file already exists.
|
|
369
422
|
|
|
370
423
|
## 2026-03-24 v0.0.83
|
|
371
424
|
|
|
@@ -387,13 +440,13 @@
|
|
|
387
440
|
## 2026-03-21 v0.0.82
|
|
388
441
|
|
|
389
442
|
- Add a `before` block setting `OC::OLLAMA::CHAT::TOOLS::CTAGS_TOOL` to `ctags`
|
|
390
|
-
in the `resolve_tag` spec.
|
|
443
|
+
in the `resolve_tag` spec.
|
|
391
444
|
- Updated `OllamaChat::Tools::PasteIntoEditor` description to use `text`
|
|
392
445
|
instead of `string` and clarified that no file or line is required when
|
|
393
|
-
pasting into the editor.
|
|
446
|
+
pasting into the editor.
|
|
394
447
|
- Added bell and question mark emojis to various `confirm?` and `ask?` prompts
|
|
395
|
-
across multiple modules for clearer UX.
|
|
396
|
-
- Updated prompt string to `⏎ Press …` for better display.
|
|
448
|
+
across multiple modules for clearer UX.
|
|
449
|
+
- Updated prompt string to `⏎ Press …` for better display.
|
|
397
450
|
- Enhanced `OllamaChat::Tools::ResolveTag` and `OllamaChat::Utils::TagResolver`
|
|
398
451
|
with a new `kinds` method, updated `kind` parameter description, refactored
|
|
399
452
|
`kind_of`, and fixed tag‑parsing regex to capture all columns.
|
data/README.md
CHANGED
|
@@ -42,7 +42,6 @@ The following environment variables can be used to configure behavior:
|
|
|
42
42
|
- `OLLAMA_CHAT_TOOLS_TEST_RUNNER` - Configured test runner for `run_tests` (default: `rspec`)
|
|
43
43
|
- `OLLAMA_CHAT_TOOLS_CTAGS_TOOL` - Path to the ctags tool
|
|
44
44
|
- `OLLAMA_CHAT_TOOLS_TAGS_FILE` - Location of the tags file
|
|
45
|
-
- `OLLAMA_CHAT_TOOLS_PATCH_TOOL` - Patch tool to use
|
|
46
45
|
- `OLLAMA_CHAT_TOOLS_JIRA_URL` - Base URL for Jira instance
|
|
47
46
|
- `OLLAMA_CHAT_TOOLS_JIRA_USER` - Username for Jira authentication
|
|
48
47
|
- `OLLAMA_CHAT_TOOLS_JIRA_API_TOKEN` - API token for Jira authentication
|
|
@@ -253,14 +252,19 @@ context, manipulate files, and retrieve external information.
|
|
|
253
252
|
|
|
254
253
|
| Category | Tools | Description |
|
|
255
254
|
| :--- | :--- | :--- |
|
|
256
|
-
| **Filesystem** | `read_file`, `write_file`, `patch_file`, `directory_structure`, `execute_grep` | Read, write, and search files within allowed directories. |
|
|
257
|
-
| **Ruby/Dev** | `resolve_tag`, `execute_ri`, `gem_path_lookup`, `run_tests` | Introspect Ruby code, check documentation, and run test suites. |
|
|
258
|
-
| **Web/External** | `search_web`, `get_url`, `browse`, `get_rfc`, `get_cve`, `get_endoflife` | Access the internet, fetch specific URLs, and look up technical standards. |
|
|
255
|
+
| **Filesystem** | `read_file`, `write_file`, `patch_file`, `delete_file`, `move_file`, `directory_structure`, `execute_grep` | Read, write, and search files within allowed directories. |
|
|
256
|
+
| **Ruby/Dev** | `resolve_tag`, `execute_ri`, `gem_path_lookup`, `run_tests`, `eval_ruby` | Introspect Ruby code, check documentation, and run test suites. |
|
|
257
|
+
| **Web/External** | `search_web`, `get_url`, `browse`, `get_rfc`, `get_cve`, `get_endoflife`, `get_ghr`, `get_jira_issue` | Access the internet, fetch specific URLs, and look up technical standards. |
|
|
259
258
|
| **System/Util** | `get_time`, `get_location`, `get_current_weather`, `generate_password`, `compute_bmi`, `roll_dice` | General utility functions for time, location, and simple calculations. |
|
|
260
259
|
| **Editor/Clip** | `copy_to_clipboard`, `paste_from_clipboard`, `paste_into_editor`, `open_file_in_editor` | Bridge the gap between the chat and the system clipboard or editor. |
|
|
261
|
-
| **Knowledge** | `retrieve_document_snippets` |
|
|
260
|
+
| **Knowledge** | `retrieve_document_snippets`, `file_context` | Semantic search for specific snippets vs. broad retrieval of structured project context. |
|
|
262
261
|
| **Multimodal** | `generate_image` | Generate images via a local ComfyUI server. |
|
|
263
262
|
|
|
263
|
+
***Note on Knowledge Tools**: Use `retrieve_document_snippets` for precise,
|
|
264
|
+
low-token semantic discovery and `file_context` for a comprehensive view of
|
|
265
|
+
modules or patterns. Be cautious with broad patterns in `file_context`, as
|
|
266
|
+
importing too many files can exceed the LLM's context window.*
|
|
267
|
+
|
|
264
268
|
## Download
|
|
265
269
|
|
|
266
270
|
The homepage of this app is located at
|
data/lib/ollama_chat/chat.rb
CHANGED
|
@@ -69,6 +69,7 @@ class OllamaChat::Chat
|
|
|
69
69
|
include OllamaChat::PromptManagement
|
|
70
70
|
include OllamaChat::Utils::Chooser
|
|
71
71
|
include OllamaChat::Utils::ValueFormatter
|
|
72
|
+
include OllamaChat::Utils::UTF8Converter
|
|
72
73
|
|
|
73
74
|
# Initializes a new OllamaChat::Chat instance with the given command-line
|
|
74
75
|
# arguments.
|
data/lib/ollama_chat/commands.rb
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
require 'ollama_chat/command_concern'
|
|
2
2
|
|
|
3
|
+
# Namespace for all available slash commands within the Ollama Chat
|
|
4
|
+
# application.
|
|
5
|
+
#
|
|
6
|
+
# This module acts as a central repository where various functional commands
|
|
7
|
+
# are declared using the DSL provided by {OllamaChat::CommandConcern}. Each
|
|
8
|
+
# command definition includes a unique name, a triggering regular expression,
|
|
9
|
+
# and a help string for documentation.
|
|
10
|
+
#
|
|
11
|
+
# The commands are categorized into several areas:
|
|
12
|
+
# - Clipboard management (/copy, /paste)
|
|
13
|
+
# - Application settings (/config, /document policy, /toggle)
|
|
14
|
+
# - Model & System Prompt configuration (/model, /system, /think)
|
|
15
|
+
# - Tooling support (/tools)
|
|
16
|
+
# - Session management (/session)
|
|
17
|
+
# - Conversation history and manipulation (/list, /last, /drop, /clear, /regenerate)
|
|
18
|
+
# - RAG collection management (/collection)
|
|
19
|
+
# - Persona & Character roleplay (/persona, /character)
|
|
20
|
+
# - Input/Output operations (/compose, /web, /input, /pipe, /vim, /output)
|
|
21
|
+
# - System actions and info (/reconnect, /quit, /info, /help)
|
|
3
22
|
module OllamaChat::Commands
|
|
4
23
|
include OllamaChat::CommandConcern
|
|
5
24
|
|
|
@@ -65,7 +84,11 @@ module OllamaChat::Commands
|
|
|
65
84
|
name: :toggle,
|
|
66
85
|
regexp: %r(^/toggle(?:\s+(markdown|stream|location|runtime_info|voice|think_loud|think_strip))?$),
|
|
67
86
|
complete: [ 'toggle', %w[ markdown stream location runtime_info voice think_loud think_strip embedding ] ],
|
|
68
|
-
help:
|
|
87
|
+
help: <<~EOT
|
|
88
|
+
Toggle feature switches
|
|
89
|
+
(markdown, stream, location, runtime_info,
|
|
90
|
+
voice, think_loud, think_strip, embedding)
|
|
91
|
+
EOT
|
|
69
92
|
) do |toggle_name|
|
|
70
93
|
if toggle_name
|
|
71
94
|
send(toggle_name).toggle
|
|
@@ -90,7 +113,10 @@ module OllamaChat::Commands
|
|
|
90
113
|
name: :favourite,
|
|
91
114
|
regexp: %r(^/favourite(?:\s+(add|delete))?(?:\s+(model|prompt|system_prompt|persona))$),
|
|
92
115
|
complete: [ 'favourite', %w[ add delete ], %w[ model prompt system_prompt persona ] ],
|
|
93
|
-
help:
|
|
116
|
+
help: <<~EOT
|
|
117
|
+
Manage favorites for models, prompts,
|
|
118
|
+
and personae (add, delete)
|
|
119
|
+
EOT
|
|
94
120
|
) do |subcommand, type|
|
|
95
121
|
case subcommand
|
|
96
122
|
when 'add'
|
|
@@ -106,8 +132,18 @@ module OllamaChat::Commands
|
|
|
106
132
|
regexp: %r(^/model(?:\s+(change|options|options from session|options to session))(?:\s+(-p\s*\w+))?$),
|
|
107
133
|
complete: [ 'model', %w[ change options options\ from\ session options\ to\ session ] ],
|
|
108
134
|
help: <<~EOT
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
Manage AI models and configurations:
|
|
136
|
+
- change: Switch the active model
|
|
137
|
+
(-p [profile] for specific
|
|
138
|
+
settings)
|
|
139
|
+
- options: Edit the configuration
|
|
140
|
+
of a saved profile
|
|
141
|
+
- options from session: Save current
|
|
142
|
+
live settings into a profile
|
|
143
|
+
(Live → Saved)
|
|
144
|
+
- options to session: Apply a saved
|
|
145
|
+
profile's settings to this
|
|
146
|
+
session (Saved → Live)
|
|
111
147
|
EOT
|
|
112
148
|
) do |subcommand, opts|
|
|
113
149
|
case subcommand
|
|
@@ -138,8 +174,18 @@ module OllamaChat::Commands
|
|
|
138
174
|
complete: [ 'system', %w[ change info edit add delete list duplicate export import reset ] ],
|
|
139
175
|
optional: true,
|
|
140
176
|
help: <<~EOT
|
|
141
|
-
Manage the system prompt
|
|
142
|
-
|
|
177
|
+
Manage the system prompt and its
|
|
178
|
+
configurations.
|
|
179
|
+
Subcommands: add, change, delete,
|
|
180
|
+
duplicate, edit, export, import,
|
|
181
|
+
info, list, reset.
|
|
182
|
+
Note: 'duplicate' allows you to clone
|
|
183
|
+
an existing system prompt as a
|
|
184
|
+
template for further modification,
|
|
185
|
+
while 'export' and 'import' handle
|
|
186
|
+
portability via external files. Use
|
|
187
|
+
'reset' to restore the default
|
|
188
|
+
system prompt settings.
|
|
143
189
|
EOT
|
|
144
190
|
) do |subcommand, filename|
|
|
145
191
|
case subcommand
|
|
@@ -193,7 +239,14 @@ module OllamaChat::Commands
|
|
|
193
239
|
regexp: %r(^/tools(?:\s+(on|off|enable|disable))?),
|
|
194
240
|
complete: [ 'tools', %w[ on off enable disable ] ],
|
|
195
241
|
optional: true,
|
|
196
|
-
help:
|
|
242
|
+
help: <<~EOT
|
|
243
|
+
Manage tool support:
|
|
244
|
+
- (no subcommand): List all available tools
|
|
245
|
+
- on: Activate tool support globally
|
|
246
|
+
- off: Deactivate tool support globally
|
|
247
|
+
- enable: Interactively enable a specific tool
|
|
248
|
+
- disable: Interactively disable a specific tool
|
|
249
|
+
EOT
|
|
197
250
|
) do |subcommand|
|
|
198
251
|
case subcommand
|
|
199
252
|
when nil
|
|
@@ -226,11 +279,26 @@ module OllamaChat::Commands
|
|
|
226
279
|
regexp: %r(^/session(?:\s+(change|previous|list|new|duplicate|rename|summarize|delete|model options change|model options))?((?:\s+-(?:[sf]|p\s*\w+))*)(?:\s+(.+))?$),
|
|
227
280
|
complete: [ 'session', %w[ change previous list new duplicate rename summarize delete model\ options\ change model\ options ] ],
|
|
228
281
|
optional: true,
|
|
229
|
-
options:
|
|
282
|
+
options: "[-s|-f|-p profile]\n[name]",
|
|
230
283
|
help: <<~EOT
|
|
231
|
-
Manage chat sessions
|
|
232
|
-
|
|
233
|
-
|
|
284
|
+
Manage chat sessions:
|
|
285
|
+
- list: List all available sessions
|
|
286
|
+
- new: Create a new session
|
|
287
|
+
- delete: Delete a session
|
|
288
|
+
- rename: Rename a session
|
|
289
|
+
- duplicate: Duplicate a session
|
|
290
|
+
- change [name]: Switch to a specific
|
|
291
|
+
session
|
|
292
|
+
- previous: Return to the previous
|
|
293
|
+
session
|
|
294
|
+
- summarize: Create a conversation
|
|
295
|
+
summary with
|
|
296
|
+
- -s: Output as single sentence
|
|
297
|
+
- -f: Save output to markdown file
|
|
298
|
+
- model options: Edit AI settings
|
|
299
|
+
for the current session
|
|
300
|
+
- model options change: Update session
|
|
301
|
+
settings from a profile
|
|
234
302
|
EOT
|
|
235
303
|
) do |subcommand, opts, name|
|
|
236
304
|
case subcommand
|
|
@@ -309,7 +377,9 @@ module OllamaChat::Commands
|
|
|
309
377
|
options: '[-t|-s|n=1]',
|
|
310
378
|
help: <<~EOT
|
|
311
379
|
List the last n or all conversation exchanges.
|
|
312
|
-
Options:
|
|
380
|
+
Options:
|
|
381
|
+
-t (force show thinking),
|
|
382
|
+
-s (suppress thinking).
|
|
313
383
|
EOT
|
|
314
384
|
) do |opts,number|
|
|
315
385
|
opts = go_command('ts', opts.to_s)
|
|
@@ -330,9 +400,11 @@ module OllamaChat::Commands
|
|
|
330
400
|
regexp: %r(^/last((?:\s+(?:-[pts]))*)(?:\s+(\d*))?$),
|
|
331
401
|
options: '[-p|-t|-s|n=1]',
|
|
332
402
|
help: <<~EOT
|
|
333
|
-
Show the last n or the most recent
|
|
334
|
-
|
|
335
|
-
-
|
|
403
|
+
Show the last n or the most recent
|
|
404
|
+
system/assistant message.
|
|
405
|
+
Options: -p (plain output, no pager),
|
|
406
|
+
-t (force show thinking),
|
|
407
|
+
-s (suppress thinking).
|
|
336
408
|
EOT
|
|
337
409
|
) do |opts,number|
|
|
338
410
|
opts = go_command('pts', opts.to_s)
|
|
@@ -390,7 +462,8 @@ module OllamaChat::Commands
|
|
|
390
462
|
regexp: %r(^/regenerate(\s+-e)?\s*$),
|
|
391
463
|
help: <<~EOT
|
|
392
464
|
Regenerate the last response.
|
|
393
|
-
Options: -e to edit the user message
|
|
465
|
+
Options: -e to edit the user message
|
|
466
|
+
before regenerating.
|
|
394
467
|
EOT
|
|
395
468
|
) do |opts|
|
|
396
469
|
opts = go_command('e', opts)
|
|
@@ -412,9 +485,15 @@ module OllamaChat::Commands
|
|
|
412
485
|
complete: [ 'prompt', %w[ edit info add delete list duplicate import export reset suggest ] ],
|
|
413
486
|
optional: true,
|
|
414
487
|
help: <<~EOT,
|
|
415
|
-
Manage preset prompt templates or prefill the prompt
|
|
416
|
-
|
|
417
|
-
|
|
488
|
+
Manage preset prompt templates or prefill the prompt.
|
|
489
|
+
Subcommands: edit, info, add, delete, list, duplicate,
|
|
490
|
+
import, export, reset.
|
|
491
|
+
Special: 'suggest' uses session history and a strategy
|
|
492
|
+
to AI-generate tailored prompts for you to refine, see
|
|
493
|
+
prompts `suggest_coding` or `suggest_roleplaying` for
|
|
494
|
+
predefined examples.
|
|
495
|
+
Options: -e to edit the next prompt
|
|
496
|
+
instead of prefilling
|
|
418
497
|
EOT
|
|
419
498
|
) do |opts, subcommand, filename|
|
|
420
499
|
case subcommand
|
|
@@ -477,7 +556,10 @@ module OllamaChat::Commands
|
|
|
477
556
|
regexp: %r(^/conversation\s+(save|load)((?:\s+-(?:[c]))*)\s+(.+)$),
|
|
478
557
|
complete: [ 'conversation', %w[ save load ] ],
|
|
479
558
|
options: '[-c]',
|
|
480
|
-
help:
|
|
559
|
+
help: <<~EOT
|
|
560
|
+
Load conversations or
|
|
561
|
+
save conversations (-c to clean first)
|
|
562
|
+
EOT
|
|
481
563
|
) do |subcommand,opts,path|
|
|
482
564
|
opts = go_command('c', opts.to_s)
|
|
483
565
|
case subcommand
|
|
@@ -497,8 +579,10 @@ module OllamaChat::Commands
|
|
|
497
579
|
complete: [ 'collection', %w[ change clear list rename update ] ],
|
|
498
580
|
optional: true,
|
|
499
581
|
help: <<~EOT
|
|
500
|
-
Manage the current RAG document collection:
|
|
501
|
-
|
|
582
|
+
Manage the current RAG document collection:
|
|
583
|
+
- change, clear, list, rename: Basic management
|
|
584
|
+
- update: Re-index only modified documents
|
|
585
|
+
- (no subcommand): Show current collection stats
|
|
502
586
|
EOT
|
|
503
587
|
) do |subcommand|
|
|
504
588
|
case subcommand
|
|
@@ -526,8 +610,23 @@ module OllamaChat::Commands
|
|
|
526
610
|
complete: [ 'persona', %w[ play load edit info list add delete backup import export duplicate ] ],
|
|
527
611
|
optional: true,
|
|
528
612
|
help: <<~EOT,
|
|
529
|
-
Manage and activate
|
|
530
|
-
|
|
613
|
+
Manage and activate personae for roleplay:
|
|
614
|
+
- Activation:
|
|
615
|
+
- play: Set the default persona
|
|
616
|
+
and start roleplaying
|
|
617
|
+
- load: Load a specific persona
|
|
618
|
+
into session
|
|
619
|
+
- Management:
|
|
620
|
+
- add: Create a new persona
|
|
621
|
+
- edit: Modify an existing persona
|
|
622
|
+
- delete: Remove a persona
|
|
623
|
+
- duplicate: Create a copy of a persona
|
|
624
|
+
- list: Browse all available personae
|
|
625
|
+
- info: View details of a specific persona
|
|
626
|
+
- Portability:
|
|
627
|
+
- backup: Save current personae to disk
|
|
628
|
+
- export: Export a specific persona to file
|
|
629
|
+
- import: Load a persona from a markdown file
|
|
531
630
|
EOT
|
|
532
631
|
) do |subcommand|
|
|
533
632
|
disable_content_parsing
|
|
@@ -581,7 +680,10 @@ module OllamaChat::Commands
|
|
|
581
680
|
name: :character,
|
|
582
681
|
regexp: %r(^/character(?:\s+(info|load|import))(?:\s+(\S+))?$),
|
|
583
682
|
complete: [ 'character', %w[ info load import ] ],
|
|
584
|
-
help:
|
|
683
|
+
help: <<~EOT
|
|
684
|
+
Display character info, load or import a character
|
|
685
|
+
from JSON/PNG as persona
|
|
686
|
+
EOT
|
|
585
687
|
) do |subcommand, path|
|
|
586
688
|
path = if path
|
|
587
689
|
Pathname.new(path)
|
|
@@ -601,7 +703,7 @@ module OllamaChat::Commands
|
|
|
601
703
|
path.read
|
|
602
704
|
when '.png'
|
|
603
705
|
path.open do |io|
|
|
604
|
-
OllamaChat::Utils::
|
|
706
|
+
OllamaChat::Utils::PNGMetadataExtractor.extract_character(io)
|
|
605
707
|
end
|
|
606
708
|
else
|
|
607
709
|
STDERR.puts "Only json and png characters are supported!"
|
|
@@ -659,17 +761,24 @@ module OllamaChat::Commands
|
|
|
659
761
|
complete: [ 'input', %w[ path context embedding summary ] ],
|
|
660
762
|
options: "[\n -w|-a|-p|-e|\n -c <collection>|\n -t <tags>\n]\n[arg…]",
|
|
661
763
|
help: <<~EOT
|
|
662
|
-
Import content from files, URLs,
|
|
663
|
-
|
|
664
|
-
|
|
764
|
+
Import content from files, URLs,
|
|
765
|
+
or globs into the context
|
|
766
|
+
Use subcommands: path, context, embedding,
|
|
767
|
+
summary, import (the default).
|
|
665
768
|
Options:
|
|
666
|
-
-p enable pattern mode to allow
|
|
667
|
-
|
|
668
|
-
-
|
|
669
|
-
|
|
670
|
-
-
|
|
671
|
-
|
|
672
|
-
|
|
769
|
+
-p enable pattern mode to allow
|
|
770
|
+
using globs/wildcards
|
|
771
|
+
-w <words> summary subcommand only
|
|
772
|
+
(default 100)
|
|
773
|
+
-a pattern mode only,
|
|
774
|
+
include all files for patterns
|
|
775
|
+
-c <collection> use this collection
|
|
776
|
+
(embedding subcommand only)
|
|
777
|
+
-t <tag1,tag2,…> the custom tags
|
|
778
|
+
to apply (embedding subcommand only)
|
|
779
|
+
-e edit content before importing,
|
|
780
|
+
only standard command and path
|
|
781
|
+
with single source are supported.
|
|
673
782
|
EOT
|
|
674
783
|
) do |input_mode,opts,arg|
|
|
675
784
|
disable_content_parsing
|
|
@@ -834,7 +943,13 @@ module OllamaChat::Commands
|
|
|
834
943
|
regexp: %r(^/info(?:\s+(session|model|runtime|rag))?$),
|
|
835
944
|
complete: [ 'info', %w[ session model runtime rag ] ],
|
|
836
945
|
optional: true,
|
|
837
|
-
help:
|
|
946
|
+
help: <<~EOT,
|
|
947
|
+
Show info:
|
|
948
|
+
- session: Details of the current chat session
|
|
949
|
+
- model: Information about the active AI model
|
|
950
|
+
- runtime: System and environmental data
|
|
951
|
+
- rag: Status of the RAG document system
|
|
952
|
+
EOT
|
|
838
953
|
) do |subcommand|
|
|
839
954
|
use_pager do |output|
|
|
840
955
|
case subcommand
|
|
@@ -858,7 +973,10 @@ module OllamaChat::Commands
|
|
|
858
973
|
regexp: %r(^/help(?:\s+(\S+))?$),
|
|
859
974
|
optional: true,
|
|
860
975
|
complete: [ 'help', %w[ me ] ],
|
|
861
|
-
help:
|
|
976
|
+
help: <<~EOT
|
|
977
|
+
View the help menu
|
|
978
|
+
(use 'me' for AI help or a pattern to filter)
|
|
979
|
+
EOT
|
|
862
980
|
) do |subcommand|
|
|
863
981
|
case subcommand
|
|
864
982
|
when 'me'
|
|
@@ -180,8 +180,6 @@ module OllamaChat::Information
|
|
|
180
180
|
# ollama_chat instance.
|
|
181
181
|
#
|
|
182
182
|
# @param output [IO] the output stream to write the information to, defaults to STDOUT
|
|
183
|
-
# @return [ nil ] This method does not return a value; it outputs information
|
|
184
|
-
# directly to standard output.
|
|
185
183
|
def info(output: STDOUT)
|
|
186
184
|
output.puts "💎 Running ollama_chat version: #{bold{OllamaChat::VERSION}}"
|
|
187
185
|
output.puts "🔌 Connected to ollama server version: #{bold{server_version}} on: #{bold{server_url}}"
|
|
@@ -205,8 +203,6 @@ module OllamaChat::Information
|
|
|
205
203
|
#
|
|
206
204
|
# @param pattern [String, Regexp, nil] An optional pattern to filter
|
|
207
205
|
# the commands displayed in the help message.
|
|
208
|
-
# @return [ nil ] This method always returns nil after printing the help
|
|
209
|
-
# message.
|
|
210
206
|
def display_chat_help(pattern = nil)
|
|
211
207
|
use_pager do |output|
|
|
212
208
|
output.puts help_message(pattern)
|
|
@@ -127,7 +127,7 @@ module OllamaChat::InputContent
|
|
|
127
127
|
end
|
|
128
128
|
files.merge(Pathname.glob(pattern))
|
|
129
129
|
end
|
|
130
|
-
files.map(&:expand_path)
|
|
130
|
+
files.map(&:expand_path).select(&:file?).to_set
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
# The provide_file_set_content method collects content from a set of files
|
data/lib/ollama_chat/oc.rb
CHANGED
|
@@ -190,13 +190,6 @@ module OC
|
|
|
190
190
|
decode { Pathname.new(_1).expand_path }
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
-
PATCH_TOOL = set do
|
|
194
|
-
description 'Patch tool to use'
|
|
195
|
-
|
|
196
|
-
default { `which patch`.full?(:chomp) }
|
|
197
|
-
check { value.blank? || File.exist?(value) }
|
|
198
|
-
end
|
|
199
|
-
|
|
200
193
|
GHR_URL = set do
|
|
201
194
|
description 'Base URL for GHR api server, e. g. https://ghr.example.com'
|
|
202
195
|
sensitive true
|