Closed daedsidog closed 3 months ago
They are currently not customizable, but are only used in
gptel-context-wrap-function
throughgptel-context--string
. If the user has their own custom wrapping function, they are never used again. If the user wishes only to have access to the context string and nothing more, he is limited to the existinggptel-context--string
.I guess what I am trying to say is that the current way these 3 functions are written do little do suggest that they are just "default suggestions", especially since they use Markdown in the generated strings.
Yeah, I'm not inclined to make the string creation function separately customizable. Writing a gptel-context-wrap-function
is only one additional step on top of creating the strings, so string creation should be covered. And if they really want to modify only the string creation part they can advise gptel-context--string
.
Anywho, everything else is on point. Cheers!
Sounds good. I'll update the README squash these commits into logical ones (as best I can), and merge it into feature-context
, then master
this weekend. Hopefully today if I can find more free time.
Oh, one last outstanding issue is the -i Include (with system message)
option in the transient menu. Should I move it into the Request Parameters section to reinforce that it works like the other settings (i.e. persistent and possibly buffer-local)?
Oh, one last outstanding issue is the
-i Include (with system message)
option in the transient menu. Should I move it into the Request Parameters section to reinforce that it works like the other settings (i.e. persistent and possibly buffer-local)?
I think it would be better, despite the crowding.
Did you by any chance do something with a6031af89685f82714397e7b6e1ab10e820ff136 and b7956e427fb09d9eae908a42f50ef6a4e29410c3? I noticed they have been superseded. If so, you didn't like the way it looked like? The whitespaces between the separators & the superimposed overlays? The superimposed overlays made it easier to see how highlighted overlays were marked.
EDIT: You didn't change the superimposed overlays, but removing the final newline makes single-line contexts be hidden under the highlighting overlay:
![Uploading image.png…]()
EDIT 2: Actually, even if I add the last newline, it doesn't show the superimposed overlay like in the first context. Strange, was sure it used to do that even for single-line contexts.
![Uploading image.png…]()
Two different things happened here.
https://github.com/karthink/gptel/commit/a6031af89685f82714397e7b6e1ab10e820ff136: This was overwritten by accident, I'll add it back.
https://github.com/karthink/gptel/commit/b7956e427fb09d9eae908a42f50ef6a4e29410c3: I only changed the code to not use a first
local var. Give me a minute to test single line contexts, I tested it but did not see what you see in the above image 1.
I can't reproduce your image with single-line contexts:
With highlighting:
I can't reproduce your image with single-line contexts:
How are you adding your context?
In the above, the top line is me adding a line + its newline, and for the rest, I just add their lines with by marking the start of the line and using line-end
, then calling gptel-context-add
on the selection. This coincides with adding the region with the transient menu.
You probably add the entire line by doing it similarly, only you just go to the start of the next line.
Also it looks like you overwrote your own change to gptel-context-previous
in the consecutive commits c0303310099b4da826e21a3b09e4954b8743e63e and b7956e427fb09d9eae908a42f50ef6a4e29410c3.
You probably add the entire line by doing it similarly, only you just go to the start of the next line.
No, here's the difference I see between picking a part of a line and a "whole line" (line + following newline).
No, here's the difference I see between picking a part of a line and a "whole line" (line + following newline).
Do you have an actual newline between the separator and the text? Could just be how my Emacs renders that separator. In a terminal version for example it appears fine:
But there's really no newline there.
I'll try with an empty config. EDIT: Getting transient-setup: Wrong type argument: (or eieio-object cl-structure-object oclosure), ""
when invoking gptel-menu
with emacs -q
. So much for that...
Do you have an actual newline between the separator and the text? Could just be how my Emacs renders that separator. In a terminal version for example it appears fine:
There is one newline between the text and the following separator:
There is one newline between the text and the following separator:
~I don't think so~ I think there should be two. In the first context, the line directly after the context text contains the separator, and the next line is the newline between the next text and the separator. In my Emacs the separator is its own line, just very shrunk.
Not sure what accounts for this difference, though.
Not sure what accounts for this difference, though.
Okay, I found the problem: separator lines are implemented differently in gtk and non-gtk Emacsen. This is probably also platform dependent. I added a second newline to be safe. The spacing in terminal and non-gtk Emacs will look weird, but we've already spent more time worrying about this than anyone should have to worry about blank lines.
Not sure what accounts for this difference, though.
Okay, I found the problem: separator lines are implemented differently in gtk and non-gtk Emacsen. This is probably also platform dependent. I added a second newline to be safe.
Also, when selecting an entire line, I get this:
I.e., single-line context highlight throughout the buffer. This looks much better than the first version.
(Note that the image above does not account for the latest commit. It's just an observation.)
(Note that the image above does not account for the latest commit. It's just an observation.)
I suppose I somehow convinced myself that this behavior existed at one point, but it probably didn't. Implementing this would require to have the deletion overlay end one point after the context overlay, and the complication it would introduce to navigation makes it not really worth it in my opinion.
I suppose I somehow convinced myself that this behavior existed at one point, but it probably didn't. Implementing this would require to have the deletion overlay end one point after the context overlay, and the complication it would introduce to navigation makes it not really worth it in my opinion.
Actually, whether or not this is correct no longer matters, as I made it work like that with minimal changes to gptel-context--buffer-setup
:
Looking sharp!
Planning to merge in ~2 hours, in case you want to make any more small changes.
(Or I can wait for a few days if you want to address something non-trivial about the PR)
Planning to merge in ~2 hours, in case you want to make any more small changes.
(Or I can wait for a few days if you want to address something non-trivial about the PR)
Looks great to me. I think you exhausted every feature!
I would check a clean config to see if we (I) didn't introduce some kind of bug to the transient menu, though:
I'll try with an empty config. EDIT: Getting transient-setup: Wrong type argument: (or eieio-object cl-structure-object oclosure), "" when invoking gptel-menu with emacs -q. So much for that...
If you can't reproduce it on your end, I'll account it for a bad, unsupported setup of the package on my account.
If you can't reproduce it on your end, I'll account it for a bad, unsupported setup of the package on my account.
I tested it with emacs -q
+ package-install-file
yesterday, mainly to test the autoloading of gptel-context.el, and everything was fine.
I'll test it again before merging.
🥳
Merged into feature-context, and now master. Fingers crossed!
Thanks for the PR @daedsidog! Took a while but we got there.
This adds the contexter I've been working on for my own personal use to GPTel. As of now, this pull request is not complete because I'm unsure what's the best path to integrate it, and also how it will fit with the new UI refactor. I synced up with the master branch of GPTel, and just added that in, but my transient menu seems to be vastly different from the previews I've seen.
Because this started as part of my config & grew organically, there are still some features that are part of my config and not in GPTel. Those parts are added to the end of this pull request in the form of a snippet from my config.
In a nutshell, I personally find this to be an incredibly useful programming tool for productivity, more so than any other AI programming tool I've tried. It pampered me to the point where I don't think I can go back to programming without it.
Here is a short guide how to use it with my config (this will change the more things I'll offload to GPTel):
C-c g p
. You can pressc
to remove selected context snippets from the context buffer directly, orC-c g p
again to remove context snippets from the code buffers.C-c g r
to send it to GPTel.With Lisp, the contexter automatically collapses s-expressions in areas that they are not required in, such as functions with docstrings, thus saving tokens:
Here is the part of my config file which sets all this up:
As can be plainly seen from the config file, the mechanism to actually send this to GPTel is rather primitive. It uses keyboard macros to navigate the transient menu, and then just dumps the prompt into the buffer, and uses the transient refactor menu to send it to GPTel.