Skip to content

Commit

Permalink
Fix LLMs not expanding inlines, broken in commit #172 (#180)
Browse files Browse the repository at this point in the history
Also add a check to the test to keep this problem from re-occurring.
  • Loading branch information
ahyatt authored Sep 3, 2024
1 parent 0ebc73f commit 4dbea88
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions doc/ekg.org
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ triples library is already installed.
** Version 0.6.4
- Fix display of extended structured data in notes.
- Add contrib directory and =ekg-email= as a contribution to import emails to notes in a structured way.
- Fix inlines not expanding in the contextual notes in =ekg-llm=.
** Version 0.6.3
- Fix issue in trying to get a single-valued item to show up in the metadata line.
- Remove the never-used named, email, and person schema.
Expand Down
2 changes: 2 additions & 0 deletions doc/ekg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ triples library is already installed.
Fix display of extended structured data in notes.
@item
Add contrib directory and @samp{ekg-email} as a contribution to import emails to notes in a structured way.
@item
Fix inlines not expanding in the contextual notes in @samp{ekg-llm}.
@end itemize

@node Version 063
Expand Down
40 changes: 23 additions & 17 deletions ekg-llm-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,29 @@
(let* ((time (current-time))
(time-str (format-time-string "%Y-%m-%dT%H:%M:%S" time))
(json-encoding-pretty-print t))
(should (equal
(json-encode
(sort
`(("tags" . ["tag1" "tag2"])
("created" . ,time-str)
("modified" . ,time-str)
("title" . ["Title"])
("text" . "Content")
("id" . "http://example.com/1"))
(lambda (a b) (string< (car a) (car b)))))
(ekg-llm-note-to-text
(make-ekg-note :id "http://example.com/1"
:properties '(:titled/title ("Title"))
:text "Content"
:creation-time time
:modified-time time
:tags '("tag1" "tag2")))))))
(cl-letf (((symbol-function 'ekg-inline-command-const-inline)
(lambda (&rest _) "inline")))
(should (equal
(json-encode
(sort
`(("tags" . ["tag1" "tag2"])
("created" . ,time-str)
("modified" . ,time-str)
("title" . ["Title"])
("text" . "Contentinline\n")
("id" . "http://example.com/1"))
(lambda (a b) (string< (car a) (car b)))))
(ekg-llm-note-to-text
(make-ekg-note :id "http://example.com/1"
:properties '(:titled/title ("Title"))
:text "Content"
:creation-time time
:modified-time time
:tags '("tag1" "tag2")
:inlines
(list (make-ekg-inline :pos 7
:command '(const-inline)
:type 'command)))))))))

(provide 'ekg-llm-test)

Expand Down
2 changes: 1 addition & 1 deletion ekg-llm.el
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ structs."
(created . ,(ekg-llm-format-time (ekg-note-creation-time note)))
(modified . ,(ekg-llm-format-time (ekg-note-modified-time note)))
(text . ,(substring-no-properties (substring-no-properties
(ekg-note-text note))))))
(ekg-display-note-text note))))))
(json-encoding-pretty-print t))
(when (ekg-should-show-id-p note)
(push (cons "id" (ekg-note-id note)) result))
Expand Down

0 comments on commit 4dbea88

Please sign in to comment.