diff --git a/.devcontainer/addcodespacename.sh b/.devcontainer/addcodespacename.sh new file mode 100755 index 00000000..fd2aa5b3 --- /dev/null +++ b/.devcontainer/addcodespacename.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e +# Determine the value of SITE_HOST based on whether the project is opened in a Codespace +if [ -n "$CODESPACE_NAME" ]; then + SITE_HOST="https://${CODESPACE_NAME}-5003.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" + + # Replace "localhost:5003" with the value of SITE_HOST in the ai-plugin.json file + sed -i "s#http://localhost:5003#${SITE_HOST}#g" .well-known/ai-plugin.json + + # Replace "localhost:5003" with the value of SITE_HOST in the openapi.yaml file + sed -i "s#http://localhost:5003#${SITE_HOST}#g" openapi.yaml +fi + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..e14708b9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "ChatGPT Quickstart Plugins", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:0-3.11", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 5003 + ], + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip install -r requirements.txt", + "postAttachCommand": ".devcontainer/addcodespacename.sh && python main.py", + "customizations": { + "codespaces": { + "openFiles": [ + ".well-known/ai-plugin.json", + "openapi.yaml" + ] + } + } +} diff --git a/README.md b/README.md index 5976d0a0..84a57379 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ Get a Todo list ChatGPT plugin up and running in under 5 minutes using Python. If you do not already have plugin developer access, please [join the waitlist](https://openai.com/waitlist/plugins). -## Setup +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/openai/plugins-quickstart?devcontainer_path=/.devcontainer/basics/devcontainer.json) + +## Local Setup To install the required packages for this plugin, run the following command: @@ -24,6 +26,35 @@ Once the local server is running: 4. Select "Develop your own plugin" 5. Enter in `localhost:5003` since this is the URL the server is running on locally, then select "Find manifest file". +The plugin should now be installed and enabled! You can start with a question like "What is on my todo list" and then try adding something to it as well! + +## GitHub Codespaces Setup +_A codespace is a development environment that's hosted in the cloud. You can build and run this plugin via a GitHub Codespace by following the directions below:_ + +1. Open this environment in a GitHub Codespace by choosing "Use this template" > "Open in Codespace" as pictured below. +Green button titled use this template with dropdown options of create new repository and open in codespace + +2. Allow the Codespace a few minutes to finish installing all necessary dependencies. It may take awhile, but keep in mind that GitHub Codespaces is running all the install commands, so you don't have to. + +3. Once everything is installed, you should see that a forwarded port is now running the plugin. **Set the port visibility to public.** +Choosing public port visibility for forwarded port + +4. Copy the forwarded port's local address. ( **Tip:** use the clipboard icon to copy and paste the local address!) +Highlighting clip board icon which shows tooltip thats says Copy local address + + + +5. Navigate to https://chat.openai.com. + +6. In the Model drop down, select "Plugins" (note, if you don't see it there, you don't have access yet). + +7. Select "Plugin store" + +8. Select "Develop your own plugin" + +9. Enter in the local address to your forwarded port (the one you copied in Step 3), then select "Find manifest file". + + The plugin should now be installed and enabled! You can start with a question like "What is on my todo list" and then try adding something to it as well! ## Getting help