branch: externals/ellama
commit 235f41be0c95118568837cdd5b344725239119e8
Author: zhijia.zhang <[email protected]>
Commit: zhijia.zhang <[email protected]>

    :recycle: Refactor ellama.el code for improved response handling.
---
 ellama.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index d3d8e4c075..6651fd85f8 100644
--- a/ellama.el
+++ b/ellama.el
@@ -108,6 +108,7 @@ Filter PROC output STRING."
        (condition-case nil
            (progn
              (mapc (lambda (s)
+                      ;; (message s)
                      (when-let ((data
                                  (json-parse-string s :object-type 'plist)))
                        (when-let ((context (plist-get data :context)))
@@ -115,6 +116,7 @@ Filter PROC output STRING."
                          (setq ellama--extract nil)
                          (setq ellama--extraction-state 'before))
                        (when-let ((response (plist-get data :response)))
+                          (goto-char (process-mark proc))
                          (if ellama--extract
                              (progn
                                (setq ellama--line (concat ellama--line 
response))
@@ -129,7 +131,9 @@ Filter PROC output STRING."
                                       (insert ellama--line)))
                                    (_ nil))
                                  (setq ellama--line nil)))
-                           (insert response)))))
+                            (insert response)
+                            (set-marker (process-mark proc) (point))
+                            ))))
                    (split-string string "\n" t))
              (setq ellama--unprocessed-data nil)
              (set-marker (process-mark proc) (point))
@@ -219,7 +223,7 @@ default. Default value is `ellama-template'."
         :name "ellama"
         :command (list
                   ellama-curl-executable
-                  "-X" "POST" ellama-url "-d"
+                   "-s" "-X" "POST" ellama-url "-d"
                   (json-encode-plist ellama--request))
         :filter 'ellama--filter
         :sentinel sentinel)))))

Reply via email to