23 lines
667 B
Bash
Executable File
23 lines
667 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
cd "$SCRIPTPATH" || exit
|
|
|
|
if [[ ! -x $(command -v aichat) ]]; then
|
|
echo "aichat is not installed."
|
|
if [[ $(docker images -q aichat-build 2>/dev/null) ]]; then
|
|
container_id=$(docker create "aichat")
|
|
docker cp "${container_id}:/usr/local/cargo/bin/aichat" "./tools/"
|
|
docker rm "${container_id}"
|
|
else
|
|
cargo install --git https://github.com/sigoden/aichat
|
|
fi
|
|
fi
|
|
|
|
source .env
|
|
mkdir -p ~/.config/aichat/
|
|
cat src/aichat/config.yaml | sed "s/__LLM_API_KEY__/${LLM_API_KEY}/" >~/.config/aichat/config.yaml
|
|
mkdir -p ~/.config/aichat/roles
|
|
cp src/aichat/roles/* ~/.config/aichat/roles/
|