Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature: add chatgpt-shell-before-command-functions hook#411

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tothedarktowercame wants to merge2 commits intoxenodium:main
base:main
Choose a base branch
Loading
fromtothedarktowercame:main

Conversation

@tothedarktowercame
Copy link

Use case:

I’m using chatgpt-shell as part of a larger system where I sometimes want to log commands externally or selectively route content into a local knowledge graph.

To do this cleanly, I’ve been maintaining a small local patch that introduces a “before command” hook that is exactly "symmetrical" with `chatgpt-shell-after-command-functions'.

New feature

chatgpt-shell-before-command-functions [...] This is useful if you'd like to automatically handle or suggest things
prior to execution.

Example usage

I'm using it toprogrammatically reset the system prompt with each call, here's a reduced example:

(defunset-user-system-prompt (_command)  (let* ((now   (current-time))         (date  (format-time-string"%A, %B %d, %Y" now))         (time  (format-time-string"%H:%M" now))         (prompt (concat"You use markdown liberally to structure responses.""Always show code snippets in markdown blocks with language labels.""The user’s most recent query has been submitted at the following date:"                  date" and the local time (in the London timezone) is" time". Please preface all your replies with the metadata ["                  date"/" time"].\n")))    (setq chatgpt-shell-system-prompts          `(("tl;dr"."Be as succinct but informative as possible and respond in tl;dr form to my queries")            ("General".,prompt)))))(add-hook'chatgpt-shell-before-command-functions#'set-user-system-prompt)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@tothedarktowercame

[8]ページ先頭

©2009-2025 Movatter.jp