mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-30 19:03:01 +01:00
Improve online chat reference extraction in Khoj.el Emacs package
- Handle online references with no title - Improve handling references which are arrays instead of lists
This commit is contained in:
parent
9d33d8c0fa
commit
c7c32a7467
1 changed files with 6 additions and 4 deletions
|
@ -993,13 +993,15 @@ RECEIVE-DATE is the message receive date."
|
||||||
(lambda (search-result)
|
(lambda (search-result)
|
||||||
(-map
|
(-map
|
||||||
(lambda (entry)
|
(lambda (entry)
|
||||||
(let ((link (cdr (or (assoc 'link entry) (assoc 'descriptionLink entry))))
|
(let* ((link (cdr (or (assoc 'link entry) (assoc 'descriptionLink entry))))
|
||||||
(title (cdr (or (assoc 'title entry) '(title . ,link))))
|
(title (cdr (or (assoc 'title entry) `(title . ,link))))
|
||||||
(description (cdr (or (assoc 'snippet entry) (assoc 'description entry)))))
|
(description (cdr (or (assoc 'snippet entry) (assoc 'description entry)))))
|
||||||
(setq result (append result `(((title . ,title) (link . ,link) (description . ,description) (search . ,search-q)))))))
|
(setq result (append result `(((title . ,title) (link . ,link) (description . ,description) (search . ,search-q)))))))
|
||||||
;; wrap search results in a list if it is not already a list
|
;; wrap search results in a list if it is not already a list
|
||||||
(if (or (equal 'knowledgeGraph (car search-result)) (equal 'webpages (car search-result)))
|
(if (or (equal 'knowledgeGraph (car search-result)) (equal 'webpages (car search-result)))
|
||||||
(list (cdr search-result))
|
(if (arrayp (cdr search-result))
|
||||||
|
(list (elt (cdr search-result) 0))
|
||||||
|
(list (cdr search-result)))
|
||||||
(cdr search-result))))
|
(cdr search-result))))
|
||||||
search-results)))
|
search-results)))
|
||||||
query-result-pairs)
|
query-result-pairs)
|
||||||
|
|
Loading…
Reference in a new issue