mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-10 22:41:17 +00:00
wipedata api
This commit is contained in:
parent
861ad49762
commit
7f34ca31a8
2 changed files with 21 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import * as apiBatchUploadTweets from './routes/batchUploadTweets';
|
|||
import * as apiGetPageContent from './routes/getPageContent';
|
||||
import * as apiDelete from './routes/delete';
|
||||
import * as apiEdit from './routes/edit';
|
||||
import * as apiWipeData from './routes/wipedata';
|
||||
import { OpenAIEmbeddings } from './OpenAIEmbedder';
|
||||
import { GenerativeModel } from '@google/generative-ai';
|
||||
import { Request } from '@cloudflare/workers-types';
|
||||
|
|
@ -35,6 +36,7 @@ routeMap.set('/getPageContent', apiGetPageContent);
|
|||
routeMap.set('/delete', apiDelete);
|
||||
routeMap.set('/edit', apiEdit);
|
||||
|
||||
routeMap.set('/wipedata', apiWipeData);
|
||||
// Add more route mappings as needed
|
||||
// routeMap.set('/api/otherRoute', { ... });
|
||||
|
||||
|
|
|
|||
19
apps/cf-ai-backend/src/routes/wipedata.ts
Normal file
19
apps/cf-ai-backend/src/routes/wipedata.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Request } from '@cloudflare/workers-types';
|
||||
import { type CloudflareVectorizeStore } from '@langchain/cloudflare';
|
||||
import { OpenAIEmbeddings } from '../OpenAIEmbedder';
|
||||
import { GenerativeModel } from '@google/generative-ai';
|
||||
import { seededRandom } from '../util';
|
||||
|
||||
// TODO: Waiting for cloudflare to implement tojson so i can get all IDS for that user and delete them
|
||||
export async function DELETE(request: Request, store: CloudflareVectorizeStore, _: OpenAIEmbeddings, m: GenerativeModel, env: Env) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const user = searchParams.get('user');
|
||||
|
||||
console.log(store.toJSONNotImplemented());
|
||||
|
||||
// for (const match of matches.matches) {
|
||||
// await store.delete({ ids: [match.id] });
|
||||
// }
|
||||
|
||||
return new Response(JSON.stringify({ message: 'Document deleted' }), { status: 200 });
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue