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 53975bb..6dfc4fd 100644 Binary files a/kagi.info and b/kagi.info differ