mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 16:14:21 +00:00
Put image score breakdown under `additional' field in search response
- Update web, emacs interfaces to consume the scores from new schema
This commit is contained in:
parent
e42a38e825
commit
0521ea10d6
3 changed files with 14 additions and 9 deletions
|
@ -187,8 +187,8 @@ Use `which-key` if available, else display simple message in echo area"
|
|||
(lambda (args) (format
|
||||
"\n\n<h2>Score: %s Meta: %s Image: %s</h2>\n\n<a href=\"%s%s\">\n<img src=\"%s%s?%s\" width=%s height=%s>\n</a>"
|
||||
(cdr (assoc 'score args))
|
||||
(cdr (assoc 'metadata_score args))
|
||||
(cdr (assoc 'image_score args))
|
||||
(cdr (assoc 'metadata_score (assoc 'additional args)))
|
||||
(cdr (assoc 'image_score (assoc 'additional args)))
|
||||
khoj-server-url
|
||||
(cdr (assoc 'entry args))
|
||||
khoj-server-url
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
return `
|
||||
<a href="${item.entry}" class="image-link">
|
||||
<img id=${item.score} src="${item.entry}?${Math.random()}"
|
||||
title="Effective Score: ${item.score}, Meta: ${item.metadata_score}, Image: ${item.image_score}"
|
||||
title="Effective Score: ${item.score}, Meta: ${item.additional.metadata_score}, Image: ${item.additional.image_score}"
|
||||
class="image">
|
||||
</a>`
|
||||
}
|
||||
|
|
|
@ -220,12 +220,17 @@ def collate_results(hits, image_names, output_directory, image_files_url, count=
|
|||
shutil.copy(source_path, target_path)
|
||||
|
||||
# Add the image metadata to the results
|
||||
results += [{
|
||||
"entry": f'{image_files_url}/{target_image_name}',
|
||||
"score": f"{hit['score']:.9f}",
|
||||
"image_score": f"{hit['image_score']:.9f}",
|
||||
"metadata_score": f"{hit['metadata_score']:.9f}",
|
||||
}]
|
||||
results += [
|
||||
{
|
||||
"entry": f'{image_files_url}/{target_image_name}',
|
||||
"score": f"{hit['score']:.9f}",
|
||||
"additional":
|
||||
{
|
||||
"image_score": f"{hit['image_score']:.9f}",
|
||||
"metadata_score": f"{hit['metadata_score']:.9f}",
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
return results
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue