[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 66d2bafad6 132/273: gptel-ollama: Fix buffer parsing
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 66d2bafad6 132/273: gptel-ollama: Fix buffer parsing |
Date: |
Wed, 1 May 2024 10:02:13 -0400 (EDT) |
branch: elpa/gptel
commit 66d2bafad6a6f51d4e4e015db7e66c5eae319a17
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
gptel-ollama: Fix buffer parsing
* gptel-ollama.el (gptel--parse-buffer): The prompt construction
for Ollama fails when starting from (point-min). Fix by checking
if a valid text-property match object is found in the parsing.
---
gptel-ollama.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/gptel-ollama.el b/gptel-ollama.el
index dac5e8c0cb..d3afd46d2b 100644
--- a/gptel-ollama.el
+++ b/gptel-ollama.el
@@ -76,20 +76,23 @@ Ollama models.")
prompts-plist))
(cl-defmethod gptel--parse-buffer ((_backend gptel-ollama) &optional
_max-entries)
- (let ((prompts) (prop))
- (setq prop (text-property-search-backward
- 'gptel 'response
- (when (get-char-property (max (point-min) (1- (point)))
- 'gptel)
- t)))
- (if (prop-match-value prop)
+ (let ((prompts)
+ (prop (text-property-search-backward
+ 'gptel 'response
+ (when (get-char-property (max (point-min) (1- (point)))
+ 'gptel)
+ t))))
+ (if (and (prop-match-p prop)
+ (prop-match-value prop))
(user-error "No user prompt found!")
(setq prompts (list
:system gptel--system-message
:prompt
- (string-trim (buffer-substring-no-properties
(prop-match-beginning prop)
-
(prop-match-end prop))
- "[*# \t\n\r]+"))))))
+ (if (prop-match-p prop)
+ (string-trim (buffer-substring-no-properties
(prop-match-beginning prop)
+
(prop-match-end prop))
+ "[*# \t\n\r]+")
+ ""))))))
;;;###autoload
(cl-defun gptel-make-ollama
- [nongnu] elpa/gptel c11e53061c 078/273: gptel-transient: New gptel-menu transient options, (continued)
- [nongnu] elpa/gptel c11e53061c 078/273: gptel-transient: New gptel-menu transient options, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 422eba8048 087/273: gptel-curl: Run post-response-hook in gptel buffer, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 42132d3662 093/273: README: tweak description of package, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 07f27be696 101/273: gptel-transient: UI tweak for custom prompt, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e6df1a5e33 098/273: gptel: Use :require for auth-source-search (#78), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 9c4af204a3 102/273: gptel-transient: Add crowdsourced prompts, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e6a1468bd2 094/273: gptel: Make API host configurable (#67), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c20fba8247 107/273: gptel-curl: Only convert to Org in Org buffers, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel ed0bfc9ed1 116/273: gptel: Offer suggestion when setting gptel-topic, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel cee5893d79 130/273: gptel: Appease the byte compiler., ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 66d2bafad6 132/273: gptel-ollama: Fix buffer parsing,
ELPA Syncer <=
- [nongnu] elpa/gptel e105a52541 142/273: gptel: Update docstrings for prompt/response prefixes, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c9d362a3e9 153/273: gptel-transient: Set model when redirecting to new buffer, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 9126bed43f 159/273: gptel: Set window when doing auto-scrolling, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 85bd47cb4c 164/273: README: Add support for llama.cpp, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 4d01dddf7d 155/273: gptel, gptel-curl: Address checkdoc warnings, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e5357383ce 166/273: gptel: Appease byte-compiler and linter, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d5b10c3d6d 169/273: gptel: gptel-model can be an arbitrary string, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d6ef79f621 177/273: gptel-transient: Show descriptions of directives, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 0690c8b6a9 161/273: gptel-transient: Exit transient when writing directive, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 149261ee79 211/273: gptel-transient: Avoid clashes with the custom directive key (#219), ELPA Syncer, 2024/05/01