mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-08 03:08:21 +00:00
save unique vectors for users from extension
This commit is contained in:
parent
75940c1936
commit
823e9d276f
5 changed files with 19 additions and 9 deletions
|
|
@ -289,7 +289,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||
},
|
||||
body: JSON.stringify({
|
||||
pageContent: content,
|
||||
url,
|
||||
url: url + "#supermemory-user-" + Math.random(),
|
||||
title,
|
||||
spaces: request.spaces,
|
||||
description,
|
||||
|
|
|
|||
|
|
@ -82,9 +82,12 @@ function Page() {
|
|||
<Filters setFilter={setFilter} filter={filter} />
|
||||
|
||||
<Masonry
|
||||
className="mt-6"
|
||||
columns={{ 640: 1, 768: 2, 1024: 3, 1280: 4 }}
|
||||
className="mt-6 relative"
|
||||
columns={{ 640: 1, 768: 2, 1024: 3 }}
|
||||
gap={12}
|
||||
columnProps={{
|
||||
className: "min-w-[calc(33.3333%-12px)] w-full",
|
||||
}}
|
||||
>
|
||||
{sortedItems.map((item) => {
|
||||
if (item.item === "memory") {
|
||||
|
|
@ -153,7 +156,7 @@ function TabComponent({
|
|||
);
|
||||
}
|
||||
|
||||
export function LinkComponent({
|
||||
function LinkComponent({
|
||||
type,
|
||||
content,
|
||||
title,
|
||||
|
|
@ -172,7 +175,7 @@ export function LinkComponent({
|
|||
return (
|
||||
<Link
|
||||
href={url}
|
||||
className={`bg-secondary border-2 border-border w-full rounded-xl ${type === "tweet" ? "" : "p-4"} hover:scale-105 transition duration-200`}
|
||||
className={`bg-secondary border-2 border-border rounded-xl ${type === "tweet" ? "" : "p-4"} hover:scale-105 transition duration-200`}
|
||||
>
|
||||
{type === "page" ? (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -223,6 +223,9 @@ export const createMemory = async (input: {
|
|||
|
||||
let contentId: number | undefined;
|
||||
|
||||
const saveToDbUrl =
|
||||
metadata.baseUrl.split("#supermemory-user-")[0] ?? metadata.baseUrl;
|
||||
|
||||
// Insert into database
|
||||
try {
|
||||
const insertResponse = await db
|
||||
|
|
@ -231,8 +234,8 @@ export const createMemory = async (input: {
|
|||
content: pageContent,
|
||||
title: metadata.title,
|
||||
description: metadata.description,
|
||||
url: input.content,
|
||||
baseUrl: metadata.baseUrl,
|
||||
url: saveToDbUrl,
|
||||
baseUrl: saveToDbUrl,
|
||||
image: metadata.image,
|
||||
savedAt: new Date(),
|
||||
userId: data.user.id,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ const createMemoryFromAPI = async (input: {
|
|||
|
||||
let contentId: number | undefined;
|
||||
|
||||
const saveToDbUrl =
|
||||
input.data.url.split("#supermemory-user-")[0] ?? input.data.url;
|
||||
|
||||
// Insert into database
|
||||
try {
|
||||
const insertResponse = await db
|
||||
|
|
@ -62,8 +65,8 @@ const createMemoryFromAPI = async (input: {
|
|||
content: input.data.pageContent,
|
||||
title: input.data.title,
|
||||
description: input.data.description,
|
||||
url: input.data.url,
|
||||
baseUrl: input.data.url,
|
||||
url: saveToDbUrl,
|
||||
baseUrl: saveToDbUrl,
|
||||
image: input.data.image,
|
||||
savedAt: new Date(),
|
||||
userId: input.userId,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export const {
|
|||
auth,
|
||||
} = NextAuth({
|
||||
secret: process.env.BACKEND_SECURITY_KEY,
|
||||
trustHost: true,
|
||||
// callbacks: {
|
||||
// session: ({ session, token, user }) => ({
|
||||
// ...session,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue