mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Set Query as Heading of Image Search Results Emacs Buffer
This commit is contained in:
parent
169ddcc8c6
commit
fdb60a8dcf
1 changed files with 4 additions and 3 deletions
|
@ -56,13 +56,14 @@
|
|||
(lambda (args) (format "%s" (cdr (assoc 'Entry args))))
|
||||
json-response))))
|
||||
|
||||
(defun semantic-search--extract-entries-as-images (json-response)
|
||||
(defun semantic-search--extract-entries-as-images (json-response query)
|
||||
"Convert json response from API to org-mode entries with images"
|
||||
;; remove leading (, ) or SPC from extracted entries string
|
||||
(replace-regexp-in-string
|
||||
"^[\(\) ]" ""
|
||||
;; extract entries from response as single string and convert to entries
|
||||
(format "* Results \n%s"
|
||||
(format "* %s \n%s"
|
||||
query
|
||||
(mapcar
|
||||
(lambda (args) (format "\n** \n [[%s]]" (cdr (assoc 'Entry args))))
|
||||
json-response))))
|
||||
|
@ -111,7 +112,7 @@
|
|||
(insert
|
||||
(cond ((or (equal search-type "notes") (equal search-type "music")) (semantic-search--extract-entries-as-org json-response))
|
||||
((equal search-type "ledger") (semantic-search--extract-entries-as-ledger json-response))
|
||||
((equal search-type "image") (semantic-search--extract-entries-as-images json-response))
|
||||
((equal search-type "image") (semantic-search--extract-entries-as-images json-response query))
|
||||
(t (format "%s" json-response)))))
|
||||
(cond ((equal search-type "notes") (org-mode))
|
||||
((equal search-type "music") (progn (org-mode)
|
||||
|
|
Loading…
Reference in a new issue