summaryrefslogtreecommitdiff
path: root/src/wasp-ai.el
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-11-07 00:20:02 -0500
committerLLLL Colonq <llll@colonq>2025-11-07 00:20:02 -0500
commitcf266a56f30daae8b9af7c9bc3267c61b1973192 (patch)
treef365939f712973840ff19d9265c552af820cd1ef /src/wasp-ai.el
parent3d31c488fb06e9937964041f4d83d0cb1c9699ab (diff)
Update
Diffstat (limited to 'src/wasp-ai.el')
-rw-r--r--src/wasp-ai.el43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/wasp-ai.el b/src/wasp-ai.el
index 2c696c56..31ca001a 100644
--- a/src/wasp-ai.el
+++ b/src/wasp-ai.el
@@ -80,49 +80,6 @@
;; (funcall k data))))
t)
-(defvar-local w/ai-callback nil)
-(defun w/ai-old (question k &optional systemprompt user assistant)
- "Ask QUESTION to ChatGPT and pass the answer to K.
-Optionally use SYSTEMPROMPT and the USER and ASSISTANT prompts."
- (let ((tmpfile (make-temp-file "wasp-ai"))
- (tmpfilesystem (make-temp-file "wasp-ai-system"))
- (tmpfileuser (make-temp-file "wasp-ai-user"))
- (tmpfileassistant (make-temp-file "wasp-ai-assistant"))
- (buf (generate-new-buffer w/ai-buffer)))
- (with-temp-file tmpfile (insert question))
- (when systemprompt
- (with-temp-file tmpfilesystem (insert systemprompt)))
- (when user
- (with-temp-file tmpfileuser
- (if (stringp user)
- (insert (s-concat user "\n"))
- (--each user
- (insert (s-concat it "\n"))))))
- (when assistant
- (with-temp-file tmpfileassistant
- (if (stringp assistant)
- (insert (s-concat assistant "\n"))
- (--each assistant
- (insert (s-concat it "\n"))))))
- (with-current-buffer buf
- (setq-local w/ai-callback k)
- (erase-buffer))
- (make-process
- :name w/ai-process
- :buffer buf
- :command
- (list
- "chatgpt"
- tmpfile
- (if systemprompt tmpfilesystem "systemprompt.txt")
- (if user tmpfileuser "userprompt.txt")
- (if assistant tmpfileassistant "assistantprompt.txt"))
- :stderr (get-buffer-create w/ai-error-buffer)
- :sentinel
- (lambda (_ _)
- (with-current-buffer buf
- (funcall w/ai-callback (s-trim (buffer-string))))))))
-
(defun w/ai (question k &optional systemprompt user assistant)
"Ask QUESTION to ChatGPT and pass the answer to K.
Optionally use SYSTEMPROMPT and the USER and ASSISTANT prompts."