Skip to content

Commit

Permalink
add chat script (#265)
Browse files Browse the repository at this point in the history
* add chat script

* include script

* fix formatting

* rename files

* fix script
  • Loading branch information
aarushik93 authored May 2, 2024
1 parent a02b523 commit bcf7da0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
26 changes: 26 additions & 0 deletions codex/deploy/backend_chat_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
script = """
#!/bin/bash
# Prompt user for necessary arguments
read -p "What's your github repo name: " repo_name
read -p "What's your github URL: " user_repo_url
# Check if tag is empty and set default
if [ -z "$tag" ]; then
tag="latest"
fi
# Pull the Docker image
echo "Pulling the Docker image..."
docker pull ghcr.io/agpt-agent/backend-chat:latest
# Run the Docker container with user-provided arguments
echo "Running the Docker container..."
docker run -p 8501:8501 \
-e REPO_URL=$user_repo_url \
-e PERSIST_DIRECTORY="db/$repo_name" \
ghcr.io/agpt-agent/backend-chat:latest
echo "Chat is running on http://localhost:8501"
""".lstrip()
9 changes: 9 additions & 0 deletions codex/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from codex.common.exec_external_tool import execute_command
from codex.deploy.model import Application
from codex.deploy.actions_workflows import manual_deploy, auto_deploy
from codex.deploy.backend_chat_script import script


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -341,6 +342,10 @@ async def create_zip_file(application: Application, spec: Specification) -> byte
server_file = app_dir / "server.py"
server_file.write_text(application.server_code)

# Make a chat script file
chat_file = package_dir / "backend_chat.sh"
chat_file.write_text(script)

# Make a app.py file
if application.app_code:
app_file = app_dir / "app.py"
Expand Down Expand Up @@ -501,6 +506,10 @@ async def create_remote_repo(
server_file = app_dir / "server.py"
server_file.write_text(application.server_code)

# Make a chat script file
chat_file = package_dir / "backend_chat.sh"
chat_file.write_text(script)

# Make a app.py file
if application.app_code:
app_file = app_dir / "app.py"
Expand Down

0 comments on commit bcf7da0

Please sign in to comment.