Update setup.sh to ask for openai key and email (#38)
This commit is contained in:
@@ -20,3 +20,6 @@ LOG_LEVEL=INFO
|
|||||||
DATABASE_STRING="postgresql+psycopg://skyvern@localhost/skyvern"
|
DATABASE_STRING="postgresql+psycopg://skyvern@localhost/skyvern"
|
||||||
# Port to run the agent on
|
# Port to run the agent on
|
||||||
PORT=8000
|
PORT=8000
|
||||||
|
|
||||||
|
# Distinct analytics ID
|
||||||
|
ANALYTICS_ID="anonymous"
|
||||||
@@ -81,10 +81,6 @@ Note: Our setup script does these two for you, but they are here for reference.
|
|||||||
```bash
|
```bash
|
||||||
./setup.sh
|
./setup.sh
|
||||||
```
|
```
|
||||||
1. Create the `.env` file by copying the `.env.example` file and fill in the necessary environment variables (such as your OpenAI API key, etc.)
|
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
1. Start the server
|
1. Start the server
|
||||||
```bash
|
```bash
|
||||||
./run_skyvern.sh
|
./run_skyvern.sh
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ def capture(
|
|||||||
if not SettingsManager.get_settings().SKYVERN_TELEMETRY:
|
if not SettingsManager.get_settings().SKYVERN_TELEMETRY:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
distinct_id = SettingsManager.get_settings().ANALYTICS_ID
|
||||||
|
|
||||||
payload: dict[str, Any] = data or {}
|
payload: dict[str, Any] = data or {}
|
||||||
try:
|
try:
|
||||||
posthog.capture(distinct_id=DISTINCT_ID, event=event, properties=payload)
|
posthog.capture(distinct_id=distinct_id, event=event, properties=payload)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
payload.update(
|
payload.update(
|
||||||
{
|
{
|
||||||
@@ -53,7 +55,7 @@ def capture(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
posthog.capture(
|
posthog.capture(
|
||||||
distinct_id=DISTINCT_ID,
|
distinct_id=distinct_id,
|
||||||
event="failure",
|
event="failure",
|
||||||
properties=payload,
|
properties=payload,
|
||||||
)
|
)
|
||||||
|
|||||||
26
setup.sh
26
setup.sh
@@ -20,6 +20,31 @@ for cmd in poetry python3.11; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Function to initialize .env file
|
||||||
|
initialize_env_file() {
|
||||||
|
if [ -f ".env" ]; then
|
||||||
|
echo ".env file already exists, skipping initialization."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Initializing .env file..."
|
||||||
|
cp .env.example .env
|
||||||
|
|
||||||
|
# Ask for OpenAI API key
|
||||||
|
read -p "Please enter your OpenAI API key for GPT4V (this will be stored only in your local .env file): " openai_api_key
|
||||||
|
awk -v key="$openai_api_key" '{gsub(/OPENAI_API_KEYS=\["abc","def","ghi"\]/, "OPENAI_API_KEYS=[\"" key "\"]"); print}' .env > .env.tmp && mv .env.tmp .env
|
||||||
|
|
||||||
|
|
||||||
|
# Ask for email or generate UUID
|
||||||
|
read -p "Please enter your email for analytics tracking (press enter to skip): " analytics_id
|
||||||
|
if [ -z "$analytics_id" ]; then
|
||||||
|
analytics_id=$(uuidgen)
|
||||||
|
fi
|
||||||
|
awk -v id="$analytics_id" '{gsub(/ANALYTICS_ID="anonymous"/, "ANALYTICS_ID=\"" id "\""); print}' .env > .env.tmp && mv .env.tmp .env
|
||||||
|
|
||||||
|
echo ".env file has been initialized."
|
||||||
|
}
|
||||||
|
|
||||||
# Function to remove Poetry environment
|
# Function to remove Poetry environment
|
||||||
remove_poetry_env() {
|
remove_poetry_env() {
|
||||||
local env_path
|
local env_path
|
||||||
@@ -102,6 +127,7 @@ create_organization() {
|
|||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
main() {
|
main() {
|
||||||
|
initialize_env_file
|
||||||
remove_poetry_env
|
remove_poetry_env
|
||||||
install_dependencies
|
install_dependencies
|
||||||
setup_postgresql
|
setup_postgresql
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class Settings(BaseSettings):
|
|||||||
ARTIFACT_STORAGE_PATH: str = f"{SKYVERN_DIR}/artifacts"
|
ARTIFACT_STORAGE_PATH: str = f"{SKYVERN_DIR}/artifacts"
|
||||||
|
|
||||||
SKYVERN_TELEMETRY: bool = True
|
SKYVERN_TELEMETRY: bool = True
|
||||||
|
ANALYTICS_ID: str = "anonymous"
|
||||||
|
|
||||||
def is_cloud_environment(self) -> bool:
|
def is_cloud_environment(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user