completion-kit 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/completion_kit/application.css +12 -0
- data/app/views/completion_kit/datasets/_form.html.erb +11 -17
- data/app/views/completion_kit/metric_groups/_form.html.erb +8 -14
- data/app/views/completion_kit/metrics/_form.html.erb +10 -16
- data/app/views/completion_kit/prompts/_form.html.erb +13 -19
- data/app/views/completion_kit/provider_credentials/_form.html.erb +5 -14
- data/app/views/completion_kit/shared/_delete_action.html.erb +18 -0
- data/app/views/completion_kit/tags/_form.html.erb +10 -16
- data/lib/completion_kit/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 693a2c9c76ea04ca616b00a76556f2aeee15c38ca6290ef968d2b9c83eb23e83
|
|
4
|
+
data.tar.gz: 6baf88740c80fe3102fff0f5d934f66357e74b62f3ac8da07b0c1d0069a3911d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e5d34d55848f1480b01a5459025936c3d27e18f4b907a1dc98ca4081510dcbbe247fcdc88f05721a7452bf0d4adc0d78270c9ff08a9fba57dd616fc6b2c254b
|
|
7
|
+
data.tar.gz: 4d12110ac0998d0f4640c89854f39ce2bdee3eae205910a4bc4a583eeda25ed1a2ac886d89da3cc185b6d4d42773d799101545c0c12ef56bd5b7cfc910bef106
|
|
@@ -2259,6 +2259,18 @@ label.ck-checkbox[hidden] {
|
|
|
2259
2259
|
outline-offset: 2px;
|
|
2260
2260
|
}
|
|
2261
2261
|
|
|
2262
|
+
.ck-delete-action {
|
|
2263
|
+
margin-top: 1rem;
|
|
2264
|
+
display: flex;
|
|
2265
|
+
flex-direction: column;
|
|
2266
|
+
align-items: flex-start;
|
|
2267
|
+
gap: 0.5rem;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
.ck-delete-action .ck-field-hint {
|
|
2271
|
+
margin: 0;
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2262
2274
|
.ck-icon-btn--spinning svg {
|
|
2263
2275
|
animation: ck-spin 0.8s linear infinite;
|
|
2264
2276
|
}
|
|
@@ -31,23 +31,6 @@
|
|
|
31
31
|
<%= render "completion_kit/tags/picker", record: dataset, param_namespace: :dataset %>
|
|
32
32
|
|
|
33
33
|
<div class="ck-actions">
|
|
34
|
-
<% if dataset.persisted? %>
|
|
35
|
-
<% runs_n = dataset.runs.count %>
|
|
36
|
-
<% responses_n = CompletionKit::Response.where(run_id: dataset.runs.select(:id)).count %>
|
|
37
|
-
<% confirm = if runs_n.zero?
|
|
38
|
-
"Delete \"#{dataset.name}\"? It has no runs."
|
|
39
|
-
else
|
|
40
|
-
"Delete \"#{dataset.name}\"? Cascades through #{pluralize(runs_n, 'run')} and #{pluralize(responses_n, 'response')} (and their reviews) that used this dataset."
|
|
41
|
-
end %>
|
|
42
|
-
<%= button_to dataset_path(dataset), method: :delete,
|
|
43
|
-
form_class: "inline-block",
|
|
44
|
-
class: "ck-icon-btn",
|
|
45
|
-
title: "Delete dataset",
|
|
46
|
-
"aria-label": "Delete dataset",
|
|
47
|
-
data: { turbo_confirm: confirm } do %>
|
|
48
|
-
<%= heroicon_tag "trash", variant: :outline, size: 16, "aria-hidden": "true" %>
|
|
49
|
-
<% end %>
|
|
50
|
-
<% end %>
|
|
51
34
|
<%= link_to "Cancel", datasets_path, class: ck_button_classes(:light, variant: :outline), tabindex: "0" %>
|
|
52
35
|
<%= form.submit(dataset.persisted? ? "Save dataset" : "Create dataset", class: ck_button_classes(:dark)) %>
|
|
53
36
|
</div>
|
|
@@ -81,3 +64,14 @@ document.addEventListener('turbo:load', ckDatasetHeaderPreview);
|
|
|
81
64
|
ckDatasetHeaderPreview();
|
|
82
65
|
</script>
|
|
83
66
|
<% end %>
|
|
67
|
+
|
|
68
|
+
<% if dataset.persisted? %>
|
|
69
|
+
<% runs_n = dataset.runs.count %>
|
|
70
|
+
<% responses_n = CompletionKit::Response.where(run_id: dataset.runs.select(:id)).count %>
|
|
71
|
+
<% confirm = if runs_n.zero?
|
|
72
|
+
"Delete \"#{dataset.name}\"? It has no runs."
|
|
73
|
+
else
|
|
74
|
+
"Delete \"#{dataset.name}\"? Cascades through #{pluralize(runs_n, 'run')} and #{pluralize(responses_n, 'response')} (and their reviews) that used this dataset."
|
|
75
|
+
end %>
|
|
76
|
+
<%= render "completion_kit/shared/delete_action", path: dataset_path(dataset), label: "Delete dataset", confirm: confirm %>
|
|
77
|
+
<% end %>
|
|
@@ -80,22 +80,16 @@
|
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
82
|
<div class="ck-actions">
|
|
83
|
-
<% if metric_group.persisted? %>
|
|
84
|
-
<% members_n = metric_group.metrics.count %>
|
|
85
|
-
<% confirm = members_n.zero? ?
|
|
86
|
-
"Delete \"#{metric_group.name}\"? It has no members." :
|
|
87
|
-
"Delete \"#{metric_group.name}\"? Removes this grouping. #{pluralize(members_n, 'member metric')} #{members_n == 1 ? 'is' : 'are'} kept." %>
|
|
88
|
-
<%= button_to metric_group_path(metric_group), method: :delete,
|
|
89
|
-
form_class: "inline-block",
|
|
90
|
-
class: "ck-icon-btn",
|
|
91
|
-
title: "Delete metric group",
|
|
92
|
-
"aria-label": "Delete metric group",
|
|
93
|
-
data: { turbo_confirm: confirm } do %>
|
|
94
|
-
<%= heroicon_tag "trash", variant: :outline, size: 16, "aria-hidden": "true" %>
|
|
95
|
-
<% end %>
|
|
96
|
-
<% end %>
|
|
97
83
|
<%= link_to "Cancel", metrics_path, class: ck_button_classes(:light, variant: :outline), tabindex: "0" %>
|
|
98
84
|
<%= form.submit(metric_group.persisted? ? "Save metric group" : "Create metric group", class: ck_button_classes(:dark)) %>
|
|
99
85
|
</div>
|
|
100
86
|
</div>
|
|
101
87
|
<% end %>
|
|
88
|
+
|
|
89
|
+
<% if metric_group.persisted? %>
|
|
90
|
+
<% members_n = metric_group.metrics.count %>
|
|
91
|
+
<% confirm = members_n.zero? ?
|
|
92
|
+
"Delete \"#{metric_group.name}\"? It has no members." :
|
|
93
|
+
"Delete \"#{metric_group.name}\"? Removes this grouping. #{pluralize(members_n, 'member metric')} #{members_n == 1 ? 'is' : 'are'} kept." %>
|
|
94
|
+
<%= render "completion_kit/shared/delete_action", path: metric_group_path(metric_group), label: "Delete metric group", confirm: confirm %>
|
|
95
|
+
<% end %>
|
|
@@ -254,24 +254,18 @@
|
|
|
254
254
|
<%= render "completion_kit/tags/picker", record: metric, param_namespace: :metric %>
|
|
255
255
|
|
|
256
256
|
<div class="ck-actions">
|
|
257
|
-
<% if metric.persisted? %>
|
|
258
|
-
<% groups_n = metric.metric_groups.count %>
|
|
259
|
-
<% reviews_n = metric.reviews.count %>
|
|
260
|
-
<% parts = [] %>
|
|
261
|
-
<% parts << "in #{pluralize(groups_n, 'metric group')} (removed from each)" if groups_n > 0 %>
|
|
262
|
-
<% parts << "scored in #{pluralize(reviews_n, 'review')} (scores kept, link cleared)" if reviews_n > 0 %>
|
|
263
|
-
<% confirm = parts.empty? ? "Delete \"#{metric.name}\"? It's not in use." : "Delete \"#{metric.name}\"? It's #{parts.to_sentence}." %>
|
|
264
|
-
<%= button_to metric_path(metric), method: :delete,
|
|
265
|
-
form_class: "inline-block",
|
|
266
|
-
class: "ck-icon-btn ck-icon-btn--form",
|
|
267
|
-
title: "Delete metric",
|
|
268
|
-
"aria-label": "Delete metric",
|
|
269
|
-
data: { turbo_confirm: confirm } do %>
|
|
270
|
-
<%= heroicon_tag "trash", variant: :outline, size: 24, "aria-hidden": "true" %>
|
|
271
|
-
<% end %>
|
|
272
|
-
<% end %>
|
|
273
257
|
<%= link_to "Cancel", metrics_path, class: ck_button_classes(:light, variant: :outline), tabindex: "0" %>
|
|
274
258
|
<%= form.submit(metric.persisted? ? "Save metric" : "Create metric", class: ck_button_classes(:dark)) %>
|
|
275
259
|
</div>
|
|
276
260
|
</div>
|
|
277
261
|
<% end %>
|
|
262
|
+
|
|
263
|
+
<% if metric.persisted? %>
|
|
264
|
+
<% groups_n = metric.metric_groups.count %>
|
|
265
|
+
<% reviews_n = metric.reviews.count %>
|
|
266
|
+
<% parts = [] %>
|
|
267
|
+
<% parts << "in #{pluralize(groups_n, 'metric group')} (removed from each)" if groups_n > 0 %>
|
|
268
|
+
<% parts << "scored in #{pluralize(reviews_n, 'review')} (scores kept, link cleared)" if reviews_n > 0 %>
|
|
269
|
+
<% confirm = parts.empty? ? "Delete \"#{metric.name}\"? It's not in use." : "Delete \"#{metric.name}\"? It's #{parts.to_sentence}." %>
|
|
270
|
+
<%= render "completion_kit/shared/delete_action", path: metric_path(metric), label: "Delete metric", confirm: confirm %>
|
|
271
|
+
<% end %>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<% end %>
|
|
12
12
|
|
|
13
13
|
<% if prompt.persisted? && prompt.runs.exists? %>
|
|
14
|
-
<p class="ck-version-note">Editing <%= prompt.version_label
|
|
14
|
+
<p class="ck-version-note">Editing <%= prompt.version_label %>. It has runs, so saving creates a new version of this prompt.</p>
|
|
15
15
|
<% end %>
|
|
16
16
|
|
|
17
17
|
<div class="ck-card ck-form-card">
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<% available = CompletionKit::ApiConfig.available_models(scope: :generation) %>
|
|
40
40
|
<% if available.any? %>
|
|
41
41
|
<div class="ck-select-with-action">
|
|
42
|
-
<%= form.select :llm_model, ck_grouped_models(available, prompt.llm_model), { include_blank: "
|
|
42
|
+
<%= form.select :llm_model, ck_grouped_models(available, prompt.llm_model), { include_blank: "Select a model" }, { class: "ck-input", id: "prompt_llm_model" } %>
|
|
43
43
|
<% ck_refreshing = CompletionKit::ProviderCredential.discovery_in_progress? %>
|
|
44
44
|
<button type="button" class="ck-icon-btn<%= ' ck-icon-btn--spinning' if ck_refreshing %>" title="Refresh models" <%= 'disabled' if ck_refreshing %> onclick="ckRefreshModels()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="16" height="16"><path fill-rule="evenodd" d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.681.75.75 0 0 1-1.264-.808 6 6 0 0 1 9.44-.908l.84.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44.908l-.84-.84v1.68a.75.75 0 0 1-1.5 0V9.567a.75.75 0 0 1 .75-.75h3.182a.75.75 0 0 1 0 1.5h-1.37l.84.841a4.5 4.5 0 0 0 7.08-.681.75.75 0 0 1 1.024-.274Z" clip-rule="evenodd"/></svg></button>
|
|
45
45
|
</div>
|
|
@@ -58,25 +58,19 @@
|
|
|
58
58
|
<%= render "completion_kit/tags/picker", record: prompt, param_namespace: :prompt %>
|
|
59
59
|
|
|
60
60
|
<div class="ck-actions">
|
|
61
|
-
<% if prompt.persisted? %>
|
|
62
|
-
<% runs_n = prompt.runs.count %>
|
|
63
|
-
<% responses_n = prompt.responses.count %>
|
|
64
|
-
<% confirm = if runs_n.zero?
|
|
65
|
-
"Delete \"#{prompt.display_name}\"? This version has no runs."
|
|
66
|
-
else
|
|
67
|
-
"Delete \"#{prompt.display_name}\"? Cascades through #{pluralize(runs_n, 'run')} and #{pluralize(responses_n, 'response')} (and their reviews). Other versions of this prompt are untouched."
|
|
68
|
-
end %>
|
|
69
|
-
<%= button_to prompt_path(prompt), method: :delete,
|
|
70
|
-
form_class: "inline-block",
|
|
71
|
-
class: "ck-icon-btn",
|
|
72
|
-
title: "Delete prompt",
|
|
73
|
-
"aria-label": "Delete prompt",
|
|
74
|
-
data: { turbo_confirm: confirm } do %>
|
|
75
|
-
<%= heroicon_tag "trash", variant: :outline, size: 16, "aria-hidden": "true" %>
|
|
76
|
-
<% end %>
|
|
77
|
-
<% end %>
|
|
78
61
|
<%= link_to "Cancel", prompts_path, class: ck_button_classes(:light, variant: :outline), tabindex: "0" %>
|
|
79
62
|
<%= form.submit(prompt.persisted? ? "Save prompt" : "Create prompt", class: ck_button_classes(:dark), disabled: available.empty?) %>
|
|
80
63
|
</div>
|
|
81
64
|
</div>
|
|
82
65
|
<% end %>
|
|
66
|
+
|
|
67
|
+
<% if prompt.persisted? %>
|
|
68
|
+
<% runs_n = prompt.runs.count %>
|
|
69
|
+
<% responses_n = prompt.responses.count %>
|
|
70
|
+
<% confirm = if runs_n.zero?
|
|
71
|
+
"Delete \"#{prompt.display_name}\"? This version has no runs."
|
|
72
|
+
else
|
|
73
|
+
"Delete \"#{prompt.display_name}\"? Cascades through #{pluralize(runs_n, 'run')} and #{pluralize(responses_n, 'response')} (and their reviews). Other versions of this prompt are untouched."
|
|
74
|
+
end %>
|
|
75
|
+
<%= render "completion_kit/shared/delete_action", path: prompt_path(prompt), label: "Delete prompt", confirm: confirm %>
|
|
76
|
+
<% end %>
|
|
@@ -43,20 +43,11 @@
|
|
|
43
43
|
<% end %>
|
|
44
44
|
|
|
45
45
|
<% if provider_credential.persisted? %>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
form_class: "inline-block",
|
|
52
|
-
class: "ck-icon-btn",
|
|
53
|
-
title: "Delete provider",
|
|
54
|
-
"aria-label": "Delete provider",
|
|
55
|
-
data: { turbo_confirm: "Delete the #{provider_credential.display_provider} provider and its discovered models? This can't be undone." } do %>
|
|
56
|
-
<%= heroicon_tag "trash", variant: :outline, size: 16, "aria-hidden": "true" %>
|
|
57
|
-
<% end %>
|
|
58
|
-
</div>
|
|
59
|
-
<% end %>
|
|
46
|
+
<%= render "completion_kit/shared/delete_action",
|
|
47
|
+
path: provider_credential_path(provider_credential),
|
|
48
|
+
label: "Delete provider",
|
|
49
|
+
confirm: "Delete the #{provider_credential.display_provider} provider and its discovered models? This can't be undone.",
|
|
50
|
+
blocked_reason: (provider_credential.in_use_message if provider_credential.in_use?) %>
|
|
60
51
|
<% end %>
|
|
61
52
|
|
|
62
53
|
<% if provider_credential.persisted? %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%# locals: (path:, label:, confirm:, blocked_reason: nil) %>
|
|
2
|
+
<div class="ck-delete-action">
|
|
3
|
+
<% if blocked_reason.present? %>
|
|
4
|
+
<button type="button" class="<%= ck_button_classes(:red, variant: :outline) %>" disabled aria-disabled="true">
|
|
5
|
+
<%= heroicon_tag "trash", variant: :outline, size: 15, "aria-hidden": "true" %>
|
|
6
|
+
<%= label %>
|
|
7
|
+
</button>
|
|
8
|
+
<p class="ck-field-hint"><%= blocked_reason %></p>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= button_to path, method: :delete,
|
|
11
|
+
form_class: "inline-block",
|
|
12
|
+
class: ck_button_classes(:red, variant: :outline),
|
|
13
|
+
data: { turbo_confirm: confirm } do %>
|
|
14
|
+
<%= heroicon_tag "trash", variant: :outline, size: 15, "aria-hidden": "true" %>
|
|
15
|
+
<%= label %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
@@ -17,24 +17,18 @@
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
19
|
<div class="ck-actions">
|
|
20
|
-
<% if tag.persisted? %>
|
|
21
|
-
<% applied_n = tag.taggings.count %>
|
|
22
|
-
<% confirm = if applied_n.zero?
|
|
23
|
-
"Delete \"#{tag.name}\"? It's not currently applied to anything."
|
|
24
|
-
else
|
|
25
|
-
"Delete \"#{tag.name}\"? It's currently applied to #{pluralize(applied_n, 'item')} — they'll lose this tag."
|
|
26
|
-
end %>
|
|
27
|
-
<%= button_to tag_path(tag), method: :delete,
|
|
28
|
-
form_class: "inline-block",
|
|
29
|
-
class: "ck-icon-btn",
|
|
30
|
-
title: "Delete tag",
|
|
31
|
-
"aria-label": "Delete tag",
|
|
32
|
-
data: { turbo_confirm: confirm } do %>
|
|
33
|
-
<%= heroicon_tag "trash", variant: :outline, size: 16, "aria-hidden": "true" %>
|
|
34
|
-
<% end %>
|
|
35
|
-
<% end %>
|
|
36
20
|
<%= link_to "Cancel", tags_path, class: ck_button_classes(:light, variant: :outline), tabindex: "0" %>
|
|
37
21
|
<%= form.submit(tag.persisted? ? "Save tag" : "Create tag", class: ck_button_classes(:dark)) %>
|
|
38
22
|
</div>
|
|
39
23
|
</div>
|
|
40
24
|
<% end %>
|
|
25
|
+
|
|
26
|
+
<% if tag.persisted? %>
|
|
27
|
+
<% applied_n = tag.taggings.count %>
|
|
28
|
+
<% confirm = if applied_n.zero?
|
|
29
|
+
"Delete \"#{tag.name}\"? It's not currently applied to anything."
|
|
30
|
+
else
|
|
31
|
+
"Delete \"#{tag.name}\"? It's currently applied to #{pluralize(applied_n, 'item')}. They'll lose this tag."
|
|
32
|
+
end %>
|
|
33
|
+
<%= render "completion_kit/shared/delete_action", path: tag_path(tag), label: "Delete tag", confirm: confirm %>
|
|
34
|
+
<% 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.26.
|
|
4
|
+
version: 0.26.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damien Bastin
|
|
@@ -421,6 +421,7 @@ files:
|
|
|
421
421
|
- app/views/completion_kit/runs/new.html.erb
|
|
422
422
|
- app/views/completion_kit/runs/show.html.erb
|
|
423
423
|
- app/views/completion_kit/shared/_branded_select.html.erb
|
|
424
|
+
- app/views/completion_kit/shared/_delete_action.html.erb
|
|
424
425
|
- app/views/completion_kit/shared/_settings_nav.html.erb
|
|
425
426
|
- app/views/completion_kit/suggestions/_scoreboard.html.erb
|
|
426
427
|
- app/views/completion_kit/suggestions/_state.html.erb
|