reaktor2 bing: more timeout, footnotes
This commit is contained in:
parent
d8ca1ceb9d
commit
01c1fffe0a
@ -55,7 +55,7 @@ let
|
|||||||
pattern = "!bing (.*)$";
|
pattern = "!bing (.*)$";
|
||||||
activate = "match";
|
activate = "match";
|
||||||
arguments = [1];
|
arguments = [1];
|
||||||
timeoutSec = 42;
|
timeoutSec = 1337;
|
||||||
command = {
|
command = {
|
||||||
filename = pkgs.writeDash "bing" ''
|
filename = pkgs.writeDash "bing" ''
|
||||||
set -efu
|
set -efu
|
||||||
@ -64,10 +64,21 @@ let
|
|||||||
pkgs.curl
|
pkgs.curl
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
]}
|
]}
|
||||||
printf '%s' "$*" |
|
response=$(printf '%s' "$*" |
|
||||||
curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' |
|
curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-'
|
||||||
jq -r '.item.messages[1].text' |
|
)
|
||||||
echo "$_from: $(cat)"
|
if [ "$?" -ne 0 ]; then
|
||||||
|
printf '%s' "$response" |
|
||||||
|
curl -Ss http://p.r --data-binary @- |
|
||||||
|
tail -1
|
||||||
|
else
|
||||||
|
printf '%s' "$response" |
|
||||||
|
jq -r '.item.messages[1].text' |
|
||||||
|
echo "$_from: $(cat)"
|
||||||
|
|
||||||
|
printf '%s' "$response" |
|
||||||
|
jq -r '[.item.messages[1].sourceAttributions[].seeMoreUrl] | to_entries[] | "[\(.key)]: \(.value)"'
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user