@@ -521,11 +521,26 @@ 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-ignored-model-versions nil
525
- " The list of model versions to ignore when swapping the model."
526
- :type '(repeat string)
524
+ (defcustom chatgpt-shell-model-filter (lambda (_model ) t )
525
+ " A predicate used to determine which models should be shown in
526
+ `chatgpt-shell-swap-model' ."
527
+ :type 'function
527
528
:group 'chatgpt-shell )
528
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 (model )
535
+ (member (map-elt model :version ) versions)))
536
+
537
+ (defun chatgpt-shell-ignore-model-versions (versions )
538
+ " A predicate intended for use with `chatgpt-shell-model-filter' to
539
+ allow model versions specified in
540
+ `chatgpt-shell-ignored-model-versions' ."
541
+ (lambda (model )
542
+ (not (member (map-elt model :version ) versions))))
543
+
529
544
(defun chatgpt-shell-swap-model ()
530
545
" Swap model version from `chatgpt-shell-models' ."
531
546
(interactive )
@@ -544,10 +559,7 @@ Downloaded from https://github.com/f/awesome-chatgpt-prompts."
544
559
(format (format " %% -%d s %% s" width)
545
560
(map-elt model :provider )
546
561
(map-elt model :version )))
547
- (seq-filter (lambda (model )
548
- (not (member (map-elt model :version )
549
- chatgpt-shell-ignored-model-versions)))
550
- chatgpt-shell-models)))
562
+ (seq-filter chatgpt-shell-model-filter chatgpt-shell-models)))
551
563
(selection (nth 1 (split-string (completing-read " Model version: "
552
564
models nil t )))))
553
565
(progn
0 commit comments