mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
some documentation for backend
This commit is contained in:
parent
5ab5d8f12f
commit
aabdef4b0d
3 changed files with 42 additions and 46 deletions
|
|
@ -1,58 +1,50 @@
|
|||
# Hono minimal project
|
||||
baseURL: https://new-cf-ai-backend.dhravya.workers.dev
|
||||
|
||||
This is a minimal project with [Hono](https://github.com/honojs/hono/) for Cloudflare Workers.
|
||||
Authentication:
|
||||
You must authenticate with a header and `Authorization: bearer token` for each request in `/api/*` routes.
|
||||
|
||||
## Features
|
||||
### Add content:
|
||||
|
||||
- Minimal
|
||||
- TypeScript
|
||||
- Wrangler to develop and deploy.
|
||||
- [Jest](https://jestjs.io/ja/) for testing.
|
||||
|
||||
## Usage
|
||||
|
||||
Initialize
|
||||
POST `/api/add` with
|
||||
|
||||
```
|
||||
npx create-cloudflare my-app https://github.com/honojs/hono-minimal
|
||||
body {
|
||||
pageContent: z.string(),
|
||||
title: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
space: z.string().optional(),
|
||||
url: z.string(),
|
||||
user: z.string(),
|
||||
}
|
||||
```
|
||||
|
||||
Install
|
||||
### Query without user data
|
||||
|
||||
GET `/api/ask` with
|
||||
query `?query=testing`
|
||||
|
||||
(this is temp but works perfectly, will change soon for chat use cases specifically)
|
||||
|
||||
### Query vectorize and get results in natural language
|
||||
|
||||
POST `/api/chat` with
|
||||
|
||||
```
|
||||
yarn install
|
||||
query paramters (?query=...&" {
|
||||
query: z.string(),
|
||||
topK: z.number().optional().default(10),
|
||||
user: z.string(),
|
||||
spaces: z.string().optional(),
|
||||
sourcesOnly: z.string().optional().default("false"),
|
||||
model: z.string().optional().default("gpt-4o"),
|
||||
}
|
||||
|
||||
body z.object({
|
||||
chatHistory: z.array(contentObj).optional(),
|
||||
});
|
||||
```
|
||||
|
||||
Develop
|
||||
### Delete vectors
|
||||
|
||||
```
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Test
|
||||
|
||||
```
|
||||
yarn test
|
||||
```
|
||||
|
||||
Deploy
|
||||
|
||||
```
|
||||
yarn deploy
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
See: <https://github.com/honojs/examples>
|
||||
|
||||
## For more information
|
||||
|
||||
See: <https://honojs.dev>
|
||||
|
||||
## Author
|
||||
|
||||
Yusuke Wada <https://github.com/yusukebe>
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
DELETE `/api/delete` with
|
||||
query param websiteUrl, user
|
||||
|
|
|
|||
|
|
@ -14,9 +14,12 @@ import { bearerAuth } from "hono/bearer-auth";
|
|||
import { zValidator } from "@hono/zod-validator";
|
||||
import chunkText from "./utils/chonker";
|
||||
import { systemPrompt, template } from "./prompts/prompt1";
|
||||
import { swaggerUI } from "@hono/swagger-ui";
|
||||
|
||||
const app = new Hono<{ Bindings: Env }>();
|
||||
|
||||
app.get("/doc", swaggerUI({ url: "/doc" }));
|
||||
|
||||
// ------- MIDDLEWARES -------
|
||||
app.use("*", poweredBy());
|
||||
app.use("*", timing());
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
"@aws-sdk/s3-request-presigner": "^3.577.0",
|
||||
"@cloudflare/puppeteer": "^0.0.8",
|
||||
"@headlessui/react": "^2.0.4",
|
||||
"@hono/swagger-ui": "^0.2.2",
|
||||
"@hookform/resolvers": "^3.4.2",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@langchain/cloudflare": "^0.0.6",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue