From 1d35f4fe2ba9b9680da614b3c321e31f36e3c4d6 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 1 Nov 2024 09:38:42 +0100 Subject: [PATCH] webbuild-functions: replace Google hint search with ChatGPT --- webbuild/webbuild-functions | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/webbuild/webbuild-functions b/webbuild/webbuild-functions index f14c220..2cccf89 100644 --- a/webbuild/webbuild-functions +++ b/webbuild/webbuild-functions @@ -1,7 +1,7 @@ #!/bin/bash # # webbuild functions -# Copyright (c) 2012-2014 by Silvan Calarco +# Copyright (c) 2012-2024 by Silvan Calarco # . /etc/autodist/config @@ -273,10 +273,10 @@ function parse_build_output() { s|^\([\+#] .*\)|\1|; s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; - s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|\1\2|i; + s|\(.*\)\(^.*error[^0-9A-Za-z]*:[[:space:]]*.*\)|\1\2|i; s|^\(== =.*\)|\1|; s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|\1|; - s|[[:cntrl:]]||g;" | iconv -c | google_search $1 + s|[[:cntrl:]]||g;" | iconv -c | hint_search $1 } function parse_generic_output() { @@ -288,17 +288,18 @@ function parse_generic_output() { s|</font|\1|; s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; - s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|;" | google_search $1 + s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|;" | hint_search $1 } -function google_search() { +function hint_search() { while read line; do if [ "${line/\%SRCURL\%}" == "${line}" ]; then echo "$line" else local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|;s|\<|<|"` - local SEARCH_STRING_ENCODED=`cgi_encodevar "$1 $SEARCH_STRING"` - echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g" + local SEARCH_STRING_ENCODED=`cgi_encodevar "I get this error while building $1: $SEARCH_STRING"` + #echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://duckduckgo.gom/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g" + echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://chatgpt.com/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Query ChatGPT on this error\"|g" fi done }