mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
ensure auto-gpt writes all files where we want
This commit is contained in:
parent
5256d97704
commit
13bc4cc0d9
2 changed files with 27 additions and 10 deletions
|
@ -1,18 +1,27 @@
|
||||||
#!/usr/bin/python
|
#!/bin/sh
|
||||||
import os
|
|
||||||
|
|
||||||
# Get the XDG base directory path
|
set -e
|
||||||
xdg_base_dir = os.environ.get('XDG_DATA_HOME') or os.path.expanduser(os.path.join('~', '.local', 'share'))
|
|
||||||
shared_data_dir = os.path.join(xdg_base_dir, 'agpt.co')
|
WD="${XDG_DATA_HOME:-$HOME/.local/share}/auto-gpt"
|
||||||
|
|
||||||
# if the data directory doesn’t exist auto-gpt bails
|
# if the data directory doesn’t exist auto-gpt bails
|
||||||
os.makedirs(os.path.join(shared_data_dir, "data"), exist_ok=True)
|
mkdir -p "$WD"/data
|
||||||
|
|
||||||
|
PREFIX="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
|
||||||
# change to this directory because auto-gpt assumes it is running
|
# change to this directory because auto-gpt assumes it is running
|
||||||
# in its own checkout and is not suitable to be run from anywhere
|
# in its own checkout and is not suitable to be run from anywhere
|
||||||
os.chdir(shared_data_dir)
|
cd "$WD"
|
||||||
|
|
||||||
print(f"tea: OUTPUT WILL BE HERE: {shared_data_dir}")
|
if ! test -f .env; then
|
||||||
|
cp "$PREFIX"/share/env.template .env
|
||||||
|
fi
|
||||||
|
|
||||||
import autogpt.cli
|
|
||||||
autogpt.cli.main()
|
echo "tea: auto-gpt output goes here: $WD"
|
||||||
|
echo "tea: auto-gpt config is here: $WD/.env"
|
||||||
|
echo "tea: You need to set \`OPENAI_API_KEY\` before running auto-gpt or add it to the above config"
|
||||||
|
echo "tea: unless you have access to GPT4 you need to run \`--gpt3only\`"
|
||||||
|
echo
|
||||||
|
|
||||||
|
exec "$VIRTUAL_ENV"/bin/python -m autogpt --workspace-directory="$WD" "$@"
|
||||||
|
|
|
@ -25,9 +25,17 @@ build:
|
||||||
${{prefix}}/venv/lib/python{{deps.python.org.version.marketing}}/site-packages
|
${{prefix}}/venv/lib/python{{deps.python.org.version.marketing}}/site-packages
|
||||||
|
|
||||||
- python-venv.py {{prefix}}/bin/auto-gpt --requirements-txt
|
- python-venv.py {{prefix}}/bin/auto-gpt --requirements-txt
|
||||||
|
|
||||||
# still pretty new and thus provides no executable, so we made one
|
# still pretty new and thus provides no executable, so we made one
|
||||||
- cp props/auto-gpt {{prefix}}/venv/bin
|
- cp props/auto-gpt {{prefix}}/venv/bin
|
||||||
|
|
||||||
|
# this is broken and means any environment variable that is set is ignored
|
||||||
|
- sed -i.bak s/^OPENAI_API_KEY=your-openai-api-key$//g .env.template
|
||||||
|
|
||||||
|
- |
|
||||||
|
mkdir {{prefix}}/share
|
||||||
|
cp .env.template {{prefix}}/share/env.template
|
||||||
|
|
||||||
provides:
|
provides:
|
||||||
- bin/auto-gpt
|
- bin/auto-gpt
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue