diff options
Diffstat (limited to 'krebs/2configs')
-rw-r--r-- | krebs/2configs/reaktor2.nix | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 032932013..8e2e5d9b8 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -55,7 +55,7 @@ let pattern = "!bing (.*)$"; activate = "match"; arguments = [1]; - timeoutSec = 42; + timeoutSec = 1337; command = { filename = pkgs.writeDash "bing" '' set -efu @@ -64,10 +64,21 @@ let pkgs.curl pkgs.jq ]} - printf '%s' "$*" | - curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' | - jq -r '.item.messages[1].text' | - echo "$_from: $(cat)" + response=$(printf '%s' "$*" | + curl -SsG http://bing-gpt.r/api/chat --data-urlencode 'prompt@-' + ) + 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 ''; }; }; |