Skip to content

Commit

Permalink
Bump chatgptPlugin template itty-router-openapi version (#3888)
Browse files Browse the repository at this point in the history
* Bump chatgptPlugin template itty-router-openapi version

* Fix issue

* Bump version
  • Loading branch information
G4brym authored Sep 14, 2023
1 parent 56da7c7 commit 7310add
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-geckos-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": minor
---

Bump chatgptPlugin template itty-router-openapi version
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The sample plugin allows ChatGPT users to search for repositories using GitHub's
## Usage

1. You can configure the `.well-known/ai-plugin.json` route in `index.ts`.
2. Update the OpenAPI schema in `openapi.ts`.
3. You can set up any new routes and the associated OpenAPI schema by defining new routes. See `search.ts` for an example.
2. You can set up any new routes and the associated OpenAPI schema by defining new routes. See `search.ts` for an example.
3. For more information read the [itty-router-openapi official documentation](https://cloudflare.github.io/itty-router-openapi/).

## Deploying to OpenAI's API

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "wrangler dev"
},
"dependencies": {
"@cloudflare/itty-router-openapi": "^0.1.2"
"@cloudflare/itty-router-openapi": "^1.0.1"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230404.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
ApiException,
OpenAPIRoute,
Query,
ValidationError,
} from "@cloudflare/itty-router-openapi";
import { OpenAPIRoute, Query } from "@cloudflare/itty-router-openapi";

export class GetSearch extends OpenAPIRoute {
static schema = {
Expand All @@ -17,6 +12,7 @@ export class GetSearch extends OpenAPIRoute {
},
responses: {
"200": {
description: "Successfully response",
schema: {
repos: [
{
Expand All @@ -33,7 +29,7 @@ export class GetSearch extends OpenAPIRoute {
};

async handle(request: Request, env, ctx, data: Record<string, any>) {
const url = `https://api.github.com/search/repositories?q=${data.q}`;
const url = `https://api.github.com/search/repositories?q=${data.query.q}`;

const resp = await fetch(url, {
headers: {
Expand Down

0 comments on commit 7310add

Please sign in to comment.