-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
241 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"projectId": "quiet-cloud-45113218", | ||
"orgId": "org-damp-cherry-40821001" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
model fact { | ||
id String @id @default(nanoid()) | ||
body String | ||
tags relationship[] | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @default(now()) @updatedAt | ||
} | ||
|
||
model tag { | ||
id String @id @default(nanoid()) | ||
body String @unique | ||
vector Unsupported("vector(768)")? | ||
facts relationship[] | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @default(now()) @updatedAt | ||
} | ||
|
||
model relationship { | ||
id String @id @default(nanoid()) | ||
factId String | ||
tagId String | ||
fact fact @relation(fields: [factId], references: [id], onDelete: Cascade) | ||
tag tag @relation(fields: [tagId], references: [id], onDelete: Cascade) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @default(now()) @updatedAt | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
previewFeatures = ["postgresqlExtensions", "prismaSchemaFolder", "typedSql"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
extensions = [vector] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create extension if not exists vector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create index on tag using hnsw (vector vector_cosine_ops); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- @param {String} $1:id | ||
-- @param {String} $2:body | ||
-- @param $3:vector | ||
insert into tag (id, body, vector) | ||
values ($1, $2, $3) | ||
on conflict (body) do nothing | ||
returning id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- @param $1:vector | ||
-- @param {Int} $2:threshold | ||
-- @param {Float} $3:limit | ||
select id, body, similarity | ||
from ( | ||
select id, body, 1 - (vector <=> $1::vector) as similarity | ||
from tag | ||
) as subquery | ||
where similarity > $2 | ||
order by similarity desc | ||
limit $3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set max_parallel_maintenance_workers = 7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set maintenance_work_mem='10 GB'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.