@@ -521,6 +521,30 @@ Downloaded from https://github.com/f/awesome-chatgpt-prompts."
521
521
(setq chatgpt-shell-models (chatgpt-shell--make-default-models))
522
522
(message " Reloaded %d models " (length chatgpt-shell-models)))
523
523
524
+ (defcustom chatgpt-shell-model-filter nil
525
+ " A function that is applied `chatgpt-shell-models' to determine
526
+ which models should be shown in `chatgpt-shell-swap-model' ."
527
+ :type 'function
528
+ :group 'chatgpt-shell )
529
+
530
+ (defun chatgpt-shell-allow-model-versions (versions )
531
+ " Return a predicate that accepts models only if their version
532
+ appears in versions. This is intended for use with
533
+ `chatgpt-shell-model-filter' ."
534
+ (lambda (models )
535
+ (seq-filter (lambda (model )
536
+ (member (map-elt model :version ) versions))
537
+ models)))
538
+
539
+ (defun chatgpt-shell-ignore-model-versions (versions )
540
+ " A predicate intended for use with `chatgpt-shell-model-filter' to
541
+ allow model versions specified in
542
+ `chatgpt-shell-ignored-model-versions' ."
543
+ (lambda (models )
544
+ (seq-filter (lambda (model )
545
+ (not (member (map-elt model :version ) versions)))
546
+ models)))
547
+
524
548
(defun chatgpt-shell-swap-model ()
525
549
" Swap model version from `chatgpt-shell-models' ."
526
550
(interactive )
@@ -539,7 +563,9 @@ Downloaded from https://github.com/f/awesome-chatgpt-prompts."
539
563
(format (format " %% -%d s %% s" width)
540
564
(map-elt model :provider )
541
565
(map-elt model :version )))
542
- chatgpt-shell-models))
566
+ (if chatgpt-shell-model-filter
567
+ (funcall chatgpt-shell-model-filter chatgpt-shell-models)
568
+ chatgpt-shell-models)))
543
569
(selection (nth 1 (split-string (completing-read " Model version: "
544
570
models nil t )))))
545
571
(progn
0 commit comments