Show related packages based on description embeddings
Package pages get a "Related packages" section: a nearest neighbor query against the package's own stored embedding (no external service call), excluding the package itself. Packages without an embedding render no section.
This commit is contained in:
parent
fdf3289f54
commit
4d07f43a2e
5 changed files with 46 additions and 0 deletions
|
|
@ -70,6 +70,19 @@
|
|||
/ #metadata is the anchor for this sticky container.
|
||||
= render(partial: 'details_rightbox', locals: {pkg: @package})
|
||||
|
||||
/ Semantically similar packages, based on the package's description embedding
|
||||
- if @related_packages.any?
|
||||
#related
|
||||
h3 Related packages
|
||||
.grid-x.grid-margin-x.medium-up-2.large-up-3 data-equalizer=true
|
||||
- @related_packages.each do |pkg|
|
||||
.cell.pkgcard data-equalizer-watch=true
|
||||
a.black href=package_path(name: pkg.name)
|
||||
.text.pkgname
|
||||
= pkg.name
|
||||
.text.small
|
||||
= pkg.description
|
||||
|
||||
javascript:
|
||||
// Where to send POST requests for uploads
|
||||
let ajax_upload_url = '#{{upload_receive_json_path}}';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue