ollama_chat 0.0.96 → 0.0.97

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54aa30ed02a44f43f0f197247d4e7f5377007802025ddc55632f60965e6d0548
4
- data.tar.gz: aa6e058dd8135e265fbfbc848620ece0730182ff6c11e4b0e9c87a8b68e97590
3
+ metadata.gz: 83e62a371bea41c14f117fc546d3acf8e8a22d6c7f3be71a06f5dbb9f76a0201
4
+ data.tar.gz: 1348fecdb529bd12784e3843fcee09228d422db9f82a06554e6cf1923d318971
5
5
  SHA512:
6
- metadata.gz: 96d53286b971b4863f688a8613e9ca3fe3e0ee65b9c5f18b042ea3a910ea8ef8cdb4b2e2b26750c08aae6bcbbdd43371e8f0fd9598f24c494256f58f42ddd8ef
7
- data.tar.gz: 1d5aa2eadaa9723f6a20f1019f6965249e9d526d38bd6de5d5e86ed1b76ac82e86bf0e59915330f35a2a48f0ce99c6a4109a50c94d38e30965f4d658be768ce3
6
+ metadata.gz: f53884d1050759f8d32731f872e3746f92fc3b9747ecfdb12015bafc39cd98dd1e3fc977c831f116a7b95ece70fd8fc2cbfc760803d06207a2cf49584138a6de
7
+ data.tar.gz: 78144c20b98504852ce74ce33709b9a5592865d9fc75c49edc5cb23ce93a767275d5f090c38d77450be6e503b5b37cdbe895650b25f0e07f91cb118d8a7f59dc
data/CHANGES.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-07-06 v0.0.97
4
+
5
+ ### New Features
6
+
7
+ - **Session-Specific Context Formatting**:
8
+ - Introduced the `/context_format` command to manage context formats per
9
+ session.
10
+ - Added a database migration `005_add_context_format_to_sessions.rb` to
11
+ include the `context_format` column in the `sessions` table.
12
+ - Updated `OllamaChat::Database::Models::Session` with presence validations
13
+ and initialization for `context_format`.
14
+ - Implemented a `context_format` state selector using
15
+ `DatabaseStateSelector` in `lib/ollama_chat/state_selectors.rb`.
16
+ - Integrated session-based format selection into
17
+ `OllamaChat::InputContent#context_spook` and
18
+ `OllamaChat::Tools::FileContext#execute`.
19
+ - **Persona Management**:
20
+ - Added a `copy` subcommand to the `/persona` command.
21
+ - Updated `select_persona_path` in `lib/ollama_chat/personae_management.rb`
22
+ to support a `no_prefill` keyword argument, affecting `@prefill_prompt`
23
+ assignment logic.
24
+
25
+ ### Improvements & Refactorings
26
+
27
+ - **Generation API**:
28
+ - Refactored `OllamaChat::Chat#generate` to utilize `ollama.chat`,
29
+ returning a string directly and supporting an optional `system` prompt.
30
+ - Implemented `OllamaChat::SystemPromptManagement#raw_system_prompt` for
31
+ resolving active system prompts.
32
+ - Enhanced `OllamaChat::PromptManagement#suggest_prompts` with an `edit:`
33
+ parameter and improved formatting.
34
+ - **Embedding & Import Logic**:
35
+ - Updated the `embed` prompt template in `default_config.yml` to include
36
+ `%{source}`.
37
+ - Modified `#embed` in `lib/ollama_chat/source_fetching.rb` to pass the
38
+ `source` variable during interpolation.
39
+ - Added `disable_content_parsing` to `'update'` and `'embedding'` command
40
+ paths in `lib/ollama_chat/commands.rb` to prevent recursive imports of
41
+ system status messages.
42
+ - **Documentation & UX**:
43
+ - Expanded `README.md` with detailed guides for `/input` and a new "Power
44
+ User Features" section (covering `/character`, `/prompt suggest`,
45
+ `/model` profiles, and `/session summarize`).
46
+ - Corrected the help text flag in `lib/ollama_chat/information.rb` from
47
+ `-s` to `-l`.
48
+
49
+ ### Bug Fixes & Maintenance
50
+
51
+ - Added `validates_presence :profile` to the `validate` method in
52
+ `lib/ollama_chat/database/models/model_options.rb`.
53
+ - Ensured character names are cast to strings in `lib/ollama_chat/parsing.rb`
54
+ for type consistency.
55
+ - Updated `/prompt` command regex and argument logic in
56
+ `lib/ollama_chat/commands.rb`.
57
+
3
58
  ## 2026-07-03 v0.0.96
4
59
 
5
60
  ### New Features
data/README.md CHANGED
@@ -103,7 +103,120 @@ connect can be configured in the environment variable `OLLAMA_CHAT_MODEL`.
103
103
  The YAML config file is stored in `$XDG_CONFIG_HOME/ollama_chat/config.yml` and
104
104
  you can use it for more complex settings.
105
105
 
