Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User should call chatgpt-shell-swap-system-prompt after calling chatgpt-shell-load-awesome-prompts #226

Open
casch-at opened this issue Aug 16, 2024 · 5 comments

Comments

@casch-at
Copy link
Contributor

(defun chatgpt-shell-load-awesome-prompts ()
"Load `chatgpt-shell-system-prompts' from awesome-chatgpt-prompts.
Downloaded from https://github.com/f/awesome-chatgpt-prompts."
(interactive)
(unless (fboundp 'pcsv-parse-file)
(user-error "Please install pcsv"))
(require 'pcsv)
(let ((csv-path (concat (temporary-file-directory) "awesome-chatgpt-prompts.csv")))
(url-copy-file "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv"
csv-path t)
(setq chatgpt-shell-system-prompts
(map-merge 'list
chatgpt-shell-system-prompts
;; Based on Daniel Gomez's parsing code from
;; https://github.com/xenodium/chatgpt-shell/issues/104
(seq-sort (lambda (rhs lhs)
(string-lessp (car rhs)
(car lhs)))
(cdr
(mapcar
(lambda (row)
(cons (car row)
(cadr row)))
(pcsv-parse-file csv-path))))))
(message "Loaded awesome-chatgpt-prompts")
(setq chatgpt-shell-system-prompt nil)
(chatgpt-shell--update-prompt t)
(chatgpt-shell-interrupt nil)
(chatgpt-shell-swap-system-prompt)))

I suggest removing L413-L416, and change the message at L412 to e.g. "Loaded awesome-chatgpt-prompts, call chatgpt-shell-swap-system-prompt to change your current chatgpt-shell-system-prompt"

@xenodium
Copy link
Owner

Thanks for filing. Could you share a bit more about the use-case? If loading awesome prompts, aren't you already highlighly likely to swap at the time of loading?

@casch-at
Copy link
Contributor Author

casch-at commented Aug 18, 2024 via email

@xenodium
Copy link
Owner

what if the user wants to automatically load them on each Emacs startup, than the user would get a warning about not being in chatgpt-shell-mode

If that's the main use-case we'd like to unblock, I'm thinking we should consider making chatgpt-shell-load-awesome-prompts a ilttle smarter to determine if invoked interactively to call swap. Would that work for you?

@casch-at
Copy link
Contributor Author

casch-at commented Aug 18, 2024

Would that work for you?

Absolutely 👍🏻 I would be open to implementing that feature.

@xenodium
Copy link
Owner

Absolutely 👍🏻 I would be open to implementing that feature.

Sounds good. (called-interactively-p #'interactive) might help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants