Fix cookined recommendations and at gpt-chef 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 7cf0a6a822fd3596465bc773c3cfedd000553371 DIR parent 6ba5ed6348f1162447c2e2d7aa2e76476708394a HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 6 Apr 2025 16:16:23 +0200 Fix cookined recommendations and at gpt-chef support. Diffstat: M annna-message-common | 18 +++++++++++++++--- M based.recipe | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -736,10 +736,16 @@ case "${text}" in results="$(fridge-recipe-search "${ingredients}")" if [ -n "${results}" ]; then - puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,/0/,/1/,')" + puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,0p,1p,')" annna-say -s "${server}" -c "${channel}" "${user}, here are some recipes: ${puri}" else - annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you." + gptchefrecipe="$(gpt-chef "${ingredients}")" + if [ -n "${gptchefrecipe}" ]; + then + annna-say -s "${server}" -c "${channel}" "${user}, there was no ready-made recipe, so maybe this is an idea: ${gptchefrecipe}" + else + annna-say -s "${server}" -c "${channel}" "${user}, I could not find any recipes for you." + fi fi ;; "${ircuser}, gpt "*) @@ -1084,7 +1090,13 @@ case "${text}" in then annna-say -s "${server}" -c "${channel}" "${user}, ${recipestr}" else - annna-say -s "${server}" -c "${channel}" "${user}, I have no recommendation for you today." + gptchefrecipe="$(gpt-chef "something random")" + if [ -n "${gptchefrecipe}" ]; + then + annna-say -s "${server}" -c "${channel}" "${user}, ${gptchefrecipe}" + else + annna-say -s "${server}" -c "${channel}" "${user}, I have no recommendation for you today." + fi fi ;; # parazyd.org is unmaintained DIR diff --git a/based.recipe b/based.recipe @@ -3,8 +3,8 @@ baseuri="https://based.cooking/" hurl "${baseuri}" \ - | grep "^<li><a href=\"[a-zA-Z0-9-]*.html\"" \ - | sed 's,.*a href="\([a-zA-Z0-9-]*.html\)">\(.*\)</a></li>$,\1\t\2,g' \ + | grep "^<li .*><a href=\".*\"" \ + | sed 's,.*a href="\(.*\)">\(.*\)</a></li>$,\1\t\2,g' \ | shuf -n 1 \ | while read -r htmluri recipename; do