diff options
| author | yxshv <[email protected]> | 2024-04-13 06:27:59 +0530 |
|---|---|---|
| committer | yxshv <[email protected]> | 2024-04-13 06:27:59 +0530 |
| commit | 957e0767ea959dbe7d7395f537eb362f6893fd89 (patch) | |
| tree | efb4f53b90364699b7725b388dd2c60492cf177b /apps | |
| parent | update store route (diff) | |
| parent | proper caching and KV (diff) | |
| download | supermemory-957e0767ea959dbe7d7395f537eb362f6893fd89.tar.xz supermemory-957e0767ea959dbe7d7395f537eb362f6893fd89.zip | |
merge
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/cf-ai-backend/pnpm-lock.yaml | 789 | ||||
| -rw-r--r-- | apps/cf-ai-backend/src/env.d.ts | 1 | ||||
| -rw-r--r-- | apps/cf-ai-backend/src/routes/add.ts | 22 | ||||
| -rw-r--r-- | apps/cf-ai-backend/src/routes/chat.ts | 20 | ||||
| -rw-r--r-- | apps/cf-ai-backend/src/routes/query.ts | 15 | ||||
| -rw-r--r-- | apps/cf-ai-backend/wrangler.toml | 6 | ||||
| -rw-r--r-- | apps/extension/src/SideBar.tsx | 184 | ||||
| -rw-r--r-- | apps/extension/src/components/FilterCombobox.tsx | 185 | ||||
| -rw-r--r-- | apps/extension/src/components/ui/command.tsx | 77 | ||||
| -rw-r--r-- | apps/extension/src/components/ui/dialog.tsx | 57 | ||||
| -rw-r--r-- | apps/extension/src/components/ui/popover.tsx | 18 | ||||
| -rw-r--r-- | apps/extension/src/ext.css | 14 | ||||
| -rw-r--r-- | apps/extension/src/types/memory.ts | 6 | ||||
| -rw-r--r-- | apps/extension/src/util.ts | 2 | ||||
| -rw-r--r-- | apps/extension/tailwind.config.js | 4 | ||||
| -rw-r--r-- | apps/web/package.json | 2 | ||||
| -rw-r--r-- | apps/web/src/app/api/store/route.ts | 12 | ||||
| -rw-r--r-- | apps/web/src/app/content.tsx | 14 | ||||
| -rw-r--r-- | apps/web/src/lib/utils.ts | 1 |
19 files changed, 364 insertions, 1065 deletions
diff --git a/apps/cf-ai-backend/pnpm-lock.yaml b/apps/cf-ai-backend/pnpm-lock.yaml deleted file mode 100644 index 5c85a415..00000000 --- a/apps/cf-ai-backend/pnpm-lock.yaml +++ /dev/null @@ -1,789 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -devDependencies: - '@cloudflare/workers-types': - specifier: ^4.20240222.0 - version: 4.20240222.0 - typescript: - specifier: ^5.0.4 - version: 5.3.3 - wrangler: - specifier: ^3.0.0 - version: 3.29.0(@cloudflare/[email protected]) - -packages: - /@cloudflare/[email protected]: - resolution: { integrity: sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA== } - dependencies: - mime: 3.0.0 - dev: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-64qjsCUz6VtjXnUex5D6dWoJDuUBRw1ps2TEVH9wGJ4ubiLVUxKhj3bzkVy0RoJ8FhaCKzJWWRyTo4yc192UTA== } - engines: { node: '>=16' } - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-eVQrAV200LhwLY6JZLx3l2lDrjsTC86lqnvH+RSeM43bAcdneC6lVfykHnTaOTgYFvYQbqRkn9ICWxXj1V9L5g== } - engines: { node: '>=16' } - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-ivZ2UuCvi44j8JZ++XlQzSYajt5ptvAdwlh3WPpCcygtHXEh6SVo8QXEUOXhPbv861C0HZMYxLCaLqlpQDWB8g== } - engines: { node: '>=16' } - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-aLfvl9kXQKbM7aLvfL0HbOt5VEgv15mEZGyFKyDldJ8+nOXH6nYPma1ccwF8BHmu8otHc420eyPr2xPKhLSJnw== } - engines: { node: '>=16' } - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-Y6KMukWnorsSmPx6d82IuJ4SU8sX1+2y+w1uFJ76sucSgXqUAN1fmjG+EyzRVbcbsxRGBCD9c1Pn8T1amMLEYA== } - engines: { node: '>=16' } - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@cloudflare/[email protected]: - resolution: { integrity: sha512-luO0BdK3rLlCv3B240+cTrfqm+XSbHtpk+88aJtGwzyVK9QF/Xz8lBgE/oZZLN8nCTmOvxAZnszyxUuZ8GP8Cg== } - dev: true - - /@cspotcode/[email protected]: - resolution: { integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== } - engines: { node: '>=12' } - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: true - - /@esbuild-plugins/[email protected]([email protected]): - resolution: { integrity: sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw== } - peerDependencies: - esbuild: '*' - dependencies: - esbuild: 0.17.19 - dev: true - - /@esbuild-plugins/[email protected]([email protected]): - resolution: { integrity: sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA== } - peerDependencies: - esbuild: '*' - dependencies: - esbuild: 0.17.19 - escape-string-regexp: 4.0.0 - rollup-plugin-node-polyfills: 0.2.1 - dev: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== } - engines: { node: '>=12' } - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== } - engines: { node: '>=12' } - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== } - engines: { node: '>=12' } - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== } - engines: { node: '>=12' } - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== } - engines: { node: '>=12' } - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== } - engines: { node: '>=12' } - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== } - engines: { node: '>=12' } - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== } - engines: { node: '>=12' } - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== } - engines: { node: '>=12' } - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== } - engines: { node: '>=12' } - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== } - engines: { node: '>=12' } - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== } - engines: { node: '>=12' } - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== } - engines: { node: '>=12' } - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== } - engines: { node: '>=12' } - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== } - engines: { node: '>=12' } - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== } - engines: { node: '>=12' } - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== } - engines: { node: '>=12' } - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== } - engines: { node: '>=12' } - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== } - engines: { node: '>=12' } - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== } - engines: { node: '>=12' } - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== } - engines: { node: '>=12' } - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/[email protected]: - resolution: { integrity: sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== } - engines: { node: '>=12' } - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@fastify/[email protected]: - resolution: { integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA== } - engines: { node: '>=14' } - dev: true - - /@jridgewell/[email protected]: - resolution: { integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== } - engines: { node: '>=6.0.0' } - dev: true - - /@jridgewell/[email protected]: - resolution: { integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== } - dev: true - - /@jridgewell/[email protected]: - resolution: { integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== } - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - - /@types/[email protected]: - resolution: { integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ== } - dependencies: - '@types/node': 20.11.20 - dev: true - - /@types/[email protected]: - resolution: { integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg== } - dependencies: - undici-types: 5.26.5 - dev: true - - resolution: { integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== } - engines: { node: '>=0.4.0' } - dev: true - - resolution: { integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== } - engines: { node: '>=0.4.0' } - hasBin: true - dev: true - - resolution: { integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== } - engines: { node: '>= 8' } - dependencies: - normalize-path: 3.0.0 - picomatch: 2.3.1 - dev: true - - resolution: { integrity: sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ== } - dependencies: - printable-characters: 1.0.42 - dev: true - - resolution: { integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== } - engines: { node: '>=8' } - dev: true - - resolution: { integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g== } - dev: true - - resolution: { integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== } - engines: { node: '>=8' } - dependencies: - fill-range: 7.0.1 - dev: true - - resolution: { integrity: sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g== } - dependencies: - debug: 4.3.4 - tslib: 2.6.2 - transitivePeerDependencies: - - supports-color - dev: true - - resolution: { integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== } - engines: { node: '>= 8.10.0' } - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - resolution: { integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== } - engines: { node: '>= 0.6' } - dev: true - - resolution: { integrity: sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA== } - dev: true - - resolution: { integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== } - engines: { node: '>=6.0' } - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - - resolution: { integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== } - engines: { node: '>=12' } - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.17.19 - '@esbuild/android-arm64': 0.17.19 - '@esbuild/android-x64': 0.17.19 - '@esbuild/darwin-arm64': 0.17.19 - '@esbuild/darwin-x64': 0.17.19 - '@esbuild/freebsd-arm64': 0.17.19 - '@esbuild/freebsd-x64': 0.17.19 - '@esbuild/linux-arm': 0.17.19 - '@esbuild/linux-arm64': 0.17.19 - '@esbuild/linux-ia32': 0.17.19 - '@esbuild/linux-loong64': 0.17.19 - '@esbuild/linux-mips64el': 0.17.19 - '@esbuild/linux-ppc64': 0.17.19 - '@esbuild/linux-riscv64': 0.17.19 - '@esbuild/linux-s390x': 0.17.19 - '@esbuild/linux-x64': 0.17.19 - '@esbuild/netbsd-x64': 0.17.19 - '@esbuild/openbsd-x64': 0.17.19 - '@esbuild/sunos-x64': 0.17.19 - '@esbuild/win32-arm64': 0.17.19 - '@esbuild/win32-ia32': 0.17.19 - '@esbuild/win32-x64': 0.17.19 - dev: true - - resolution: { integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== } - engines: { node: '>=10' } - dev: true - - resolution: { integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== } - dev: true - - resolution: { integrity: sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw== } - engines: { node: '>=6' } - dev: true - - resolution: { integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== } - engines: { node: '>=8' } - dependencies: - to-regex-range: 5.0.1 - dev: true - - resolution: { integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== } - engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 } - os: [darwin] - requiresBuild: true - dev: true - optional: true - - resolution: { integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== } - dev: true - - resolution: { integrity: sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w== } - dependencies: - data-uri-to-buffer: 2.0.2 - source-map: 0.6.1 - dev: true - - resolution: { integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== } - engines: { node: '>= 6' } - dependencies: - is-glob: 4.0.3 - dev: true - - resolution: { integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== } - dev: true - - resolution: { integrity: sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== } - engines: { node: '>= 0.4' } - dependencies: - function-bind: 1.1.2 - dev: true - - resolution: { integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== } - engines: { node: '>=8' } - dependencies: - binary-extensions: 2.2.0 - dev: true - - resolution: { integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== } - dependencies: - hasown: 2.0.1 - dev: true - - resolution: { integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== } - engines: { node: '>=0.10.0' } - dev: true - - resolution: { integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== } - engines: { node: '>=0.10.0' } - dependencies: - is-extglob: 2.1.1 - dev: true - - resolution: { integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== } - engines: { node: '>=0.12.0' } - dev: true - - resolution: { integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== } - dependencies: - sourcemap-codec: 1.4.8 - dev: true - - resolution: { integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== } - engines: { node: '>=10.0.0' } - hasBin: true - dev: true - - resolution: { integrity: sha512-NnP3MQFh2pV7iETNmJzSlMBF/KhRA+XT4A7JLCfxunadQSPbTMMgbsZo9EfLloMwHMUhZGNVot3Pvh+VnT2joQ== } - engines: { node: '>=16.13' } - hasBin: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - acorn: 8.11.3 - acorn-walk: 8.3.2 - capnp-ts: 0.7.0 - exit-hook: 2.2.1 - glob-to-regexp: 0.4.1 - stoppable: 1.1.0 - undici: 5.28.3 - workerd: 1.20240208.0 - ws: 8.16.0 - youch: 3.3.3 - zod: 3.22.4 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - - resolution: { integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== } - dev: true - - resolution: { integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== } - hasBin: true - dev: true - - resolution: { integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== } - engines: { node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 } - hasBin: true - dev: true - - resolution: { integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== } - engines: { node: '>= 6.13.0' } - dev: true - - resolution: { integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== } - engines: { node: '>=0.10.0' } - dev: true - - resolution: { integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== } - dev: true - - resolution: { integrity: sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw== } - dev: true - - resolution: { integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== } - engines: { node: '>=8.6' } - dev: true - - resolution: { integrity: sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ== } - dev: true - - resolution: { integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== } - engines: { node: '>=8.10.0' } - dependencies: - picomatch: 2.3.1 - dev: true - - resolution: { integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== } - engines: { node: '>=10' } - dev: true - - resolution: { integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== } - hasBin: true - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - - resolution: { integrity: sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w== } - deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. - dependencies: - estree-walker: 0.6.1 - magic-string: 0.25.9 - rollup-pluginutils: 2.8.2 - dev: true - - resolution: { integrity: sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA== } - dependencies: - rollup-plugin-inject: 3.0.2 - dev: true - - resolution: { integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== } - dependencies: - estree-walker: 0.6.1 - dev: true - - resolution: { integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== } - engines: { node: '>=10' } - dependencies: - '@types/node-forge': 1.3.11 - node-forge: 1.3.1 - dev: true - - resolution: { integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== } - engines: { node: '>=0.10.0' } - dev: true - - resolution: { integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== } - deprecated: Please use @jridgewell/sourcemap-codec instead - dev: true - - resolution: { integrity: sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw== } - dependencies: - as-table: 1.0.55 - get-source: 2.0.12 - dev: true - - resolution: { integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== } - engines: { node: '>=4', npm: '>=6' } - dev: true - - resolution: { integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== } - engines: { node: '>= 0.4' } - dev: true - - resolution: { integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== } - engines: { node: '>=8.0' } - dependencies: - is-number: 7.0.0 - dev: true - - resolution: { integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== } - dev: true - - resolution: { integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== } - engines: { node: '>=14.17' } - hasBin: true - dev: true - - resolution: { integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== } - dev: true - - resolution: { integrity: sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA== } - engines: { node: '>=14.0' } - dependencies: - '@fastify/busboy': 2.1.0 - dev: true - - resolution: { integrity: sha512-edFdwHU95Ww2SmjBvBJhbc7hhVXMEo6Y7qqSWCl6W9lGScTlCMCXd4AU3f/EGJ3P++FC+CWqu+XuAywebbKF2Q== } - engines: { node: '>=16' } - hasBin: true - requiresBuild: true - optionalDependencies: - '@cloudflare/workerd-darwin-64': 1.20240208.0 - '@cloudflare/workerd-darwin-arm64': 1.20240208.0 - '@cloudflare/workerd-linux-64': 1.20240208.0 - '@cloudflare/workerd-linux-arm64': 1.20240208.0 - '@cloudflare/workerd-windows-64': 1.20240208.0 - dev: true - - /[email protected](@cloudflare/[email protected]): - resolution: { integrity: sha512-VXUUltM0/fxCF20Z3tH39zpnykDJNPH2lMWI5wA0VmRpuKG0Gffjj5lU2vJaI/PfUCo3q4JErxWcgLezBGnFyA== } - engines: { node: '>=16.17.0' } - hasBin: true - peerDependencies: - '@cloudflare/workers-types': ^4.20230914.0 - peerDependenciesMeta: - '@cloudflare/workers-types': - optional: true - dependencies: - '@cloudflare/kv-asset-handler': 0.3.1 - '@cloudflare/workers-types': 4.20240222.0 - '@esbuild-plugins/node-globals-polyfill': 0.2.3([email protected]) - '@esbuild-plugins/node-modules-polyfill': 0.2.2([email protected]) - blake3-wasm: 2.1.5 - chokidar: 3.6.0 - esbuild: 0.17.19 - miniflare: 3.20240208.0 - nanoid: 3.3.7 - path-to-regexp: 6.2.1 - resolve: 1.22.8 - resolve.exports: 2.0.2 - selfsigned: 2.4.1 - source-map: 0.6.1 - xxhash-wasm: 1.0.2 - optionalDependencies: - fsevents: 2.3.3 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - - resolution: { integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== } - engines: { node: '>=10.0.0' } - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: true - - resolution: { integrity: sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A== } - dev: true - - resolution: { integrity: sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA== } - dependencies: - cookie: 0.5.0 - mustache: 4.2.0 - stacktracey: 2.1.8 - dev: true - - resolution: { integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== } - dev: true diff --git a/apps/cf-ai-backend/src/env.d.ts b/apps/cf-ai-backend/src/env.d.ts index 65def4fd..4d6f675e 100644 --- a/apps/cf-ai-backend/src/env.d.ts +++ b/apps/cf-ai-backend/src/env.d.ts @@ -5,6 +5,7 @@ interface Env { OPENAI_API_KEY: string; GOOGLE_AI_API_KEY: string; MY_QUEUE: Queue<TweetData>; + KV: KVNamespace; } interface TweetData { diff --git a/apps/cf-ai-backend/src/routes/add.ts b/apps/cf-ai-backend/src/routes/add.ts index b9a6da8f..b7fe073a 100644 --- a/apps/cf-ai-backend/src/routes/add.ts +++ b/apps/cf-ai-backend/src/routes/add.ts @@ -1,7 +1,9 @@ import { Request } from '@cloudflare/workers-types'; import { type CloudflareVectorizeStore } from '@langchain/cloudflare'; +import { OpenAIEmbeddings } from '../OpenAIEmbedder'; +import { GenerativeModel } from '@google/generative-ai'; -export async function POST(request: Request, store: CloudflareVectorizeStore) { +export async function POST(request: Request, store: CloudflareVectorizeStore, _: OpenAIEmbeddings, m: GenerativeModel, env: Env) { const body = (await request.json()) as { pageContent: string; title?: string; @@ -16,6 +18,22 @@ export async function POST(request: Request, store: CloudflareVectorizeStore) { } const newPageContent = `Title: ${body.title}\nDescription: ${body.description}\nURL: ${body.url}\nContent: ${body.pageContent}`; + const ourID = `${body.url}-${body.user}`; + + // WHY? Because this helps us to prevent duplicate entries for the same URL and user + function seededRandom(seed: string) { + let x = [...seed].reduce((acc, cur) => acc + cur.charCodeAt(0), 0); + return () => { + x = (x * 9301 + 49297) % 233280; + return x / 233280; + }; + } + + const random = seededRandom(ourID); + const uuid = random().toString(36).substring(2, 15) + random().toString(36).substring(2, 15); + + await env.KV.put(uuid, ourID); + await store.addDocuments( [ { @@ -30,7 +48,7 @@ export async function POST(request: Request, store: CloudflareVectorizeStore) { }, ], { - ids: [`${body.url}-${body.user}`], + ids: [uuid], }, ); diff --git a/apps/cf-ai-backend/src/routes/chat.ts b/apps/cf-ai-backend/src/routes/chat.ts index 185bb3a6..7603667f 100644 --- a/apps/cf-ai-backend/src/routes/chat.ts +++ b/apps/cf-ai-backend/src/routes/chat.ts @@ -62,12 +62,26 @@ export async function POST(request: Request, _: CloudflareVectorizeStore, embedd // return new Response(JSON.stringify({ message: "No Results Found" }), { status: 404 }); // } - const highScoreIds = responses.matches.filter(({ score }) => score > 0.4).map(({ id }) => id); + const highScoreIds = responses.matches.filter(({ score }) => score > 0.35).map(({ id }) => id); console.log('highscoreIds', highScoreIds); if (sourcesOnly === 'true') { - return new Response(JSON.stringify({ ids: highScoreIds }), { status: 200 }); + // Try await env.KV.get(id) for each id in a Promise.all + const idsAsStrings = highScoreIds.map(String); + + const storedContent = await Promise.all( + idsAsStrings.map(async (id) => { + const stored = await env!.KV.get(id); + if (stored) { + return stored; + } + return id; + }), + ); + + console.log(storedContent); + return new Response(JSON.stringify({ ids: storedContent }), { status: 200 }); } const vec = await env!.VECTORIZE_INDEX.getByIds(highScoreIds); @@ -102,7 +116,7 @@ export async function POST(request: Request, _: CloudflareVectorizeStore, embedd history: [...defaultHistory, ...(body.chatHistory ?? [])], }); - const prompt = `Context:\n${preparedContext}\n\nQuestion: ${query}\nAnswer:`; + const prompt = `Context:\n${preparedContext ?? ''}\n\nQuestion: ${query}\nAnswer:`; const output = await chat.sendMessageStream(prompt); diff --git a/apps/cf-ai-backend/src/routes/query.ts b/apps/cf-ai-backend/src/routes/query.ts index cd5295c5..090dfbb0 100644 --- a/apps/cf-ai-backend/src/routes/query.ts +++ b/apps/cf-ai-backend/src/routes/query.ts @@ -42,7 +42,20 @@ export async function GET(request: Request, _: CloudflareVectorizeStore, embeddi const highScoreIds = resp.matches.filter(({ score }) => score > 0.3).map(({ id }) => id); if (sourcesOnly === 'true') { - return new Response(JSON.stringify({ ids: highScoreIds }), { status: 200 }); + const idsAsStrings = highScoreIds.map(String); + + const storedContent = await Promise.all( + idsAsStrings.map(async (id) => { + const stored = await env!.KV.get(id); + if (stored) { + return stored; + } + return id; + }), + ); + + console.log(storedContent); + return new Response(JSON.stringify({ ids: storedContent }), { status: 200 }); } const vec = await env!.VECTORIZE_INDEX.getByIds(highScoreIds); diff --git a/apps/cf-ai-backend/wrangler.toml b/apps/cf-ai-backend/wrangler.toml index 9a9effb6..6ef02af0 100644 --- a/apps/cf-ai-backend/wrangler.toml +++ b/apps/cf-ai-backend/wrangler.toml @@ -4,7 +4,7 @@ compatibility_date = "2024-02-23" [[vectorize]] binding = "VECTORIZE_INDEX" -index_name = "any-vector" +index_name = "supermem-vector" [ai] binding = "AI" @@ -13,6 +13,10 @@ binding = "AI" queue = "batch-vector-queue" binding = "MY_QUEUE" +[[kv_namespaces]] +binding = "KV" +id = "37a90353da63401e84e20e71165531d0" + # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables) # Note: Use secrets to store sensitive data. # Docs: https://developers.cloudflare.com/workers/platform/environment-variables diff --git a/apps/extension/src/SideBar.tsx b/apps/extension/src/SideBar.tsx index 20d54cde..890619ca 100644 --- a/apps/extension/src/SideBar.tsx +++ b/apps/extension/src/SideBar.tsx @@ -7,8 +7,17 @@ import { TooltipProvider, TooltipTrigger, } from "./components/ui/tooltip"; -import { FilterSpaces } from "./components/FilterCombobox" -import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogTrigger, DialogFooter, DialogClose } from "./components/ui/dialog"; +import { FilterSpaces } from "./components/FilterCombobox"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogDescription, + DialogTrigger, + DialogFooter, + DialogClose, +} from "./components/ui/dialog"; function sendUrlToAPI() { // get the current URL @@ -41,7 +50,7 @@ function SideBar() { const [isSendingData, setIsSendingData] = useState(false); - const [selectedSpaces, setSelectedSpaces] = useState<number[]>([0,1]) + const [selectedSpaces, setSelectedSpaces] = useState<number[]>([0, 1]); interface TweetData { tweetText: string; @@ -154,9 +163,7 @@ function SideBar() { {window.location.href.includes("twitter.com") || window.location.href.includes("x.com") ? ( <Tooltip delayDuration={300}> - <TooltipTrigger - className="anycontext-bg-transparent anycontext-border-none anycontext-m-0 anycontext-p-0" - > + <TooltipTrigger className="anycontext-bg-transparent anycontext-border-none anycontext-m-0 anycontext-p-0"> <button onClick={() => { if (window.location.href.endsWith("/i/bookmarks/all")) { @@ -198,87 +205,98 @@ function SideBar() { ) : ( <></> )} - <Dialog> - <Tooltip delayDuration={300}> - <TooltipTrigger - className="anycontext-bg-transparent + <Dialog> + <Tooltip delayDuration={300}> + <TooltipTrigger + className="anycontext-bg-transparent anycontext-border-none anycontext-m-0 anycontext-p-0 " - > - <DialogTrigger asChild> - <button - onClick={() => { - return - sendUrlToAPI(); - setIsSendingData(true); - setTimeout(() => { - setIsSendingData(false); - setSavedWebsites([...savedWebsites, window.location.href]); - }, 1000); - }} - disabled={savedWebsites.includes(window.location.href)} - className="anycontext-open-button disabled:anycontext-opacity-30 anycontext-bg-transparent + > + <DialogTrigger asChild> + <button + onClick={() => { + sendUrlToAPI(); + setIsSendingData(true); + setTimeout(() => { + setIsSendingData(false); + setSavedWebsites([ + ...savedWebsites, + window.location.href, + ]); + }, 1000); + }} + disabled={savedWebsites.includes(window.location.href)} + className="anycontext-open-button disabled:anycontext-opacity-30 anycontext-bg-transparent anycontext-border-none anycontext-m-0 anycontext-p-0" - > - {savedWebsites.includes(window.location.href) ? ( - <svg - xmlns="http://www.w3.org/2000/svg" - width="24" - height="24" - viewBox="0 0 24 24" - fill="none" - stroke="currentColor" - strokeWidth="2" - strokeLinecap="round" - strokeLinejoin="round" - className="lucide lucide-file-check-2" - > - <path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4" /> - <path d="M14 2v4a2 2 0 0 0 2 2h4" /> - <path d="m3 15 2 2 4-4" /> - </svg> - ) : ( - <svg - xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 20 20" - fill="currentColor" - className={`anycontext-w-5 anycontext-h-5 ${isSendingData ? "anycontext-animate-spin" : ""}`} - > - <path d="M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684ZM13.949 13.684a1 1 0 0 0-1.898 0l-.184.551a1 1 0 0 1-.632.633l-.551.183a1 1 0 0 0 0 1.898l.551.183a1 1 0 0 1 .633.633l.183.551a1 1 0 0 0 1.898 0l.184-.551a1 1 0 0 1 .632-.633l.551-.183a1 1 0 0 0 0-1.898l-.551-.184a1 1 0 0 1-.633-.632l-.183-.551Z" /> - </svg> - )} - </button> - </DialogTrigger> - </TooltipTrigger> - <TooltipContent className="anycontext-p-0" side="left"> - <p className="anycontext-p-0 anycontext-m-0"> - {savedWebsites.includes(window.location.href) - ? "Added to memory" - : "Add to memory"} - </p> - </TooltipContent> - </Tooltip> - <DialogContent> - <DialogHeader> - <DialogTitle>Add to Memory</DialogTitle> - <DialogDescription> - Add the current page to memory - </DialogDescription> - </DialogHeader> + > + {savedWebsites.includes(window.location.href) ? ( + <svg + xmlns="http://www.w3.org/2000/svg" + width="24" + height="24" + viewBox="0 0 24 24" + fill="none" + stroke="currentColor" + strokeWidth="2" + strokeLinecap="round" + strokeLinejoin="round" + className="lucide lucide-file-check-2" + > + <path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4" /> + <path d="M14 2v4a2 2 0 0 0 2 2h4" /> + <path d="m3 15 2 2 4-4" /> + </svg> + ) : ( + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 20 20" + fill="currentColor" + className={`anycontext-w-5 anycontext-h-5 ${isSendingData ? "anycontext-animate-spin" : ""}`} + > + <path d="M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684ZM13.949 13.684a1 1 0 0 0-1.898 0l-.184.551a1 1 0 0 1-.632.633l-.551.183a1 1 0 0 0 0 1.898l.551.183a1 1 0 0 1 .633.633l.183.551a1 1 0 0 0 1.898 0l.184-.551a1 1 0 0 1 .632-.633l.551-.183a1 1 0 0 0 0-1.898l-.551-.184a1 1 0 0 1-.633-.632l-.183-.551Z" /> + </svg> + )} + </button> + </DialogTrigger> + </TooltipTrigger> + <TooltipContent className="anycontext-p-0" side="left"> + <p className="anycontext-p-0 anycontext-m-0"> + {savedWebsites.includes(window.location.href) + ? "Added to memory" + : "Add to memory"} + </p> + </TooltipContent> + </Tooltip> + <DialogContent> + <DialogHeader> + <DialogTitle>Add to Memory</DialogTitle> + <DialogDescription> + Add the current page to memory + </DialogDescription> + </DialogHeader> - <FilterSpaces className='anycontext-mr-auto' selectedSpaces={selectedSpaces} setSelectedSpaces={setSelectedSpaces} name={"Add to Spaces"} spaces={[{ - name: "cool tech", - id: 0, - }, { - name: "cool libs", - id: 1, - }]} /> - <DialogFooter className="anycontext-w-full anycontext-text-sm"> - <DialogClose>Add</DialogClose> - <DialogClose>Cancel</DialogClose> - </DialogFooter> - </DialogContent> - </Dialog> + <FilterSpaces + className="anycontext-mr-auto" + selectedSpaces={selectedSpaces} + setSelectedSpaces={setSelectedSpaces} + name={"Add to Spaces"} + spaces={[ + { + name: "cool tech", + id: 0, + }, + { + name: "cool libs", + id: 1, + }, + ]} + /> + <DialogFooter className="anycontext-w-full anycontext-text-sm"> + <DialogClose>Add</DialogClose> + <DialogClose>Cancel</DialogClose> + </DialogFooter> + </DialogContent> + </Dialog> </div> </TooltipProvider> </> diff --git a/apps/extension/src/components/FilterCombobox.tsx b/apps/extension/src/components/FilterCombobox.tsx index 254cb0e1..f6215c03 100644 --- a/apps/extension/src/components/FilterCombobox.tsx +++ b/apps/extension/src/components/FilterCombobox.tsx @@ -15,7 +15,7 @@ import { PopoverContent, PopoverTrigger, } from "../components/ui/popover"; -import { Space } from "../types/memory" +import { Space } from "../types/memory"; export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> { side?: "top" | "bottom"; @@ -26,10 +26,9 @@ export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> { spaces: number[] | ((prev: number[]) => number[]), ) => void; name: string; - spaces: Space[]; + spaces: Space[]; } - export function FilterSpaces({ className, side = "bottom", @@ -38,12 +37,12 @@ export function FilterSpaces({ selectedSpaces, setSelectedSpaces, name, - spaces, + spaces, ...props }: Props) { const [open, setOpen] = React.useState(false); - console.log(selectedSpaces, spaces) + console.log(selectedSpaces, spaces); const sortedSpaces = spaces.sort(({ id: a }, { id: b }) => selectedSpaces.includes(a) && !selectedSpaces.includes(b) @@ -59,100 +58,98 @@ export function FilterSpaces({ } }, [open]); - return ( - <div className="anycontext-flex anycontext-flex-wrap anycontext-gap-1 anycontext-text-sm anycontext-"> - {selectedSpaces.map(spaceid => { - const space = spaces.find(s => s.id === spaceid)! - return (<SpaceItem {...space} key={spaceid} onRemove={() => {}} />) - })} - </div> - ) + return ( + <div className="anycontext-flex anycontext-flex-wrap anycontext-gap-1 anycontext-text-sm anycontext-"> + {selectedSpaces.map((spaceid) => { + const space = spaces.find((s) => s.id === spaceid)!; + return <SpaceItem {...space} key={spaceid} onRemove={() => {}} />; + })} + </div> + ); return ( - <Popover open={open} onOpenChange={setOpen}> - <PopoverTrigger asChild> - <button - type={undefined} - data-state-on={open} - className={cn( - "anycontext-combobox-button anycontext-w-fit", - className, - )} - {...props} - > - {name} - <ChevronsUpDown className="anycontext-h-4 anycontext-w-4" /> - <div - data-state-on={selectedSpaces.length > 0} - className="on:anycontext-flex anycontext-text-rgray-11 anycontext-border-rgray-6 anycontext-bg-rgray-2 anycontext-absolute anycontext-left-0 anycontext-top-0 anycontext-hidden anycontext-aspect-[1] anycontext-h-4 anycontext-w-4 anycontext--translate-x-1/3 anycontext--translate-y-1/3 anycontext-items-center anycontext-justify-center anycontext-rounded-full anycontext-border anycontext-text-center anycontext-text-[9px]" - > - {selectedSpaces.length} - </div> - </button> - </PopoverTrigger> - <PopoverContent - onCloseAutoFocus={(e) => e.preventDefault()} - align={align} - side={side} - className="anycontext-w-[200px] anycontext-p-0" + <Popover open={open} onOpenChange={setOpen}> + <PopoverTrigger asChild> + <button + type={undefined} + data-state-on={open} + className={cn( + "anycontext-combobox-button anycontext-w-fit", + className, + )} + {...props} + > + {name} + <ChevronsUpDown className="anycontext-h-4 anycontext-w-4" /> + <div + data-state-on={selectedSpaces.length > 0} + className="on:anycontext-flex anycontext-text-rgray-11 anycontext-border-rgray-6 anycontext-bg-rgray-2 anycontext-absolute anycontext-left-0 anycontext-top-0 anycontext-hidden anycontext-aspect-[1] anycontext-h-4 anycontext-w-4 anycontext--translate-x-1/3 anycontext--translate-y-1/3 anycontext-items-center anycontext-justify-center anycontext-rounded-full anycontext-border anycontext-text-center anycontext-text-[9px]" > - <Command - filter={(val, search) => - spaces - .find((s) => s.id.toString() === val) - ?.name.toLowerCase() - .includes(search.toLowerCase().trim()) - ? 1 - : 0 - } - > - <CommandInput placeholder="Filter spaces..." /> - <CommandList asChild> - <div> - <CommandEmpty>Nothing found</CommandEmpty> - <CommandGroup> - {sortedSpaces.map((space) => ( - <CommandItem - key={space.id} - value={space.id.toString()} - onSelect={(val) => { - setSelectedSpaces((prev: number[]) => - prev.includes(parseInt(val)) - ? prev.filter((v) => v !== parseInt(val)) - : [...prev, parseInt(val)], - ); - }} - asChild - > - <div - className="anycontext-text-black/90 dark:anycontext-text-white/90" - > - {space.name} - <Check - data-state-on={selectedSpaces.includes(space.id)} - className={cn( - "on:anycontext-opacity-100 anycontext-ml-auto anycontext-h-4 anycontext-w-4 anycontext-opacity-0", - )} - /> - </div> - </CommandItem> - ))} - </CommandGroup> - </div> - </CommandList> - </Command> - </PopoverContent> - </Popover> + {selectedSpaces.length} + </div> + </button> + </PopoverTrigger> + <PopoverContent + onCloseAutoFocus={(e) => e.preventDefault()} + align={align} + side={side} + className="anycontext-w-[200px] anycontext-p-0" + > + <Command + filter={(val, search) => + spaces + .find((s) => s.id.toString() === val) + ?.name.toLowerCase() + .includes(search.toLowerCase().trim()) + ? 1 + : 0 + } + > + <CommandInput placeholder="Filter spaces..." /> + <CommandList asChild> + <div> + <CommandEmpty>Nothing found</CommandEmpty> + <CommandGroup> + {sortedSpaces.map((space) => ( + <CommandItem + key={space.id} + value={space.id.toString()} + onSelect={(val) => { + setSelectedSpaces((prev: number[]) => + prev.includes(parseInt(val)) + ? prev.filter((v) => v !== parseInt(val)) + : [...prev, parseInt(val)], + ); + }} + asChild + > + <div className="anycontext-text-black/90 dark:anycontext-text-white/90"> + {space.name} + <Check + data-state-on={selectedSpaces.includes(space.id)} + className={cn( + "on:anycontext-opacity-100 anycontext-ml-auto anycontext-h-4 anycontext-w-4 anycontext-opacity-0", + )} + /> + </div> + </CommandItem> + ))} + </CommandGroup> + </div> + </CommandList> + </Command> + </PopoverContent> + </Popover> ); } function SpaceItem({ name, onRemove }: { onRemove: () => void } & Space) { - return ( - <div className="anycontext-flex anycontext-justify-center anycontext-items-center anycontext-gap-2 anycontext-p-1 anycontext-pl-2 anycontext-pr-3 anycontext-rounded-full anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-border-white/20 dark:anycontext-border-black/20 border"> - <button className="anycontext-flex hover:anycontext-bg-transparent anycontext-justify-center anycontext-scale-110 anycontext-items-center focus-visible:anycontext-outline-none anycontext-rounded-full anycontext-w-3 anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-h-3 anycontext-text-transparent hover:anycontext-text-black dark:hover:anycontext-text-white"> - <X className="anycontext-w-3 anycontext-h-3" /> - </button> - {name} - </div> - ) + return ( + <div className="anycontext-flex anycontext-justify-center anycontext-items-center anycontext-gap-2 anycontext-p-1 anycontext-pl-2 anycontext-pr-3 anycontext-rounded-full anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-border-white/20 dark:anycontext-border-black/20 border"> + <button className="anycontext-flex hover:anycontext-bg-transparent anycontext-justify-center anycontext-scale-110 anycontext-items-center focus-visible:anycontext-outline-none anycontext-rounded-full anycontext-w-3 anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-h-3 anycontext-text-transparent hover:anycontext-text-black dark:hover:anycontext-text-white"> + <X className="anycontext-w-3 anycontext-h-3" /> + </button> + {name} + </div> + ); } diff --git a/apps/extension/src/components/ui/command.tsx b/apps/extension/src/components/ui/command.tsx index 27ae9b96..858b67f4 100644 --- a/apps/extension/src/components/ui/command.tsx +++ b/apps/extension/src/components/ui/command.tsx @@ -1,10 +1,10 @@ -import * as React from "react" -import { type DialogProps } from "@radix-ui/react-dialog" -import { Command as CommandPrimitive } from "cmdk" -import { Search } from "lucide-react" +import * as React from "react"; +import { type DialogProps } from "@radix-ui/react-dialog"; +import { Command as CommandPrimitive } from "cmdk"; +import { Search } from "lucide-react"; -import { cn } from "../../lib/utils" -import { Dialog, DialogContent } from "../../components/ui/dialog" +import { cn } from "../../lib/utils"; +import { Dialog, DialogContent } from "../../components/ui/dialog"; const Command = React.forwardRef< React.ElementRef<typeof CommandPrimitive>, @@ -14,12 +14,12 @@ const Command = React.forwardRef< ref={ref} className={cn( "anycontext-flex anycontext-h-full anycontext-w-full anycontext-flex-col anycontext-overflow-hidden anycontext-rounded-md anycontext-bg-white anycontext-text-stone-950 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className + className, )} {...props} /> -)) -Command.displayName = CommandPrimitive.displayName +)); +Command.displayName = CommandPrimitive.displayName; interface CommandDialogProps extends DialogProps {} @@ -32,27 +32,30 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => { </Command> </DialogContent> </Dialog> - ) -} + ); +}; const CommandInput = React.forwardRef< React.ElementRef<typeof CommandPrimitive.Input>, React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> >(({ className, ...props }, ref) => ( - <div className="anycontext-flex anycontext-items-center anycontext-border-b anycontext-px-3" cmdk-input-wrapper=""> + <div + className="anycontext-flex anycontext-items-center anycontext-border-b anycontext-px-3" + cmdk-input-wrapper="" + > <Search className="anycontext-mr-2 anycontext-h-4 anycontext-w-4 anycontext-shrink-0 anycontext-opacity-50" /> <CommandPrimitive.Input ref={ref} className={cn( "anycontext-flex anycontext-h-11 anycontext-w-full anycontext-rounded-md anycontext-bg-transparent anycontext-py-3 anycontext-text-sm anycontext-outline-none placeholder:anycontext-text-stone-500 disabled:anycontext-cursor-not-allowed disabled:anycontext-opacity-50 dark:placeholder:anycontext-text-stone-400", - className + className, )} {...props} /> </div> -)) +)); -CommandInput.displayName = CommandPrimitive.Input.displayName +CommandInput.displayName = CommandPrimitive.Input.displayName; const CommandList = React.forwardRef< React.ElementRef<typeof CommandPrimitive.List>, @@ -60,12 +63,15 @@ const CommandList = React.forwardRef< >(({ className, ...props }, ref) => ( <CommandPrimitive.List ref={ref} - className={cn("anycontext-max-h-[300px] anycontext-overflow-y-auto anycontext-overflow-x-hidden", className)} + className={cn( + "anycontext-max-h-[300px] anycontext-overflow-y-auto anycontext-overflow-x-hidden", + className, + )} {...props} /> -)) +)); -CommandList.displayName = CommandPrimitive.List.displayName +CommandList.displayName = CommandPrimitive.List.displayName; const CommandEmpty = React.forwardRef< React.ElementRef<typeof CommandPrimitive.Empty>, @@ -76,9 +82,9 @@ const CommandEmpty = React.forwardRef< className="anycontext-py-6 anycontext-text-center anycontext-text-sm" {...props} /> -)) +)); -CommandEmpty.displayName = CommandPrimitive.Empty.displayName +CommandEmpty.displayName = CommandPrimitive.Empty.displayName; const CommandGroup = React.forwardRef< React.ElementRef<typeof CommandPrimitive.Group>, @@ -88,13 +94,13 @@ const CommandGroup = React.forwardRef< ref={ref} className={cn( "anycontext-overflow-hidden anycontext-p-1 anycontext-text-stone-950 [&_[cmdk-group-heading]]:anycontext-px-2 [&_[cmdk-group-heading]]:anycontext-py-1.5 [&_[cmdk-group-heading]]:anycontext-text-xs [&_[cmdk-group-heading]]:anycontext-font-medium [&_[cmdk-group-heading]]:anycontext-text-stone-500 dark:anycontext-text-stone-50 dark:[&_[cmdk-group-heading]]:anycontext-text-stone-400", - className + className, )} {...props} /> -)) +)); -CommandGroup.displayName = CommandPrimitive.Group.displayName +CommandGroup.displayName = CommandPrimitive.Group.displayName; const CommandSeparator = React.forwardRef< React.ElementRef<typeof CommandPrimitive.Separator>, @@ -102,11 +108,14 @@ const CommandSeparator = React.forwardRef< >(({ className, ...props }, ref) => ( <CommandPrimitive.Separator ref={ref} - className={cn("anycontext--mx-1 anycontext-h-px anycontext-bg-stone-200 dark:anycontext-bg-stone-800", className)} + className={cn( + "anycontext--mx-1 anycontext-h-px anycontext-bg-stone-200 dark:anycontext-bg-stone-800", + className, + )} {...props} /> -)) -CommandSeparator.displayName = CommandPrimitive.Separator.displayName +)); +CommandSeparator.displayName = CommandPrimitive.Separator.displayName; const CommandItem = React.forwardRef< React.ElementRef<typeof CommandPrimitive.Item>, @@ -116,13 +125,13 @@ const CommandItem = React.forwardRef< ref={ref} className={cn( "anycontext-relative anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-px-2 anycontext-py-1.5 anycontext-text-sm anycontext-outline-none aria-selected:anycontext-bg-stone-100 aria-selected:anycontext-text-stone-900 data-[disabled]:anycontext-pointer-events-none data-[disabled]:anycontext-opacity-50 dark:aria-selected:anycontext-bg-stone-800 dark:aria-selected:anycontext-text-stone-50", - className + className, )} {...props} /> -)) +)); -CommandItem.displayName = CommandPrimitive.Item.displayName +CommandItem.displayName = CommandPrimitive.Item.displayName; const CommandShortcut = ({ className, @@ -132,13 +141,13 @@ const CommandShortcut = ({ <span className={cn( "anycontext-ml-auto anycontext-text-xs anycontext-tracking-widest anycontext-text-stone-500 dark:anycontext-text-stone-400", - className + className, )} {...props} /> - ) -} -CommandShortcut.displayName = "CommandShortcut" + ); +}; +CommandShortcut.displayName = "CommandShortcut"; export { Command, @@ -150,4 +159,4 @@ export { CommandItem, CommandShortcut, CommandSeparator, -} +}; diff --git a/apps/extension/src/components/ui/dialog.tsx b/apps/extension/src/components/ui/dialog.tsx index 2f8dcb69..583c335d 100644 --- a/apps/extension/src/components/ui/dialog.tsx +++ b/apps/extension/src/components/ui/dialog.tsx @@ -1,16 +1,16 @@ -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import { X } from "lucide-react" +import * as React from "react"; +import * as DialogPrimitive from "@radix-ui/react-dialog"; +import { X } from "lucide-react"; -import { cn } from "../../lib/utils" +import { cn } from "../../lib/utils"; -const Dialog = DialogPrimitive.Root +const Dialog = DialogPrimitive.Root; -const DialogTrigger = DialogPrimitive.Trigger +const DialogTrigger = DialogPrimitive.Trigger; -const DialogPortal = DialogPrimitive.Portal +const DialogPortal = DialogPrimitive.Portal; -const DialogClose = DialogPrimitive.Close +const DialogClose = DialogPrimitive.Close; const DialogOverlay = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Overlay>, @@ -20,12 +20,12 @@ const DialogOverlay = React.forwardRef< ref={ref} className={cn( "anycontext-fixed anycontext-inset-0 anycontext-z-50 anycontext-bg-black/80 anycontext- data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0", - className + className, )} {...props} /> -)) -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; const DialogContent = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Content>, @@ -37,7 +37,7 @@ const DialogContent = React.forwardRef< ref={ref} className={cn( "anycontext-text-black dark:anycontext-text-white anycontext-fixed anycontext-left-[50%] anycontext-top-[50%] anycontext-z-50 anycontext-grid anycontext-w-full anycontext-max-w-lg anycontext-translate-x-[-50%] anycontext-translate-y-[-50%] anycontext-gap-4 anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-6 anycontext-shadow-lg anycontext-duration-200 data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[state=closed]:anycontext-slide-out-to-left-1/2 data-[state=closed]:anycontext-slide-out-to-top-[48%] data-[state=open]:anycontext-slide-in-from-left-1/2 data-[state=open]:anycontext-slide-in-from-top-[48%] sm:anycontext-rounded-lg dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950", - className + className, )} {...props} > @@ -48,8 +48,8 @@ const DialogContent = React.forwardRef< </DialogPrimitive.Close> </DialogPrimitive.Content> </DialogPortal> -)) -DialogContent.displayName = DialogPrimitive.Content.displayName +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, @@ -58,12 +58,12 @@ const DialogHeader = ({ <div className={cn( "anycontext-flex anycontext-flex-col anycontext-space-y-1.5 anycontext-text-center sm:anycontext-text-left", - className + className, )} {...props} /> -) -DialogHeader.displayName = "DialogHeader" +); +DialogHeader.displayName = "DialogHeader"; const DialogFooter = ({ className, @@ -72,12 +72,12 @@ const DialogFooter = ({ <div className={cn( "anycontext-flex anycontext-flex-col-reverse sm:anycontext-flex-row sm:anycontext-justify-end sm:anycontext-space-x-2", - className + className, )} {...props} /> -) -DialogFooter.displayName = "DialogFooter" +); +DialogFooter.displayName = "DialogFooter"; const DialogTitle = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Title>, @@ -87,12 +87,12 @@ const DialogTitle = React.forwardRef< ref={ref} className={cn( "anycontext-text-lg anycontext-font-semibold anycontext-leading-none anycontext-tracking-tight", - className + className, )} {...props} /> -)) -DialogTitle.displayName = DialogPrimitive.Title.displayName +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Description>, @@ -100,11 +100,14 @@ const DialogDescription = React.forwardRef< >(({ className, ...props }, ref) => ( <DialogPrimitive.Description ref={ref} - className={cn("anycontext-text-sm anycontext-text-stone-500 dark:anycontext-text-stone-400", className)} + className={cn( + "anycontext-text-sm anycontext-text-stone-500 dark:anycontext-text-stone-400", + className, + )} {...props} /> -)) -DialogDescription.displayName = DialogPrimitive.Description.displayName +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, @@ -117,4 +120,4 @@ export { DialogFooter, DialogTitle, DialogDescription, -} +}; diff --git a/apps/extension/src/components/ui/popover.tsx b/apps/extension/src/components/ui/popover.tsx index beda5d46..e1b9282d 100644 --- a/apps/extension/src/components/ui/popover.tsx +++ b/apps/extension/src/components/ui/popover.tsx @@ -1,11 +1,11 @@ -import * as React from "react" -import * as PopoverPrimitive from "@radix-ui/react-popover" +import * as React from "react"; +import * as PopoverPrimitive from "@radix-ui/react-popover"; -import { cn } from "../../lib/utils" +import { cn } from "../../lib/utils"; -const Popover = PopoverPrimitive.Root +const Popover = PopoverPrimitive.Root; -const PopoverTrigger = PopoverPrimitive.Trigger +const PopoverTrigger = PopoverPrimitive.Trigger; const PopoverContent = React.forwardRef< React.ElementRef<typeof PopoverPrimitive.Content>, @@ -18,12 +18,12 @@ const PopoverContent = React.forwardRef< sideOffset={sideOffset} className={cn( "anycontext-z-50 anycontext-w-72 anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-4 anycontext-text-stone-950 anycontext-shadow-md anycontext-outline-none data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[side=bottom]:anycontext-slide-in-from-top-2 data-[side=left]:anycontext-slide-in-from-right-2 data-[side=right]:anycontext-slide-in-from-left-2 data-[side=top]:anycontext-slide-in-from-bottom-2 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className + className, )} {...props} /> </PopoverPrimitive.Portal> -)) -PopoverContent.displayName = PopoverPrimitive.Content.displayName +)); +PopoverContent.displayName = PopoverPrimitive.Content.displayName; -export { Popover, PopoverTrigger, PopoverContent } +export { Popover, PopoverTrigger, PopoverContent }; diff --git a/apps/extension/src/ext.css b/apps/extension/src/ext.css index 5ea84318..bf7a4156 100644 --- a/apps/extension/src/ext.css +++ b/apps/extension/src/ext.css @@ -3,13 +3,13 @@ @tailwind utilities; .anycontext-combobox-button { - padding: 0.5rem 1rem; - display: flex; - flex-direction: row; - justify-items: center; - align-items: center; - gap: 0.5rem; - @apply anycontext-rounded-md dark:anycontext-bg-white/5 anycontext-bg-black/5; + padding: 0.5rem 1rem; + display: flex; + flex-direction: row; + justify-items: center; + align-items: center; + gap: 0.5rem; + @apply anycontext-rounded-md dark:anycontext-bg-white/5 anycontext-bg-black/5; } .anycontext-overlay { diff --git a/apps/extension/src/types/memory.ts b/apps/extension/src/types/memory.ts index 83a7f00f..03ffb848 100644 --- a/apps/extension/src/types/memory.ts +++ b/apps/extension/src/types/memory.ts @@ -1,4 +1,4 @@ export type Space = { - id: number; - name: string; -} + id: number; + name: string; +}; diff --git a/apps/extension/src/util.ts b/apps/extension/src/util.ts index d2ea35d3..0b73b6c8 100644 --- a/apps/extension/src/util.ts +++ b/apps/extension/src/util.ts @@ -9,5 +9,5 @@ export const getEnv = () => { // }) // return null - return "production"; + return "development"; }; diff --git a/apps/extension/tailwind.config.js b/apps/extension/tailwind.config.js index 6fbe85ed..ed971842 100644 --- a/apps/extension/tailwind.config.js +++ b/apps/extension/tailwind.config.js @@ -35,9 +35,7 @@ export default { }, }, }, - plugins: [ - tailwindcssAnimate, - ], + plugins: [tailwindcssAnimate], corePlugins: { preflight: false, }, diff --git a/apps/web/package.json b/apps/web/package.json index 3141a243..4fd421db 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -26,7 +26,7 @@ "cmdk": "latest", "framer-motion": "^11.0.24", "lucide-react": "^0.338.0", - "next": "14.1.0", + "next": "14.2.0", "novel": "0.1.22", "react": "^18", "react-dom": "^18", diff --git a/apps/web/src/app/api/store/route.ts b/apps/web/src/app/api/store/route.ts index fd2bc520..d592bc53 100644 --- a/apps/web/src/app/api/store/route.ts +++ b/apps/web/src/app/api/store/route.ts @@ -1,5 +1,5 @@ import { db } from "@/server/db"; -import { and, eq, inArray } from "drizzle-orm"; +import { and, eq, sql, inArray } from "drizzle-orm"; import { contentToSpace, sessions, @@ -78,6 +78,15 @@ export async function POST(req: NextRequest) { storeToSpaces = []; } + const count = await db + .select({ + count: sql<number>`count(*)`.mapWith(Number), + }) + .from(storedContent) + .where(eq(storedContent.user, session.user.id)); + + console.log("count", count[0].count); + const { id } = (await db.insert(storedContent).values({ content: data.pageContent, title: metadata.title, @@ -120,6 +129,7 @@ export async function POST(req: NextRequest) { ])) as Response; if (res.status !== 200) { + console.log(res.status, res.statusText); return NextResponse.json( { message: "Error", error: "Error in CF function" }, { status: 500 }, diff --git a/apps/web/src/app/content.tsx b/apps/web/src/app/content.tsx index 50e0617c..effd06e0 100644 --- a/apps/web/src/app/content.tsx +++ b/apps/web/src/app/content.tsx @@ -8,11 +8,13 @@ export default function Content({ jwt }: { jwt: string }) { const [selectedItem, setSelectedItem] = useState<string | null>(null); return ( - <SessionProvider> - <div className="flex w-screen"> - <Sidebar jwt={jwt} selectChange={setSelectedItem} /> - <Main sidebarOpen={selectedItem !== null} /> - </div> - </SessionProvider> + <div> + <SessionProvider> + <div className="flex w-screen"> + <Sidebar jwt={jwt} selectChange={setSelectedItem} /> + <Main sidebarOpen={selectedItem !== null} /> + </div> + </SessionProvider> + </div> ); } diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index f7e6d3be..f50b526d 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -19,6 +19,7 @@ export function cleanUrl(url: string) { } export function getIdsFromSource(sourceIds: string[]) { + console.log(sourceIds); return sourceIds.map((id) => { const parts = id.split("-"); if (parts.length > 1) { |