Add common gpt support. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit c26b5809f33306b49c9a4303ab9f66ada4d4d71c | |
parent 36b1b73d43ffbd3aef31c68aa04756846844c33b | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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… | |
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 com… | |
;; | |
"${ircuser}, please scare me.") | |
- annna-say -s "${server}" -c "${channel}" "$(halloween)" | |
+ { | |
+ annna-say -s "${server}" -c "${channel}" "$(halloween)" | |
+ } & | |
;; | |
"${ircuser}, how drunk is "*) | |
{ | |
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 '"' | |
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 talki… | |
- | head -n 1 \ | |
- | tr -d '"' | |
+gpt "You are going to scare ${hdo} the user on Halloween in the style of talki… | |