From cfacb94c7492fcdc9e6dd09bf24c91f1adff580f Mon Sep 17 00:00:00 2001 From: Akhileshwar Shriram <112577383+AkhilTheBoss@users.noreply.github.com> Date: Thu, 29 Jan 2026 12:49:57 -0800 Subject: [PATCH 1/3] refactor: changed Benny's description --- client/src/utils/ChatBot.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/ChatBot.tsx b/client/src/utils/ChatBot.tsx index 09bd26f1..c2c491b3 100644 --- a/client/src/utils/ChatBot.tsx +++ b/client/src/utils/ChatBot.tsx @@ -137,7 +137,7 @@ const ChatBot: React.FC = () => { {messages.length === 0 && (

👋 Hi! I'm Benny, your AI assistant.

-

I can search the LibreTexts Knowledge Base and the web to help you!

+

I am here to search the LibreTexts Knowledge Base to help you!

)} From f00a28adf64f39cdf9c7ed862c92a498fcbd0d95 Mon Sep 17 00:00:00 2001 From: Akhileshwar Shriram <112577383+AkhilTheBoss@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:36:56 -0800 Subject: [PATCH 2/3] feat: dynamic kb page embeddings --- server/api/kb.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/server/api/kb.ts b/server/api/kb.ts index eabc0fc9..26d7b26d 100644 --- a/server/api/kb.ts +++ b/server/api/kb.ts @@ -223,6 +223,15 @@ async function createKBPage( lastEditedByUUID: editor.uuid, }); + if (kbPage.status === "published" && kbPage.body) { + try { + await qdrantService.initializeCollection(); + await qdrantService.upsertKBPage(kbPage.toObject()); + } catch (err) { + debugError(err); + } + } + return res.send({ err: false, page: kbPage, @@ -366,6 +375,20 @@ async function updateKBPage( await kbPage.save(); + try { + await qdrantService.initializeCollection(); + + if (kbPage.status === "published" && kbPage.body) { + // Upsert replaces old embedding with new content + await qdrantService.upsertKBPage(kbPage.toObject()); + } else { + // Remove from vector DB if it's no longer published + await qdrantService.deleteKBPage(kbPage.uuid); + } + } catch (err) { + debugError(err); + } + return res.send({ err: false, page: kbPage, @@ -393,6 +416,13 @@ async function deleteKBPage( await KBPage.findOneAndDelete({ uuid }).orFail(); + try { + await qdrantService.initializeCollection(); + await qdrantService.deleteKBPage(uuid); + } catch (err) { + debugError(err); + } + return res.send({ err: false, page, From fac603fff3cbdd20343fa974c89f414796d875d2 Mon Sep 17 00:00:00 2001 From: Akhileshwar Shriram <112577383+AkhilTheBoss@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:43:05 -0800 Subject: [PATCH 3/3] refactor: modified Bennys Prompt to include the fact that if mentioned abt homework it is ADAPT --- server/api/services/prompts.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/api/services/prompts.ts b/server/api/services/prompts.ts index 69160bef..cde8d822 100644 --- a/server/api/services/prompts.ts +++ b/server/api/services/prompts.ts @@ -22,7 +22,9 @@ IMPORTANT: - If a question is not about LibreTexts, politely redirect to our support team - Always cite your sources - If you cannot find relevant information, suggest contacting our support team -- Use "we", "our", and "us" when referring to LibreTexts (e.g., "our support team", "our documentation", "we recommend")`, +- Use "we", "our", and "us" when referring to LibreTexts (e.g., "our support team", "our documentation", "we recommend") +- If a user asks about assignments, questions, or exams, assume they mean LibreTexts' assessment and homework platform, ADAPT. +`, detailed: `You are the official LibreTexts AI Assistant, part of the LibreTexts team, focused exclusively on helping users with our platform questions. @@ -65,7 +67,9 @@ Response guidelines: - Always cite sources with proper attribution - If no relevant information is found, acknowledge limitations and suggest contacting our support team - Be helpful but stay within your LibreTexts-focused scope -- Always use first-person language: "we", "our", "us" when referring to LibreTexts, our team, our documentation, our support, etc.`, +- Always use first-person language: "we", "our", "us" when referring to LibreTexts, our team, our documentation, our support, etc. +- If a user asks about assignments, questions, or exams, assume they mean LibreTexts' assessment and homework platform, ADAPT. +`, concise: `LibreTexts AI Assistant, part of the LibreTexts team. Answer only LibreTexts-related questions using bullet points or numbered lists. Direct other questions to our support team. Always cite sources. Use "we", "our", and "us" when referring to LibreTexts.`, };