mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-09 19:45:34 +00:00
Add Editor Endpoint
This commit is contained in:
parent
88289d1228
commit
242cbf721a
1 changed files with 17 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { z } from "zod";
|
||||
import { Hono } from "hono";
|
||||
import { CoreMessage, streamText } from "ai";
|
||||
import { CoreMessage, generateText, streamText } from "ai";
|
||||
import { chatObj, Env, vectorObj } from "./types";
|
||||
import {
|
||||
batchCreateChunksAndEmbeddings,
|
||||
|
|
@ -331,4 +331,20 @@ app.delete(
|
|||
},
|
||||
);
|
||||
|
||||
app.get('/api/editorai', zValidator(
|
||||
"query",
|
||||
z.object({
|
||||
context: z.string(),
|
||||
request: z.string(),
|
||||
}),
|
||||
), async (c)=> {
|
||||
const { context, request } = c.req.valid("query");
|
||||
|
||||
const { model } = await initQuery(c);
|
||||
|
||||
const {text} = await generateText({ model, prompt: `${request}-${context}` });
|
||||
|
||||
return c.json({completion: text});
|
||||
})
|
||||
|
||||
export default app;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue