fix(reason): Automatically convert :response plists to :CHAT messages
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
This commit is contained in:
@@ -66,7 +66,11 @@ The Reason stage is the cognitive engine of the OpenCortex. It bridges the gap b
|
|||||||
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
|
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
|
||||||
(if (stringp cleaned)
|
(if (stringp cleaned)
|
||||||
(let ((*read-eval* nil))
|
(let ((*read-eval* nil))
|
||||||
(handler-case (read-from-string cleaned)
|
(handler-case
|
||||||
|
(let ((parsed (read-from-string cleaned)))
|
||||||
|
(if (and (listp parsed) (getf parsed :response))
|
||||||
|
(list :TYPE :CHAT :TEXT (getf parsed :response))
|
||||||
|
parsed))
|
||||||
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
|
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
|
||||||
cleaned)))))
|
cleaned)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
@@ -44,7 +44,11 @@
|
|||||||
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
|
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
|
||||||
(if (stringp cleaned)
|
(if (stringp cleaned)
|
||||||
(let ((*read-eval* nil))
|
(let ((*read-eval* nil))
|
||||||
(handler-case (read-from-string cleaned)
|
(handler-case
|
||||||
|
(let ((parsed (read-from-string cleaned)))
|
||||||
|
(if (and (listp parsed) (getf parsed :response))
|
||||||
|
(list :TYPE :CHAT :TEXT (getf parsed :response))
|
||||||
|
parsed))
|
||||||
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
|
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
|
||||||
cleaned)))))
|
cleaned)))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user