Add common gpt support. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit c26b5809f33306b49c9a4303ab9f66ada4d4d71c DIR parent 36b1b73d43ffbd3aef31c68aa04756846844c33b HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Fri, 1 Nov 2024 18:37:44 +0100 Add common gpt support. Diffstat: M annna-message-common | 10 +++++++++- M gpt | 4 +++- M halloween | 4 +--- 3 files changed, 13 insertions(+), 5 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -661,6 +661,12 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you." fi ;; +"${ircuser}, gpt "*) + prompt="$(printf "%s\n" "${text}" | cut -c 12- | sed 's,\t, ,g')" + { + annna-say -s "${server}" -c "${channel}" "$(gpt "${prompt}")" + } & + ;; "${ircuser}, wolfram is "*) word="$(printf "%s\n" "${text}" | cut -c 19- | sed 's,\t, ,g')" case "$word" in @@ -717,7 +723,9 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, Your word is my command, Power to satan!" ;; "${ircuser}, please scare me.") - annna-say -s "${server}" -c "${channel}" "$(halloween)" + { + annna-say -s "${server}" -c "${channel}" "$(halloween)" + } & ;; "${ircuser}, how drunk is "*) { DIR diff --git a/gpt b/gpt @@ -12,5 +12,7 @@ cd $ggmlbase $ggmlbin -m $ggmlmodel -n $ggmlntokens \ "$1 Begin all lines with OUTPUT:." 2>/dev/null \ | grep "^OUTPUT:" \ - | cut -d' ' -f 2- + | cut -d' ' -f 2- \ + | head -n 1 \ + | tr -d '"' DIR diff --git a/halloween b/halloween @@ -6,7 +6,5 @@ hchar="$(shuf -n 1 $halloweenbase/character.txt)" hmood="$(shuf -n 1 $halloweenbase/mood.txt)" hdo="$(printf "trick\ntreat\n" | shuf -n 1)" -gpt "You are going to scare ${hdo} the user on Halloween in the style of talking ${hmood} ${hchar}. Please be really scary." \ - | head -n 1 \ - | tr -d '"' +gpt "You are going to scare ${hdo} the user on Halloween in the style of talking ${hmood} ${hchar}. Please be really scary."