Skip to content

Commit

Permalink
making things work
Browse files Browse the repository at this point in the history
  • Loading branch information
psionic-k committed Feb 12, 2025
1 parent 13646c8 commit b6c80d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gptel-openai.el
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ Mutate state INFO with response metadata."
(format "call_%s" tool-id))

(defun gptel--openai-unformat-tool-id (tool-id)
(or (and (string-match-p "call_\\(.+\\)" tool-id)
(match-string 0 tool-id))
(or (and (string-match "call_\\(.+\\)" tool-id)
(match-string 1 tool-id))
(progn
(message "Unexpected tool_call_id format: %s" tool-id)
tool-id)))
Expand Down
1 change: 1 addition & 0 deletions gptel-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
(declare-function gptel-backend-name "gptel")
(declare-function gptel--parse-buffer "gptel")
(declare-function gptel--parse-directive "gptel")
(declare-function gptel--restore-props "gptel")
(declare-function org-entry-get "org")
(declare-function org-entry-put "org")
(declare-function org-with-wide-buffer "org-macs")
Expand Down
7 changes: 5 additions & 2 deletions gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
(declare-function ediff-regions-internal "ediff")
(declare-function hl-line-highlight "hl-line")

(declare-function org-escape-code-in-string "org-src")
(declare-function gptel-org--create-prompt "gptel-org")
(declare-function gptel-org-set-topic "gptel-org")
(declare-function gptel-org--save-state "gptel-org")
Expand Down Expand Up @@ -1979,7 +1980,8 @@ Run post-response hooks."
backend (plist-get info :data)
(gptel--parse-tool-results
backend (plist-get info :tool-use)))
(funcall (plist-get info :callback) result-alist info)
(funcall (plist-get info :callback)
(cons 'tool-result result-alist) info)
(gptel--fsm-transition fsm)))))
(when-let* ((tool-spec
(cl-find-if
Expand Down Expand Up @@ -2011,7 +2013,8 @@ Run post-response hooks."
(setq gptel--fsm-last fsm)
(when gptel-mode (gptel--update-status
(format " Run tools?" ) 'mode-line-emphasis)))
(funcall (plist-get info :callback) pending-calls info)))))
(funcall (plist-get info :callback)
(cons 'tool-call pending-calls) info)))))

;;;; State machine predicates
;; Predicates used to find the next state to transition to, see
Expand Down

0 comments on commit b6c80d9

Please sign in to comment.