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: ac7c957ea2f72e08f2cacd0aa07822ef6b1821b14ac181559a1ae84f38bc448e
4
- data.tar.gz: 0f148d1967f41dfd41e1a35b695c0d3331b9c43a6ec23e355b7ccfe8ed71a88f
3
+ metadata.gz: 6481d39133e4f2fd59c4fe262608363e206e5a374863055489021cbde84dfa11
4
+ data.tar.gz: c3e7db262f0c8d97526eb7057af0d4724dfbc331051640ff02d64129936e6bec
5
5
  SHA512:
6
- metadata.gz: 1efcb92af022f62acf1dca51ca567a435b5b20388b32242923d50fb86d95a0dfa3fbe5a5ce6c7efb5d367a49c20b4fabecf19749bfca43d3be282d6155876f07
7
- data.tar.gz: dc1d3dde06d43840707dd1f41c3d9e6b4ce8c0a0b93c84db730a79ac9ad940d92381d1587cb33fe019cf9633a9a677e788ff83edd9e3f6760d170a1f4205fd0d
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
- @runs = apply_tag_filter(Run.includes(:prompt, :dataset, :tags, responses: :reviews).order(created_at: :desc))
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.&ensp;<%= 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 %>
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.16.1"
2
+ VERSION = "0.16.3"
3
3
  end
@@ -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.1
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.1.0
476
+ version: 3.2.0
477
477
  required_rubygems_version: !ruby/object:Gem::Requirement
478
478
  requirements:
479
479
  - - ">="