completion-kit 0.16.1 → 0.16.3
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6481d39133e4f2fd59c4fe262608363e206e5a374863055489021cbde84dfa11
|
|
4
|
+
data.tar.gz: c3e7db262f0c8d97526eb7057af0d4724dfbc331051640ff02d64129936e6bec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34158b719e5bc88757f81c43f6f676e236db71cd935008f3910e7b94b2560b9c420dd0dec0ef7428a31bfd30d4544b674f39337b0745d539dd53449b2534de0a
|
|
7
|
+
data.tar.gz: fffb6ff7102277d203378100ad0e58319f2fd34f1867d3563f3fdf8e5f409a42a29cb5a602d8be143c512374ba51617c8580b5bfe89a6703fb2ddbef020e324b
|
data/README.md
CHANGED
|
@@ -270,6 +270,17 @@ end
|
|
|
270
270
|
|
|
271
271
|
`tenant_scope` runs as each engine model's `default_scope` (use `unscoped` to bypass). `tenant_scope_columns` is appended to every engine uniqueness validation. Adding the tenant columns and composite unique indexes lives in your host migrations. Both defaults (`nil`, `[]`) are no-ops.
|
|
272
272
|
|
|
273
|
+
Two further hooks let a host shape the runs index page without overriding the controller or the view:
|
|
274
|
+
|
|
275
|
+
```ruby
|
|
276
|
+
CompletionKit.configure do |config|
|
|
277
|
+
config.runs_index_scope = -> { where(created_at: 90.days.ago..) }
|
|
278
|
+
config.runs_index_footer_partial = "runs/retention_notice"
|
|
279
|
+
end
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
`runs_index_scope` is a callable evaluated against the runs index relation, in the same bare-`where` style as `tenant_scope` (it runs via `instance_exec`, so write it zero-arg with the relation as `self`, like a Rails `scope` lambda). It must return a relation: a callable that returns `nil` or anything non-chainable raises when the list renders. Use it to apply list-only filters such as run-history retention, rather than a global `default_scope` that would also null `Run` associations everywhere they are traversed. `runs_index_footer_partial` names a partial rendered below the list; it receives the shown runs as a `runs` local. Use it for a notice like "older runs are hidden, upgrade to see them" — your host owns the retention rule in `runs_index_scope`, so it computes the hidden count itself. Both default to `nil` (no-ops), leaving standalone behaviour unchanged.
|
|
283
|
+
|
|
273
284
|
## Contributing
|
|
274
285
|
|
|
275
286
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and pull request guidelines.
|
|
@@ -5,7 +5,10 @@ module CompletionKit
|
|
|
5
5
|
before_action :load_form_collections, only: [:new, :edit, :create, :update]
|
|
6
6
|
|
|
7
7
|
def index
|
|
8
|
-
|
|
8
|
+
scope = Run.includes(:prompt, :dataset, :tags, responses: :reviews).order(created_at: :desc)
|
|
9
|
+
index_scope = CompletionKit.config.runs_index_scope
|
|
10
|
+
scope = scope.instance_exec(&index_scope) if index_scope
|
|
11
|
+
@runs = apply_tag_filter(scope)
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
def show
|
|
@@ -22,3 +22,7 @@
|
|
|
22
22
|
<% else %>
|
|
23
23
|
<div class="ck-empty">No runs yet. <%= link_to "Create your first run →", new_run_path, class: "ck-link" %></div>
|
|
24
24
|
<% end %>
|
|
25
|
+
|
|
26
|
+
<% if CompletionKit.config.runs_index_footer_partial %>
|
|
27
|
+
<%= render CompletionKit.config.runs_index_footer_partial, runs: @runs %>
|
|
28
|
+
<% end %>
|
data/lib/completion_kit.rb
CHANGED
|
@@ -10,6 +10,7 @@ module CompletionKit
|
|
|
10
10
|
attr_accessor :username, :password, :auth_strategy, :api_token
|
|
11
11
|
attr_accessor :tenant_scope, :tenant_scope_columns
|
|
12
12
|
attr_accessor :api_reference_authentication_partial
|
|
13
|
+
attr_accessor :runs_index_scope, :runs_index_footer_partial
|
|
13
14
|
attr_accessor :api_rate_limit, :web_rate_limit
|
|
14
15
|
attr_accessor :allow_loopback_endpoints
|
|
15
16
|
attr_accessor :judge_agreement_enabled
|
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.16.
|
|
4
|
+
version: 0.16.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damien Bastin
|
|
@@ -473,7 +473,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
473
473
|
requirements:
|
|
474
474
|
- - ">="
|
|
475
475
|
- !ruby/object:Gem::Version
|
|
476
|
-
version: 3.
|
|
476
|
+
version: 3.2.0
|
|
477
477
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
478
478
|
requirements:
|
|
479
479
|
- - ">="
|