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

Binding RET to gptel-return-dwim, don't need press C-c to send prompt. #395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manateelazycat
Copy link

Hi, I've added a gptel-return-dwim function today, which will detect every time you press the RET key, execute gptel-send if it starts with #, otherwise call the RET function

In this way, we can just press RET for normal use, and we don't need to press the C-c prefix button every time

@manateelazycat
Copy link
Author

@KarimAziev Can you help to review this patch? Thanks

@KarimAziev
Copy link
Contributor

KarimAziev commented Sep 30, 2024

Hi @manateelazycat, I believe you might have meant to mention karthink, the owner and maintainer of this repository. I just contributed once but I'm not actively maintaining the project.

@karthink
Copy link
Owner

karthink commented Oct 3, 2024

I think there's some misunderstanding here about how prompts work in gptel. gptel does not have a "prompt line" or require a prompt prefix character like ###. Everything up to the cursor position is part of the prompt. Consider this example:

#### In this quote:

"To be more explicit, we do not know why the standard model is based on the
gauge group SU(3)xSU(2)xU(1)/Z_6, and not some other gauge group. Even given
that gauge group, the standard model does not specify why it uses such a long,
apparently arbitrary, list of particles to represent that group. The standard
model does not explain why its quarks and leptons are organized into three
generations. It does not explain why SU(2) weak isospin acts only on left-handed
states."

What kind of product are they talking about by "x"?  Is it the cartesian product
or the tensor product?

*Response*: The "x" in the quote refers to the *direct product* of groups. It is
not the Cartesian product or the tensor product.

The direct product of groups is a way to combine multiple groups into a larger
group. In the context of the standard model, the direct product \(SU(3)\times
SU(2) \times U(1)\) represents the combination of three different gauge groups:

- *SU(3)*: The gauge group of strong interactions, responsible for the forces
  that bind quarks together.
- *SU(2)*: The gauge group of weak interactions, responsible for processes like
  beta decay.
- *U(1)*: The gauge group of electromagnetic interactions, responsible for the
  forces between charged particles.

The quotient group \(\frac{SU(3)\times SU(2) \times U(1)}{Z_6}\) is a slight
modification of the direct product, where \(Z_6\) is a cyclic group of
order 6. This modification is necessary to ensure that the standard model
correctly describes the interactions of particles.

In this exchange, everything up to the last line I typed: or the tensor product? is sent as part of the user prompt.

The default prompt and response prefix strings in chat sessions (here #### and *Response*: respectively) are just visual aids for the user, they don't imply any parsing logic.

@manateelazycat
Copy link
Author

I know that ### doesn't necessarily start with a prompt, it may be the content of the AI response.

However, it is more frequently used to send requests to the AI or enter RET in normal content, so we should improve the ease of use of these high-frequency keys, and if there is really text starting with ### in the content, we should encourage the user to use other keys to solve the problem at this time.

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

Successfully merging this pull request may close these issues.

3 participants