https://github.com/rxliuli/fastapi-poe-javascript
Create PoeAI server bot with JavaScript and Cloudflare Workers
https://github.com/rxliuli/fastapi-poe-javascript
ai bot poe
Last synced: 6 months ago
JSON representation
Create PoeAI server bot with JavaScript and Cloudflare Workers
- Host: GitHub
- URL: https://github.com/rxliuli/fastapi-poe-javascript
- Owner: rxliuli
- License: mit
- Created: 2024-08-20T09:42:23.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-21T17:22:56.000Z (about 1 year ago)
- Last Synced: 2025-04-12T14:15:42.646Z (6 months ago)
- Topics: ai, bot, poe
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/fastapi-poe
- Size: 53.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastapi-poe
Create PoeAI server bot with JavaScript and Cloudflare Workers.
## Bootstrap Project
```bash
pnpm dlx fastapi-poe@latest init
```### Development
```sh
cd
pnpm i
pnpm dev
```### Deployment
```sh
pnpm run deploy
echo | pnpm wrangler secret put ACCESS_KEY
```## Basic Usage
```ts
import { Hono } from 'hono'
import { poe } from 'fastapi-poe'const app = new Hono()
interface Env {
ACCESS_KEY: string
}const bot = poe({
name: 'poe-bot-template',
getSettings() {
return {
server_bot_dependencies: {
'Claude-3.5-Sonnet': 1,
},
}
},
async *getResponse(req) {
for await (const response of bot.streamRequest(req, 'Claude-3.5-Sonnet')) {
yield {
text: response.text,
}
}
},
})app.post('/', bot.handler)
app.get('/', async (c) => c.text('Hello Hono!'))export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
bot.accessKey = env.ACCESS_KEY
return app.fetch(request, env, ctx)
},
}
```