completion-kit 0.28.7 → 0.28.9

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/completion_kit/application.css +40 -9
  3. data/app/controllers/completion_kit/runs_controller.rb +2 -0
  4. data/app/models/completion_kit/response.rb +5 -0
  5. data/app/views/completion_kit/datasets/edit.html.erb +1 -0
  6. data/app/views/completion_kit/datasets/index.html.erb +1 -0
  7. data/app/views/completion_kit/datasets/new.html.erb +1 -0
  8. data/app/views/completion_kit/datasets/show.html.erb +2 -1
  9. data/app/views/completion_kit/metric_groups/_form.html.erb +5 -9
  10. data/app/views/completion_kit/metric_groups/edit.html.erb +1 -0
  11. data/app/views/completion_kit/metric_groups/index.html.erb +1 -0
  12. data/app/views/completion_kit/metric_groups/new.html.erb +1 -0
  13. data/app/views/completion_kit/metrics/_form.html.erb +1 -1
  14. data/app/views/completion_kit/metrics/edit.html.erb +1 -0
  15. data/app/views/completion_kit/metrics/index.html.erb +1 -0
  16. data/app/views/completion_kit/metrics/new.html.erb +1 -0
  17. data/app/views/completion_kit/metrics/show.html.erb +3 -2
  18. data/app/views/completion_kit/prompts/edit.html.erb +1 -0
  19. data/app/views/completion_kit/prompts/index.html.erb +1 -0
  20. data/app/views/completion_kit/prompts/new.html.erb +1 -0
  21. data/app/views/completion_kit/prompts/show.html.erb +8 -7
  22. data/app/views/completion_kit/provider_credentials/edit.html.erb +1 -0
  23. data/app/views/completion_kit/provider_credentials/index.html.erb +1 -0
  24. data/app/views/completion_kit/provider_credentials/new.html.erb +1 -0
  25. data/app/views/completion_kit/runs/_form.html.erb +2 -2
  26. data/app/views/completion_kit/runs/_response_row.html.erb +5 -5
  27. data/app/views/completion_kit/runs/_row.html.erb +5 -4
  28. data/app/views/completion_kit/runs/compare.html.erb +2 -1
  29. data/app/views/completion_kit/runs/compare_picker.html.erb +1 -0
  30. data/app/views/completion_kit/runs/edit.html.erb +1 -0
  31. data/app/views/completion_kit/runs/index.html.erb +1 -0
  32. data/app/views/completion_kit/runs/new.html.erb +1 -0
  33. data/app/views/completion_kit/runs/show.html.erb +9 -8
  34. data/app/views/completion_kit/tags/_form.html.erb +4 -6
  35. data/app/views/completion_kit/tags/edit.html.erb +1 -0
  36. data/app/views/completion_kit/tags/index.html.erb +1 -0
  37. data/app/views/completion_kit/tags/new.html.erb +1 -0
  38. data/app/views/layouts/completion_kit/application.html.erb +1 -1
  39. data/lib/completion_kit/version.rb +1 -1
  40. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15a1909a7793a8a6cb9e0d95eb333483823c0040dd902b40a4a50e3ced485bee
4
- data.tar.gz: fc407f0abd09a7505d56a96d4adcad8f9aedfa7ec6aaa4de928fb71fb8a9859c
3
+ metadata.gz: d8c0966124eec13a8ab4f91dae2c0f592ed5b2147efc6cfe41c43bd3bbc2b88c
4
+ data.tar.gz: e6d8c475875979668fe7856c6a035f0070c7e6f0485e3cbcc73c30740eb0feb6
5
5
  SHA512:
