Commit graph

17 commits

Author SHA1 Message Date
Karthik Chikmagalur
ac754ceb2a gptel: Handle read-only gptel-buffers
* gptel.el (gptel--insert-response):
* gptel-transient.el (gptel--suffix-send):
* gptel-curl.el (gptel-curl--stream-filter, gptel-curl--stream-insert-response,
gptel-curl--stream-cleanup):
Handle read-only gptel buffers by redirecting the output to a new buffer (that
pops up automatically).  To track this,
- the `:position' argument of the INFO plist, which is a marker, is moved to the
new output buffer.
- the `:buffer' argument of the INFO plist is unmodified, it always points to
the buffer that the request originated from.
2023-05-03 13:50:27 -07:00
Karthik Chikmagalur
f218388d4d gptel-transient: Fix bug when sending in existing session
* gptel-transient.el (gptel--suffix-send, gptel-menu): When
reading input from the minibuffer and sending the output to an
existing gptel session, only use the prompt read from the
minibuffer. Reword the "Overwrite/Delete prompt" option.
2023-04-10 22:49:41 -07:00
Karthik Chikmagalur
00abbf7597 gptel-transient: More visual feedback
* gptel.el (gptel): `gptel' only pops to the gptel buffer when
called interactively.

* gptel-transient.el: Pop up the gptel session buffer when the
prompt is sent to it, but don't select it. Also message the user
that the response has been redirected to the gptel session.
2023-04-09 22:57:51 -07:00
Karthik Chikmagalur
c29e1cd673 gptel-transient: Minor formatting changes.
* gptel-transient.el (gptel-system-prompt): Formatting changes.
2023-04-09 13:02:56 -07:00
Karthik Chikmagalur
c11e53061c gptel-transient: New gptel-menu transient options
* gptel-transient.el (gptel-menu, gptel--suffix-send,
gptel--suffix-send-existing, gptel--suffix-send-new): Rewrite
`gptel-menu' to allow for selecting prompt sources and response
sinks independently. Sensible combinations of the following are
now possible:
- prompt from minibuffer
- Replace prompt with response
- Response to echo area
- Response to new gptel session
- Response to existing gptel session
- Response to kill-ring

The transient suffixes `gptel--suffix-send-existing' and
`gptel--suffix-send-new' are now obsolete and have been removed.
2023-04-09 13:02:56 -07:00
Karthik Chikmagalur
23332a9bc5 gptel-transient: Add outline-minor-mode support
* gptel-transient.el: Add section headers and an `outline-regexp'.
2023-04-09 13:01:46 -07:00
Karthik Chikmagalur
937c754e57 gptel-transient: Add refactor transient
* gptel-transient.el: Add `gptel-rewrite-menu' (accessible via the
main `gptel-menu') to rewrite/refactor the selected region,
including the choice to Ediff it linewise/wordwise afterwards.
2023-04-09 13:01:40 -07:00
Karthik Chikmagalur
c6abda6f0f gptel-transient: Rename gptel-send-menu -> gptel-menu
* gptel.el (gptel-send): Replace references to `gptel-send-menu'.

* gptel-transient.el: Rename `gptel-send-menu' t `gptel-menu'.
This shorter name is apropos of its increased feature set (in the
forthcoming commits).
2023-04-09 04:14:37 -07:00
Karthik Chikmagalur
9b3db255e8 gptel: Turn API parameters into defcustoms
* gptel.el (gptel--request-data, gptel--system-message-alist,
gptel--model, gptel--temperature, gptel--max-tokens): Rename API
parameters and turn them into customizable variables. They are
still buffer-local.

Rename:
`gptel--system-message-alist' to `gptel-directives'
`gptel--max-tokens' to `gptel-max-tokens'
`gptel--model' to `gptel-model'
`gptel--temperature' to `gptel-temperature'

* gptel-transient.el (gptel-system-prompt,
gptel--infix-max-tokens, gptel--infix-model,
gptel--infix-temperature): Accommodating changes when setting the
renamed parameters.
2023-03-24 17:51:00 -07:00
Schroedi
23caab41cf Add gpt-4 model 2023-03-23 14:27:33 -07:00
Karthik Chikmagalur
8a6ef565f0 gptel-transient: Remove unused lexical vars 2023-03-17 23:44:17 -07:00
Karthik Chikmagalur
30161850ad gptel-transient: Allow setting num past messages to 0
gptel-transient.el (gptel--infix-num-messages-to-send): Allow
setting the number of past messages to send to 0 for no-context
responses.
2023-03-14 02:09:53 -07:00
Karthik Chikmagalur
3d0df72bd3 gptel-transient: linting for MELPA 2023-03-12 14:51:07 -07:00
Karthik Chikmagalur
cd6d90b24d gptel-transient: Improve "send in existing/new session" option
gptel-transient.el (gptel-send-menu, gptel--suffix-send-existing,
gptel--suffix-send-new, gptel--infix-model): Make menu keybindings
more uniform and improve descriptions. Suffixes to send queries in
existing/new sessions will now automatically send them instead of
just yanking the text into these sessions.
2023-03-11 18:40:06 -08:00
Karthik Chikmagalur
9da22155de gptel-transient: Fix autoloads for gptel-send-menu 2023-03-11 02:09:01 -08:00
Karthik Chikmagalur
9f8fc0e519 gptel-transient: Commands to act on region
gptel.el (gptel): When calling `gptel' with a selected region, insert it
into a new session.

gptel-transient.el (gptel--suffix-send-existing,
gptel--suffix-send-new): Transient suffixes available when a region is
selected.  These send the text as a prompt in a existing or new gptel
session.
2023-03-10 06:14:46 -08:00
Karthik Chikmagalur
39376aa3f4 gptel-transient: Add transient menus for setting parameters
gptel-transient (gptel-send-menu): Add new transient-prefix
`gptel-send-menu' for setting API options for the buffer
and (optionally) sending queries. Various infix options are supported.

2023-03-09: Some transient menus are generated dynamically, which
requires a more recent version of transient than the latest tagged
release. As a result, the dynamic generation code is commented out for
now.
2023-03-10 06:13:19 -08:00