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 +4 -4
- data/lib/legion/apollo/version.rb +1 -1
- data/lib/legion/apollo.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7150a2def38a098c16a2f35362210994cc77537ca6ee3e0e615823cf8e1797c2
|
|
4
|
+
data.tar.gz: 6e0bfa593f70915134195672dbe321f03c00c86e1f80fee06f5370f3c6578110
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97783044f23209d697578c0f56d570bc48b9531e5d569f23e4db98bf55cb5d0c4602d6a0fedeb8e7c04a89618d4586c25bc7ca89f1a8d922e8618c5b724cc13e
|
|
7
|
+
data.tar.gz: 8498fae869abc9f54520b216ed88e2aea006ee6e520d8421d44cf5781c76ae9c158553e3c34a7e9e1e37d44594248a5c6daae1c7b55336c9692e7b668f00fbb4
|
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
|