diff options
Diffstat (limited to 'src/gizmo/wasp-clone2.el')
| -rw-r--r-- | src/gizmo/wasp-clone2.el | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/gizmo/wasp-clone2.el b/src/gizmo/wasp-clone2.el index 3b76900f..02205e29 100644 --- a/src/gizmo/wasp-clone2.el +++ b/src/gizmo/wasp-clone2.el @@ -31,7 +31,9 @@ quality head thorax - abdomen) + abdomen + othermessages + ourmessages) (defun w/c2-take-random (n xs) "Select N random elements from XS." @@ -125,32 +127,37 @@ The clone has a BIOGRAPHY describing it." (lambda (old) (let* ( (idx (if (s-present? old) (string-to-number old) 0)) (key (format "c2_clone:%s:%s" (w/c2-clone-userid c) idx))) - (w/db-hmset key - "userid" (w/c2-clone-userid c) - "name" (w/c2-clone-name c) - "disposition" (w/c2-clone-disposition c) - "typingstyle" (w/c2-clone-typingstyle c) - "favoriteword" (w/c2-clone-favoriteword c) - "biography" (w/c2-clone-biography c) - "zodiac" (w/c2-clone-zodiac c) - "mbti" (w/c2-clone-mbti c) - "enneagram" (w/c2-clone-enneagram c) - "humor" (w/c2-clone-humor c) - "bloodtype" (w/c2-clone-bloodtype c) - "alignment" (w/c2-clone-alignment c) - "kikibouba" (w/c2-clone-kikibouba c) - "class" (w/c2-clone-class c) - "stack" (w/c2-clone-stack c) - "element" (w/c2-clone-element c) - "faction" (w/c2-clone-faction c) - "machiavellianism" (format "%s" (w/c2-clone-machiavellianism c)) - "narcissism" (format "%s" (w/c2-clone-narcissism c)) - "psychopathy" (format "%s" (w/c2-clone-psychopathy c)) - "quality" (w/c2-clone-quality c) - "head" (w/c2-clone-head c) - "thorax" (w/c2-clone-thorax c) - "abdomen" (w/c2-clone-abdomen c)) + (apply #'w/db-hmset key + (--mapcat + (list (format "%s" it) (format "%s" (w/struct-get c it))) + (w/struct-fields 'w/c2-clone))) (w/db-set countkey (format "%s" (+ idx 1)))))))) +(defun w/c2-get (userid idx k) + "Download the clone of USERID at IDX and pass it to K." + (w/db-hgetall (format "c2_clone:%s:%s" userid idx) + (lambda (data) + (funcall k + (apply #'w/make-c2-clone + (--mapcat + (list (intern (format ":%s" it)) (ht-get data (format "%s" it))) + (w/struct-fields 'w/c2-clone))))))) + +(defun w/c2-build-prompt (c) + "Build prompt for C." + (format + "Respond to the message given as if you are the Twitch chat user %s. Your typing style can be described as follows: %s. Please closely adhere to this typing style. Your general disposition is %s. %s." + (w/c2-clone-name c) + (w/c2-clone-typingstyle c) + (w/c2-clone-disposition c) + (w/c2-clone-biography c))) + +(defun w/c2-respond (c event k) + "Have C respond to EVENT and pass the response to K." + (w/ai event + (lambda (res) + (funcall k res)) + (w/c2-build-prompt c))) + (provide 'wasp-clone2) ;;; wasp-clone2.el ends here |
