diff --git a/examples/mem0-demo/app/assistant.tsx b/examples/mem0-demo/app/assistant.tsx index eb333202..4e2c8b87 100644 --- a/examples/mem0-demo/app/assistant.tsx +++ b/examples/mem0-demo/app/assistant.tsx @@ -6,7 +6,7 @@ import { Thread } from "@/components/assistant-ui/thread"; import { ThreadList } from "@/components/assistant-ui/thread-list"; import { useEffect, useState } from "react"; import { v4 as uuidv4 } from "uuid"; -import { Sun, Moon, MessageSquare } from "lucide-react"; +import { Sun, Moon, AlignJustify } from "lucide-react"; import { Button } from "@/components/ui/button"; import ThemeAwareLogo from "@/components/mem0/theme-aware-logo"; import Link from "next/link"; @@ -63,7 +63,7 @@ export const Assistant = () => { return ( -
+
@@ -71,15 +71,17 @@ export const Assistant = () => {
-
- + + + + +
- -
+
- +
diff --git a/examples/mem0-demo/components/assistant-ui/thread.tsx b/examples/mem0-demo/components/assistant-ui/thread.tsx index 46225b9a..240bfc46 100644 --- a/examples/mem0-demo/components/assistant-ui/thread.tsx +++ b/examples/mem0-demo/components/assistant-ui/thread.tsx @@ -22,9 +22,12 @@ import { SendHorizontalIcon, ArchiveIcon, PlusIcon, + Sun, + Moon, + SaveIcon, } from "lucide-react"; import { cn } from "@/lib/utils"; -import { Dispatch, SetStateAction, useState } from "react"; +import { Dispatch, SetStateAction, useState, useRef } from "react"; import { Button } from "@/components/ui/button"; import { ScrollArea } from "../ui/scroll-area"; import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button"; @@ -42,24 +45,29 @@ import { AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; - +import GithubButton from "../mem0/github-button"; +import Link from "next/link"; interface ThreadProps { sidebarOpen: boolean; setSidebarOpen: Dispatch>; onResetUserId?: () => void; isDarkMode: boolean; + toggleDarkMode: () => void; } export const Thread: FC = ({ sidebarOpen, setSidebarOpen, - onResetUserId + onResetUserId, + isDarkMode, + toggleDarkMode }) => { const [resetDialogOpen, setResetDialogOpen] = useState(false); + const composerInputRef = useRef(null); return ( = ({ {/* Mobile sidebar drawer */}
-

Recent Chats

+

Settings

{onResetUserId && ( = ({
+
+ + + + + + + Save Memories + + +

@@ -158,9 +197,13 @@ export const Thread: FC = ({

- -
- + +
+ + } + /> = ({
-
+
- + + } + />
); @@ -198,57 +245,74 @@ const ThreadScrollToBottom: FC = () => { ); }; -const ThreadWelcome: FC = () => { +interface ThreadWelcomeProps { + composerInputRef: React.RefObject; +} + +const ThreadWelcome: FC = ({ composerInputRef }) => { return ( -
-
+
+
-
+
Mem0 - ChatGPT with memory
-

+

A personalized AI chat app powered by Mem0 that remembers your preferences, facts, and memories.

-
+

How can I help you today?

- +
); }; -const ThreadWelcomeSuggestions: FC = () => { +interface ThreadWelcomeSuggestionsProps { + composerInputRef: React.RefObject; +} + +const ThreadWelcomeSuggestions: FC = ({ composerInputRef }) => { return ( -
+
{ + composerInputRef.current?.focus(); + }} > Travel { + composerInputRef.current?.focus(); + }} > Food { + composerInputRef.current?.focus(); + }} > Project details @@ -258,7 +322,11 @@ const ThreadWelcomeSuggestions: FC = () => { ); }; -const Composer: FC = () => { +interface ComposerProps { + composerInputRef: React.RefObject; +} + +const Composer: FC = ({ composerInputRef }) => { return ( { autoFocus placeholder="Message to Mem0..." className="placeholder:text-zinc-400 dark:placeholder:text-zinc-500 max-h-40 flex-grow resize-none border-none bg-transparent px-2 py-4 text-sm outline-none focus:ring-0 disabled:cursor-not-allowed text-[#1e293b] dark:text-zinc-200" + ref={composerInputRef} /> diff --git a/examples/mem0-demo/components/mem0/github-button.tsx b/examples/mem0-demo/components/mem0/github-button.tsx index a6bcafa6..9f5518c0 100644 --- a/examples/mem0-demo/components/mem0/github-button.tsx +++ b/examples/mem0-demo/components/mem0/github-button.tsx @@ -1,18 +1,18 @@ +import { cn } from "@/lib/utils"; - -const GithubButton = ({ url }: { url: string }) => { +const GithubButton = ({ url, className, text }: { url: string, className?: string, text?: string }) => { return ( { clipRule="evenodd" /> + {text && {text}} ); }; diff --git a/mem0-ts/package.json b/mem0-ts/package.json index bed8587a..9c04f2ee 100644 --- a/mem0-ts/package.json +++ b/mem0-ts/package.json @@ -1,6 +1,6 @@ { "name": "mem0ai", - "version": "2.1.3", + "version": "2.1.4", "description": "The Memory Layer For Your AI Apps", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/mem0-ts/src/client/mem0.ts b/mem0-ts/src/client/mem0.ts index 8cab84da..760b15cf 100644 --- a/mem0-ts/src/client/mem0.ts +++ b/mem0-ts/src/client/mem0.ts @@ -205,6 +205,10 @@ export default class MemoryClient { if (options.project_name) delete options.project_name; } + if (options.api_version) { + options.version = options.api_version.toString(); + } + const payload = this._preparePayload(messages, options); const response = await this._fetchWithErrorHandling( `${this.host}/v1/memories/`, diff --git a/mem0-ts/src/client/mem0.types.ts b/mem0-ts/src/client/mem0.types.ts index 9b2e6211..50ae316c 100644 --- a/mem0-ts/src/client/mem0.types.ts +++ b/mem0-ts/src/client/mem0.types.ts @@ -1,4 +1,6 @@ export interface MemoryOptions { + api_version?: API_VERSION | string; + version?: API_VERSION | string; user_id?: string; agent_id?: string; app_id?: string;