create-cloudflare 0.0.0-7310add1 → 0.0.0-765ebc1c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -57864,7 +57864,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
57864
57864
|
var yargs_default = Yargs;
|
|
57865
57865
|
|
|
57866
57866
|
// package.json
|
|
57867
|
-
var version = "0.0.0-
|
|
57867
|
+
var version = "0.0.0-765ebc1c";
|
|
57868
57868
|
var devDependencies = {
|
|
57869
57869
|
"@babel/parser": "^7.21.3",
|
|
57870
57870
|
"@babel/types": "^7.21.4",
|
package/package.json
CHANGED
|
@@ -17,8 +17,8 @@ The sample plugin allows ChatGPT users to search for repositories using GitHub's
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
19
|
1. You can configure the `.well-known/ai-plugin.json` route in `index.ts`.
|
|
20
|
-
2.
|
|
21
|
-
3.
|
|
20
|
+
2. Update the OpenAPI schema in `openapi.ts`.
|
|
21
|
+
3. You can set up any new routes and the associated OpenAPI schema by defining new routes. See `search.ts` for an example.
|
|
22
22
|
|
|
23
23
|
## Deploying to OpenAI's API
|
|
24
24
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ApiException,
|
|
3
|
+
OpenAPIRoute,
|
|
4
|
+
Query,
|
|
5
|
+
ValidationError,
|
|
6
|
+
} from "@cloudflare/itty-router-openapi";
|
|
2
7
|
|
|
3
8
|
export class GetSearch extends OpenAPIRoute {
|
|
4
9
|
static schema = {
|
|
@@ -12,7 +17,6 @@ export class GetSearch extends OpenAPIRoute {
|
|
|
12
17
|
},
|
|
13
18
|
responses: {
|
|
14
19
|
"200": {
|
|
15
|
-
description: "Successfully response",
|
|
16
20
|
schema: {
|
|
17
21
|
repos: [
|
|
18
22
|
{
|
|
@@ -29,7 +33,7 @@ export class GetSearch extends OpenAPIRoute {
|
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
async handle(request: Request, env, ctx, data: Record<string, any>) {
|
|
32
|
-
const url = `https://api.github.com/search/repositories?q=${data.
|
|
36
|
+
const url = `https://api.github.com/search/repositories?q=${data.q}`;
|
|
33
37
|
|
|
34
38
|
const resp = await fetch(url, {
|
|
35
39
|
headers: {
|