mirror of
https://github.com/the-jordan-lab/docs.git
synced 2025-05-09 21:32:38 +00:00
Add OpenAI API key config and environment setup guide
This commit is contained in:
parent
8201dddc40
commit
ea51502f93
@ -9,6 +9,10 @@
|
||||
"jupyter.alwaysTrustNotebooks": true,
|
||||
"workbench.startupEditor": "none"
|
||||
},
|
||||
"runArgs": ["--env-file", "${localWorkspaceFolder}/.env"],
|
||||
"containerEnv": {
|
||||
"OPENAI_API_KEY": "${localEnv:OPENAI_API_KEY}"
|
||||
},
|
||||
"postCreateCommand": "pip install -r requirements.txt && chmod +x .devcontainer/jupyter-setup.sh && .devcontainer/jupyter-setup.sh && chmod +x .devcontainer/windsurf-auth-setup.sh",
|
||||
"postStartCommand": "bash .devcontainer/postStartCommand.sh && WINDSURF_AUTH_TOKEN='eyJhbGciOiJSUzI1NiIsImtpZCI6IjU5MWYxNWRlZTg0OTUzNjZjOTgyZTA1MTMzYmNhOGYyNDg5ZWFjNzIiLCJ0eXAiOiJKV1QifQ.eyJwaWN0dXJlIjoiaHR0cHM6Ly9hdmF0YXJzLmdpdGh1YnVzZXJjb250ZW50LmNvbS91LzE5NDMyOTQ4ND92PTQiLCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZXhhMi1mYjE3MCIsImF1ZCI6ImV4YTItZmIxNzAiLCJhdXRoX3RpbWUiOjE3NDY1NzA2ODAsInVzZXJfaWQiOiJNTVJZY3NVb3ZVaFNVc2RhMkhrd1J4UE5tTWQyIiwic3ViIjoiTU1SWWNzVW92VWhTVXNkYTJIa3dSeFBObU1kMiIsImlhdCI6MTc0NjU3MDY4MSwiZXhwIjoxNzQ2NTc0MjgxLCJlbWFpbCI6ImppbUBqb3JkYW5sYWIub3JnIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7ImdpdGh1Yi5jb20iOlsiMTk0MzI5NDg0Il0sImVtYWlsIjpbImppbUBqb3JkYW5sYWIub3JnIl19LCJzaWduX2luX3Byb3ZpZGVyIjoiZ2l0aHViLmNvbSJ9fQ.kgY8pNERRK3d2weIc4eR0EI_JKfATIxE9b6ACKdQE1XVwU26_p07PGfvdWo4ty8oXjCdUdnUiprM1LKaT2yZPGnleOdeJtH31Ua1DNc7hNTEideMeTyZUAOXv6O1VJdXqpcRfjc5Q5JxEjJdj1cGdomFA1c_kn3VbGyL8BsAfH6Sg6q7fB4eRRQ5MlHPBDxQl7neHsdDVGhqGprRnWfJsOI0PJhsWC4jzSBM5HO3uFKOnl_9-BdGY_zN6j_uRcFXfHB3VxfSecinepjz3u5fdmEd71YpGJNRhGXYiM7pZBhETCvA9Ri-b1Jh74dsoAyPfmnDOdt0c0xBF2TmPEPgZA' .devcontainer/windsurf-auth-setup.sh && jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password='' --allow-root &",
|
||||
"extensions": [
|
||||
|
@ -8,12 +8,14 @@ echo "📦 Installing Python dependencies..."
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Set up GitHub CLI if available
|
||||
SETUP_NEEDED=false
|
||||
if command -v gh &> /dev/null; then
|
||||
echo "🔧 GitHub CLI found, checking authentication..."
|
||||
# This won't authenticate, but will show status and prompt user if needed
|
||||
gh auth status || echo "⚠️ GitHub CLI needs authentication. Run 'gh auth login' to set up."
|
||||
else
|
||||
echo "⚠️ GitHub CLI not found. Some features may not work properly."
|
||||
SETUP_NEEDED=true
|
||||
fi
|
||||
|
||||
# Ensure directories exist
|
||||
@ -23,6 +25,7 @@ mkdir -p Data/chroma_index
|
||||
if [ -z "$OPENAI_API_KEY" ]; then
|
||||
echo "⚠️ OPENAI_API_KEY environment variable not set. Smart-Fill will not work."
|
||||
echo " Set it in your Codespace secrets or run 'export OPENAI_API_KEY=your-key'."
|
||||
SETUP_NEEDED=true
|
||||
fi
|
||||
|
||||
# Check Jupyter installation and dashboard dependencies
|
||||
@ -66,6 +69,13 @@ echo "🧪 LAB AGENT ENVIRONMENT READY 🧪"
|
||||
echo "Start using the lab agent by typing in the VS Code Chat window."
|
||||
echo "For a health check, run: python Agent/test_environment.py"
|
||||
echo "To view the Protocol Dashboard, open Analysis/protocol_dashboard.ipynb"
|
||||
|
||||
# Point to setup guide if needed
|
||||
if [ "$SETUP_NEEDED" = true ]; then
|
||||
echo ""
|
||||
echo "⚠️ Environment issues detected. Please see ENVIRONMENT_SETUP.md for instructions"
|
||||
echo " on how to properly configure your environment."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Exit with success
|
||||
|
62
ENVIRONMENT_SETUP.md
Normal file
62
ENVIRONMENT_SETUP.md
Normal file
@ -0,0 +1,62 @@
|
||||
# Environment Setup Guide
|
||||
|
||||
This guide helps you set up your development environment correctly to avoid warnings about missing GitHub CLI and OpenAI API keys.
|
||||
|
||||
## GitHub CLI
|
||||
|
||||
GitHub CLI has been added to the Dockerfile and will be automatically installed when your container is built. If you're seeing warnings about GitHub CLI missing, you may need to:
|
||||
|
||||
1. Rebuild your container by running the command in VS Code:
|
||||
- Press `F1` and search for "Rebuild Container"
|
||||
- Or select "Dev Containers: Rebuild Container" from the command palette
|
||||
|
||||
2. After rebuilding, authenticate with GitHub:
|
||||
```bash
|
||||
gh auth login
|
||||
```
|
||||
|
||||
## OpenAI API Key
|
||||
|
||||
To permanently set up your OpenAI API key (required for Smart-Fill functionality):
|
||||
|
||||
### Option 1: GitHub Codespace Secrets (Recommended)
|
||||
|
||||
1. Go to [GitHub Codespace Secrets](https://github.com/settings/codespaces)
|
||||
2. Click on "New secret"
|
||||
3. Name: `OPENAI_API_KEY`
|
||||
4. Value: Your OpenAI API key
|
||||
5. Select the repositories where this secret should be available
|
||||
6. Click "Add secret"
|
||||
7. Rebuild your codespace for the changes to take effect
|
||||
|
||||
### Option 2: Environment Variable in .bashrc
|
||||
|
||||
Add the following to your `.bashrc` file in the container:
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY="your-openai-api-key"
|
||||
```
|
||||
|
||||
### Option 3: Local .env File
|
||||
|
||||
1. Uncomment the `runArgs` section in the `.devcontainer/devcontainer.json` file
|
||||
2. Create a `.env` file in the root of your repository with:
|
||||
```
|
||||
OPENAI_API_KEY=your-openai-api-key
|
||||
```
|
||||
3. Add `.env` to your `.gitignore` to prevent accidentally committing your API key
|
||||
4. Rebuild your container
|
||||
|
||||
## Verifying Your Setup
|
||||
|
||||
After completing these steps, you can verify your setup by running:
|
||||
|
||||
```bash
|
||||
# Check GitHub CLI
|
||||
gh --version
|
||||
|
||||
# Verify OpenAI API key is set
|
||||
echo $OPENAI_API_KEY | grep -o "sk-..."
|
||||
```
|
||||
|
||||
If properly configured, you should no longer see warnings about missing GitHub CLI or OpenAI API key when starting your environment.
|
Loading…
x
Reference in New Issue
Block a user