xenodium / chatgpt-shell

A multi-llm Emacs shell (ChatGPT, Claude, Gemini, Ollama, Perplexity) + editing integrations
https://lmno.lol/alvaro
GNU General Public License v3.0
867 stars 77 forks source link

Feat request: set chatgpt-shell-system-prompts to awesome-chatgpt-prompts/prompts.csv #104

Closed dangom closed 1 year ago

dangom commented 1 year ago

This repo provides a large list of curated system prompts. Would be nice to have them available from chatgpt-shell.

I asked chatgpt to tell me how to do that, and here's the reply (which works):

(defun parse-csv-line (line)
  (mapcar (lambda (s) (replace-regexp-in-string "\"" "" s))
          (split-string line ",")))

(defun csv-to-assoc (file)
  (with-temp-buffer
    (insert-file-contents file)
    (mapcar (lambda (row) (cons (car row) (cadr row)))
            (mapcar 'parse-csv-line (split-string (buffer-string) "\n")))))

(setq chatgpt-shell-system-prompts (cdr (csv-to-assoc "~/Downloads/prompts.csv")))

I was wondering whether it'd make sense to add that to chatgpt-shell, hence the issue. Feel free to close if not relevant.

xenodium commented 1 year ago

Sorry for the delay responding. Thank you for the feature request and contribution.

Combined your code/logic into a single function that downloads and loads the csv.

Give that a try via M-x chatgpt-shell-load-awesome-prompts. Please reopen if you run into issues.