llm_logs 0.1.3 → 0.1.4

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: 6234bcff772d83a80d691f6cf61e5238f50038feb031a00b7a013c0557fea3b0
4
- data.tar.gz: 6b71fd68445d3817fe004a2ebae1ad5644ddc42f51ef0d224e9cde31aba3cc23
3
+ metadata.gz: 87a8d5b11b7782e2dbda613ce9ef2c0717f2984574953d1070e7df443366d9d4
4
+ data.tar.gz: b18d3628a4658e2288744f680df716850a99bac16afaf4de07af199513034d46
5
5
  SHA512:
6
- metadata.gz: b696c698bcbeaa6da42e3e45a2f02bc4368fcbb7fa8fef3a49b6844cef1b949ebaa0c4f7a43ad6c4c4d4f178f8d93f4cd73af2e207b6941726afac10e8b152ac
7
- data.tar.gz: eca247f5563982227a6f5a2b664ec4b68ff96fe93110ea9dde0974ecedd78cdbbb3a480542e90fc87aa6445f43ceec35b160e76242f2439f27a0eaead90a2197
6
+ metadata.gz: c5ddca4dfee273333daf57dbd8b7e96959183547fece1e3c08b1de9e4f556bc8bdf1c2001ecd0110eab703580a559d4a75f4d8472fe6df06ef7a2b5bb757ec59
7
+ data.tar.gz: 1a740b579f7d7c84950edd7b3a70a33a843f8bf8e32a4e5eef902de80110b3a161eef1e2e65ec556b353c9ab7d7ed77c07f84c883d0b62a1e30c168866ca9919
@@ -1,8 +1,12 @@
1
1
  module LlmLogs
2
2
  class PromptsController < ApplicationController
3
+ SORT_COLUMNS = { "name" => :name, "slug" => :slug, "updated" => :updated_at }.freeze
4
+
3
5
  def index
4
6
  tag = params[:tag].is_a?(String) ? params[:tag].presence : nil
5
- scope = Prompt.order(:name).includes(:versions)
7
+ @sort = SORT_COLUMNS.key?(params[:sort]) ? params[:sort] : "name"
8
+ @direction = params[:direction] == "desc" ? "desc" : "asc"
9
+ scope = Prompt.order(SORT_COLUMNS.fetch(@sort) => @direction.to_sym).includes(:versions)
6
10
  scope = scope.with_tag(tag) if tag
7
11
  @prompts = scope.page(params[:page]).per(25)
8
12
  @active_tag = tag
@@ -0,0 +1,19 @@
1
+ module LlmLogs
2
+ module PromptsHelper
3
+ def sort_link(label, column)
4
+ active = @sort == column
5
+ next_direction = active && @direction == "asc" ? "desc" : "asc"
6
+ arrow = active ? (@direction == "asc" ? " ↑" : " ↓") : ""
7
+
8
+ link_to(
9
+ "#{label}#{arrow}",
10
+ prompts_path(
11
+ sort: column,
12
+ direction: next_direction,
13
+ tag: @active_tag
14
+ ),
15
+ class: "hover:text-gray-700 #{'text-gray-900' if active}"
16
+ )
17
+ end
18
+ end
19
+ end
@@ -17,11 +17,11 @@
17
17
  <table class="min-w-full divide-y divide-gray-200">
18
18
  <thead class="bg-gray-50">
19
19
  <tr>
20
- <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Name</th>
21
- <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Slug</th>
20
+ <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase"><%= sort_link "Name", "name" %></th>
21
+ <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase"><%= sort_link "Slug", "slug" %></th>
22
22
  <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Tags</th>
23
23
  <th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">Version</th>
24
- <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Updated</th>
24
+ <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase"><%= sort_link "Updated", "updated" %></th>
25
25
  </tr>
26
26
  </thead>
27
27
  <tbody class="divide-y divide-gray-200">
@@ -1,3 +1,3 @@
1
1
  module LlmLogs
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton
@@ -108,6 +108,7 @@ files:
108
108
  - app/controllers/llm_logs/spans_controller.rb
109
109
  - app/controllers/llm_logs/traces_controller.rb
110
110
  - app/helpers/llm_logs/formatting_helper.rb
111
+ - app/helpers/llm_logs/prompts_helper.rb
111
112
  - app/models/llm_logs/application_record.rb
112
113
  - app/models/llm_logs/prompt.rb
113
114
  - app/models/llm_logs/prompt_version.rb