Combine scripts into pipeline
First successful run from TG to ChatGPT back to TG!
This commit is contained in:
parent
672d66d6d9
commit
197ae8fe3c
|
@ -1,14 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $(basename $0) offset"
|
echo "Usage: $(basename $0) [offset]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! $# -eq 1 ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
OFFSET=$1
|
OFFSET=$1
|
||||||
|
|
||||||
if [ -z $TELEGRAM_BOT_TOKEN ]; then
|
if [ -z $TELEGRAM_BOT_TOKEN ]; then
|
||||||
|
@ -35,7 +30,10 @@ do
|
||||||
prompt="${text:8}"
|
prompt="${text:8}"
|
||||||
chat_id="$(echo "$R" | jq -e '.result[0].message.chat.id')"
|
chat_id="$(echo "$R" | jq -e '.result[0].message.chat.id')"
|
||||||
echo "Received prompt "$prompt" in chat $chat_id"
|
echo "Received prompt "$prompt" in chat $chat_id"
|
||||||
# TODO: send prompt to OpenAI and stream response back to chat
|
# TODO: update parent message id such that GPT knows context of previous requests
|
||||||
|
gpt2tg_prompt 9e76b8fc-e37e-4dcb-8d8d-d074e5480047 60b11ad6-25c1-4209-b6b4-84482dd774fa "$prompt" | \
|
||||||
|
gpt2tg_prompt_streamparser | \
|
||||||
|
gpt2tg_telegram_sender $chat_id
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
OFFSET=$(( update_id + 1))
|
OFFSET=$(( update_id + 1))
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
# exit if any command fails
|
# exit if any command fails
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $(basename $0) <chat_id> <file>"
|
echo "Usage: $(basename $0) <chat_id>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! $# -eq 2 ]; then
|
if [ ! $# -eq 1 ]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue