branch: elpa/gptel
commit 07b105c191fd598f475c9317752659f364bbb0de
Author: Andrea Arcangeli <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>

    gptel-context: Maintain context order in context buffer
    
    gptel-context.el (gptel-context-confirm): When confirming changes
    in the gptel context buffer, retain the context order instead of
    reversing it.
    
    `gptel-context--collect' returns a list in an order that's the
    reverse of `gptel-context' -- this change was made in d8f3f67c to
    ensure that new context is added at the end in the request payload
    to maximize KV-cache reuse.  This commit adjusts the
    context-buffer behavior to account for this change.
---
 gptel-context.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gptel-context.el b/gptel-context.el
index 36f0f220473..08deee69a02 100644
--- a/gptel-context.el
+++ b/gptel-context.el
@@ -840,7 +840,7 @@ If non-nil, indicates backward movement.")
   ;; FIXME(context): This should run in the buffer from which the context
   ;; inspection buffer was visited.
   ;; Update contexts and revert buffer (#482)
-  (setq gptel-context (gptel-context--collect))
+  (setq gptel-context (nreverse (gptel-context--collect)))
   (gptel-context-quit))
 
 (provide 'gptel-context)

Reply via email to