https://github.com/yoshinorisano/chatgpt-simple-todo-plugin
With this minimal code and instructions, you can get started on developing a ChatGPT Plugin. It's perfect as an example for your first plugin development.
https://github.com/yoshinorisano/chatgpt-simple-todo-plugin
Last synced: 5 months ago
JSON representation
With this minimal code and instructions, you can get started on developing a ChatGPT Plugin. It's perfect as an example for your first plugin development.
- Host: GitHub
- URL: https://github.com/yoshinorisano/chatgpt-simple-todo-plugin
- Owner: yoshinorisano
- Created: 2023-05-14T04:38:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-14T12:49:34.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T01:19:58.094Z (9 months ago)
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 23
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ChatGPT-repositories - chatgpt-simple-todo-plugin - With this minimal code and instructions, you can get started on developing a ChatGPT Plugin. It's perfect as an example for your first plugin development. (Browser-extensions)
README
# A Simple TODO ChatGPT Plugin
This is a proof-of-concept for a ToDo ChatGPT Plugin, implemented using Python.
The primary value of this repository is to replicate the experience of developing the ChatGPT plugin for the first time. This will allow you to *rapidly acquire experience in developing a ChatGPT plugin*.
This repository includes all the necessary code to run the plugin.
Here is a demonstration of the TODO plugin in action.
# Requirements
- Basic understanding of Python programming, JSON, and YAML.
- Access to ChatGPT Plugins. If you don't currently have access, you can apply for it [here](https://openai.com/waitlist/plugins).
- (Optional) Access to ChatGPT GPT-4 for code generation. You can also use [my code](https://github.com/yoshinorisano/chatgpt-simple-todo-plugin/blob/main/main.py) if you cannot generate expected code.# Additional Information
Since making this repository public, I've noticed that the original code is [available](https://github.com/openai/plugins-quickstart).
However, it's still worth trying out this repository compared to the original.
Because the original repository lacks sufficient explanation, which could be a hurdle for beginners.
As of May 14, 2023, it reflects the latest information, which is beneficial for beginners as well.# Instructions
Here is my memo. You can also follow this instruction.1. Watch the instruction video.
ChatGPT plugins developer experience:
https://openai.com/blog/chatgpt-pluginsAs you may notice, the video content is getting older.
2. Generate a simple TODO app code using ChatGPT.
Open ChatGPT and change GPT-4 mode. Then execute the following prompt. This prompt is from the instruction video. (Thanks for the provided instruction video from OpenAI!)
Used Prompt:
```
Write a simple TODO app using FastAPI, that lets the user add TODOs, list their TODOs, and delete TODOs.Include a `__main__` section which will run this app using uvicorn. The Python module where I save this code will be called `main.py`.
In addition to the normal endpoints, include a route `/.well-known/ai-plugin.json` which serves (as JSON) the contents of `./manifest.json`, located in the same directory as `main.py`. Exclude this route from the OpenAPI spec, and don’t serve any other static content.
```You will get differnt code (compare to my [main.py](https://github.com/yoshinorisano/chatgpt-simple-todo-plugin/blob/main/main.py)) and will not work properly. Retry generating the code, and if that does not work, modify it manually.
Add the following code to serve `openapi.yaml`.
```python
# Added manually after code generation.
@app.get("/openapi.yaml", include_in_schema=False)
async def get_openapi_yaml():
return FileResponse('openapi.yaml')
```3. Sing up [CodeSandbox](https://codesandbox.io/) for developing and deploying our app.
4. Create a python environment on CodeSandbox.
5. Add dependency libraries to `requirements.txt`
```
fastapi
uvicorn
```6. Restart the environment to create the updated container for us.
7. Copy the content of the generated code and paste it into the `main.py`.
8. Create a `manifest.json` on the top directory.
Here is `manifest.json`. Replace `` in `https:///openapi.yaml` with your environment.
```json
{
"schema_version": "v1",
"name_for_human": "TODO Demo",
"name_for_model": "todo_demo",
"description_for_human": "TODO demo app",
"description_for_model": "An app for managing a user's TODOs",
"auth": {
"type": "none"
},
"api": {
"type": "openapi",
"url": "https:///openapi.yaml",
"is_user_authenticated": false
},
"logo_url": "https://upload.wikimedia.org/wikipedia/commons/5/50/Yes_Check_Circle.svg",
"contact_email": "[email protected]",
"legal_info_url": "http://www.example.com/legal"
}
```9. Restart again to deploy the app.
10. Access the `https:///openapi.json` to get OpenAPI specification.
I got the specification like this:
```
{"openapi":"3.0.2","info":{"title":"Simple TODO API","description":"This is a very simple TODO API","version":"1.0.0"},"paths":{"/todos":{"get":{"summary":"Get Todos",
[...]
```11. Copy the OpenAPI specification and paste it into [Swagger Editor](https://editor.swagger.io/) to convert json to yaml. Then, the Swagger Editor will pop up the dialog "Would you like to convert your JSON into YAML?" and hit OK button. Create `openapi.yaml` on the top directory and paste the yaml.
12. Almost done. All you need to do is to register the plugin with ChatGPT. Open ChatGPT and then open `Plugin store` and then click `Develop your own plugin`. After that, follow the instruction shown in the display.
13. Voilà! ChatGPT now uses our TODO plugin.