Code Monkey home page Code Monkey logo

Comments (2)

xenodium avatar xenodium commented on June 12, 2024

Interesting idea. I suspect it'll get tricky to find a sweet spot for this sort of behaviour, so I'm adding an integration point and some building blocks (around ielm) for folks to implement own neat ideas.

You can achieve something like what you've described with:

(setq chatgpt-shell-response-post-process-function
      (lambda (response)
        (let* ((source-blocks (seq-filter (lambda (block)
                                            (or (string-equal (car block)
                                                              "emacs-lisp")
                                                (string-equal (car block)
                                                              "elisp")))
                                          (chatgpt-shell--markdown-source-blocks
                                           response)))
               (source-block (cdr (seq-first source-blocks))))
          (when (and source-block source-blocks)
            (if (eq (seq-length source-blocks) 1)
                (when (y-or-n-p "Execute emacs-lisp block?")
                  (chatgpt-shell-send-to-ielm-buffer (string-trim source-block) t))
              (message "Too many blocks to choose from"))))))
execthis.mov

from chatgpt-shell.

Dickby avatar Dickby commented on June 12, 2024

This is an example where the the "system" role can be handy. I think shell-gpt is not using "system" but prepends something to every user prompt. look how it's achieved that chatgpt will only output the code requested, and no extra information: https://github.com/TheR1D/shell_gpt/blob/main/sgpt/make_prompt.py

from chatgpt-shell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.