6
- metadata.gz: 16242a62b2e34fc8667093e88cb77cba25fcdaab65c4603cfd693fbe3dcce71ac34a76a501ffb1725a8d868ee78107775984d42135d9b98ca846f48712416634
7
- data.tar.gz: a3b5ba5d4eda948f3c2e2d0c5f75262793e3ddf439aac7e4a33c782df93dd0a4944e1b2b8655836fb4df25ae0f4e1e6a70ccb3b795a53d78951cac30456256dd
6
+ metadata.gz: 383719e92a5353355beb243b136911cbce1965a26a5e0f5830e7c61e7b68743ed2d24a65512aa8724deef0da1f44204c293437bfd67ab76e80c2f317ddc50d89
7
+ data.tar.gz: 970823682d45586018b0ee93b36b3b4abbb6af8f680ab6ab3502c5a751d74b55c6c1af95570c0869ee1a7a6032dfac75d5277de4136c4c7dc9638e922645b6a1
@@ -289,8 +289,16 @@ form.button_to {
289
289
  .ck-pagination {
290
290
  display: flex;
291
291
  align-items: center;
292
- gap: 1rem;
293
- margin-top: 1rem;
292
+ justify-content: center;
293
+ gap: 1.25rem;
294
+ margin-top: 1.25rem;
295
+ padding-top: 1rem;
296
+ border-top: 1px solid var(--ck-line);
297
+ }
298
+ .ck-pagination .ck-meta-copy {
299
+ margin: 0;
300
+ min-width: 14rem;
301
+ text-align: center;
294
302
  }
295
303
 
296
304
  .ck-title,
@@ -352,7 +360,9 @@ form.button_to {
352
360
  }
353
361
 
354
362
  .ck-link {
355
- text-decoration: none;
363
+ text-decoration: underline;
364
+ text-decoration-color: color-mix(in srgb, var(--ck-text) 40%, transparent);
365
+ text-underline-offset: 0.15em;
356
366
  color: var(--ck-text);
357
367
  transition: color 0.15s;
358
368
  }
@@ -664,7 +674,7 @@ form.button_to {
664
674
 
665
675
  .ck-chip {
666
676
  background: var(--ck-surface-soft);
667
- border: 1px solid var(--ck-line);
677
+ border: 1px solid var(--ck-line-strong);
668
678
  color: var(--ck-muted);
669
679
  }
670
680
 
@@ -743,7 +753,7 @@ tr:hover .ck-chip--publish {
743
753
 
744
754
  .ck-badge--pending {
745
755
  background: var(--ck-surface-soft);
746
- border: 1px solid var(--ck-line);
756
+ border: 1px solid var(--ck-line-strong);
747
757
  color: var(--ck-dim);
748
758
  }
749
759
 
@@ -4309,7 +4319,8 @@ table.ck-runs-table {
4309
4319
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
4310
4320
  }
4311
4321
 
4312
- .ck-response-row--expanded .ck-response-cell__preview {
4322
+ .ck-response-row--expanded .ck-response-cell__preview,
4323
+ .ck-responses-table tbody tr:focus-within .ck-response-cell__preview {
4313
4324
  -webkit-line-clamp: 12;
4314
4325
  line-clamp: 12;
4315
4326
  max-height: 22em;
@@ -4936,7 +4947,7 @@ a.tag:hover, label.tag:hover { filter: brightness(1.12); }
4936
4947
  text-transform: lowercase;
4937
4948
  white-space: nowrap;
4938
4949
  background: color-mix(in srgb, var(--mark-color) 38%, transparent);
4939
- color: color-mix(in srgb, var(--mark-color) 88%, var(--ck-text));
4950
+ color: color-mix(in srgb, var(--mark-color) 35%, white);
4940
4951
  }
4941
4952
 
4942
4953
  .tag-mark::before {
@@ -4995,8 +5006,8 @@ a.tag:hover, label.tag:hover { filter: brightness(1.12); }
4995
5006
  .ck-tag-filter .tag-mark:not(.tag-mark--off),
4996
5007
  .ck-metric-tag-filter .tag-mark:not(.tag-mark--off) {
4997
5008
  background: color-mix(in srgb, var(--mark-color) 38%, transparent);
4998
- color: color-mix(in srgb, var(--mark-color) 95%, var(--ck-text));
4999
- border-color: color-mix(in srgb, var(--mark-color) 50%, transparent);
5009
+ color: color-mix(in srgb, var(--mark-color) 42%, white);
5010
+ border-color: color-mix(in srgb, var(--mark-color) 70%, transparent);
5000
5011
  }
5001
5012
 
5002
5013
  /* Unselected state — same shape, neutral outline + muted text */
@@ -6487,3 +6498,23 @@ a.tag-mark {
6487
6498
  color: var(--ck-muted);
6488
6499
  margin-right: 0.2rem;
6489
6500
  }
6501
+
6502
+ .ck-slider:focus-visible {
6503
+ outline: 2px solid var(--ck-accent);
6504
+ outline-offset: 4px;
6505
+ }
6506
+ .ck-select__option:focus-visible {
6507
+ box-shadow: inset 0 0 0 2px var(--ck-accent);
6508
+ }
6509
+ .ck-disclosure-toggle:focus-visible {
6510
+ outline: 2px solid var(--ck-accent);
6511
+ outline-offset: 2px;
6512
+ }
6513
+ .ck-settings-menu__trigger:focus-visible {
6514
+ outline: 2px solid var(--ck-accent);
6515
+ outline-offset: 2px;
6516
+ }
6517
+ .ck-tag-picker__input:focus-visible {
6518
+ outline: 2px solid var(--ck-accent);
6519
+ outline-offset: 2px;
6520
+ }
@@ -11,6 +11,7 @@ module CompletionKit
11
11
  end
12
12
 
13
13
  RESPONSES_PER_PAGE = 100
14
+ RESPONSE_PREVIEW_CHARS = 700
14
15
 
15
16
  def show
16
17
  @responses_total = @run.responses.count
@@ -19,6 +20,7 @@ module CompletionKit
19
20
  @responses_page = params[:page].to_s.to_i.clamp(1, @responses_total_pages)
20
21
  @responses_offset = (@responses_page - 1) * RESPONSES_PER_PAGE
21
22
  @responses = ordered_responses_relation(@run, params[:sort])
23
+ .with_body_preview(RESPONSE_PREVIEW_CHARS)
22
24
  .includes(:reviews)
23
25
  .limit(RESPONSES_PER_PAGE)
24
26
  .offset(@responses_offset)
@@ -8,6 +8,11 @@ module CompletionKit
8
8
 
9
9
  delegate :prompt, to: :run
10
10
 
11
+ scope :with_body_preview, ->(limit) {
12
+ other_columns = (column_names - ["response_text"]).map { |column| "#{table_name}.#{column}" }
13
+ select(*other_columns, "SUBSTR(#{table_name}.response_text, 1, #{limit.to_i}) AS response_text")
14
+ }
15
+
11
16
  validates :response_text, presence: true, if: :requires_response_text?
12
17
 
13
18
  before_validation :set_default_status, on: :create
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit dataset" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Datasets", datasets_path %></li>
3
4
  <li><%= link_to @dataset.name, dataset_path(@dataset) %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Datasets" %>
1
2
  <section class="ck-page-header">
2
3
  <div>
3
4
  <h1 class="ck-title">Datasets</h1>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New dataset" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Datasets", datasets_path %></li>
3
4
  <li>New</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, @dataset.name %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Datasets", datasets_path %></li>
3
4
  <li><%= @dataset.name %></li>
@@ -55,7 +56,7 @@
55
56
  <tr>
56
57
  <td class="ck-csv-table__rownum"><%= idx + 1 %></td>
57
58
  <% headers.each_with_index do |_, i| %>
58
- <td><span class="ck-csv-cell"><%= row[i] %></span></td>
59
+ <td><span class="ck-csv-cell" title="<%= row[i] %>"><%= row[i] %></span></td>
59
60
  <% end %>
60
61
  </tr>
61
62
  <% end %>
@@ -6,19 +6,15 @@
6
6
  "Delete \"#{metric_group.name}\"? Removes this grouping. #{pluralize(members_n, 'member metric')} #{members_n == 1 ? 'is' : 'are'} kept." %>
7
7
  <% end %>
8
8
  <%= form_with(model: metric_group, url: metric_group.persisted? ? metric_group_path(metric_group) : metric_groups_path, local: true) do |form| %>
9
- <% name_error = metric_group.errors[:name].first %>
10
-
11
9
  <div class="ck-card ck-form-card">
12
10
  <div class="ck-field">
13
11
  <%= form.label :name, "Metric group name", class: "ck-label" %>
14
12
  <%= form.text_field :name,
15
- class: ["ck-input", ("ck-input--error" if name_error)].compact.join(" "),
13
+ class: ["ck-input", ("ck-input--error" if metric_group.errors[:name].any?)].compact.join(" "),
16
14
  placeholder: "Support quality",
17
15
  autofocus: !metric_group.persisted?,
18
- "aria-invalid": name_error ? "true" : nil %>
19
- <% if name_error %>
20
- <p class="ck-field-error" role="alert"><%= name_error %></p>
21
- <% end %>
16
+ **ck_field_aria(form, :name) %>
17
+ <%= ck_field_error(form, :name) %>
22
18
  </div>
23
19
 
24
20
  <div class="ck-field">
@@ -29,7 +25,7 @@
29
25
  <%= render "completion_kit/tags/picker", record: metric_group, param_namespace: :metric_group %>
30
26
 
31
27
  <div class="ck-field">
32
- <p class="ck-label">Metrics in this group</p>
28
+ <p class="ck-label" id="mg_metrics_label">Metrics in this group</p>
33
29
  <p class="ck-hint">Pick the metrics to include. Filter the list by tag to narrow it down.</p>
34
30
 
35
31
  <% available_filter_tags = @metrics.flat_map(&:tags).uniq.sort_by(&:name) %>
@@ -46,7 +42,7 @@
46
42
  </div>
47
43
  <% end %>
48
44
 
49
- <div class="ck-metric-checkboxes" data-metric-checkboxes>
45
+ <div class="ck-metric-checkboxes" data-metric-checkboxes role="group" aria-labelledby="mg_metrics_label">
50
46
  <% @metrics.each do |metric| %>
51
47
  <label class="ck-checkbox-label" data-metric-tags="<%= metric.tag_names.join(",") %>">
52
48
  <%= check_box_tag "metric_group[metric_ids][]", metric.id, metric_group.metrics.exists?(metric.id), class: "ck-checkbox", id: "metric_group_metric_#{metric.id}" %>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit metric group" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li><%= link_to @metric_group.name, metric_group_path(@metric_group) %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Metric groups" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li>Metric groups</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New metric group" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li>New metric group</li>
@@ -138,7 +138,7 @@
138
138
  <input type="hidden" name="metric[rubric_bands][<%= index %>][stars]" value="<%= band["stars"] %>">
139
139
  </div>
140
140
  <div class="ck-rubric-row__fields">
141
- <textarea name="<%= target_name %>" rows="2" class="ck-input ck-input--area"><%= band["description"] %></textarea>
141
+ <textarea name="<%= target_name %>" rows="2" class="ck-input ck-input--area" aria-label="Rubric description for the <%= band["stars"] %>-star rating"><%= band["description"] %></textarea>
142
142
  <% if band_changed %>
143
143
  <div class="ck-inline-suggestion ck-inline-suggestion--band">
144
144
  <div class="ck-inline-suggestion__head">
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit metric" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li><%= link_to @metric.name, metric_path(@metric) %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Metrics" %>
1
2
  <section class="ck-page-header">
2
3
  <div>
3
4
  <h1 class="ck-title">Metrics</h1>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New metric" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li>New</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, @metric.name %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Metrics", metrics_path %></li>
3
4
  <li><%= @metric.name %></li>
@@ -125,11 +126,11 @@
125
126
  <% pred = predecessor_of[v] %>
126
127
  <% next unless v.change_summary_against(pred) %>
127
128
  <% vs = v.validation_summary %>
128
- <dialog id="ck-mvdiff-<%= v.id %>" class="ck-modal" onclick="if(event.target===this)this.close()">
129
+ <dialog id="ck-mvdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-mvdiff-title-<%= v.id %>" onclick="if(event.target===this)this.close()">
129
130
  <article class="ck-modal__panel" tabindex="-1" onclick="event.stopPropagation()">
130
131
  <header class="ck-modal__header">
131
132
  <div class="ck-modal__heading">
132
- <h2 class="ck-modal__title"><%= pred.version_label %> &rarr; <%= v.version_label %></h2>
133
+ <h2 class="ck-modal__title" id="ck-mvdiff-title-<%= v.id %>"><%= pred.version_label %> &rarr; <%= v.version_label %></h2>
133
134
  <span class="ck-modal__meta">What changed in <%= v.version_label %><% if v.current? %> (live)<% elsif v.draft? %> (draft)<% end %></span>
134
135
  </div>
135
136
  <button type="button" class="ck-modal__close" aria-label="Close" onclick="this.closest('dialog').close()">&times;</button>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit prompt" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Prompts", prompts_path %></li>
3
4
  <li><%= link_to @prompt.name, prompt_path(@prompt) %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Prompts" %>
1
2
  <section class="ck-page-header">
2
3
  <div>
3
4
  <h1 class="ck-title">Prompts</h1>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New prompt" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Prompts", prompts_path %></li>
3
4
  <li>New</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, @prompt.name %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Prompts", prompts_path %></li>
3
4
  <li><%= @prompt.name %></li>
@@ -15,7 +16,7 @@
15
16
  <% end %>
16
17
  <div class="ck-endpoint">
17
18
  <code class="ck-endpoint__url" id="prompt_endpoint"><%= request.base_url %><%= api_v1_prompt_path(@prompt.slug) %></code>
18
- <button type="button" class="ck-icon-btn" title="Copy endpoint" onclick="navigator.clipboard.writeText(document.getElementById('prompt_endpoint').textContent)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="14" height="14"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
19
+ <button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint" onclick="navigator.clipboard.writeText(document.getElementById('prompt_endpoint').textContent)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
19
20
  </div>
20
21
  <% if @prompt.tags.any? %>
21
22
  <div class="tag-marks-row">
@@ -72,7 +73,7 @@
72
73
  <td>
73
74
  <div class="ck-version-cell">
74
75
  <div class="ck-version-cell__label" onclick="event.stopPropagation()">
75
- <strong>v<%= v.version_number %></strong>
76
+ <%= link_to prompt_path(v), class: "ck-record-name" do %><strong>v<%= v.version_number %></strong><% end %>
76
77
  <% if v.current? %>
77
78
  <span class="ck-chip">Published</span>
78
79
  <% else %>
@@ -80,7 +81,7 @@
80
81
  <% end %>
81
82
  </div>
82
83
  <% if version_changed.call(v, pred) %>
83
- <button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from v<%= pred.version_number %>" onclick="event.stopPropagation();document.getElementById('ck-vdiff-<%= v.id %>').showModal()">&Delta;</button>
84
+ <button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from v<%= pred.version_number %>" aria-label="What changed from v<%= pred.version_number %>" onclick="event.stopPropagation();document.getElementById('ck-vdiff-<%= v.id %>').showModal()"><span aria-hidden="true">&Delta;</span></button>
84
85
  <% end %>
85
86
  </div>
86
87
  </td>
@@ -106,11 +107,11 @@
106
107
  <% versions.each do |v| %>
107
108
  <% pred = predecessor_of[v] %>
108
109
  <% next unless version_changed.call(v, pred) %>
109
- <dialog id="ck-vdiff-<%= v.id %>" class="ck-modal" onclick="if(event.target===this)this.close()">
110
+ <dialog id="ck-vdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-vdiff-title-<%= v.id %>" onclick="if(event.target===this)this.close()">
110
111
  <article class="ck-modal__panel" tabindex="-1" autofocus onclick="event.stopPropagation()">
111
112
  <header class="ck-modal__header">
112
113
  <div class="ck-modal__heading">
113
- <h2 class="ck-modal__title">v<%= pred.version_number %> &rarr; v<%= v.version_number %></h2>
114
+ <h2 class="ck-modal__title" id="ck-vdiff-title-<%= v.id %>">v<%= pred.version_number %> <span aria-hidden="true">&rarr;</span> v<%= v.version_number %></h2>
114
115
  <span class="ck-modal__meta">What changed in <%= v.version_label %><% if v.current? %> (published)<% end %></span>
115
116
  </div>
116
117
  <button type="button" class="ck-modal__close" aria-label="Close" onclick="this.closest('dialog').close()">&times;</button>
@@ -168,11 +169,11 @@
168
169
  <tbody>
169
170
  <% suggestions.each do |s| %>
170
171
  <tr onclick="window.location='<%= suggestion_path(s, from: "prompt") %>'" style="cursor: pointer;">
171
- <td><strong><%= s.run.name %></strong></td>
172
+ <td><%= link_to suggestion_path(s, from: "prompt"), class: "ck-record-name" do %><strong><%= s.run.name %></strong><% end %></td>
172
173
  <td class="ck-meta-copy"><%= truncate(s.reasoning.to_s, length: 100) %></td>
173
174
  <td><%= s.applied_at? ? content_tag(:span, "Applied", class: "ck-chip", style: "background: var(--ck-success-soft); color: var(--ck-success);") : "&mdash;".html_safe %></td>
174
175
  <td class="ck-meta-copy"><time data-relative-time datetime="<%= s.created_at.utc.iso8601 %>"><%= time_ago_in_words(s.created_at) %> ago</time></td>
175
- <td class="ck-results-table__arrow">&rarr;</td>
176
+ <td class="ck-results-table__arrow" aria-hidden="true">&rarr;</td>
176
177
  </tr>
177
178
  <% end %>
178
179
  </tbody>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit provider" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Providers", provider_credentials_path %></li>
3
4
  <li>Edit</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Providers" %>
1
2
  <% @provider_credentials.each do |pc| %>
2
3
  <%= turbo_stream_from "completion_kit_provider_#{pc.id}" %>
3
4
  <% end %>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New provider" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Providers", provider_credentials_path %></li>
3
4
  <li>New</li>
@@ -119,7 +119,7 @@
119
119
  </div>
120
120
 
121
121
  <div class="ck-field" id="metrics-field">
122
- <label class="ck-label">Metrics</label>
122
+ <p class="ck-label" id="run_metrics_label">Metrics</p>
123
123
  <% if @all_metrics.empty? %>
124
124
  <p class="ck-field-hint" style="color: var(--ck-warning);">No metrics yet.&ensp;<%= link_to "Create a metric", new_metric_path, class: "ck-link" %></p>
125
125
  <% else %>
@@ -158,7 +158,7 @@
158
158
  </div>
159
159
  <% end %>
160
160
 
161
- <div class="ck-metric-checkboxes" data-metric-checkboxes>
161
+ <div class="ck-metric-checkboxes" data-metric-checkboxes role="group" aria-labelledby="run_metrics_label">
162
162
  <% @all_metrics.each do |metric| %>
163
163
  <label class="ck-checkbox-label" data-metric-tags="<%= metric.tag_names.join(",") %>" data-compare-expected="<%= metric.check? && metric.check_config.to_h["compare_to"] == "expected" ? "1" : "0" %>">
164
164
  <%= check_box_tag "run[metric_ids][]", metric.id, run.metric_ids.include?(metric.id), class: "ck-checkbox", id: "run_metric_#{metric.id}" %>
@@ -15,14 +15,14 @@
15
15
  <span class="ck-metric-bar ck-metric-bar--compact">
16
16
  <% pip_reviews.each do |r| %>
17
17
  <% if r.ai_score.present? %>
18
- <span class="ck-metric-pip ck-metric-pip--<%= ck_score_kind(r.ai_score.to_f) %>">
18
+ <span class="ck-metric-pip ck-metric-pip--<%= ck_score_kind(r.ai_score.to_f) %>" role="img" aria-label="<%= r.metric_name %> score <%= r.ai_score %>">
19
19
  <span class="ck-metric-pip__bar"></span>
20
- <span class="ck-metric-pip__label"><%= r.metric_name %> <strong><%= r.ai_score %></strong></span>
20
+ <span class="ck-metric-pip__label" aria-hidden="true"><%= r.metric_name %> <strong><%= r.ai_score %></strong></span>
21
21
  </span>
22
22
  <% else %>
23
- <span class="ck-metric-pip ck-metric-pip--<%= ck_pass_rate_kind(r.passed ? 1.0 : 0.0) %>">
23
+ <span class="ck-metric-pip ck-metric-pip--<%= ck_pass_rate_kind(r.passed ? 1.0 : 0.0) %>" role="img" aria-label="<%= r.metric_name %> <%= r.passed ? "Pass" : "Fail" %>">
24
24
  <span class="ck-metric-pip__bar"></span>
25
- <span class="ck-metric-pip__label"><%= r.metric_name %> <strong><%= r.passed ? "Pass" : "Fail" %></strong></span>
25
+ <span class="ck-metric-pip__label" aria-hidden="true"><%= r.metric_name %> <strong><%= r.passed ? "Pass" : "Fail" %></strong></span>
26
26
  </span>
27
27
  <% end %>
28
28
  <% end %>
@@ -69,5 +69,5 @@
69
69
  onclick: "event.stopPropagation();" %>
70
70
  <% end %>
71
71
  </td>
72
- <td class="ck-results-table__arrow"><% if clickable %>&rarr;<% end %></td>
72
+ <td class="ck-results-table__arrow"><% if clickable %><span aria-hidden="true">&rarr;</span><% end %></td>
73
73
  </tr>
@@ -3,6 +3,7 @@
3
3
  <div class="ck-runs-table__identity">
4
4
  <span class="ck-run-name">
5
5
  <span class="<%= ck_run_dot(run) %>"></span>
6
+ <span class="ck-visually-hidden"><%= run.status.to_s.humanize %>:</span>
6
7
  <%= link_to ck_run_path(run), class: "ck-record-name" do %><strong><%= run.name %></strong><% end %>
7
8
  </span>
8
9
  <div class="ck-runs-table__config">
@@ -35,14 +36,14 @@
35
36
  <div class="ck-metric-bar ck-metric-bar--compact">
36
37
  <% metrics.each do |m| %>
37
38
  <% if m[:kind] == "check" %>
38
- <span class="ck-metric-pip ck-metric-pip--<%= ck_pass_rate_kind(m[:pass_rate]) %>">
39
+ <span class="ck-metric-pip ck-metric-pip--<%= ck_pass_rate_kind(m[:pass_rate]) %>" role="img" aria-label="<%= m[:name] %> <%= (m[:pass_rate] * 100).round %>% pass rate">
39
40
  <span class="ck-metric-pip__bar"></span>
40
- <span class="ck-metric-pip__label"><%= m[:name] %> <strong><%= (m[:pass_rate] * 100).round %>%</strong></span>
41
+ <span class="ck-metric-pip__label" aria-hidden="true"><%= m[:name] %> <strong><%= (m[:pass_rate] * 100).round %>%</strong></span>
41
42
  </span>
42
43
  <% else %>
43
- <span class="ck-metric-pip ck-metric-pip--<%= ck_score_kind(m[:avg]) %>">
44
+ <span class="ck-metric-pip ck-metric-pip--<%= ck_score_kind(m[:avg]) %>" role="img" aria-label="<%= m[:name] %> average score <%= m[:avg] %>">
44
45
  <span class="ck-metric-pip__bar"></span>
45
- <span class="ck-metric-pip__label"><%= m[:name] %> <strong><%= m[:avg] %></strong></span>
46
+ <span class="ck-metric-pip__label" aria-hidden="true"><%= m[:name] %> <strong><%= m[:avg] %></strong></span>
46
47
  </span>
47
48
  <% end %>
48
49
  <% end %>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "#{@run.name} vs #{@other_run.name}" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Runs", runs_path %></li>
3
4
  <li><%= link_to @run.name, run_path(@run) %></li>
@@ -26,7 +27,7 @@
26
27
  <th scope="col">Case</th>
27
28
  <th scope="col">Metric</th>
28
29
  <th scope="col">A → B</th>
29
- <th scope="col" class="ck-num">Δ</th>
30
+ <th scope="col" class="ck-num"><span aria-hidden="true">Δ</span><span class="ck-visually-hidden">Delta (B minus A)</span></th>
30
31
  <th scope="col">Version</th>
31
32
  </tr>
32
33
  </thead>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Compare runs" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Runs", runs_path %></li>
3
4
  <li><%= link_to @run.name, run_path(@run) %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit run" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <% if @run.prompt %>
3
4
  <li><%= link_to "Prompts", prompts_path %></li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Runs" %>
1
2
  <section class="ck-page-header">
2
3
  <div>
3
4
  <h1 class="ck-title">Runs</h1>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New run" %>
1
2
  <ol class="ck-breadcrumb">
2
3
  <li><%= link_to "Runs", runs_path %></li>
3
4
  <li>New run</li>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, @run.name %>
1
2
  <%= turbo_stream_from "completion_kit_run_#{@run.id}" %>
2
3
 
3
4
  <ol class="ck-breadcrumb">
@@ -117,11 +118,11 @@
117
118
  <% end %>
118
119
 
119
120
  <% if @run.dataset %>
120
- <dialog id="dataset-preview-<%= @run.id %>" class="ck-modal" onclick="if(event.target===this)this.close()">
121
+ <dialog id="dataset-preview-<%= @run.id %>" class="ck-modal" aria-labelledby="dataset-preview-title-<%= @run.id %>" onclick="if(event.target===this)this.close()">
121
122
  <article class="ck-modal__panel" tabindex="-1" autofocus onclick="event.stopPropagation()">
122
123
  <header class="ck-modal__header">
123
124
  <div class="ck-modal__heading">
124
- <h2 class="ck-modal__title"><%= @run.dataset.name %></h2>
125
+ <h2 class="ck-modal__title" id="dataset-preview-title-<%= @run.id %>"><%= @run.dataset.name %></h2>
125
126
  <span class="ck-modal__meta"><%= @run.dataset.row_count %> rows</span>
126
127
  </div>
127
128
  <button type="button" class="ck-modal__close" aria-label="Close" onclick="this.closest('dialog').close()">×</button>
@@ -187,12 +188,12 @@
187
188
  <table class="ck-results-table ck-responses-table"<%= ' hidden'.html_safe unless @responses.any? %> id="responses_table">
188
189
  <thead>
189
190
  <tr>
190
- <th>#</th>
191
- <th>Response</th>
192
- <th>Metrics</th>
193
- <th>Avg score</th>
194
- <th>Status</th>
195
- <th></th>
191
+ <th scope="col">#</th>
192
+ <th scope="col">Response</th>
193
+ <th scope="col">Metrics</th>
194
+ <th scope="col">Avg score</th>
195
+ <th scope="col">Status</th>
196
+ <th scope="col"></th>
196
197
  </tr>
197
198
  </thead>
198
199
  <tbody id="run_responses">
@@ -7,18 +7,16 @@
7
7
  <% end %>
8
8
  <%= form_with(model: tag, local: true) do |form| %>
9
9
  <div class="ck-card ck-form-card">
10
- <% name_error = tag.errors[:name].first %>
11
10
  <div class="ck-field">
12
11
  <%= form.label :name, "Tag name", class: "ck-label" %>
13
12
  <%= form.text_field :name,
14
13
  id: "tag_name",
15
- class: ["ck-input", ("ck-input--error" if name_error)].compact.join(" "),
14
+ class: ["ck-input", ("ck-input--error" if tag.errors[:name].any?)].compact.join(" "),
16
15
  placeholder: "e.g. production",
17
16
  autofocus: true,
18
- "aria-invalid": name_error ? "true" : nil %>
19
- <% if name_error %>
20
- <p class="ck-field-error" role="alert"><%= name_error %></p>
21
- <% elsif !tag.persisted? %>
17
+ **ck_field_aria(form, :name) %>
18
+ <%= ck_field_error(form, :name) %>
19
+ <% if tag.errors[:name].empty? && !tag.persisted? %>
22
20
  <p class="ck-hint">Color is auto-assigned from a 10-color palette.</p>
23
21
  <% end %>
24
22
  </div>
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Edit tag" %>
1
2
  <% original = @tag.name_was.presence || "tag" %>
2
3
  <% display_name = @tag.name.presence || original %>
3
4
  <% pill = content_tag(:span,
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "Tags" %>
1
2
  <%= render "completion_kit/shared/settings_nav", section_label: "Tags" %>
2
3
 
3
4
  <section class="ck-page-header">
@@ -1,3 +1,4 @@
1
+ <% content_for :ck_title, "New tag" %>
1
2
  <% display_name = @tag.name.presence.to_s %>
2
3
  <% pill = content_tag(:span,
3
4
  content_tag(:span, display_name, id: "tag-pill-text", data: { placeholder: "" }),
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>CompletionKit</title>
4
+ <title><%= [content_for(:ck_title).presence, "CompletionKit"].compact.join(" — ") %></title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <%= csrf_meta_tags %>
7
7
  <%= csp_meta_tag %>
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.28.7"
2
+ VERSION = "0.28.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completion-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.7
4
+ version: 0.28.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin