mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
entrypoint for agpt.co
This commit is contained in:
parent
73e4cbf62a
commit
9c56216f04
5 changed files with 81 additions and 21 deletions
|
@ -2,26 +2,13 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
WD="${XDG_DATA_HOME:-$HOME/.local/share}/auto-gpt"
|
workspace_directory="${XDG_DOCUMENTS_DIR:-$HOME/Documents}/Auto-GPT"
|
||||||
|
|
||||||
# if the data|plugins directories don’t exist auto-gpt bails
|
# if the data|plugins directories don’t exist auto-gpt bails
|
||||||
mkdir -p "$WD"/data "$WD"/plugins
|
mkdir -p "$workspace_directory"/data "$workspace_directory"/plugins
|
||||||
|
|
||||||
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
|
||||||
cd "$WD"
|
cd "$workspace_directory"
|
||||||
|
|
||||||
if ! test -f .env; then
|
exec "$VIRTUAL_ENV"/bin/python -m autogpt --workspace-directory="$workspace_directory" "$@"
|
||||||
cp "$PREFIX"/share/env.template .env
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
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" "$@"
|
|
||||||
|
|
63
projects/agpt.co/entrypoint.sh
Normal file
63
projects/agpt.co/entrypoint.sh
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/usr/bin/env -S tea bash
|
||||||
|
|
||||||
|
#---
|
||||||
|
# dependencies:
|
||||||
|
# charm.sh/gum: '*'
|
||||||
|
#---
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
# attempt to get the key from the user’s shell rc files (if set)
|
||||||
|
if [ -z "$OPENAI_API_KEY" -a -n "$SHELL" ]; then
|
||||||
|
export OPENAI_API_KEY="$(env -i "$SHELL" -ic 'echo $OPENAI_API_KEY')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$OPENAI_API_KEY" ]; then
|
||||||
|
gum format <<EoMD
|
||||||
|
# OpenAI API key
|
||||||
|
|
||||||
|
Auto-GPT requires an OpenAI API.
|
||||||
|
|
||||||
|
> https://platform.openai.com/account/api-keys
|
||||||
|
|
||||||
|
GPT4 is recommended (but you gotta sign up for the
|
||||||
|
the [waitlist](https://openai.com/waitlist/gpt-4-api))
|
||||||
|
|
||||||
|
**this key will not be persisted by tea!**
|
||||||
|
EoMD
|
||||||
|
|
||||||
|
echo # spacer
|
||||||
|
|
||||||
|
export OPENAI_API_KEY="$(gum input --placeholder 'key pls')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
gum format <<EoMD
|
||||||
|
# gpt version?
|
||||||
|
|
||||||
|
which gpt version does your OpenAI API key support?
|
||||||
|
|
||||||
|
> sadly this must be specified explicitly, so we gotta ask
|
||||||
|
EoMD
|
||||||
|
|
||||||
|
echo #spacer
|
||||||
|
|
||||||
|
GPT="$(gum choose {GPT3,GPT4})"
|
||||||
|
|
||||||
|
docs="${XDG_DOCUMENTS_DIR:-$HOME/Documents}/Auto-GPT"
|
||||||
|
|
||||||
|
gum format <<EoMD
|
||||||
|
# fyi
|
||||||
|
|
||||||
|
* output goes here: \`$docs\`
|
||||||
|
|
||||||
|
# exe
|
||||||
|
|
||||||
|
running **Auto-GPT**…
|
||||||
|
EoMD
|
||||||
|
|
||||||
|
if test "$GPT" = GPT3
|
||||||
|
then
|
||||||
|
exec auto-gpt --gpt3only
|
||||||
|
else
|
||||||
|
exec auto-gpt
|
||||||
|
fi
|
|
@ -10,9 +10,12 @@ versions:
|
||||||
platforms:
|
platforms:
|
||||||
- darwin
|
- darwin
|
||||||
|
|
||||||
|
entrypoint: tea ./entrypoint.sh
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
python.org: ^3.10
|
python.org: ^3.10
|
||||||
redis.io: ^7
|
redis.io: ^7
|
||||||
|
tea.xyz: ^0
|
||||||
|
|
||||||
build:
|
build:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -31,13 +34,12 @@ build:
|
||||||
# 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
|
mkdir {{prefix}}/share
|
||||||
cp .env.template {{prefix}}/share/env.template
|
cp .env.template {{prefix}}/share/env.template
|
||||||
|
|
||||||
|
- cp props/entrypoint.sh {{prefix}}
|
||||||
|
|
||||||
provides:
|
provides:
|
||||||
- bin/auto-gpt
|
- bin/auto-gpt
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env -S tea bash
|
||||||
|
|
||||||
#---
|
#---
|
||||||
# dependencies:
|
# dependencies:
|
||||||
|
@ -7,6 +7,11 @@
|
||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
# attempt to get the key from the user’s shell rc files (if set)
|
||||||
|
if [ -z "$OPENAI_API_KEY" -a -n "$SHELL" ]; then
|
||||||
|
export OPENAI_API_KEY="$(env -i "$SHELL" -ic 'echo $OPENAI_API_KEY')"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$OPENAI_API_KEY"]; then
|
if [ -z "$OPENAI_API_KEY"]; then
|
||||||
gum format <<EoMD
|
gum format <<EoMD
|
||||||
# OpenAI API key required
|
# OpenAI API key required
|
||||||
|
|
|
@ -5,6 +5,9 @@ distributable:
|
||||||
versions:
|
versions:
|
||||||
- 2023.07.20
|
- 2023.07.20
|
||||||
|
|
||||||
|
display-name:
|
||||||
|
LLaMA.cpp
|
||||||
|
|
||||||
provides:
|
provides:
|
||||||
- bin/llama.cpp
|
- bin/llama.cpp
|
||||||
# NOTE! we do not “provide” convert.py. ∵ it’s too generic
|
# NOTE! we do not “provide” convert.py. ∵ it’s too generic
|
||||||
|
|
Loading…
Reference in a new issue