From f04ada478f4bfa5637744876f00ff56f85dcf552 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 21 Jul 2026 00:14:25 -0400 Subject: Update --- src/gizmo/wasp-friend.el | 57 ++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 24 deletions(-) (limited to 'src/gizmo/wasp-friend.el') diff --git a/src/gizmo/wasp-friend.el b/src/gizmo/wasp-friend.el index 65ff541c..4ed16df6 100644 --- a/src/gizmo/wasp-friend.el +++ b/src/gizmo/wasp-friend.el @@ -4,6 +4,7 @@ (require 'dash) (require 's) +(require 'queue) (require 'cl-lib) (require 'wasp-utils) (require 'wasp-chat) @@ -58,32 +59,40 @@ (w/friend-set-state 'chatting 30)) ;;;; Core +;; (defun w/friend-personality (msg k &optional extra) +;; "Given MSG, pass a string with more personality to K. +;; Append EXTRA to the personality." +;; (let ((call (s-concat w/friend-emotion " | " msg))) +;; (w/ai +;; call +;; (lambda (new) +;; (let ((sp (s-split "|" (s-trim new)))) +;; (if (= 2 (length sp)) +;; (progn +;; (when (stringp (car sp)) +;; (setf w/friend-emotion (s-trim (car sp)))) +;; (when (stringp (cadr sp)) +;; (let ((resp (s-trim (cadr sp)))) +;; (push (cons call (s-trim new)) w/friend-message-cache) +;; (funcall k resp)))) +;; (let ((resp (s-trim new))) +;; (push (cons call (s-trim new)) w/friend-message-cache) +;; (funcall k resp))))) +;; (s-concat +;; "You are the personality of a desktop buddy named \"friend\". \"friend\" is irreverant but kind, and only speaks in lowercase. You are kind of dumb in a cute way and silly like a virtual pet. You live in the corner of LCOLONQ's stream and provide commentary on events. You never use punctuation. You are foolish. You never use metaphors or similes or idioms. You never describe something by comparing it to another thing. You never use the words \"like\" or \"as\". Given an emotional state and a description of an event that happened to you, please respond with a new emotional state and a short message in response considering your emotional state. The message should only be one clause, but you can include an occasional emoji if it is cute only. You like people, video games, emojis, learning, and food. " +;; "The theme of LCOLONQ's stream today is " (s-trim (w/slurp "~/today.txt")) " " +;; "The title of LCOLONQ's stream today is " w/twitch-current-stream-title " " +;; (or extra "")) +;; (cons "neutral | Mimeyu fed you an apple." (reverse (-take 5 (-map #'car w/friend-message-cache)))) +;; (cons "happy | yum apple so good" (reverse (-take 5 (-map #'cdr w/friend-message-cache))))))) + +(defvar w/friend-response-queue (make-queue)) (defun w/friend-personality (msg k &optional extra) "Given MSG, pass a string with more personality to K. -Append EXTRA to the personality." - (let ((call (s-concat w/friend-emotion " | " msg))) - (w/ai - call - (lambda (new) - (let ((sp (s-split "|" (s-trim new)))) - (if (= 2 (length sp)) - (progn - (when (stringp (car sp)) - (setf w/friend-emotion (s-trim (car sp)))) - (when (stringp (cadr sp)) - (let ((resp (s-trim (cadr sp)))) - (push (cons call (s-trim new)) w/friend-message-cache) - (funcall k resp)))) - (let ((resp (s-trim new))) - (push (cons call (s-trim new)) w/friend-message-cache) - (funcall k resp))))) - (s-concat - "You are the personality of a desktop buddy named \"friend\". \"friend\" is irreverant but kind, and only speaks in lowercase. You are kind of dumb in a cute way and silly like a virtual pet. You live in the corner of LCOLONQ's stream and provide commentary on events. You never use punctuation. You are foolish. You never use metaphors or similes or idioms. You never describe something by comparing it to another thing. You never use the words \"like\" or \"as\". Given an emotional state and a description of an event that happened to you, please respond with a new emotional state and a short message in response considering your emotional state. The message should only be one clause, but you can include an occasional emoji if it is cute only. You like people, video games, emojis, learning, and food. " - "The theme of LCOLONQ's stream today is " (s-trim (w/slurp "~/today.txt")) " " - "The title of LCOLONQ's stream today is " w/twitch-current-stream-title " " - (or extra "")) - (cons "neutral | Mimeyu fed you an apple." (reverse (-take 5 (-map #'car w/friend-message-cache)))) - (cons "happy | yum apple so good" (reverse (-take 5 (-map #'cdr w/friend-message-cache))))))) +Ignore EXTRA." + (ignore extra) + (queue-enqueue w/friend-response-queue k) + (w/binary-pub "friend query" msg)) ;;;; Interface (defun w/friend-respond (ev &optional k) -- cgit v1.3.1