Add gpt coder mode. - 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 4afb26473519f04d6b461081e9025c3a2c535de0
DIR parent dd3a6e4312ae9694f13ee1a0fcad4ec882698b1c
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Mon, 23 Mar 2026 10:58:06 +0100
Add gpt coder mode.
Diffstat:
M annna-message-common | 21 +++++++++++++--------
A gpt-coder | 30 ++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 8 deletions(-)
---
DIR diff --git a/annna-message-common b/annna-message-common
@@ -309,7 +309,7 @@ case "${IRC_PRIVMSG_TEXT}" in
then
if [ $nocuri -eq 0 ];
then
- [ -z "${curi}" ] && curi="$(html2text < "${tmpf}" | /br/bin/bitreich-paste)"
+ [ -z "${curi}" ] && curi="$(html2text < "${tmpf}" | bitreich-paste)"
outputstr="${outputstr} content: ${curi} ;"
fi
@@ -515,7 +515,7 @@ case "${IRC_PRIVMSG_TEXT}" in
word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 15-)"
tmpf=$(mktemp)
if cowsayasaservice ${word} > ${tmpf}; then
- curi="$(/br/bin/bitreich-paste < ${tmpf})"
+ curi="$(bitreich-paste < ${tmpf})"
annna-say "${IRC_CMD_USER}: the cow said... ${curi}"
fi
rm ${tmpf} 2>/dev/null;;
@@ -556,11 +556,11 @@ case "${IRC_PRIVMSG_TEXT}" in
nuri=$(darwin)
tmpf=$(mktemp)
fetch-uri "${nuri}" > "${tmpf}"
- curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
+ curi="$(9 htmlfmt < "${tmpf}" | bitreich-paste)"
annna-say "${IRC_CMD_USER}, do not feel stupid, others are more stupid: ${curi}"
rm ${tmpf} 2>/dev/null;;
"${IRC_USER}, I feel down"*)
- postmortem="$(post-mortem | /br/bin/bitreich-paste)"
+ postmortem="$(post-mortem | bitreich-paste)"
annna-say "${IRC_CMD_USER}, do not feel bad, others had worse days: ${postmortem}";;
"${IRC_USER}, I feel perl"*)
perlfeelings="$(perl-feelings)"
@@ -683,6 +683,11 @@ case "${IRC_PRIVMSG_TEXT}" in
{
annna-say "$(gpt "${prompt}. Please answer short and precise.")"
} & ;;
+"${IRC_USER}, code "*)
+ prompt="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 12- | sed 's,\t, ,g')"
+ {
+ annna-say "$(gpt-coder "${prompt}. Only output the code." | bitreich-paste)"
+ } & ;;
"${IRC_USER}, wolfram is "*)
word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 19- | sed 's,\t, ,g')"
case "$word" in
@@ -713,7 +718,7 @@ case "${IRC_PRIVMSG_TEXT}" in
wcl="$(printf "%s" "${dresult}" | wc -l)"
if [ $wcl -gt 1 ];
then
- puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-paste)"
+ puri="$(printf "%s" "${dresult}" | bitreich-paste)"
else
puri="${dresult}"
fi
@@ -986,10 +991,10 @@ $'\001'"ACTION snouts ${IRC_USER}"$'\001')
annna-say "${IRC_CMD_USER}, ${meows}";;
"${IRC_USER}, how many memes do you know?") annna-say "I know $(hashtagcount) memes: gophers://bitreich.org/1/meme/count";;
"${IRC_USER}, please show me your memes"*)
- puri="$(printf "%s" "$(hashtags)" | /br/bin/bitreich-paste)"
+ puri="$(printf "%s" "$(hashtags)" | bitreich-paste)"
annna-say "Here are my memes: ${puri}";;
"${IRC_USER}, please show me the victims"*)
- puri="$(printf "%s" "$(hashtags)" | grep victim | /br/bin/bitreich-paste)"
+ puri="$(printf "%s" "$(hashtags)" | grep victim | bitreich-paste)"
annna-say "Here are the victims: ${puri}";;
"${IRC_USER}, please distro-hop with me"*)
ndistro="$(curl -s 'https://distrowatch.com/dwres.php?resource=popularity' \
@@ -1179,7 +1184,7 @@ $'\001'"ACTION snouts ${IRC_USER}"$'\001')
"${IRC_USER}, please mine "*" bitreichcoin"*)
q="${IRC_PRIVMSG_TEXT#* please mine }"
q="${q% bitreichcoin*}"
- curi="$(bitreichcoin "$q" | /br/bin/bitreich-paste)"
+ curi="$(bitreichcoin "$q" | bitreich-paste)"
annna-say "${IRC_CMD_USER}, please don't spend it all at once: ${curi}";;
"${IRC_USER}, please hug me.") annna-say "$(echo -e '\001')ACTION hugs ${IRC_CMD_USER}$(echo -e '\001')";;
"${IRC_USER}, please hug "*" for me.")
DIR diff --git a/gpt-coder b/gpt-coder
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+export PATH="$HOME/bin:$PATH"
+
+function remote_llama() {
+ prompt="$1"
+ ggmlmodel="qwen3-coder:30b"
+ if [ -z "$prompt" ];
+ then
+ cat \
+ | ollama-gpu \
+ ollama run \
+ --hidethinking \
+ --nowordwrap \
+ "${ggmlmodel}"
+ else
+ printf "%s\n" "${prompt}" \
+ | ollama-gpu \
+ ollama run \
+ --hidethinking \
+ --nowordwrap \
+ "${ggmlmodel}"
+ fi
+}
+
+prompt="$1"
+response="$(remote_llama "${prompt}")"
+[ -z "${response}" ] && response="GPU server error."
+[ -n "${response}" ] && printf "%s\n" "${response}"
+