aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-04-11 02:38:41 -0700
committerDhravya <[email protected]>2024-04-11 02:38:41 -0700
commit22effd214c3bfa3e927604282da619bcc40b0d5f (patch)
tree281fa1f0b1bb2266c4f970d88dbcc1e594c04041
parentMerge branch 'main' of https://github.com/Dhravya/supermemory (diff)
downloadsupermemory-22effd214c3bfa3e927604282da619bcc40b0d5f.tar.xz
supermemory-22effd214c3bfa3e927604282da619bcc40b0d5f.zip
prepare statement
-rw-r--r--apps/cf-ai-backend/src/routes/chat.ts3
-rw-r--r--apps/web/db/prepare.sql4
-rw-r--r--apps/web/src/app/api/store/route.ts2
3 files changed, 6 insertions, 3 deletions
diff --git a/apps/cf-ai-backend/src/routes/chat.ts b/apps/cf-ai-backend/src/routes/chat.ts
index 75e298b8..980e46a3 100644
--- a/apps/cf-ai-backend/src/routes/chat.ts
+++ b/apps/cf-ai-backend/src/routes/chat.ts
@@ -60,8 +60,9 @@ export async function POST(request: Request, _: CloudflareVectorizeStore, embedd
// if (responses.count === 0) {
// return new Response(JSON.stringify({ message: "No Results Found" }), { status: 404 });
// }
+ console.log(responses.matches);
- const highScoreIds = responses.matches.filter(({ score }) => score > 0.35).map(({ id }) => id);
+ const highScoreIds = responses.matches.filter(({ score }) => score > 0.3).map(({ id }) => id);
if (sourcesOnly === 'true') {
return new Response(JSON.stringify({ ids: highScoreIds }), { status: 200 });
diff --git a/apps/web/db/prepare.sql b/apps/web/db/prepare.sql
index a4f9951d..dcba4d40 100644
--- a/apps/web/db/prepare.sql
+++ b/apps/web/db/prepare.sql
@@ -34,7 +34,7 @@ CREATE TABLE `session` (
--> statement-breakpoint
CREATE TABLE `space` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
- `name` text DEFAULT 'all' NOT NULL,
+ `name` text DEFAULT 'none' NOT NULL,
`user` text(255),
FOREIGN KEY (`user`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
);
@@ -47,6 +47,7 @@ CREATE TABLE `storedContent` (
`url` text NOT NULL,
`savedAt` integer NOT NULL,
`baseUrl` text(255),
+ `type` text DEFAULT 'page',
`image` text(255),
`user` text(255),
FOREIGN KEY (`user`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
@@ -69,6 +70,7 @@ CREATE TABLE `verificationToken` (
--> statement-breakpoint
CREATE INDEX `account_userId_idx` ON `account` (`userId`);--> statement-breakpoint
CREATE INDEX `session_userId_idx` ON `session` (`userId`);--> statement-breakpoint
+CREATE UNIQUE INDEX `space_name_unique` ON `space` (`name`);--> statement-breakpoint
CREATE INDEX `spaces_name_idx` ON `space` (`name`);--> statement-breakpoint
CREATE INDEX `spaces_user_idx` ON `space` (`user`);--> statement-breakpoint
CREATE INDEX `storedContent_url_idx` ON `storedContent` (`url`);--> statement-breakpoint
diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts
index ebe23077..ca6921c4 100644
--- a/apps/web/src/app/api/store/route.ts
+++ b/apps/web/src/app/api/store/route.ts
@@ -67,7 +67,7 @@ export async function POST(req: NextRequest) {
let storeToSpace = data.space;
if (!storeToSpace) {
- storeToSpace = "all";
+ storeToSpace = "none";
}
const storedContentId = await db.insert(storedContent).values({