diff --git a/.gitignore b/.gitignore index 82f0a25..92324df 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Cargo.lock **/*.rs.bk .vscode/ Notes.md +openai.sk diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..c399127 --- /dev/null +++ b/start.sh @@ -0,0 +1,19 @@ +#!/bin/zsh + +if ! [ -f "target/release/ai_chat" ]; then + if ! cargo build --release; then + echo "Could not build binary! Press any key to exit..." >&2 + read + exit + fi +fi + +if ! [ -f "openai.sk" ]; then + echo -n "Enter OpenAI secret key: " + read -s OPENAI_SK +else + OPENAI_SK="$(cat openai.sk)" +fi + +export OPENAI_SK +target/release/ai_chat