Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dev container to open in GitHub Codespace #14

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

blackgirlbytes
Copy link

@blackgirlbytes blackgirlbytes commented May 1, 2023

I added a devcontainer to this repository along with instructions in the README for how a user can get started.

To test out this implementation, follow the steps for the README using either of the following:

  1. GitHub Codespaces - VS Code Web Client
  2. GitHub Codespaces - VS Code Desktop with GitHub Codespaces extension

It should work in the two indicated above.

What's happening in this PR?

  • The devcontainer is handles opening up this environment, it runs the commands to install requirements and to run the main.py file.
  • The devcontainer also indicates that the forwarded port should be on localhost:5003
  • The devcontainer also automatically opens up two files for the developer's ease of use well-known/ai-plugin.json and openapi.yaml
  • It also runs a bash script and enables permissions to run the bash script with chmod. This bash script automatically adds the Codespace forwarded port, so that developer's don't have to manual update those files to match the Codespace URL. I did this because your Codespace URL changes with each new Codespace and folks might forget to update it.
  • I added instructions to the README.

Questions/Concerns

  • The Codespace seemed to take a bit of a time to finish loading everything. Should I implement a pre-build?
  • Are the instructions I added in the README too much? too little? too confusing?

Looking for review

I am looking for review from Logan and anyone on the Open AI team. I am also looking for review from anyone on the GitHub side, especially folks within the Codespaces team.

Thank you so much for this opportunity. It was fun!

cc: @logankilpatrick

@blackgirlbytes blackgirlbytes changed the title Insert codespace name Add dev container to open in GitHub CodeSpace May 1, 2023
@blackgirlbytes blackgirlbytes changed the title Add dev container to open in GitHub CodeSpace Add dev container to open in GitHub Codespace May 1, 2023
README.md Outdated Show resolved Hide resolved
Rizel Scarlett and others added 3 commits May 1, 2023 17:35
Co-authored-by: Josh Spicer <josh@joshspicer.com>
Co-authored-by: Josh Spicer <josh@joshspicer.com>
README.md Outdated Show resolved Hide resolved
Rizel Scarlett and others added 3 commits May 1, 2023 17:43
Co-authored-by: Josh Spicer <josh@joshspicer.com>
Co-authored-by: Josh Spicer <josh@joshspicer.com>
Rizel Scarlett and others added 3 commits May 1, 2023 18:17
@blackgirlbytes
Copy link
Author

I wrote this DEV post to explain the changes that I made and help create awareness around Codespaces + ChatGPT plugins : https://dev.to/github/chatgpt-meets-github-codespaces-how-im-optimizing-chatgpt-quickstart-plugins-for-remote-development-5bc8

Hopefully this will be helpful for the OpenAI team and the Codespaces team.

@@ -0,0 +1,13 @@
#!/bin/bash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, we can update the file to have $host placeholder and then replace with host header. For codespaces, the original host is in x-forwarded-host.

  "api": {
    "type": "openapi",
    "is_user_authenticated": "false",
    "url": "$host/.well-known/openapi.yaml"
  },
  "logo_url": "$host/.well-known/logo.png",
  
@app.get("/.well-known/ai-plugin.json")
async def plugin_manifest(request: Request):
    """
    Returns the ai-plugin.json from .well-known location
    """

    host_header = request.headers.get("X-Forwarded-Host") or request.headers.get("Host")

    with open(".well-known/ai-plugin.json") as f:
        return Response(
            content=Template(f.read()).substitute(host=f"https://{host_header}"),
            media_type="application/json",
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants