mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-09 03:18:04 +00:00
Merge branch 'main' of github.com:supermemoryai/supermemory
This commit is contained in:
commit
d966b8e485
8 changed files with 21248 additions and 14185 deletions
11
apps/web/.gitignore
vendored
11
apps/web/.gitignore
vendored
|
|
@ -1,14 +1,3 @@
|
|||
|
||||
# Sentry Config File
|
||||
.env.sentry-build-plugin
|
||||
|
||||
# next-pwa
|
||||
/public/sw.js
|
||||
/public/workbox-*.js
|
||||
/public/worker-*.js
|
||||
/public/fallback-*.js
|
||||
/public/precache.*.*.js.map
|
||||
/public/sw.js.map
|
||||
/public/workbox-*.js.map
|
||||
/public/worker-*.js.map
|
||||
/public/fallback-*.js
|
||||
|
|
@ -37,7 +37,22 @@ import { toast } from "sonner";
|
|||
import { Input } from "@repo/ui/shadcn/input";
|
||||
import { motion } from "framer-motion";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@repo/ui/shadcn/alert-dialog";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@repo/ui/shadcn/alert-dialog";
|
||||
import {
|
||||
BookOpenIcon,
|
||||
DocumentTextIcon,
|
||||
FolderIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
type TMemoriesPage = {
|
||||
memoriesAndSpaces: { memories: Content[]; spaces: StoredSpace[] };
|
||||
|
|
@ -154,9 +169,24 @@ export function MemoriesPage({
|
|||
</h2>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between w-full">
|
||||
<Filters
|
||||
setFilter={setFilter}
|
||||
filter={filter}
|
||||
filterMethods={
|
||||
currentSpace ? SpaceFilterMethods : MemoriesFilterMethods
|
||||
}
|
||||
/>
|
||||
<button
|
||||
onClick={handleExport}
|
||||
className={`transition px-4 py-2 rounded-lg text-[#B3BCC5] bg-secondary hover:bg-secondary hover:text-[#76a3cc]`}
|
||||
>
|
||||
JSON Export
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{currentSpace && (
|
||||
<div className="flex flex-col gap-2">
|
||||
|
||||
{usersWithAccess && usersWithAccess.length > 0 && (
|
||||
<div className="flex gap-4 items-center">
|
||||
Users with access
|
||||
|
|
@ -204,22 +234,6 @@ export function MemoriesPage({
|
|||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-between w-full">
|
||||
<Filters
|
||||
setFilter={setFilter}
|
||||
filter={filter}
|
||||
filterMethods={
|
||||
currentSpace ? SpaceFilterMethods : MemoriesFilterMethods
|
||||
}
|
||||
/>
|
||||
<button
|
||||
onClick={handleExport}
|
||||
className={`transition px-4 py-2 rounded-lg text-[#B3BCC5] bg-secondary hover:bg-secondary hover:text-[#76a3cc]`}
|
||||
>
|
||||
JSON Export
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<Masonry
|
||||
className="mt-6 relative"
|
||||
columns={{ 640: 1, 768: 2, 1024: 3 }}
|
||||
|
|
@ -280,9 +294,9 @@ function SpaceComponent({
|
|||
handleDeleteSpace: (id: number) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex group flex-col gap-4 bg-[#161f2a]/25 backdrop-blur-md border-[1px] shadow-md border-border w-full rounded-xl p-4">
|
||||
<div className="flex group flex-col gap-4 bg-[#161f2a]/25 backdrop-blur-md border-[1px] shadow-md border-border w-full rounded-xl py-4 px-6">
|
||||
<div className="flex items-center gap-2 text-xs">
|
||||
<Image alt="Spaces icon" src={MemoriesIcon} className="size-3" /> Space
|
||||
<FolderIcon className="h-4" /> Space
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
@ -290,12 +304,7 @@ function SpaceComponent({
|
|||
href={`/space/${id}`}
|
||||
className="flex items-center justify-between w-full"
|
||||
>
|
||||
<div>
|
||||
<div className="h-12 w-12 flex justify-center items-center rounded-md">
|
||||
{title.slice(0, 2).toUpperCase()}{id}
|
||||
</div>
|
||||
</div>
|
||||
<div className="grow px-2">
|
||||
<div className="grow">
|
||||
<div className="text-lg text-[#fff] line-clamp-2">{title}</div>
|
||||
<div>{description}</div>
|
||||
</div>
|
||||
|
|
@ -303,9 +312,12 @@ function SpaceComponent({
|
|||
<Image src={NextIcon} alt="Search icon" />
|
||||
</div>
|
||||
</Link>
|
||||
<div className="absolute z-40 right-3 top-3 opacity-0 group-hover:opacity-100 hover:text-red-600">
|
||||
|
||||
<SpaceDeleteAlert onClick={()=> {handleDeleteSpace(id)}} />
|
||||
<div className="absolute z-40 right-5 top-4 opacity-0 group-hover:opacity-100 hover:text-red-600">
|
||||
<SpaceDeleteAlert
|
||||
onClick={() => {
|
||||
handleDeleteSpace(id);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -344,7 +356,7 @@ function MemoryComponent({
|
|||
{type === "page" ? (
|
||||
<>
|
||||
<div className="flex items-center gap-2 text-xs">
|
||||
<PaperclipIcon className="w-3 h-3" /> Page
|
||||
<DocumentTextIcon className="w-3 h-3" /> Page
|
||||
</div>
|
||||
{/* remove `<---chunkId: ${vector.id}\n${content}\n---->` pattern from title */}
|
||||
<div className="text-lg text-[#fff] mt-4 line-clamp-2">
|
||||
|
|
@ -357,7 +369,7 @@ function MemoryComponent({
|
|||
) : type === "note" ? (
|
||||
<>
|
||||
<div className="flex items-center gap-2 text-xs">
|
||||
<NotebookIcon className="w-3 h-3" /> Note
|
||||
<BookOpenIcon className="h-4" /> Note
|
||||
</div>
|
||||
<div className="text-lg text-[#fff] mt-4 line-clamp-2">
|
||||
{title.replace(/(<---chunkId: .*?\n.*?\n---->)/g, "")}
|
||||
|
|
@ -442,38 +454,48 @@ function Filters({
|
|||
<div className="flex gap-3 flex-wrap">
|
||||
{filterMethods.map((i) => {
|
||||
return (
|
||||
<button
|
||||
onClick={() => setFilter(i)}
|
||||
className={`transition px-4 py-2 shadow-md rounded-lg bg-border ${i === filter ? " text-[#369DFD]" : "text-[#B3BCC5] bg-secondary drop-shadow-md hover:bg-secondary hover:text-[#76a3cc]"}`}
|
||||
>
|
||||
{i}
|
||||
</button>
|
||||
<div className="relative">
|
||||
<button
|
||||
onClick={() => setFilter(i)}
|
||||
className={`transition px-4 py-2 ${i === filter ? " text-[#369DFD]" : "text-[#B3BCC5]"}`}
|
||||
>
|
||||
{i}
|
||||
</button>
|
||||
{i === filter && (
|
||||
<motion.div
|
||||
layoutId="bg"
|
||||
className="bg-secondary shadow-md drop-shadow-md rounded-lg z-[-1] absolute h-full w-full top-0 left-0"
|
||||
></motion.div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SpaceDeleteAlert({onClick}: {onClick: ()=> void}){
|
||||
function SpaceDeleteAlert({ onClick }: { onClick: () => void }) {
|
||||
return (
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger> <TrashIcon
|
||||
className="w-4 cursor-pointer"
|
||||
/></AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
This is irreversible. This will delete the space and all memories inside it.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={onClick}>Delete</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)
|
||||
<AlertDialogTrigger>
|
||||
{" "}
|
||||
<TrashIcon className="w-4 cursor-pointer" />
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
This is irreversible. This will delete the space and all memories
|
||||
inside it.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={onClick}>Delete</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default MemoriesPage;
|
||||
export default MemoriesPage;
|
||||
|
|
|
|||
2
apps/web/next-env.d.ts
vendored
2
apps/web/next-env.d.ts
vendored
|
|
@ -2,4 +2,4 @@
|
|||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import MillionLint from "@million/lint";
|
||||
import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";
|
||||
import pwa from "next-pwa";
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const baseNextConfig = {
|
||||
transpilePackages: ["@repo/ui"],
|
||||
|
|
@ -9,17 +9,10 @@ const baseNextConfig = {
|
|||
TELEGRAM_BOT_TOKEN: process.env.TELEGRAM_BOT_TOKEN,
|
||||
},
|
||||
eslint: {
|
||||
ignoreDuringBuilds: true
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
};
|
||||
|
||||
const withPWA = pwa({
|
||||
dest: "public",
|
||||
disable: process.env.NODE_ENV === "development",
|
||||
register: true,
|
||||
skipWaiting: true,
|
||||
});
|
||||
|
||||
let selectedConfig = baseNextConfig;
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
|
|
@ -28,7 +21,7 @@ if (process.env.NODE_ENV === "development") {
|
|||
})(baseNextConfig);
|
||||
}
|
||||
|
||||
export default withPWA(selectedConfig);
|
||||
export default selectedConfig;
|
||||
|
||||
// we only need to use the utility during development so we can check NODE_ENV
|
||||
// (note: this check is recommended but completely optional)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev": "next dev --turbo",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint . --max-warnings 0",
|
||||
|
|
@ -27,13 +27,12 @@
|
|||
"drizzle-orm": "0.30.0",
|
||||
"lowlight": "^3.1.0",
|
||||
"million": "^3.1.6",
|
||||
"next": "^14.1.1",
|
||||
"next-pwa": "^5.6.0",
|
||||
"next": "15.0.0-canary.112",
|
||||
"novel": "^0.4.2",
|
||||
"nuqs": "^1.17.4",
|
||||
"posthog-js": "^1.154.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "19.0.0-rc-68dbd84b-20240812",
|
||||
"react-dom": "19.0.0-rc-68dbd84b-20240812",
|
||||
"react-resizable-panels": "^2.0.19",
|
||||
"use-debounce": "^10.0.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
"@hookform/resolvers": "^3.4.2",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@langchain/cloudflare": "^0.0.6",
|
||||
"@million/lint": "^1.0.0-rc.81",
|
||||
"@million/lint": "1.0.0-rc.82-beta.39",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@radix-ui/react-accordion": "^1.1.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.1",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ const config = {
|
|||
"./components/**/*.{ts,tsx}",
|
||||
"./app/**/*.{ts,tsx}",
|
||||
"./src/**/*.{ts,tsx}",
|
||||
"../../packages/ui/**/*.{js,ts,jsx,tsx}", // Add the ui package
|
||||
"../../packages/ui/shadcn/**/*.{js,ts,jsx,tsx}",
|
||||
"../../packages/ui/components/**/*.{js,ts,jsx,tsx}",
|
||||
"./content/**/*.{js,ts,jsx,tsx}",
|
||||
"./ui/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
|
|
|
|||
35259
pnpm-lock.yaml
generated
35259
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue