cloudflare / chanfana

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!
https://chanfana.pages.dev
MIT License
288 stars 38 forks source link

feat: simplify local ChatGPT plugin development #43

Closed ericlewis closed 1 year ago

ericlewis commented 1 year ago

When developing ChatGPT plugins locally, there are aspects we can automate to streamline the development process.

This Pull Request introduces an is_dev flag to the aiPlugin options that serves two purposes:

Modifies the default CORS settings Alters the URL for the OpenAPI specification to target localhost. This approach assumes the utilization of wrangler dev for local execution.

Please note that this PR addresses the issue specifically concerning the OpenAPI specification and ai-plugin.json files. Further efforts are required to enable routes to adopt these default parameters. I welcome feedback and suggestions on the optimal method to achieve this objective. One alternative idea involves the implementation of a comprehensive "default headers" system that can be automatically applied across all endpoints.

ericlewis commented 1 year ago

It seems possible that the notes here https://github.com/kwhitley/itty-router/pull/148 & itty-cors could be helpful and negate the need for this PR. I will investigate.

github-actions[bot] commented 1 year ago

🧪 A prerelease is available for testing 🧪

You can install this latest build in your project with:

npm install --save https://prerelease-registry.devprod.cloudflare.dev/itty-router-openapi/runs/4669702351/npm-package-itty-router-openapi-43

Or you can immediately run this with npx:

npx https://prerelease-registry.devprod.cloudflare.dev/itty-router-openapi/runs/4669702351/npm-package-itty-router-openapi-43
G4brym commented 1 year ago

Hey @ericlewis, we will be updating the itty-router dependency to 4.x as soon as it is released I think it is better to keep CORS config out of this library (itty-router-openapi), and let the user configure CORS on its own, using the provided itty-router functions

that will work like this

image

But I agree, that we should provide example development configurations in the docs for this aiPlugin feature

G4brym commented 1 year ago

Hey @ericlewis do you think this pr still makes sence?

G4brym commented 1 year ago

Closing this pr for inactivity