@@ -521,25 +521,29 @@ 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 ( lambda ( _model ) t )
525
- " A predicate used to determine which models should be shown in
526
- `chatgpt-shell-swap-model' ."
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
527
:type 'function
528
528
:group 'chatgpt-shell )
529
529
530
530
(defun chatgpt-shell-allow-model-versions (versions )
531
531
" Return a predicate that accepts models only if their version
532
532
appears in versions. This is intended for use with
533
533
`chatgpt-shell-model-filter' ."
534
- (lambda (model )
535
- (member (map-elt model :version ) versions)))
534
+ (lambda (models )
535
+ (seq-filter (lambda (model )
536
+ (member (map-elt model :version ) versions))
537
+ models)))
536
538
537
539
(defun chatgpt-shell-ignore-model-versions (versions )
538
540
" A predicate intended for use with `chatgpt-shell-model-filter' to
539
541
allow model versions specified in
540
542
`chatgpt-shell-ignored-model-versions' ."
541
- (lambda (model )
542
- (not (member (map-elt model :version ) versions))))
543
+ (lambda (models )
544
+ (seq-filter (lambda (model )
545
+ (not (member (map-elt model :version ) versions)))
546
+ models)))
543
547
544
548
(defun chatgpt-shell-swap-model ()
545
549
" Swap model version from `chatgpt-shell-models' ."
@@ -559,7 +563,9 @@ allow model versions specified in
559
563
(format (format " %% -%d s %% s" width)
560
564
(map-elt model :provider )
561
565
(map-elt model :version )))
562
- (seq-filter chatgpt-shell-model-filter chatgpt-shell-models)))
566
+ (if chatgpt-shell-model-filter
567
+ (funcall chatgpt-shell-model-filter chatgpt-shell-models)
568
+ chatgpt-shell-models)))
563
569
(selection (nth 1 (split-string (completing-read " Model version: "
564
570
models nil t )))))
565
571
(progn
0 commit comments