106
- ### Example: Using a Persona
106
+ ### The `/input` Command: Advanced Context Injection
107
+
108
+ The `/input` command is a versatile tool designed to bring external data into
109
+ your conversation context. Instead of manually copying and pasting, `/input`
110
+ allows you to target files, URLs, or even live system output using powerful
111
+ filters.
112
+
113
+ #### 1. Understanding "Sources"
114
+
115
+ One of the most powerful aspects of `/input` is its definition of a **source**.
116
+ A source isn't just a filename; it can be any of the following:
117
+
118
+ * **Local Files**: Standard paths (e.g., `lib/ollama_chat.rb`) or quoted paths
119
+ for those with spaces.
120
+ * **Remote URLs**: Any `http://` or `https://` link. The command will fetch the
121
+ web content and parse it before importing.
122
+ * **Shell Commands (`!`)**: Any source starting with an exclamation mark is
123
+ executed as a shell command, and its **STDOUT** is imported as the content.
124
+ * *Example*: `/input !ls -la` imports the current directory listing.
125
+ * *Example*: `/input !git branch` tells the AI which branch you are on.
126
+
127
+ #### 2. Subcommands
128
+
129
+ Depending on how you want the AI to "see" the data, you can use different
130
+ subcommands:
131
+
132
+ * **`import` (Default)**: The standard way to bring content in. It reads the
133
+ source and formats it for the chat.
134
+ * **`path`**: Specifically targets local files to read their raw content.
135
+ * **`summary`**: Instead of importing the whole file, this uses the LLM to
136
+ generate a concise summary first. Use `-w <words>` to control the length
137
+ (default: 100).
138
+ * **`embedding`**: Sends the content directly into your RAG vector database
139
+ rather than the immediate chat window. Use `-c <collection>` for specific
140
+ collections and `-t <tags>` to categorize the data.
141
+ * **`context`**: Uses `ContextSpook` to generate a comprehensive structural dump
142
+ of your project, providing both the architectural skeleton and full file
143
+ contents in a high-density format.
144
+
145
+ #### 3. The Power of Patterns (`-p`)
146
+
147
+ By adding the `-p` flag, you can use Unix-style globs to select multiple files
148
+ at once.
149
+
150
+ * **Interactive Selection**: By default, when using patterns, `ollama_chat` will
151
+ present an interactive menu allowing you to pick exactly which matching
152
+ files you want to import.
153
+ * **Bulk Import (`-a`)**: Use the `-a` (all) flag alongside `-p` to bypass the
154
+ menu and import every file that matches the pattern automatically.
155
+
156
+ #### 4. Refining the Input
157
+
158
+ * **Editing on the Fly (`-e`)**: For the `import` and `path` subcommands, you
159
+ can use the `-e` flag. This opens the content in your default editor,
160
+ allowing you to trim or modify the text before it is sent to the LLM.
161
+ * **Custom Tags**: When embedding, tags allow you to create "slices" of
162
+ knowledge that can be retrieved later based on specific categories.
163
+
164
+ #### Examples
165
+
166
+ | Goal | Command |
167
+ | :--- | :--- |
168
+ | **Import a single file** | `/input path lib/ollama_chat.rb` |
169
+ | **Input the output of a command** | `/input !env` |
170
+ | **Summarize multiple files (Interactive)** | `/input summary -p "spec/**/*_spec.rb"` |
171
+ | **Bulk import all Ruby files in `lib/`** | `/input -p "lib/**/*.rb" -a` |
172
+ | **Embed a doc into a specific collection** | `/input embedding -c documentation-v1 "docs/api.md"` |
173
+ | **Import and edit a URL's content** | `/input -e https://example.com/guide` |
174
+ | **Generate project context for the AI** | `/input context` |
175
+
176
+ ### 🚀 Power User Features
177
+
178
+ Beyond basic chat, **ollama_chat** includes several advanced systems designed
179
+ for high-end AI orchestration and personalization.
180
+
181
+ #### 1. The Character & Persona Engine
182
+ The bot supports a sophisticated roleplay system that goes beyond simple text prompts.
183
+
184
+ * **SillyTavern Compatibility (`/character`)**: You can import character
185
+ cards directly from PNG or JSON files. This supports the SillyTavern
186
+ standard, allowing you to load entire personalities—including metadata and
187
+ example dialogues—embedded within an image file.
188
+ * *Example*: `/character import fluffy.png`
189
+ * **Persona Management (`/persona`)**: Create, duplicate, and export complex
190
+ persona profiles. You can use `/persona play` to activate a personality as
191
+ your default for the session.
192
+
193
+ #### 2. Intelligent Prompt Engineering (`/prompt suggest`)
194
+
195
+ Instead of guessing the right prompt, you can let the AI help you write one.
196
+ The `suggest` subcommand analyzes your current session history and utilizes
197
+ specialized strategies (like `suggest_coding` or `suggest_roleplaying`) to
198
+ generate a tailored prompt template for you to refine.
199
+
200
+ #### 3. Model Profile Orchestration (`/model`)
201
+
202
+ Avoid the tedious task of re-configuring model parameters every time you
203
+ switch. The profile system allows you to manage "Live" vs "Saved" settings:
204
+ * **Saved -> Live**: Apply a pre-configured profile's settings (temperature,
205
+ top\_p, etc.) to your current session using `options to session`.
206
+ * **Live -> Saved**: After fine-tuning your model's behavior during a chat,
207
+ "bake" those live settings into a permanent profile using `options from
208
+ session`.
209
+
210
+ #### 4. Conversation Archiving (`/session summarize`)
211
+
212
+ Turn your long-form brainstorming sessions into structured documents. The
213
+ `/session summarize` command can distill an entire conversation into a concise
214
+ summary.
215
+ * **Quick View**: Use `-s` for a one-sentence executive summary.
216
+ * **Archiving**: Use `-f <filename>` to dump the full summary directly into a
217
+ Markdown file, creating an automatic journal of your project's evolution.
218
+
219
+ ### Using a Persona
107
220
 
108
221
  You can import a persona profile from a Markdown file and load it into the
109
222
  current session. The persona's content is then interpolated into the system
@@ -140,7 +253,7 @@ seems to be the problem that has brought you to our humble abode at 221B Baker
140
253
  Street?
