From 499757968361bc8e92083f105f86582dc5cd9116 Mon Sep 17 00:00:00 2001 From: Sreeram Sreedhar Date: Tue, 21 Apr 2026 16:09:23 -0700 Subject: [PATCH] fixed eslint --- apps/docs/integrations/convex.mdx | 34 +++++++++---------- packages/tools/src/convex-component/README.md | 34 +++++++++---------- .../src/convex-component/src/react/index.tsx | 26 +++++++------- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/apps/docs/integrations/convex.mdx b/apps/docs/integrations/convex.mdx index 28ce7fcd..11622f35 100644 --- a/apps/docs/integrations/convex.mdx +++ b/apps/docs/integrations/convex.mdx @@ -46,18 +46,18 @@ npx convex env set SUPERMEMORY_API_KEY your-api-key ```tsx - import { addMemory, searchMemories } from "@supermemory/convex-component/react"; + import { useAddMemory, useSupermemorySearch } from "@supermemory/convex-component/react"; function ChatApp() { - const add = addMemory(); - const { results, isLoading, search } = searchMemories({ + const addMemory = useAddMemory(); + const { results, isLoading, search } = useSupermemorySearch({ q: "user preferences", containerTag: "user_123", searchMode: "hybrid" }); const handleSendMessage = async (message: string) => { - await add({ + await addMemory({ content: message, containerTag: "user_123" }); @@ -112,14 +112,14 @@ npx convex env set SUPERMEMORY_API_KEY your-api-key ## React Hooks -### `addMemory()` +### `useAddMemory()` -Add memories to Supermemory through a Convex action. +Hook to add memories to Supermemory through a Convex action. ```tsx -const add = addMemory(); +const addMemory = useAddMemory(); -await add({ +await addMemory({ content: "Meeting notes from Q1 planning", containerTag: "user_123", customId: "meeting_2024_q1", @@ -127,12 +127,12 @@ await add({ }); ``` -### `searchMemories(args)` +### `useSupermemorySearch(args)` -Reactive semantic search with loading and error states. +Hook for reactive semantic search with loading and error states. ```tsx -const { results, isLoading, error, search } = searchMemories({ +const { results, isLoading, error, search } = useSupermemorySearch({ q: "project updates", containerTag: "user_123", searchMode: "hybrid", @@ -143,12 +143,12 @@ const { results, isLoading, error, search } = searchMemories({ await search({ q: "new query", containerTag: "user_123" }); ``` -### `getProfile(args)` +### `useSupermemoryProfile(args)` -Get user profile with static and dynamic facts. +Hook to get user profile with static and dynamic facts. ```tsx -const { profile, isLoading, refresh } = getProfile({ +const { profile, isLoading, refresh } = useSupermemoryProfile({ containerTag: "user_123", q: "recent preferences" }); @@ -157,12 +157,12 @@ const { profile, isLoading, refresh } = getProfile({ await refresh(); ``` -### `listMemories(args)` +### `useMemories(args)` -List memories by container tag and source. +Hook to list memories by container tag and source. ```tsx -const memories = listMemories({ +const memories = useMemories({ containerTag: "user_123", source: "manual", // "chat" | "document" | "manual" limit: 50 diff --git a/packages/tools/src/convex-component/README.md b/packages/tools/src/convex-component/README.md index 4008f433..45f01dc7 100644 --- a/packages/tools/src/convex-component/README.md +++ b/packages/tools/src/convex-component/README.md @@ -54,11 +54,11 @@ npx convex env set SUPERMEMORY_API_KEY your-api-key #### React/Next.js with Hooks ```tsx -import { addMemory, searchMemories } from "@supermemory/convex-component/react"; +import { useAddMemory, useSupermemorySearch } from "@supermemory/convex-component/react"; function ChatApp() { - const add = addMemory(); - const { results, isLoading, search } = searchMemories({ + const addMemory = useAddMemory(); + const { results, isLoading, search } = useSupermemorySearch({ q: "user preferences", containerTag: "user_123", searchMode: "hybrid" @@ -66,7 +66,7 @@ function ChatApp() { const handleSendMessage = async (message: string) => { // Add to memory - await add({ + await addMemory({ content: `User: ${message}`, containerTag: "user_123" }); @@ -127,14 +127,14 @@ console.log("Dynamic context:", profile.profile.dynamic); ### React Hooks -#### `addMemory(componentPath?)` +#### `useAddMemory(componentPath?)` -Add memories to Supermemory. +Hook to add memories to Supermemory. ```tsx -const add = addMemory(); +const addMemory = useAddMemory(); -await add({ +await addMemory({ content: "Meeting notes from Q1 planning", containerTag: "user_123", customId: "meeting_2024_q1", @@ -142,12 +142,12 @@ await add({ }); ``` -#### `searchMemories(args, componentPath?)` +#### `useSupermemorySearch(args, componentPath?)` -Search Supermemory with reactive results. +Hook for reactive semantic search with loading and error states. ```tsx -const { results, isLoading, error, search } = searchMemories({ +const { results, isLoading, error, search } = useSupermemorySearch({ q: "project updates", containerTag: "user_123", searchMode: "hybrid", @@ -158,12 +158,12 @@ const { results, isLoading, error, search } = searchMemories({ await search({ q: "new query", containerTag: "user_123" }); ``` -#### `getProfile(args, componentPath?)` +#### `useSupermemoryProfile(args, componentPath?)` -Get user profile with context. +Hook to get user profile with static and dynamic facts. ```tsx -const { profile, isLoading, refresh } = getProfile({ +const { profile, isLoading, refresh } = useSupermemoryProfile({ containerTag: "user_123", q: "recent preferences" }); @@ -172,12 +172,12 @@ const { profile, isLoading, refresh } = getProfile({ await refresh(); ``` -#### `listMemories(args, componentPath?)` +#### `useMemories(args, componentPath?)` -List memories reactively. Includes content and extracted memories. +Hook to list memories reactively. Includes content and extracted memories. ```tsx -const memories = listMemories({ containerTag: "user_123", limit: 20 }); +const memories = useMemories({ containerTag: "user_123", limit: 20 }); return (
diff --git a/packages/tools/src/convex-component/src/react/index.tsx b/packages/tools/src/convex-component/src/react/index.tsx index 4baffe75..4ca8578d 100644 --- a/packages/tools/src/convex-component/src/react/index.tsx +++ b/packages/tools/src/convex-component/src/react/index.tsx @@ -20,17 +20,17 @@ import type { */ /** - * Add memories to Supermemory + * Hook to add memories to Supermemory * * @example * ```tsx * function ChatApp() { - * const add = addMemory(); - * await add({ content: "Hello", containerTag: "user_123" }); + * const addMemory = useAddMemory(); + * await addMemory({ content: "Hello", containerTag: "user_123" }); * } * ``` */ -export function addMemory(componentPath = "supermemory") { +export function useAddMemory(componentPath = "supermemory") { const action = `${componentPath}:actions.add` as unknown as FunctionReference<"action"> const addAction = useAction(action) @@ -44,16 +44,16 @@ export function addMemory(componentPath = "supermemory") { } /** - * Search Supermemory with reactive results + * Hook for reactive semantic search with loading and error states * * @example * ```tsx - * const { results, isLoading, search } = searchMemories({ + * const { results, isLoading, search } = useSupermemorySearch({ * q: "typescript", containerTag: "user_123" * }); * ``` */ -export function searchMemories( +export function useSupermemorySearch( args: SearchMemoriesArgs | null, componentPath = "supermemory", ) { @@ -88,16 +88,16 @@ export function searchMemories( } /** - * Get user profile + * Hook to get user profile with static and dynamic facts * * @example * ```tsx - * const { profile, isLoading, refresh } = getProfile({ + * const { profile, isLoading, refresh } = useSupermemoryProfile({ * containerTag: "user_123" * }); * ``` */ -export function getProfile( +export function useSupermemoryProfile( args: ProfileArgs | null, componentPath = "supermemory", ) { @@ -132,15 +132,15 @@ export function getProfile( } /** - * List memories reactively + * Hook to list memories reactively * * @example * ```tsx - * const memories = listMemories({ containerTag: "user_123" }); + * const memories = useMemories({ containerTag: "user_123" }); * // memories includes content + extractedMemories for each entry * ``` */ -export function listMemories( +export function useMemories( args: { containerTag: string source?: "chat" | "document" | "manual"