Replies: 1 comment 4 replies
-
All of this functionality is already built into gptel's transient menu. Is there some reason you don't want to use the interactive interface gptel provides for switching presets?
You don't need to define a (defun gptel-my-set-default-preset (&optional preset)
(interactive
(list (intern-soft
(completing-read "Apply preset: " gptel--known-presets))))
(unless preset (user-error "No preset specified"))
(condition-case nil
(progn (gptel--appl-preset preset)
(message "Preset %s applied" preset))
(void-function
(user-error "Function `gptel--apply-preset' is unavailable (may have changed)")))) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Starting a discussion on use of presets, and how to have a default preset, and how to switch.
Background: This issue: #1000 where I at the end wondered:
Based on karthink's help, I came up with the code below. Sharing it here in the hope it helps others and facilitates discussions about usage of presets.
Note: The code example at the bottom uses a private gptel function, so it'll eventually break.
First define some preset, that can use a shared "base-preset".
Then (unfortunately) manually listing the presets from which I can interactively select:
And a function to help select/set a default prefix.
Beta Was this translation helpful? Give feedback.
All reactions