141
254
  ```
142
255
 
143
- ### Example: Using a multimodal model
256
+ ### Using a multimodal model
144
257
 
145
258
  This example shows how an image like this can be sent to the LLM for multimodal
146
259
  analysis:
@@ -230,23 +230,39 @@ class OllamaChat::Chat
230
230
  @messages.system_name
231
231
  end
232
232
 
233
- # The generate method sends a prompt to the Ollama model and returns the
234
- # result.
235
- #
236
- # @param prompt [ String ] the prompt to send to the model
237
- #
238
- # @return [ Ollama::Response ] the response from the Ollama model
239
- def generate(prompt:)
240
- prepare_model(@model)
241
- msg = "Using prompt #{prompt.inspect} for generation to #{@model.inspect}."
242
- log(:info, msg)
243
- ollama.generate(
244
- model: @model,
245
- prompt:,
246
- options: model_options,
247
- stream: false,
248
- think: false,
249
- )
233
+ # Sends a structured chat request to the Ollama model and returns the
234
+ # response content.
235
+ #
236
+ # This method creates a minimal conversation consisting of a system message
237
+ # and a user message, executing it as a one-shot chat interaction.
238
+ #
239
+ # @param system [String] the system prompt to guide the model's behavior
240
+ # (defaults to current raw_system_prompt)
241
+ #
242
+ # @param prompt [String] the user prompt to send to the model
243
+ #
244
+ # @return [String] the content of the resulting response message
245
+ def generate(system: raw_system_prompt, prompt:)
246
+ messages = [
247
+ OllamaChat::Message.new(
248
+ role: 'system',
249
+ content: system,
250
+ ),
251
+
252
+ OllamaChat::Message.new(
253
+ role: 'user',
254
+ content: prompt
255
+ ),
256
+ ]
257
+
258
+ ollama.chat(
259
+ model: @model,
260
+ messages: ,
261
+ options: model_options,
262
+ stream: false,
263
+ think: false,
264
+ tools:
265
+ )&.message&.content.to_s
250
266
  end
251
267
 
252
268
  private
@@ -234,6 +234,15 @@ module OllamaChat::Commands
234
234
  :next
235
235
  end
236
236
 
237
+ command(
238
+ name: :context_format,
239
+ regexp: %r(^/context_format$),
240
+ help: 'Configure the context_format for context_spook JSON|TOON',
241
+ ) do
242
+ context_format.choose
243
+ :next
244
+ end
245
+
237
246
  command(
238
247
  name: :tools,
239
248
  regexp: %r(^/tools(?:\s+(on|off|enable|disable))?),
@@ -481,7 +490,7 @@ module OllamaChat::Commands
481
490
 
482
491
  command(
483
492
  name: :prompt,
484
- regexp: %r(^/prompt(\s+-e)?(?:\s+(edit|info|add|delete|list|duplicate|import|export|reset|suggest))?(?:\s+(\S+))?$),
493
+ regexp: %r(^/prompt(?:\s+(edit|info|add|delete|list|duplicate|import|export|reset|suggest|-e))?(\s+-e)?(?:\s+(\S+))?$),
485
494
  complete: [ 'prompt', %w[ edit info add delete list duplicate import export reset suggest ] ],
486
495
  optional: true,
487
496
  help: <<~EOT,
@@ -495,7 +504,7 @@ module OllamaChat::Commands
495
504
  Options: -e to edit the next prompt
496
505
  instead of prefilling
497
506
  EOT
498
- ) do |opts, subcommand, filename|
507
+ ) do |subcommand, opts, filename|
499
508
  case subcommand
500
509
  when 'add'
501
510
  add_new_prompt
@@ -526,11 +535,11 @@ module OllamaChat::Commands
526
535
  end
527
536
  end
528
537
  when 'suggest'
529
- prompt = suggest_prompts and next prompt
530
- when nil
531
- opts = go_command('e', opts)
538
+ opts = go_command('e', opts)
539
+ prompt = suggest_prompts(edit: opts[?e]) and next prompt
540
+ when nil, '-e'
532
541
  if prompt = choose_prompt(prompt: 'Which template shall guide the next response? %s').full?(&:to_s)
533
- if opts[?e]
542
+ if subcommand
534
543
  prompt = edit_text(prompt)
535
544
  next prompt
536
545
  else
@@ -595,7 +604,10 @@ module OllamaChat::Commands
595
604
  when 'rename'
596
605
  rename_collection(collection)
597
606
  when 'update'
598
- results = update_collection and next results
607
+ if results = update_collection
608
+ disable_content_parsing
609
+ next results
610
+ end
599
611
  when nil
600
612
  collection_stats
601
613
  end
@@ -606,8 +618,8 @@ module OllamaChat::Commands
606
618
 
607
619
  command(
608
620
  name: :persona,
609
- regexp: %r(^/persona(?:\s+(play|load|edit|info|list|add|delete|backup|import|export|duplicate))?$),
610
- complete: [ 'persona', %w[ play load edit info list add delete backup import export duplicate ] ],
621
+ regexp: %r(^/persona(?:\s+(play|load|edit|info|list|add|delete|backup|import|export|duplicate|copy))?$),
622
+ complete: [ 'persona', %w[ play load edit info list add delete backup import export duplicate copy ] ],
611
623
  optional: true,
612
624
  help: <<~EOT,
613
625
  Manage and activate personae for roleplay:
@@ -616,6 +628,7 @@ module OllamaChat::Commands
616
628
  and start roleplaying
617
629
  - load: Load a specific persona
618
630
  into session
631
+ - copy: persona pathname to clipboard
619
632
  - Management:
620
633
  - add: Create a new persona
621
634
  - edit: Modify an existing persona
@@ -670,6 +683,9 @@ module OllamaChat::Commands
670
683
  when 'play'
671
684
  set_default_persona
672
685
  :next
686
+ when 'copy'
687
+ select_persona_path(no_prefill: true)
688
+ :next
673
689
  else
674
690
  select_persona_path
675
691
  :next
@@ -805,6 +821,7 @@ module OllamaChat::Commands
805
821
  next context_spook(nil) || :next
806
822
  end
807
823
  when 'embedding'
824
+ disable_content_parsing
808
825
  opts = go_command('pac:t:', opts)
809
826
  switch_collection(opts[?c]) do |other_collection|
810
827
  if collection == other_collection and !confirm?(
@@ -0,0 +1,5 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_column :sessions, :context_format, String, null: false, default: 'JSON'
4
+ end
5
+ end
@@ -12,6 +12,7 @@ class OllamaChat::Database::Models::ModelOptions < Sequel::Model(OllamaChat::DB)
12
12
  super
13
13
  validates_presence :model_name
14
14
  validates_unique [ :model_name, :profile ]
15
+ validates_presence :profile
15
16
  end
16
17
 
17
18
  # @!attribute [v] id
@@ -25,6 +25,20 @@ class OllamaChat::Database::Models::Session < Sequel::Model(OllamaChat::DB)
25
25
  validates_unique :name
26
26
  validates_presence :updated_at
27
27
  validates_presence :created_at
28
+
29
+ validates_presence :context_format
30
+ validates_presence :current_voice
31
+ validates_presence :document_policy
32
+ validates_presence :embedding_enabled
33
+ validates_presence :location_enabled
34
+ validates_presence :markdown_enabled
35
+ validates_presence :runtime_info_enabled
36
+ validates_presence :stream_enabled
37
+ validates_presence :think_loud_enabled
38
+ validates_presence :think_mode
39
+ validates_presence :think_strip_enabled
40
+ validates_presence :tools_enabled
41
+ validates_presence :voice_enabled
28
42
  end
29
43
 
30
44
  # Calculates the age of the session based on the last update timestamp.
@@ -93,6 +107,9 @@ class OllamaChat::Database::Models::Session < Sequel::Model(OllamaChat::DB)
93
107
  # @!attribute [v] current_voice
94
108
  # @return [String] The name of the voice currently in use.
95
109
  #
110
+ # @!attribute [v] context_format
111
+ # @return [String] The format used for project context generation (e.g., 'JSON', 'TOON').
112
+ #
96
113
  # @!attribute [v] working_directory
97
114
  # @return [String] The directory used as the working context for this session.
98
115
  #
@@ -144,6 +161,7 @@ class OllamaChat::Database::Models::Session < Sequel::Model(OllamaChat::DB)
144
161
  voice_enabled: chat.config.voice.enabled,
145
162
  model_options: ,
146
163
  current_voice: chat.config.voice.default,
164
+ context_format: chat.config.context.format,
147
165
  working_directory: Dir.pwd,
148
166
  messages: '',
149
167
  }
@@ -142,6 +142,7 @@ module OllamaChat::Information
142
142
  output.print ' '; voices.show(output:)
143
143
  end
144
144
  output.print ' '; location.show(output:)
145
+ output.print ' '; context_format.show(output:)
145
146
  end
146
147
 
147
148
  # Displays the current runtime environment details, split into static
@@ -232,7 +233,7 @@ module OllamaChat::Information
232
233
  -V display the current version number and quit
233
234
  -h this help
234
235
 
235
- Use `?selector` with `-m` or `-s` to filter options. Multiple matches
236
+ Use `?selector` with `-m` or `-l` to filter options. Multiple matches
236
237
  will open a chooser dialog.
237
238
  EOT
238
239
  0
@@ -92,7 +92,7 @@ module OllamaChat::InputContent
92
92
  # @example Load default context
93
93
  # context_spook(nil)
94
94
  def context_spook(patterns, all: false)
95
- format = config.context.format
95
+ format = @context_format.selected
96
96
  myself = self
97
97
  if patterns
98
98
  ContextSpook::generate_context(verbose: true, format:) do |context|
@@ -24,7 +24,7 @@ infobar:
24
24
  :frames: :braille181
25
25
  :message: ✓
26
26
  prompts:
27
- embed: This source has been added to or updated in collection "%{collection}".
27
+ embed: The source %{source} has been added to or updated in collection "%{collection}".
28
28
  rerank: |
29
29
  Query: %{query}
30
30
  Candidates:
@@ -78,7 +78,7 @@ module OllamaChat::Parsing
78
78
  if data = metadata.delete('chara') and
79
79
  (char, char_data = OllamaChat::Utils::PNGMetadataExtractor.decode_character(data))
80
80
  then
81
- name = char_data.dig('data', 'name').full? || Pathname.new(source_io.path).basename.sub_ext('')
81
+ name = char_data.dig('data', 'name').full? || Pathname.new(source_io.path).basename.sub_ext('').to_s
82
82
  results << "Character Profile:\n\n#{personalize_character_profile(char, name:)}"
83
83
  end
84
84
 
@@ -262,13 +262,14 @@ module OllamaChat::PersonaeManagement
262
262
  # Prompts the user to select a persona, copies its filesystem path to the
263
263
  # clipboard, and sets it as the prefill prompt for the next interaction.
264
264
  #
265
+ # @param [Boolean] no_prefill Whether to skip updating the prefill prompt.
265
266
  # @return [String, nil] the filesystem path of the selected persona,
266
267
  # or nil if the selection was cancelled.
267
- def select_persona_path
268
+ def select_persona_path(no_prefill: false)
268
269
  persona = choose_persona(prompt: "Which persona's path do you need? %s") or return
269
270
  path = persona_name_to_pathname(persona).to_s
270
271
  perform_copy_to_clipboard(text: path, edit: false)
271
- @prefill_prompt = path
272
+ no_prefill or @prefill_prompt = path
272
273
  path
273
274
  end
274
275
 
@@ -579,13 +580,12 @@ module OllamaChat::PersonaeManagement
579
580
  # @param persona_name [String] the name of the character to replace {{char}} with
580
581
  # @return [String] the resulting structured Markdown persona profile
581
582
  def convert_json_character_to_markdown(character, persona_name)
582
- response = generate(
583
+ generate(
583
584
  prompt: prompt(:persona_architect).to_s % {
584
585
  character:,
585
586
  persona_template: prompt(:persona).to_s
586
587
  }
587
- ).response
588
- response.gsub(/{{user}}/i, '%{user}').gsub(/{{char}}/i, persona_name)
588
+ ).gsub(/{{user}}/i, '%{user}').gsub(/{{char}}/i, persona_name)
589
589
  end
590
590
 
591
591
  # Interactively exports a persona profile to a specified file.
@@ -232,24 +232,38 @@ module OllamaChat::PromptManagement
232
232
  # Interactively generates follow-up prompt suggestions based on the current
233
233
  # session.
234
234
  #
235
- # This method prompts the user to select a suggestion strategy (e.g., coding
236
- # or roleplaying), constructs a prompt containing the conversation history,
237
- # and requests a generation from the AI model. The resulting suggestions
238
- # are then opened in the editor for final refinement before being returned.
235
+ # This method constructs a prompt containing the conversation history and an
236
+ # instruction (either selected from a template or provided manually) and
237
+ # requests a generation from the AI model. The resulting suggestions are then
238
+ # opened in the editor for final refinement before being returned.
239
+ #
240
+ # @param edit [Boolean] If true, allows the user to write a custom suggestion
241
+ # instruction on the fly; otherwise, prompts the user to pick a template.
239
242
  #
240
243
  # @return [String, nil] The refined suggestion text, or nil if the process
241
244
  # was cancelled.
242
- def suggest_prompts
243
- # Let the user pick a prompt template (e.g., suggest_coding, suggest_roleplaying)
244
- instruction = choose_prompt(prompt: 'Which suggestion strategy shall we employ? %s') or return
245
+ def suggest_prompts(edit: false)
246
+ instruction = nil
247
+ if edit
248
+ # Let the user write a suggestion instruction on the fly
249
+ instruction = edit_text('')
250
+ else
251
+ # Let the user pick a prompt template (e.g., suggest_coding, suggest_roleplaying)
252
+ instruction = choose_prompt(prompt: 'Which suggestion strategy shall we employ? %s') or return
253
+ end
245
254
 
246
255
  # Build the context by gathering all current conversation messages
247
256
  history = prepare_conversation_history
248
- full_prompt = "Conversation History:\n#{history}\n\n#{instruction}"
257
+ full_prompt = <<~EOT
258
+ Conversation History:
259
+ #{history}
260
+
261
+ Instruction:
262
+ #{instruction}
263
+ EOT
249
264
 
250
- # Execute a silent generation call (doesn't add to history)
251
- response = generate(prompt: full_prompt)
252
- suggestions = response.response
265
+ # Execute a silent chat oneshot call (doesn't add to history)
266
+ suggestions = generate(prompt: full_prompt)
253
267
 
254
268
  # Pass the AI's suggestions through the editor for final refinement
255
269
  edit_text(suggestions)
@@ -349,7 +349,7 @@ module OllamaChat::SessionManagement
349
349
  prompt: prompt(:session_summarize).to_s % {
350
350
  sender_name:, unit:, message_content:, message_thinking:, context:
351
351
  }
352
- ).response
352
+ )
353
353
  content = if pretty
354
354
  '**%s**: %s' % [ sender_name_output, summary ]
355
355
  else
@@ -380,7 +380,7 @@ module OllamaChat::SessionManagement
380
380
  c << "%s: %s\n\n" % [ sender_name, message.content ]
381
381
  end
382
382
  prompt = prompt(:session_title).to_s % { length:, content: }
383
- generate(prompt:).response.full? do |name|
383
+ generate(prompt:).full? do |name|
384
384
  name = name.
385
385
  gsub(/(\A(\s|[^A-Za-z])+|(\s|[^A-Za-z])+\z)/m, '').
386
386
  gsub(/\s+/, ' ')
@@ -246,7 +246,7 @@ module OllamaChat::SourceFetching
246
246
  source_io.rewind
247
247
  embed_source(source_io, source, tags:) or return
248
248
  end
249
- prompt(:embed).to_s % { collection: }
249
+ prompt(:embed).to_s % { source:, collection: }
250
250
  end
251
251
 
252
252
  private
@@ -241,6 +241,14 @@ module OllamaChat::StateSelectors
241
241
  # that manages the currently selected voice for the chat session
242
242
  attr_reader :voices
243
243
 
244
+ # The context_format reader returns the context format selector for the
245
+ # chat session.
246
+ #
247
+ # @return [ OllamaChat::StateSelector ] the context format selector object
248
+ # that manages the format used for project context generation
249
+ # (e.g., 'JSON', 'TOON')
250
+ attr_reader :context_format
251
+
244
252
  # Sets up state selectors for document policy and think mode based on the
245
253
  # provided configuration.
246
254
  #
@@ -268,5 +276,11 @@ module OllamaChat::StateSelectors
268
276
  states: config.voice.list,
269
277
  allow_empty: true
270
278
  )
279
+ @context_format = DatabaseStateSelector.new(
280
+ chat: self,
281
+ attribute: :context_format,
282
+ name: 'Context format',
283
+ states: %w[ JSON TOON ],
284
+ )
271
285
  end
272
286
  end
@@ -41,6 +41,27 @@ module OllamaChat::SystemPromptManagement
41
41
  messages.system_name
42
42
  end
43
43
 
44
+ # Resolves the currently active system prompt name to its raw text content.
45
+ #
46
+ # If the current system prompt is set to 'model_default', this method
47
+ # retrieves the default prompt associated with the loaded model. Otherwise,
48
+ # it fetches the content of the specifically named system prompt from the
49
+ # database.
50
+ #
51
+ # The returned string represents the base template; any dynamic placeholders
52
+ # (e.g., %{persona} and %{runtime_info}) are nullified to ensure only the raw
53
+ # structure is returned.
54
+ #
55
+ # @return [String] The raw text content of the active system prompt.
56
+ def raw_system_prompt
57
+ system_name = current_system_prompt_name
58
+ if system_name == 'model_default'
59
+ model_default_system_prompt.to_s
60
+ else
61
+ system_prompt(system_name).to_s
62
+ end % { persona: nil, runtime_info: nil }
63
+ end
64
+
44
65
  # Retrieves the content of the system prompt currently active in the chat
45
66
  # session.
46
67
  #
@@ -5,7 +5,6 @@
5
5
  # thinking modes, checking the current state, and displaying the current
6
6
  # think mode status.
7
7
  module OllamaChat::ThinkControl
8
-
9
8
  # An array of strings representing the valid configuration states for the
10
9
  # thinking mode.
11
10
  #
@@ -65,9 +65,10 @@ class OllamaChat::Tools::FileContext
65
65
  # @return [String] the generated context data in the configured format (JSON by default)
66
66
  # @return [String] a JSON string containing error information if the operation fails
67
67
  def execute(tool_call, **opts)
68
- config = opts[:chat].config
68
+ chat = opts[:chat]
69
+ config = chat.config
69
70
  pattern = tool_call.function.arguments.pattern
70
- format = config.context.format
71
+ format = chat.context_format.selected
71
72
 
72
73
  directory = Pathname.new(tool_call.function.arguments.directory || ?.)
73
74
  search_path = directory + pattern
@@ -188,7 +188,7 @@ class OllamaChat::Tools::RetrieveDocumentSnippets
188
188
  begin
189
189
  # We use the active chat model to perform the surgical precision
190
190
  # filtering
191
- if response = chat.generate(prompt:)&.response.full?
191
+ if response = chat.generate(prompt:).full?
192
192
  indices = response.scan(/\d+/).map(&:to_i).select { |i| (0...records.size).include?(i) }
193
193
  records = records.values_at(*indices) if indices.any?
194
194
  end
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.96'
3
+ VERSION = '0.0.97'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  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.96 ruby lib
2
+ # stub: ollama_chat 0.0.97 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.96".freeze
6
+ s.version = "0.0.97".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]
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = "The app provides a command-line interface (CLI) to an Ollama AI model,\nallowing users to engage in text-based conversations and generate\nhuman-like responses. Users can import data from local files or web pages,\nwhich are then processed through three different modes: fully importing the\ncontent into the conversation context, summarizing the information for\nconcise reference, or storing it in an embedding vector database for later\nretrieval based on the conversation.\n".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_chat".freeze, "ollama_chat_send".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/command_concern.rb".freeze, "lib/ollama_chat/commands.rb".freeze, "lib/ollama_chat/config_handling.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/database.rb".freeze, "lib/ollama_chat/database/duplicatable.rb".freeze, "lib/ollama_chat/database/migrations.rb".freeze, "lib/ollama_chat/database/migrations/001_initial_schema.rb".freeze, "lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb".freeze, "lib/ollama_chat/database/models/favourite.rb".freeze, "lib/ollama_chat/database/models/model_options.rb".freeze, "lib/ollama_chat/database/models/prompt.rb".freeze, "lib/ollama_chat/database/models/session.rb".freeze, "lib/ollama_chat/database/session_locking.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/favourites_management.rb".freeze, "lib/ollama_chat/file_editing.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/http_handling.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/links_set.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/logging.rb".freeze, "lib/ollama_chat/message.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/oc.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/pager.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/personae_management.rb".freeze, "lib/ollama_chat/prompt_handling.rb".freeze, "lib/ollama_chat/prompt_management.rb".freeze, "lib/ollama_chat/rag_handling.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/session_management.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/system_prompt_management.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/token_estimator.rb".freeze, "lib/ollama_chat/token_estimator/crude.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/compute_bmi.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/copy_to_clipboard.rb".freeze, "lib/ollama_chat/tools/delete_file.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/eval_ruby.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/execute_ri.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/generate_image.rb".freeze, "lib/ollama_chat/tools/generate_password.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_ghr.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_rfc.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/get_url.rb".freeze, "lib/ollama_chat/tools/move_file.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/paste_from_clipboard.rb".freeze, "lib/ollama_chat/tools/paste_into_editor.rb".freeze, "lib/ollama_chat/tools/patch_file.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/resolve_tag.rb".freeze, "lib/ollama_chat/tools/retrieve_document_snippets.rb".freeze, "lib/ollama_chat/tools/roll_dice.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/backup.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/json_jsonl_io.rb".freeze, "lib/ollama_chat/utils/path_completer.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/utils/png_metadata_extractor.rb".freeze, "lib/ollama_chat/utils/tag_resolver.rb".freeze, "lib/ollama_chat/utils/utf8_converter.rb".freeze, "lib/ollama_chat/utils/value_formatter.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
- s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "config/sherlock.md".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/command_concern.rb".freeze, "lib/ollama_chat/commands.rb".freeze, "lib/ollama_chat/config_handling.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/database.rb".freeze, "lib/ollama_chat/database/duplicatable.rb".freeze, "lib/ollama_chat/database/migrations.rb".freeze, "lib/ollama_chat/database/migrations/001_initial_schema.rb".freeze, "lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb".freeze, "lib/ollama_chat/database/models/favourite.rb".freeze, "lib/ollama_chat/database/models/model_options.rb".freeze, "lib/ollama_chat/database/models/prompt.rb".freeze, "lib/ollama_chat/database/models/session.rb".freeze, "lib/ollama_chat/database/session_locking.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/favourites_management.rb".freeze, "lib/ollama_chat/file_editing.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/http_handling.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/links_set.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/logging.rb".freeze, "lib/ollama_chat/message.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/oc.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/pager.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/personae_management.rb".freeze, "lib/ollama_chat/prompt_handling.rb".freeze, "lib/ollama_chat/prompt_management.rb".freeze, "lib/ollama_chat/rag_handling.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/session_management.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/system_prompt_management.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/token_estimator.rb".freeze, "lib/ollama_chat/token_estimator/crude.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/compute_bmi.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/copy_to_clipboard.rb".freeze, "lib/ollama_chat/tools/delete_file.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/eval_ruby.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/execute_ri.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/generate_image.rb".freeze, "lib/ollama_chat/tools/generate_password.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_ghr.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_rfc.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/get_url.rb".freeze, "lib/ollama_chat/tools/move_file.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/paste_from_clipboard.rb".freeze, "lib/ollama_chat/tools/paste_into_editor.rb".freeze, "lib/ollama_chat/tools/patch_file.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/resolve_tag.rb".freeze, "lib/ollama_chat/tools/retrieve_document_snippets.rb".freeze, "lib/ollama_chat/tools/roll_dice.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/backup.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/json_jsonl_io.rb".freeze, "lib/ollama_chat/utils/path_completer.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/utils/png_metadata_extractor.rb".freeze, "lib/ollama_chat/utils/tag_resolver.rb".freeze, "lib/ollama_chat/utils/utf8_converter.rb".freeze, "lib/ollama_chat/utils/value_formatter.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/conversation.jsonl".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/fluffy.png".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/miyu.png".freeze, "spec/assets/pirateweather.json".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/database/models/favourite_spec.rb".freeze, "spec/ollama_chat/file_editing_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/history_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/token_estimator_spec.rb".freeze, "spec/ollama_chat/tool_calling_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/compute_bmi_spec.rb".freeze, "spec/ollama_chat/tools/copy_to_clipboard_spec.rb".freeze, "spec/ollama_chat/tools/delete_file_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/execute_ri_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/generate_image_spec.rb".freeze, "spec/ollama_chat/tools/generate_password_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_ghr_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_rfc_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/get_url_spec.rb".freeze, "spec/ollama_chat/tools/move_file_spec.rb".freeze, "spec/ollama_chat/tools/open_file_in_editor_spec.rb".freeze, "spec/ollama_chat/tools/paste_from_clipboard_spec.rb".freeze, "spec/ollama_chat/tools/paste_into_editor_spec.rb".freeze, "spec/ollama_chat/tools/patch_file_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/resolve_tag_spec.rb".freeze, "spec/ollama_chat/tools/retrieve_document_snippets_spec.rb".freeze, "spec/ollama_chat/tools/roll_dice_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/path_completer_spec.rb".freeze, "spec/ollama_chat/utils/png_metadata_extractor_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/command_concern.rb".freeze, "lib/ollama_chat/commands.rb".freeze, "lib/ollama_chat/config_handling.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/database.rb".freeze, "lib/ollama_chat/database/duplicatable.rb".freeze, "lib/ollama_chat/database/migrations.rb".freeze, "lib/ollama_chat/database/migrations/001_initial_schema.rb".freeze, "lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb".freeze, "lib/ollama_chat/database/migrations/005_add_context_format_to_sessions.rb".freeze, "lib/ollama_chat/database/models/favourite.rb".freeze, "lib/ollama_chat/database/models/model_options.rb".freeze, "lib/ollama_chat/database/models/prompt.rb".freeze, "lib/ollama_chat/database/models/session.rb".freeze, "lib/ollama_chat/database/session_locking.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/favourites_management.rb".freeze, "lib/ollama_chat/file_editing.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/http_handling.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/links_set.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/logging.rb".freeze, "lib/ollama_chat/message.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/oc.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/pager.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/personae_management.rb".freeze, "lib/ollama_chat/prompt_handling.rb".freeze, "lib/ollama_chat/prompt_management.rb".freeze, "lib/ollama_chat/rag_handling.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/session_management.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/system_prompt_management.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/token_estimator.rb".freeze, "lib/ollama_chat/token_estimator/crude.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/compute_bmi.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/copy_to_clipboard.rb".freeze, "lib/ollama_chat/tools/delete_file.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/eval_ruby.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/execute_ri.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/generate_image.rb".freeze, "lib/ollama_chat/tools/generate_password.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_ghr.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_rfc.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/get_url.rb".freeze, "lib/ollama_chat/tools/move_file.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/paste_from_clipboard.rb".freeze, "lib/ollama_chat/tools/paste_into_editor.rb".freeze, "lib/ollama_chat/tools/patch_file.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/resolve_tag.rb".freeze, "lib/ollama_chat/tools/retrieve_document_snippets.rb".freeze, "lib/ollama_chat/tools/roll_dice.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/backup.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/json_jsonl_io.rb".freeze, "lib/ollama_chat/utils/path_completer.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/utils/png_metadata_extractor.rb".freeze, "lib/ollama_chat/utils/tag_resolver.rb".freeze, "lib/ollama_chat/utils/utf8_converter.rb".freeze, "lib/ollama_chat/utils/value_formatter.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
+ s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "config/sherlock.md".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/command_concern.rb".freeze, "lib/ollama_chat/commands.rb".freeze, "lib/ollama_chat/config_handling.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/database.rb".freeze, "lib/ollama_chat/database/duplicatable.rb".freeze, "lib/ollama_chat/database/migrations.rb".freeze, "lib/ollama_chat/database/migrations/001_initial_schema.rb".freeze, "lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb".freeze, "lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb".freeze, "lib/ollama_chat/database/migrations/005_add_context_format_to_sessions.rb".freeze, "lib/ollama_chat/database/models/favourite.rb".freeze, "lib/ollama_chat/database/models/model_options.rb".freeze, "lib/ollama_chat/database/models/prompt.rb".freeze, "lib/ollama_chat/database/models/session.rb".freeze, "lib/ollama_chat/database/session_locking.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/favourites_management.rb".freeze, "lib/ollama_chat/file_editing.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/http_handling.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/links_set.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/logging.rb".freeze, "lib/ollama_chat/message.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/oc.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/pager.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/personae_management.rb".freeze, "lib/ollama_chat/prompt_handling.rb".freeze, "lib/ollama_chat/prompt_management.rb".freeze, "lib/ollama_chat/rag_handling.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/session_management.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/system_prompt_management.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/token_estimator.rb".freeze, "lib/ollama_chat/token_estimator/crude.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/compute_bmi.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/copy_to_clipboard.rb".freeze, "lib/ollama_chat/tools/delete_file.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/eval_ruby.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/execute_ri.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/generate_image.rb".freeze, "lib/ollama_chat/tools/generate_password.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_ghr.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_rfc.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/get_url.rb".freeze, "lib/ollama_chat/tools/move_file.rb".freeze, "lib/ollama_chat/tools/open_file_in_editor.rb".freeze, "lib/ollama_chat/tools/paste_from_clipboard.rb".freeze, "lib/ollama_chat/tools/paste_into_editor.rb".freeze, "lib/ollama_chat/tools/patch_file.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/resolve_tag.rb".freeze, "lib/ollama_chat/tools/retrieve_document_snippets.rb".freeze, "lib/ollama_chat/tools/roll_dice.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/backup.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/json_jsonl_io.rb".freeze, "lib/ollama_chat/utils/path_completer.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/utils/png_metadata_extractor.rb".freeze, "lib/ollama_chat/utils/tag_resolver.rb".freeze, "lib/ollama_chat/utils/utf8_converter.rb".freeze, "lib/ollama_chat/utils/value_formatter.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/conversation.jsonl".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/fluffy.png".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/miyu.png".freeze, "spec/assets/pirateweather.json".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/database/models/favourite_spec.rb".freeze, "spec/ollama_chat/file_editing_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/history_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/token_estimator_spec.rb".freeze, "spec/ollama_chat/tool_calling_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/compute_bmi_spec.rb".freeze, "spec/ollama_chat/tools/copy_to_clipboard_spec.rb".freeze, "spec/ollama_chat/tools/delete_file_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/execute_ri_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/generate_image_spec.rb".freeze, "spec/ollama_chat/tools/generate_password_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_ghr_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_rfc_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/get_url_spec.rb".freeze, "spec/ollama_chat/tools/move_file_spec.rb".freeze, "spec/ollama_chat/tools/open_file_in_editor_spec.rb".freeze, "spec/ollama_chat/tools/paste_from_clipboard_spec.rb".freeze, "spec/ollama_chat/tools/paste_into_editor_spec.rb".freeze, "spec/ollama_chat/tools/patch_file_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/resolve_tag_spec.rb".freeze, "spec/ollama_chat/tools/retrieve_document_snippets_spec.rb".freeze, "spec/ollama_chat/tools/roll_dice_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/path_completer_spec.rb".freeze, "spec/ollama_chat/utils/png_metadata_extractor_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
17
17
  s.homepage = "https://github.com/flori/ollama_chat".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "OllamaChat - A command-line interface (CLI) for interacting with an Ollama AI model.".freeze, "--main".freeze, "README.md".freeze]
@@ -31,7 +31,7 @@ describe OllamaChat::SourceFetching do
31
31
  './spec/assets/example.html'
32
32
  )
33
33
  expect(chat.embed('./spec/assets/example.html')).to eq(
34
- 'This source has been added to or updated in collection "default".'
34
+ 'The source ./spec/assets/example.html has been added to or updated in collection "default".'
35
35
  )
36
36
  end
37
37
 
@@ -201,8 +201,7 @@ describe OllamaChat::Tools::RetrieveDocumentSnippets do
201
201
  expect(tool).to receive(:find_document_records).and_return(records)
202
202
 
203
203
  allow(chat).to receive(:prompt).with('rerank').and_return("template %{query} %{candidates}")
204
- response_val = double('Response', response: double('FullResponse', full?: '1', response: '1'))
205
- allow(chat).to receive(:generate).with(prompt: anything).and_return(response_val)
204
+ allow(chat).to receive(:generate).with(prompt: anything).and_return('1')
206
205
 
207
206
  result = tool.execute(tool_call, chat:)
208
207
  json = json_object(result)
@@ -239,8 +238,7 @@ describe OllamaChat::Tools::RetrieveDocumentSnippets do
239
238
  expect(tool).to receive(:find_document_records).and_return(records)
240
239
 
241
240
  allow(chat).to receive(:prompt).with('rerank').and_return("template %{query} %{candidates}")
242
- response_val = double('Response', response: double('FullResponse', full?: '0', response: '0'))
243
- allow(chat).to receive(:generate).with(prompt: anything).and_return(response_val)
241
+ allow(chat).to receive(:generate).with(prompt: anything).and_return('0')
244
242
 
245
243
  result = tool.execute(tool_call, chat:)
246
244
  json = json_object(result)
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.96
4
+ version: 0.0.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -478,6 +478,7 @@ extra_rdoc_files:
478
478
  - lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb
479
479
  - lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb
480
480
  - lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb
481
+ - lib/ollama_chat/database/migrations/005_add_context_format_to_sessions.rb
481
482
  - lib/ollama_chat/database/models/favourite.rb
482
483
  - lib/ollama_chat/database/models/model_options.rb
483
484
  - lib/ollama_chat/database/models/prompt.rb
@@ -598,6 +599,7 @@ files:
598
599
  - lib/ollama_chat/database/migrations/002_add_links_to_sessions.rb
599
600
  - lib/ollama_chat/database/migrations/003_add_history_to_sessions.rb
600
601
  - lib/ollama_chat/database/migrations/004_add_profile_to_model_options.rb
602
+ - lib/ollama_chat/database/migrations/005_add_context_format_to_sessions.rb
601
603
  - lib/ollama_chat/database/models/favourite.rb
602
604
  - lib/ollama_chat/database/models/model_options.rb
603
605
  - lib/ollama_chat/database/models/prompt.rb