legion-apollo 0.5.5 → 0.5.6

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: da837d4b00044d6028f0d62cfcf972c1da2a15121c182c7e6306e188e6b8c5b8
4
- data.tar.gz: 7eabbcc8623e98f023f9c1d39c824719336ea83826047ec7afe59d97fafa595f
3
+ metadata.gz: 7150a2def38a098c16a2f35362210994cc77537ca6ee3e0e615823cf8e1797c2
4
+ data.tar.gz: 6e0bfa593f70915134195672dbe321f03c00c86e1f80fee06f5370f3c6578110
5
5
  SHA512:
6
- metadata.gz: 2d5167b38adf9a921a97e72e0304a6b7c2d3b1706c105ffaf48dcbaa8e66af42b21c42e36d6b1f78d2b765fc1796ebffcb3aeed2a224a6343c43bb077aefd9ba
7
- data.tar.gz: 6219138ff5582bcf5433b37ee3cadc59946df54c4d9cf64bba71e878e8062ed31fe9703bb66ae92f7849ed87eb0d8dba0f9a38c41d109e1f35ee5d127c97c55d
6
+ metadata.gz: 97783044f23209d697578c0f56d570bc48b9531e5d569f23e4db98bf55cb5d0c4602d6a0fedeb8e7c04a89618d4586c25bc7ca89f1a8d922e8618c5b724cc13e
7
+ data.tar.gz: 8498fae869abc9f54520b216ed88e2aea006ee6e520d8421d44cf5781c76ae9c158553e3c34a7e9e1e37d44594248a5c6daae1c7b55336c9692e7b668f00fbb4
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Apollo
5
- VERSION = '0.5.5'
5
+ VERSION = '0.5.6'
6
6
  end
7
7
  end
data/lib/legion/apollo.rb CHANGED
@@ -74,6 +74,7 @@ module Legion
74
74
  normalized_tags = normalize_tags_input(tags)
75
75
  limit ||= apollo_setting(:default_limit, 5)
76
76
  min_confidence ||= apollo_setting(:min_confidence, 0.3)
77
+ opts = inject_requesting_principal_id(opts)
77
78
  log.info { "Apollo query requested scope=#{scope} text_length=#{text.to_s.length} limit=#{limit}" }
78
79
  log.debug do
79
80
  "Apollo query scope=#{scope} limit=#{limit} min_confidence=#{min_confidence} tags=#{normalized_tags.size}"
@@ -577,6 +578,19 @@ module Legion
577
578
  opts
578
579
  end
579
580
 
581
+ def inject_requesting_principal_id(opts)
582
+ return opts if opts.key?(:requesting_principal_id)
583
+ return opts unless defined?(Legion::Identity::Process)
584
+
585
+ principal_id = Legion::Identity::Process.db_principal_id
586
+ return opts if principal_id.nil?
587
+
588
+ opts.merge(requesting_principal_id: principal_id)
589
+ rescue StandardError => e
590
+ handle_exception(e, level: :warn, operation: 'apollo.inject_requesting_principal_id')
591
+ opts
592
+ end
593
+
580
594
  def not_started_error
581
595
  { success: false, error: :not_started }
582
596
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-apollo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity