Skip to content

Commit

Permalink
feat: remove vercel and trpc from dexa-mfm
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Apr 11, 2023
1 parent 34523e2 commit d5ac44b
Show file tree
Hide file tree
Showing 21 changed files with 209 additions and 1,698 deletions.
8 changes: 0 additions & 8 deletions examples/dexa-mfm/.env.example

This file was deleted.

3 changes: 0 additions & 3 deletions examples/dexa-mfm/.eslintrc.json

This file was deleted.

16 changes: 0 additions & 16 deletions examples/dexa-mfm/next.config.mjs

This file was deleted.

25 changes: 4 additions & 21 deletions examples/dexa-mfm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,14 @@
"node": ">=14"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "wrangler dev",
"deploy": "wrangler publish"
},
"dependencies": {
"@fisch0920/trpc-openapi": "^1.1.3",
"@sindresorhus/slugify": "^2.2.0",
"@trpc/server": "^10.19.1",
"chatgpt-plugin": "latest",
"next": "^13.3.0",
"next-transpile-modules": "^10.0.0",
"nextjs-cors": "^2.1.2",
"@cloudflare/itty-router-openapi": "^0.0.15",
"chatgpt-plugin": "workspace:../../packages/chatgpt-plugin",
"zod": "^3.21.4"
},
"devDependencies": {
"@types/react": "18.0.34",
"@types/react-dom": "18.0.11",
"eslint": "8.38.0",
"eslint-config-next": "13.3.0",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.0.4"
},
"aiPlugin": {
"name": "MFM Podcast",
"description_for_model": "Plugin for searching transcripts from the My First Million (MFM) Podcast by Sam Parr (@TheSamParr) and Shaan Puri (@ShaanVP). Use it whenever a user asks about business ideas, entrepreneurship, investment advice, fitness, e-commerce, side hustles, or the MFM Podcast.",
Expand Down
5 changes: 0 additions & 5 deletions examples/dexa-mfm/pages/_app.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions examples/dexa-mfm/pages/api/.well-known/ai-plugin.json.ts

This file was deleted.

20 changes: 0 additions & 20 deletions examples/dexa-mfm/pages/api/[...trpc].ts

This file was deleted.

9 changes: 0 additions & 9 deletions examples/dexa-mfm/pages/api/openapi.json.ts

This file was deleted.

9 changes: 0 additions & 9 deletions examples/dexa-mfm/pages/api/trpc/[...trpc].ts

This file was deleted.

9 changes: 0 additions & 9 deletions examples/dexa-mfm/pages/index.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions examples/dexa-mfm/server/ai-plugin.ts

This file was deleted.

13 changes: 0 additions & 13 deletions examples/dexa-mfm/server/config.ts

This file was deleted.

11 changes: 0 additions & 11 deletions examples/dexa-mfm/server/openapi.ts

This file was deleted.

121 changes: 0 additions & 121 deletions examples/dexa-mfm/server/router.ts

This file was deleted.

45 changes: 45 additions & 0 deletions examples/dexa-mfm/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { OpenAPIRouter } from '@cloudflare/itty-router-openapi'
import { defineAIPluginManifest } from 'chatgpt-plugin'

import * as routes from './routes'
import pkg from '../package.json'

export interface Env {
DEXA_API_BASE_URL: string
}

const router = OpenAPIRouter({
schema: {
info: {
title: pkg.aiPlugin.name,
version: pkg.version
}
}
})

router.get('/search', routes.DexaSearch)

router.get('/.well-known/ai-plugin.json', (request: Request) => {
const host = request.headers.get('host')
const pluginManifest = defineAIPluginManifest(
{
description_for_human: pkg.description,
...pkg.aiPlugin
},
{ openAPIUrl: `https://${host}/openapi.json` }
)

return new Response(JSON.stringify(pluginManifest, null, 2), {
headers: {
'content-type': 'application/json;charset=UTF-8'
}
})
})

// 404 for everything else
router.all('*', () => new Response('Not Found.', { status: 404 }))

export default {
fetch: (request: Request, env: Env, ctx: ExecutionContext) =>
router.handle(request, env, ctx)
}
Loading

0 comments on commit d5ac44b

Please sign in to comment.