⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24# ./llmchat.sh c387212da15e4747e15e1c8700f85aeeef6472ffc3f147f9fe6357af1e601b86 if [ ${#1} -ne 64 ] then echo "chat id required ${#1}" exit fi req='["REQ","q",{"kinds":[42],"limit":1,"#e":["'$1'"]}]' #relay="wss://relay1.nostrchat.io" relay="wss://relay2.denostr.com" # https://denny.denostr.com event=$(echo "$req" | websocat $relay | head -n 1 | jq -r .[2]) ref=$(echo "$event" | jq -r .id) temperature=$(echo "scale=1;$RANDOM/10000" | bc) content=$(echo $event | jq -r .content) echo "content $content" echo "ref $ref" echo "temperature $temperature" prompt=$(echo '{"model": "tinydolphin:1.1b-v2.8-q5_K_M", "stream": false, "options": {"temperature": '"$temperature"'}}' | jq --arg p "$content" '.prompt = $p') bot_reply=$(curl http://localhost:11434/api/generate -d "$prompt" | jq -r .response) nostr-tool -r $relay custom-event -t "e|$1|wss://relay1.nostrchat.io/|root" -k 42 -c "$bot_reply"
Warning LINK You are about to visit a link which has been flagged with the above content warnings. Do you wish to continue? Continue Cancel