Skip to content

Commit 53e1a20

Browse files
authored
Ai agent in- Memory saver to custom sqlite saver(#3)
* feat: AI assistant with streaming chat,in memory context with agentcheckpoint and sqlite db for storing chat history * index on ai-agent: cf8bac5 Merge remote-tracking branch 'upstream/ai-agent' into ai-agent * refactor: switch from MemorySaver to custom SQLiteSaver * clean up * Update from Agent in- Memory saver to custom sqlite saver * Bug fix; removed async operations from db transactions * linting
1 parent 672fbbd commit 53e1a20

File tree

3 files changed

+731
-204
lines changed

3 files changed

+731
-204
lines changed

src/pages/aiAssistant/assistant.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { isAIMessageChunk } from "@langchain/core/messages";
22
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
3-
import { MemorySaver } from "@langchain/langgraph-checkpoint";
43
import { createReactAgent } from "@langchain/langgraph/prebuilt";
54
import confirm from "dialogs/confirm";
65
import select from "dialogs/select";
@@ -18,6 +17,7 @@ import {
1817
getMessagesForConversation,
1918
updateConversation,
2019
} from "./db";
20+
import { CordovaSqliteSaver } from "./memory";
2121
import { SYSTEM_PROMPT } from "./system_prompt";
2222
import { allTools } from "./tools";
2323

@@ -39,7 +39,10 @@ export default function openAIAssistantPage() {
3939

4040
const GEMINI_API_KEY = ""; // Replace
4141

42-
const agentCheckpointer = new MemorySaver();
42+
const searchTool = {
43+
googleSearch: {},
44+
};
45+
const agentCheckpointer = new CordovaSqliteSaver();
4346
const model = new ChatGoogleGenerativeAI({
4447
model: "gemini-2.0-flash",
4548
apiKey: GEMINI_API_KEY,

0 commit comments

Comments
 (0)