From ad6cd1cf6c78895cfaf31c2dd677c65ec48007e9 Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Sat, 20 Jul 2024 21:32:58 +0200 Subject: [PATCH] Show welcome message when starting the FastGPT shell --- README.org | 9 ++++++++- kagi.el | 24 +++++++++++++++++++++++- kagi.info | Bin 17707 -> 16884 bytes 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index e1bb3c6..a2ff066 100644 --- a/README.org +++ b/README.org @@ -120,6 +120,7 @@ In order to use the Kagi API, follow these steps: |----------------------------------------+---------------------------------------------------------| | kagi-api-token | The Kagi API token. | | kagi-fastgpt-api-url | The Kagi FastGPT API entry point. | +| kagi-fastgpt-welcome-function | A function returning a welcome string. | | kagi-summarizer-api-url | The Kagi Summarizer API entry point. | | kagi-summarizer-cache | Determines whether the Summarizer should cache results. | | kagi-summarizer-default-language | Default target language of the summary. | @@ -261,6 +262,12 @@ Needless to say, the tests won't make actual API calls. Otherwise it wouldn't be The full changelog can be found in README.org. +** 0.6pre + +*** New + +- Show a welcome message when starting the FastGPT shell (=kagi-fastgpt-shell=). This can be customized with =kagi-fastgpt-welcome-function=, a variable with a function that returns a welcome string. + ** 0.5 *** Breaking changes @@ -289,7 +296,7 @@ The full changelog can be found in README.org. - Fixed language code for Czech summaries. - Handle error responses when calling the FastGPT API. -** 0.4 +** 0.4 :noexport: *** Breaking changes diff --git a/kagi.el b/kagi.el index e97830f..e030fce 100644 --- a/kagi.el +++ b/kagi.el @@ -400,6 +400,26 @@ retrieving a result from Lisp code." (text-mode) (display-buffer buffer-name)))) +(defun kagi--fastgpt-welcome-message (_config) + "Return a string to be shown at the start of a new FastGPT shell. + +This can be overridden by setting a different function in +`kagi-fastgpt-welcome-function'." + (format "Welcome to Kagi FastGPT. + +- Enter `help' for more info. +- Press `C-c RET' to open a URL. + +")) + +(defcustom kagi-fastgpt-welcome-function #'kagi--fastgpt-welcome-message + "A function returning a welcome string. + +The function takes one argument: a shell-maker configuration +object (created with `make-shell-maker-config')." + :type 'function + :group 'kagi) + (defvar kagi-fastgpt--config (make-shell-maker-config :name "FastGPT" @@ -419,7 +439,9 @@ retrieving a result from Lisp code." (defun kagi-fastgpt-shell () "Start an FastGPT shell." (interactive) - (shell-maker-start kagi-fastgpt--config)) + (shell-maker-start kagi-fastgpt--config + nil + kagi-fastgpt-welcome-function)) (defun kagi--get-text-for-prompt () "Return the text to insert in a prompt. diff --git a/kagi.info b/kagi.info index 53975bb05054b3c43258cc03854c1c585a9ce02d..6dfc4fd4023788a8b0013b5e2017018e4ebf3883 100644 GIT binary patch delta 937 zcmZ`%zi-n(6jl;iA&a7_5~QjEJ<$rKRby-?XFH)$6(uc1s3o*vV{wv;ZQ-*k&^E~nMS>o-3WL9=P zQbI!b@!UERcnluqIZoh1j00?s3`-@}O5R`}lMBfb$G+ptyVU)3y{q|DcWG`&thUo5 zxo+QXQ`520xmQ6`)FZU-*`}={4aF(Qryc;KyGu)%gQh_s*s@UD&}^Mpj*i-zjaq;@ zeY=B98|`mbYP;LKEhd zm*C3N_g90l20;8OSaE@8pEHIIheDX`oD;qEk= z$Tx^(agkbC_Gxx8SmP0D8m2!X-tPO<>6uSR2MtYXj6+Y4UOd)xGxtCFPmf-1z!(F~ zGqsil{UHu_l3t6=4i9H*sY)kgx>NU*=YqgM2|L#?kjc090wzkq<}Z23Rc0>``?&C8|aC zw7Qa#A?MXfdL}4}Qh~j%W>S(MvCq}jmMSQ5jT#xik-0r$Qy4@L3o$-D3_#Vq8l%y+ z1F<0Fag4wvfG_6dNdyMBkQdl-EnNi@%ae)_8EOTXf+q}i%tPV>TUm_hqJ7dO97rBB<{vR!3E?AUP}RCZIkMM(4q)%Ma;C-FEjab_&f zIB8B^i5u6slv~RUaY5QM65J4+xN(5X{sBlx9JmzqjelfCxDm;b-+MFP``-87^IxCW zzWJi|?WZdjoGvt-hOq<9hK;XwL(NwSv&(O+U)_Pbl%<$T(^zJtUR=L=uIbbP zA)iXkQN3)hspp;dYF+hf=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