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)))
|
||||
(if (stringp cleaned)
|
||||
(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))))))
|
||||
cleaned)))))
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user