prompt_navigator 2.1.0 → 2.3.0

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: d2bd1c7a54df81a452d45f5c47cf2d9d615c960d49c9315a932aa72fcbbb1c46
4
- data.tar.gz: f8a13126d0457b4f78368a8c00354bb91fcafc4ee65dc41f1d1c26021bc066fa
3
+ metadata.gz: d8d6d7f53a86bd7346042c4bd0fc8453ab6730c32c2a82db980a8baa48ab57b8
4
+ data.tar.gz: c1f9ba3a7a01b7e96c9b910f8ef2f74bb36ea985fe46fc7f651fedf6d178cee6
5
5
  SHA512:
6
- metadata.gz: 140614573d6032ef309d6899a43c0c79f04819bc0fc33cb42c867c66f905ba04ed0db30776d7b3eb2d4d5d6535949e63c46b17e351d4fc8b9d74fbb39af56854
7
- data.tar.gz: 5854d8db2def7559e15e1e5f6c0c5161148c07a99bc51e8a9087c522b0666c21c72fd942b5c7565e0adbb3e38840e83adcde5556d07cd4a58bbaf2dc996c5d75
6
+ metadata.gz: 49ad4dd6cc6818466ebe23421dbe05472ebe616854a1add8b3804ba08c6aa816085075240ae761f5c23e349b2a58347dcf1847c6e7cda8d7a077556e5f2bcdf5
7
+ data.tar.gz: 2079bd5b058312231a66c5e666ac747a2a3736e76fc0734ff6a99402cc7d72d4b6f4140e103cf8e54ce08244f92e1b1d32708e19eaabee7be63dbebefd3904eb
@@ -6,14 +6,17 @@
6
6
  card_path = locals[:card_path]
7
7
  delete_path = locals[:delete_path]
8
8
  is_leaf = locals[:is_leaf]
9
- %>
10
9
 
11
- <%
12
- # Hide leading attached-image data URIs (`![](data:image/png;base64,…)`).
13
- # The base64 blob isn't useful in a 30-char preview — replace each with a
14
- # short marker so the rest of the prompt text is visible.
15
- display_prompt = ann.prompt.to_s.gsub(/!\[[^\]]*\]\(data:[^)]+\)/m, "[image]").strip
10
+ # Hide attached-file data URIs so the base64 blob doesn't dominate the
11
+ # 30-char preview. Images use `![alt](data:…)` and get replaced with `[image]`;
12
+ # documents use `[filename](data:…)` and get replaced with `[filename]`
13
+ # (or `[document]` if the filename slot is empty).
14
+ display_prompt = ann.prompt.to_s
15
+ .gsub(/!\[[^\]]*\]\(data:[^)]+\)/m, "[image]")
16
+ .gsub(/(?<!!)\[([^\]]*)\]\(data:[^)]+\)/m) { "[#{Regexp.last_match(1).presence || 'document'}]" }
17
+ .strip
16
18
  %>
19
+
17
20
  <div class="history-card<%= ' is-active' if is_active %>" data-history-target="cards" data-uuid="<%= ann.execution_id %>" data-parent-uuid="<%= parent_uuid %>">
18
21
  <div class="history-card-row">
19
22
  <%= link_to card_path.call(ann.execution_id), class: "history-card-link" do %>
@@ -30,14 +33,19 @@
30
33
  <% end %>
31
34
  <% end %>
32
35
  <% if ann.llm_platform.present? %>
33
- <% platform_label = { "openai" => "GPT", "anthropic" => "A", "google" => "G", "ollama" => "O" }[ann.llm_platform] || ann.llm_platform %>
36
+ <% platform_label = PromptNavigator.label_for(platform: ann.llm_platform, model: ann.model) %>
34
37
  <% tooltip = ann.model.present? ? "#{ann.model} (#{ann.llm_platform})" : ann.llm_platform.to_s %>
35
38
  <span class="history-card-platform-label" data-platform="<%= ann.llm_platform %>" title="<%= tooltip %>"><%= platform_label %></span>
36
39
  <% end %>
37
40
  </div>
38
41
  </div>
39
42
 
40
- <%# Check !next_ann.nil? to prevent the "↑" arrow from appearing below the bottom history entry, as parent_uuid would be nil in that case. %>
41
- <% if !next_ann.nil? && parent_uuid == next_ann.execution_id %>
42
- <div class="history-straight-arrow">↑</div>
43
+ <%# Direction-agnostic adjacency arrow: detect whether the next card is this card's
44
+ parent (newest-first ordering "↑") or its child (oldest-first ordering → "↓"). %>
45
+ <% if next_ann %>
46
+ <% if parent_uuid == next_ann.execution_id %>
47
+ <div class="history-straight-arrow">↑</div>
48
+ <% elsif next_ann.previous_id == ann.id %>
49
+ <div class="history-straight-arrow">↓</div>
50
+ <% end %>
43
51
  <% end %>
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PromptNavigator
4
+ # Host-overridable display config for the history sidebar.
5
+ #
6
+ # Usage from a host app initializer:
7
+ #
8
+ # PromptNavigator.configure do |c|
9
+ # c.platform_labels["openai"] = "OAI" # override platform default
10
+ # c.model_labels["claude-opus-4-7"] = "Opus" # per-model override
11
+ # end
12
+ class Configuration
13
+ DEFAULT_PLATFORM_LABELS = {
14
+ "openai" => "GPT",
15
+ "anthropic" => "Claude",
16
+ "google" => "Gemini",
17
+ "ollama" => "Ollama"
18
+ }.freeze
19
+
20
+ attr_accessor :platform_labels, :model_labels
21
+
22
+ def initialize
23
+ @platform_labels = DEFAULT_PLATFORM_LABELS.dup
24
+ @model_labels = {}
25
+ end
26
+ end
27
+
28
+ def self.config
29
+ @config ||= Configuration.new
30
+ end
31
+
32
+ def self.configure
33
+ yield config
34
+ end
35
+
36
+ # Resolution order: per-model override → per-platform → raw platform string.
37
+ # Returns "" only when both inputs are blank.
38
+ def self.label_for(platform:, model: nil)
39
+ model_key = model.to_s
40
+ return config.model_labels[model_key] if model_key != "" && config.model_labels.key?(model_key)
41
+ platform_key = platform.to_s
42
+ config.platform_labels[platform_key] || platform_key
43
+ end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module PromptNavigator
2
- VERSION = "2.1.0"
2
+ VERSION = "2.3.0"
3
3
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "prompt_navigator/version"
4
+ require "prompt_navigator/configuration"
4
5
  require "prompt_navigator/engine"
5
6
  require "prompt_navigator/helpers"
6
7
  require_relative "../app/controllers/concerns/prompt_navigator/history_manageable"
7
8
 
8
9
  module PromptNavigator
9
- # Your code goes here...
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt_navigator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler
@@ -60,6 +60,7 @@ files:
60
60
  - lib/generators/prompt_navigator/modeling/modeling_generator.rb
61
61
  - lib/generators/prompt_navigator/modeling/templates/db/migrate/20260129073026_create_prompt_navigator_prompt_executions.rb
62
62
  - lib/prompt_navigator.rb
63
+ - lib/prompt_navigator/configuration.rb
63
64
  - lib/prompt_navigator/engine.rb
64
65
  - lib/prompt_navigator/helpers.rb
65
66
  - lib/prompt_navigator/version.rb