repo stringlengths 5 53 | pr_number int32 1 321k | task_type stringclasses 2
values | issue_text stringlengths 0 81.2k | pr_title stringlengths 1 319 | pr_body stringlengths 0 105k | base_sha stringlengths 40 40 | head_sha stringlengths 40 40 | gold_diff stringlengths 0 202M | changed_files listlengths 0 100 | review_threads listlengths 0 100 | test_patch stringlengths 0 23.4M | merged bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | i18n? | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "i18n?",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"react\";\n+import {\n+ Question,\n+ ArrowLeft,\n+ ArrowRight,\n+ X,\n+ SkipForward,\n+ C... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | i18n? | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/HistoricalClarifyingQuestions/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/HistoricalClarifyingQuestions/index.jsx
new file mode 100644
index 00000000000..bb7c1351e66
--- /dev/... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/HistoricalClarifyingQuestions/index.jsx"
] | [
{
"comment": "i18n?",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/HistoricalClarifyingQuestions/index.jsx",
"hunk": "@@ -0,0 +1,105 @@\n+import { Question } from \"@phosphor-icons/react\";\n+import { useTranslation } from \"react-i18next\";\n+\n+/**\n+ * Re... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | i18n? | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/server/utils/helpers/chat/responses.js b/server/utils/helpers/chat/responses.js
index 92585bc6a92..ff1f65469a7 100644
--- a/server/utils/helpers/chat/responses.js
+++ b/server/utils/helpers/chat/responses.js
@@ -203,6 +203,9 @@ function convertToChatHistory(history = []) {
feedbackScore,
... | [
"server/utils/helpers/chat/responses.js"
] | [
{
"comment": "i18n?",
"path": "server/utils/helpers/chat/responses.js",
"hunk": "@@ -158,13 +158,49 @@ function convertToChatHistory(history = []) {\n feedbackScore,\n metrics: data?.metrics || {},\n ...(data?.outputs?.length > 0 ? { outputs: data.outputs } : {}),\n+ ...(d... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Seems like this logic is repeated in a few places. Let's extract this into a util to help clean this up. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Seems like this logic is repeated in a few places. Let's extract this into a util to help clean this up. ",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } f... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Check the `ToolApprovalRequest` component. There is already timer logic there that does almost the exact same thing. Let's extract that logic to a hook called something like `useTimeoutProgress(timeoutMs, { onTimeout })` so that we can reuse it in both places (and more places in the future). | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Check the `ToolApprovalRequest` component. There is already timer logic there that does almost the exact same thing. Let's extract that logic to a hook called something like `useTimeoutProgress(timeoutMs, { onTimeout })` so that we can reuse it in both places (and more places in the future).",
... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Nit: rename this component to `ClarifyingQuestionCard` since it renders the multiple question card. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Nit: rename this component to `ClarifyingQuestionCard` since it renders the multiple question card.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Split this into a subcomponent file of `ClarifiyingQuestion` since this component file is very large. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Split this into a subcomponent file of `ClarifiyingQuestion` since this component file is very large.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from ... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Split this into a subcomponent of `ClarifyingQuestion` as well. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Split this into a subcomponent of `ClarifyingQuestion` as well.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"react\";\n+import {\n+ Question,\n+... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Split to subcomponent. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Split to subcomponent.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"react\";\n+import {\n+ Question,\n+ ArrowLeft,\n+ ArrowRight,\n+ X,\n+ S... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Split to subcomponent. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Split to subcomponent.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"react\";\n+import {\n+ Question,\n+ ArrowLeft,\n+ ArrowRight,\n+ X,\n+ S... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Split to subcomponent. | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx
new file mode 100644
index 00000000000..2f9da686519
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatConta... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx"
] | [
{
"comment": "Split to subcomponent.",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ClarifyingQuestion/index.jsx",
"hunk": "@@ -0,0 +1,539 @@\n+import { useEffect, useMemo, useRef, useState } from \"react\";\n+import {\n+ Question,\n+ ArrowLeft,\n+ ArrowRight,\n+ X,\n+ S... | true | ||
Mintplex-Labs/anything-llm | 5,577 | comment_to_fix | Agent Skill: User Survey | Instead of doing this, we can add some new methods to the `server/utils/agents/aibitat/index.js` similar to `addCitation`, `addToolAttachment`, or `clearCitations`.
I'd suggest adding a `addClarifyingQuestionSurvey()` to `server/utils/agents/aibitat/index.js` and a matching `clearClarifyingQuestionSurveys()`so that it... | 4e324105bb9d3b3bd73aded669e0a9e81e26dc9f | 4311effd5f34183dcf8ded66bad28e83ae49f94a | diff --git a/server/utils/agents/aibitat/plugins/request-user-input.js b/server/utils/agents/aibitat/plugins/request-user-input.js
new file mode 100644
index 00000000000..13c176d4ff2
--- /dev/null
+++ b/server/utils/agents/aibitat/plugins/request-user-input.js
@@ -0,0 +1,265 @@
+const { SystemSettings } = require("../.... | [
"server/utils/agents/aibitat/plugins/request-user-input.js"
] | [
{
"comment": "Instead of doing this, we can add some new methods to the `server/utils/agents/aibitat/index.js` similar to `addCitation`, `addToolAttachment`, or `clearCitations`.\n\nI'd suggest adding a `addClarifyingQuestionSurvey()` to `server/utils/agents/aibitat/index.js` and a matching `clearClarifyingQues... | true | ||
Mintplex-Labs/anything-llm | 5,669 | issue_to_patch | 5577 i18n | Translations for #5577 | 4ec83250b8c45f081433d3f962f4109f1032637b | 84e0b1188fe2a7dfe381e29fd86fb00e0889aefd | diff --git a/frontend/src/locales/ar/common.js b/frontend/src/locales/ar/common.js
index 6047523c084..2c96e00cb09 100644
--- a/frontend/src/locales/ar/common.js
+++ b/frontend/src/locales/ar/common.js
@@ -748,6 +748,17 @@ const TRANSLATIONS = {
"الحد الأقصى لعدد الأدوات التي يمكن اختيارها لكل استعلام. ونوص... | [
"frontend/src/locales/ar/common.js",
"frontend/src/locales/ca/common.js",
"frontend/src/locales/cs/common.js",
"frontend/src/locales/da/common.js",
"frontend/src/locales/de/common.js",
"frontend/src/locales/es/common.js",
"frontend/src/locales/et/common.js",
"frontend/src/locales/fa/common.js",
"fro... | [] | true | ||
Mintplex-Labs/anything-llm | 5,324 | issue_to_patch | [FEAT]: Model router
### What would you like to see?
- Build an intelligent prompt routing layer that intercepts user prompts before they reach LLM to dynamically select the model that would provide the best result for the costs
- Main idea is to use calculated (deterministic) rules such as: keyword triggers, token c... | Model router | ### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [x] ✨ feat (New feature)
- [ ] 🐛 fix (Bug fix)
- [ ] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [ ] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Relevant I... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/README.md b/README.md
index d055bb37c5a..899e0104c88 100644
--- a/README.md
+++ b/README.md
@@ -55,8 +55,9 @@ AnythingLLM supports multiple users as well where you can control the access and
## Cool Features of AnythingLLM
-- [Automatic & User Managed Memories](https://docs.anythingllm.com/features/me... | [
"README.md",
"frontend/src/components/LLMSelection/ModelRouterOptions/index.jsx",
"frontend/src/components/SettingsSidebar/MenuOption/index.jsx",
"frontend/src/components/SettingsSidebar/index.jsx",
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/ModelRouteNotification/index.jsx",
"fronte... | [
{
"comment": "i18n",
"path": "frontend/src/pages/GeneralSettings/LLMPreference/index.jsx",
"hunk": "@@ -85,6 +86,15 @@ import { CaretUpDown, MagnifyingGlass, X } from \"@phosphor-icons/react\";\n import CTAButton from \"@/components/lib/CTAButton\";\n \n export const AVAILABLE_LLM_PROVIDERS = [\n+ {\n+... | true | |
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | i18n | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
index 1f060a8279f..cefd768db31 100644
--- a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
+++ b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
@@ -44,6 +44,7 @@ i... | [
"frontend/src/pages/GeneralSettings/LLMPreference/index.jsx"
] | [
{
"comment": "i18n",
"path": "frontend/src/pages/GeneralSettings/LLMPreference/index.jsx",
"hunk": "@@ -85,6 +86,15 @@ import { CaretUpDown, MagnifyingGlass, X } from \"@phosphor-icons/react\";\n import CTAButton from \"@/components/lib/CTAButton\";\n \n export const AVAILABLE_LLM_PROVIDERS = [\n+ {\n+... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | i18n? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
index 1f060a8279f..cefd768db31 100644
--- a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
+++ b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
@@ -44,6 +44,7 @@ i... | [
"frontend/src/pages/GeneralSettings/LLMPreference/index.jsx"
] | [
{
"comment": "i18n?",
"path": "frontend/src/pages/GeneralSettings/LLMPreference/index.jsx",
"hunk": "@@ -85,6 +86,15 @@ import { CaretUpDown, MagnifyingGlass, X } from \"@phosphor-icons/react\";\n import CTAButton from \"@/components/lib/CTAButton\";\n \n export const AVAILABLE_LLM_PROVIDERS = [\n+ {\n... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Right now this code hits the database once to get all the routers, then loops through each one and hits the database twice more, once for rules and once for workspace count. You can get all of that in a single query using Prisma's `_coun`t:
You could put this in a model method.
```js
try {
const routers = await p... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "Right now this code hits the database once to get all the routers, then loops through each one and hits the database twice more, once for rules and once for workspace count. You can get all of that in a single query using Prisma's `_coun`t:\n\nYou could put this in a model method.\n\n```js\ntry {\... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | is this a relation to `user` ? Could we call it user and add a relationship to user? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma
index 7b160a5397f..65cfd6ca2a8 100644
--- a/server/prisma/schema.prisma
+++ b/server/prisma/schema.prisma
@@ -139,6 +139,7 @@ model workspaces {
agentModel String?
queryRefusalResponse String?
vectorSearchMode ... | [
"server/prisma/schema.prisma"
] | [
{
"comment": "is this a relation to `user` ? Could we call it user and add a relationship to user?",
"path": "server/prisma/schema.prisma",
"hunk": "@@ -394,3 +396,40 @@ model external_communication_connectors {\n createdAt DateTime @default(now())\n lastUpdatedAt DateTime @default(now())\n }\n+... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Checking a string match for this contraint error is brittle, prisma offers ways to check for this:
```js
const { Prisma } = require("@prisma/client");
// ...
} catch (error) {
console.error(error.message);
if (
error instanceof Prisma.PrismaClientKnownRequestError &&
error.code === "P2002"
) {
retur... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouter.js b/server/models/modelRouter.js
new file mode 100644
index 00000000000..2e4fb40b0b4
--- /dev/null
+++ b/server/models/modelRouter.js
@@ -0,0 +1,259 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { ModelRouterRule } = require(... | [
"server/models/modelRouter.js"
] | [
{
"comment": "Checking a string match for this contraint error is brittle, prisma offers ways to check for this:\n\n```js\nconst { Prisma } = require(\"@prisma/client\");\n\n// ...\n} catch (error) {\n console.error(error.message);\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n erro... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | These 2 calls get paired a lot. You could execute both operations in one db call with a clever prisma query and just put it inside one model method | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "These 2 calls get paired a lot. You could execute both operations in one db call with a clever prisma query and just put it inside one model method",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | no need to call `end()` after `sendStatus()`. `sendStatus` ends the response. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "no need to call `end()` after `sendStatus()`. `sendStatus` ends the response.",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\");\n+const ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | no need to call `end()` after `sendStatus()`. `sendStatus` ends the response. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "no need to call `end()` after `sendStatus()`. `sendStatus` ends the response.",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\");\n+const ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | update operation would be a `put` or `patch` | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "update operation would be a `put` or `patch`",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\");\n+const { reqBody, userFromSession } = re... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | can the error field on the return object be `error` instead of `message` to be more clear? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouter.js b/server/models/modelRouter.js
new file mode 100644
index 00000000000..2e4fb40b0b4
--- /dev/null
+++ b/server/models/modelRouter.js
@@ -0,0 +1,259 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { ModelRouterRule } = require(... | [
"server/models/modelRouter.js"
] | [
{
"comment": "can the error field on the return object be `error` instead of `message` to be more clear?",
"path": "server/models/modelRouter.js",
"hunk": "@@ -0,0 +1,201 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const ModelRouter = {\n+ validations: {\n+ name: (value) => {\n+ if (... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | This should prob be broken into two responses. If an error happened while trying to update it shouldn't return a 200 response.
something like
```js
const { router, error } = await ModelRouter.update(Number(id), data);
if(error) {
response.status(400).json({ router, error });
} | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "This should prob be broken into two responses. If an error happened while trying to update it shouldn't return a 200 response.\n\nsomething like\n```js\n const { router, error } = await ModelRouter.update(Number(id), data);\n\nif(error) {\n response.status(400).json({ router, error });\n}",
... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Same thing here, errors shouldnt respond with a 200. break out into two response paths. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "Same thing here, errors shouldnt respond with a 200. break out into two response paths.",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\")... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | pretty sure this is redundant and can be removed, schema already handles this when you delete a model router a workspace has a relation to. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouter.js b/server/models/modelRouter.js
new file mode 100644
index 00000000000..2e4fb40b0b4
--- /dev/null
+++ b/server/models/modelRouter.js
@@ -0,0 +1,259 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { ModelRouterRule } = require(... | [
"server/models/modelRouter.js"
] | [
{
"comment": "pretty sure this is redundant and can be removed, schema already handles this when you delete a model router a workspace has a relation to.",
"path": "server/models/modelRouter.js",
"hunk": "@@ -0,0 +1,201 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const ModelRouter = {\n+ val... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Question:
I notice all routes are prefixed with `/admin` and the file that mounts all `/admin` endpoints is in `endpoints/admin.js` Should this be moved there for consistency? Maybe these ednpoints shouldn't even be prefixed with this parent route at all? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "Question:\n\nI notice all routes are prefixed with `/admin` and the file that mounts all `/admin` endpoints is in `endpoints/admin.js` Should this be moved there for consistency? Maybe these ednpoints shouldn't even be prefixed with this parent route at all?",
"path": "server/endpoints/modelRo... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Same thing here, errors shouldnt respond with a 200. break out into two response paths. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "Same thing here, errors shouldnt respond with a 200. break out into two response paths.",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\")... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | this should be an error code | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "this should be an error code",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\");\n+const { reqBody, userFromSession } = require(\"../utils... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | can the error field on the return object be `error` instead of `message` to be more clear? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouterRule.js b/server/models/modelRouterRule.js
new file mode 100644
index 00000000000..d40f4035cac
--- /dev/null
+++ b/server/models/modelRouterRule.js
@@ -0,0 +1,336 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { safeJsonParse } ... | [
"server/models/modelRouterRule.js"
] | [
{
"comment": "can the error field on the return object be `error` instead of `message` to be more clear?",
"path": "server/models/modelRouterRule.js",
"hunk": "@@ -0,0 +1,279 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const VALID_TYPES = [\"calculated\", \"llm\"];\n+const VALID_PROPERTIES = ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | There's more Prisma-y ways to catch these specific error types that are better than string matching. You can look them up.
e.g
```js
const { PrismaClientKnownRequestError } = require("@prisma/client/runtime/library");
// a unique constraint was violated
if (e instanceof PrismaClientKnownRequestError && e.code === "P2... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouterRule.js b/server/models/modelRouterRule.js
new file mode 100644
index 00000000000..d40f4035cac
--- /dev/null
+++ b/server/models/modelRouterRule.js
@@ -0,0 +1,336 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { safeJsonParse } ... | [
"server/models/modelRouterRule.js"
] | [
{
"comment": "There's more Prisma-y ways to catch these specific error types that are better than string matching. You can look them up.\ne.g\n\n```js\nconst { PrismaClientKnownRequestError } = require(\"@prisma/client/runtime/library\");\n\n// a unique constraint was violated\nif (e instanceof PrismaClientKnow... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Same thing here, errors shouldnt respond with a 200. break out into two response paths. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/endpoints/modelRouter.js b/server/endpoints/modelRouter.js
new file mode 100644
index 00000000000..62724bec361
--- /dev/null
+++ b/server/endpoints/modelRouter.js
@@ -0,0 +1,204 @@
+const { ModelRouter } = require("../models/modelRouter");
+const { ModelRouterRule } = require("../models/modelRouterR... | [
"server/endpoints/modelRouter.js"
] | [
{
"comment": "Same thing here, errors shouldnt respond with a 200. break out into two response paths.",
"path": "server/endpoints/modelRouter.js",
"hunk": "@@ -0,0 +1,193 @@\n+const { ModelRouter } = require(\"../models/modelRouter\");\n+const { ModelRouterRule } = require(\"../models/modelRouterRule\")... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Same here, could check for official prisma constraint errors. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouterRule.js b/server/models/modelRouterRule.js
new file mode 100644
index 00000000000..d40f4035cac
--- /dev/null
+++ b/server/models/modelRouterRule.js
@@ -0,0 +1,336 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { safeJsonParse } ... | [
"server/models/modelRouterRule.js"
] | [
{
"comment": "Same here, could check for official prisma constraint errors.",
"path": "server/models/modelRouterRule.js",
"hunk": "@@ -0,0 +1,279 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const VALID_TYPES = [\"calculated\", \"llm\"];\n+const VALID_PROPERTIES = [\n+ \"promptContent\",\n+ ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | good idea with the transaction here 👍 | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouterRule.js b/server/models/modelRouterRule.js
new file mode 100644
index 00000000000..d40f4035cac
--- /dev/null
+++ b/server/models/modelRouterRule.js
@@ -0,0 +1,336 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { safeJsonParse } ... | [
"server/models/modelRouterRule.js"
] | [
{
"comment": "good idea with the transaction here 👍 ",
"path": "server/models/modelRouterRule.js",
"hunk": "@@ -0,0 +1,279 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const VALID_TYPES = [\"calculated\", \"llm\"];\n+const VALID_PROPERTIES = [\n+ \"promptContent\",\n+ \"conversationTokenCou... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | this update handler is pretty busy, I see a lot of repetition that could be refactored to be less loc.
An example:
```js
const VALID_PROPERTIES = [
"promptContent",
"conversationTokenCount",
"conversationMessageCount",
"currentHour",
"hasImageAttachment",
];
const VALID_COMPARATORS = [
"contains",
"gt",... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouterRule.js b/server/models/modelRouterRule.js
new file mode 100644
index 00000000000..d40f4035cac
--- /dev/null
+++ b/server/models/modelRouterRule.js
@@ -0,0 +1,336 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { safeJsonParse } ... | [
"server/models/modelRouterRule.js"
] | [
{
"comment": "this update handler is pretty busy, I see a lot of repetition that could be refactored to be less loc.\n\nAn example:\n\n```js\nconst VALID_PROPERTIES = [\n \"promptContent\",\n \"conversationTokenCount\",\n \"conversationMessageCount\",\n \"currentHour\",\n \"hasImageAttachment\",\n];\nconst... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | consider `resolvedProvider`. I think that's a clearer name and consistent wording across codebase. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/utils/chats/stream.js b/server/utils/chats/stream.js
index b384c75807e..ee053c76762 100644
--- a/server/utils/chats/stream.js
+++ b/server/utils/chats/stream.js
@@ -51,10 +51,37 @@ async function streamChatWithWorkspace(
});
if (isAgentChat) return;
- const LLMConnector = getLLMProvider({
-... | [
"server/utils/chats/stream.js"
] | [
{
"comment": "consider `resolvedProvider`. I think that's a clearer name and consistent wording across codebase.",
"path": "server/utils/chats/stream.js",
"hunk": "@@ -51,10 +51,75 @@ async function streamChatWithWorkspace(\n });\n if (isAgentChat) return;\n \n- const LLMConnector = getLLMProvider(... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Are any of these methods ever invoked? In `stream.js`, `LLMConnector` gets assigned to `router.delegateProvider` which is the actual provider instance. These methods are never invoked anywhere?
Unless im unaware of something, i dont think the `delegateProvider` ref is necesarry. You could just return the provider dir... | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/utils/AiProviders/modelRouter/index.js b/server/utils/AiProviders/modelRouter/index.js
new file mode 100644
index 00000000000..d54d3d9d1a9
--- /dev/null
+++ b/server/utils/AiProviders/modelRouter/index.js
@@ -0,0 +1,170 @@
+const { ModelRouterService } = require("../../router");
+const { getLLMProvi... | [
"server/utils/AiProviders/modelRouter/index.js"
] | [
{
"comment": "Are any of these methods ever invoked? In `stream.js`, `LLMConnector` gets assigned to `router.delegateProvider` which is the actual provider instance. These methods are never invoked anywhere? \n\nUnless im unaware of something, i dont think the `delegateProvider` ref is necesarry. You could just... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | As I mentioned in my server-side comment on the LLM classification file, since the fallback provider is being used for route classification, it would be helpful to surface that information to the user. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/pages/GeneralSettings/ModelRouters/LLMProviderModelPicker/index.jsx b/frontend/src/pages/GeneralSettings/ModelRouters/LLMProviderModelPicker/index.jsx
new file mode 100644
index 00000000000..f275a54541b
--- /dev/null
+++ b/frontend/src/pages/GeneralSettings/ModelRouters/LLMProviderModelPicker/... | [
"frontend/src/pages/GeneralSettings/ModelRouters/LLMProviderModelPicker/index.jsx"
] | [
{
"comment": "As I mentioned in my server-side comment on the LLM classification file, since the fallback provider is being used for route classification, it would be helpful to surface that information to the user.",
"path": "frontend/src/pages/GeneralSettings/ModelRouters/LLMProviderModelPicker/index.jsx"... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | 👍️ | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouter.js b/server/models/modelRouter.js
new file mode 100644
index 00000000000..2e4fb40b0b4
--- /dev/null
+++ b/server/models/modelRouter.js
@@ -0,0 +1,259 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { ModelRouterRule } = require(... | [
"server/models/modelRouter.js"
] | [
{
"comment": "👍️",
"path": "server/models/modelRouter.js",
"hunk": "@@ -96,6 +101,28 @@ const ModelRouter = {\n }\n },\n \n+ getWithRulesAndCount: async function (clause = {}) {\n+ try {\n+ const router = await prisma.model_routers.findFirst({\n+ where: clause,\n+ include: ... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | 👍️ | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/server/models/modelRouter.js b/server/models/modelRouter.js
new file mode 100644
index 00000000000..2e4fb40b0b4
--- /dev/null
+++ b/server/models/modelRouter.js
@@ -0,0 +1,259 @@
+const { Prisma } = require("@prisma/client");
+const prisma = require("../utils/prisma");
+const { ModelRouterRule } = require(... | [
"server/models/modelRouter.js"
] | [
{
"comment": "👍️",
"path": "server/models/modelRouter.js",
"hunk": "@@ -110,13 +137,37 @@ const ModelRouter = {\n }\n },\n \n+ getAllWithCounts: async function () {\n+ try {\n+ const routers = await prisma.model_routers.findMany({\n+ orderBy: { createdAt: \"asc\" },\n+ incl... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | This leads to the rules. `modelRouterRules` seems more accurate, editing is now a modal in "/settings/model-routers", | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/utils/paths.js b/frontend/src/utils/paths.js
index acde39509d4..1bc36695603 100644
--- a/frontend/src/utils/paths.js
+++ b/frontend/src/utils/paths.js
@@ -1,5 +1,13 @@
import { API_BASE } from "./constants";
+/**
+ * Check if a href matches the current pathname.
+ * Matches exactly or as a ... | [
"frontend/src/utils/paths.js"
] | [
{
"comment": "This leads to the rules. `modelRouterRules` seems more accurate, editing is now a modal in \"/settings/model-routers\",",
"path": "frontend/src/utils/paths.js",
"hunk": "@@ -148,6 +156,12 @@ export default {\n apiKeys: () => {\n return \"/settings/api-keys\";\n },\n+ model... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | `RouterFormPage` should be renamed to `RouterRulesPage` or something like that. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx
index ed59fa420c5..3929915a0b1 100644
--- a/frontend/src/main.jsx
+++ b/frontend/src/main.jsx
@@ -248,6 +248,24 @@ const router = createBrowserRouter([
return { element: <AdminRoute Component={GeneralApiKeys} /> };
},
},
+ {
+ ... | [
"frontend/src/main.jsx"
] | [
{
"comment": "`RouterFormPage` should be renamed to `RouterRulesPage` or something like that.",
"path": "frontend/src/main.jsx",
"hunk": "@@ -255,6 +255,24 @@ const router = createBrowserRouter([\n return { element: <AdminRoute Component={GeneralApiKeys} /> };\n },\n },\n+ {... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | Should be renamed to `RouterRulesPage/index.jsx` or something to be more clear, this name was from a pre-design implementation. | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/pages/GeneralSettings/ModelRouters/RouterRulesPage/index.jsx b/frontend/src/pages/GeneralSettings/ModelRouters/RouterRulesPage/index.jsx
new file mode 100644
index 00000000000..ea0828a5859
--- /dev/null
+++ b/frontend/src/pages/GeneralSettings/ModelRouters/RouterRulesPage/index.jsx
@@ -0,0 +1,... | [
"frontend/src/pages/GeneralSettings/ModelRouters/RouterRulesPage/index.jsx"
] | [
{
"comment": "Should be renamed to `RouterRulesPage/index.jsx` or something to be more clear, this name was from a pre-design implementation.",
"path": "frontend/src/pages/GeneralSettings/ModelRouters/RouterRulesPage/index.jsx",
"hunk": "",
"resolving_sha": "7696110d841027e12dfce3e4f012b8add0e90e0b"... | true | ||
Mintplex-Labs/anything-llm | 5,324 | comment_to_fix | Model router | What was the reasoning for the modification of this change? Did this sub-menu option highlight system not work prior? | e1035dec79c15244a90c81ff37d170fd9f94be67 | 7696110d841027e12dfce3e4f012b8add0e90e0b | diff --git a/frontend/src/components/SettingsSidebar/MenuOption/index.jsx b/frontend/src/components/SettingsSidebar/MenuOption/index.jsx
index ac7955dad5c..751c0d36a2b 100644
--- a/frontend/src/components/SettingsSidebar/MenuOption/index.jsx
+++ b/frontend/src/components/SettingsSidebar/MenuOption/index.jsx
@@ -2,6 +2,... | [
"frontend/src/components/SettingsSidebar/MenuOption/index.jsx"
] | [
{
"comment": "What was the reasoning for the modification of this change? Did this sub-menu option highlight system not work prior?",
"path": "frontend/src/components/SettingsSidebar/MenuOption/index.jsx",
"hunk": "@@ -28,9 +29,11 @@ export default function MenuOption({\n \n const isActive = hasChildr... | true | ||
Mintplex-Labs/anything-llm | 5,666 | issue_to_patch | 5315 i18n | c29d03ae5898a1d7f0f4d5f54399dfde33ba6fcf | 01a6079f3b2ad616933cdbe95e0ebfe27cb5b059 | diff --git a/frontend/src/locales/ar/common.js b/frontend/src/locales/ar/common.js
index 48ab1626560..6047523c084 100644
--- a/frontend/src/locales/ar/common.js
+++ b/frontend/src/locales/ar/common.js
@@ -108,6 +108,7 @@ const TRANSLATIONS = {
telegram: "تليجرام",
},
"scheduled-jobs": "المهام المجدولة"... | [
"frontend/src/locales/ar/common.js",
"frontend/src/locales/ca/common.js",
"frontend/src/locales/cs/common.js",
"frontend/src/locales/da/common.js",
"frontend/src/locales/de/common.js",
"frontend/src/locales/es/common.js",
"frontend/src/locales/et/common.js",
"frontend/src/locales/fa/common.js",
"fro... | [] | true | |||
Mintplex-Labs/anything-llm | 5,662 | issue_to_patch | [FEAT]: System Administrator ENV config for Workspace Deletion protection
### What would you like to see?
As a system admin/IT deploying the AnythingLLM container on my infra:
- I should be able to configure [an additional configuration](https://docs.anythingllm.com/configuration) called `WORKSPACE_DELETION_PROTECTIO... | Workspace deletion protection |
### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [x] ✨ feat (New feature)
- [ ] 🐛 fix (Bug fix)
- [ ] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [ ] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Releva... | b4a68c6910ecbb084865dedd77c0490ed2a6ffb2 | d7fa6eb109eb47e8e94de24eb2fe65c222b880ea | diff --git a/docker/.env.example b/docker/.env.example
index c98782d41a0..4e449de984b 100644
--- a/docker/.env.example
+++ b/docker/.env.example
@@ -408,6 +408,9 @@ GID='1000'
# See https://docs.anythingllm.com/configuration#disable-view-chat-history for more information.
# DISABLE_VIEW_CHAT_HISTORY=1
+# Disable wo... | [
"docker/.env.example",
"frontend/src/pages/Admin/Workspaces/WorkspaceRow/index.jsx",
"frontend/src/pages/Admin/Workspaces/index.jsx",
"frontend/src/pages/WorkspaceSettings/GeneralAppearance/DeleteWorkspace/index.jsx",
"frontend/src/pages/WorkspaceSettings/GeneralAppearance/index.jsx",
"frontend/src/pages/... | [
{
"comment": "👍 ",
"path": "frontend/src/pages/Admin/Workspaces/index.jsx",
"hunk": "@@ -57,13 +58,18 @@ function WorkspacesContainer() {\n const [loading, setLoading] = useState(true);\n const [users, setUsers] = useState([]);\n const [workspaces, setWorkspaces] = useState([]);\n+ const [deleti... | diff --git a/server/__tests__/utils/middleware/workspaceDeletionProtection.test.js b/server/__tests__/utils/middleware/workspaceDeletionProtection.test.js
new file mode 100644
index 00000000000..b8afa8e4cc3
--- /dev/null
+++ b/server/__tests__/utils/middleware/workspaceDeletionProtection.test.js
@@ -0,0 +1,43 @@
+const... | true |
Mintplex-Labs/anything-llm | 5,269 | issue_to_patch | [FEAT]: Memories/Personalization
### What would you like to see?
- Implement the memories/personalization feature per internal spec
- Uses bg worker to processes chats and extract memories to be used in future conversations
- Reranks memories based on query to provide useful context to LLM model
- Support for regular... | feat: Memories/Personalization | ### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [x] ✨ feat (New feature)
- [ ] 🐛 fix (Bug fix)
- [ ] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [ ] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Relevant I... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/docker/.env.example b/docker/.env.example
index 9fe9f71b7d3..c98782d41a0 100644
--- a/docker/.env.example
+++ b/docker/.env.example
@@ -456,6 +456,18 @@ GID='1000'
# AGENT_SKILL_RERANKER_ENABLED="true"
# AGENT_SKILL_RERANKER_TOP_N=15 # (optional) Number of top tools to keep after reranking (default: 15)
... | [
"docker/.env.example",
"frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx",
"frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/Memories/index.jsx",
"frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/TextSize/index.jsx",
"frontend/src/com... | [
{
"comment": "Since users can manually create their own memories, there should be some guidance explaining what a “Memory” actually is. The LLM is instructed in the system prompt that each memory should be a single, concise statement (one sentence maximum). It would make sense to surface similar guidance in the... | true | |
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization |
Consideration:
I think it'd be handy for this to be shorter in development.
for example:
```js
interval: process.env.NODE_ENV === "development" ? "15s" : "15m"
```
Or even better yet, maybe configurable via environment variable?
```js
interval: process.env.MEMORY_EXTRACTION_JOB_INTERVAL || "15m"
``` | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/BackgroundWorkers/index.js b/server/utils/BackgroundWorkers/index.js
index 09a25eaf5f3..9350a979be0 100644
--- a/server/utils/BackgroundWorkers/index.js
+++ b/server/utils/BackgroundWorkers/index.js
@@ -13,6 +13,7 @@ class BackgroundService {
name = "BackgroundWorkerService";
static _ins... | [
"server/utils/BackgroundWorkers/index.js"
] | [
{
"comment": "\nConsideration: \nI think it'd be handy for this to be shorter in development.\n\nfor example:\n```js\ninterval: process.env.NODE_ENV === \"development\" ? \"15s\" : \"15m\"\n```\n\nOr even better yet, maybe configurable via environment variable?\n\n```js\ninterval: process.env.MEMORY_EXTRACTION... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Nit: We're hitting the database twice for the same data here — once to get the distinct pairs, then again inside the loop to fetch each pair's chats. We can simplify this by fetching all
unprocessed chats in a single query and grouping them ourselves:
```js
const allUnprocessed = await WorkspaceChats.where(
{ m... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "Nit: We're hitting the database twice for the same data here — once to get the distinct pairs, then again inside the loop to fetch each pair's chats. We can simplify this by fetching all\n unprocessed chats in a single query and grouping them ourselves:\n```js\n const allUnprocessed = await Work... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | These share the same path pattern as `PUT /memories/:memoryId` and `DELETE /memories/:memoryId` — different HTTP methods so no runtime error today, but the param means two different things
depending on the verb, which is fragile. Shouldn't the REST pattern be `GET /workspaces/:workspaceId/memories` and `POST /workspa... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "These share the same path pattern as `PUT /memories/:memoryId` and `DELETE /memories/:memoryId` — different HTTP methods so no runtime error today, but the param means two different things\n depending on the verb, which is fragile. Shouldn't the REST pattern be `GET /workspaces/:workspaceId/memor... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | 👍️ | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "👍️",
"path": "server/endpoints/memory.js",
"hunk": "",
"resolving_sha": "a627a42b2302bbbebfe456e270971d56e6c20ab0",
"resolving_diff": "diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js\nnew file mode 100644\nindex 00000000000..64af4a69552\n--- /dev/null\n+++ b/s... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | 👍️ | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/BackgroundWorkers/index.js b/server/utils/BackgroundWorkers/index.js
index 09a25eaf5f3..9350a979be0 100644
--- a/server/utils/BackgroundWorkers/index.js
+++ b/server/utils/BackgroundWorkers/index.js
@@ -13,6 +13,7 @@ class BackgroundService {
name = "BackgroundWorkerService";
static _ins... | [
"server/utils/BackgroundWorkers/index.js"
] | [
{
"comment": "👍️",
"path": "server/utils/BackgroundWorkers/index.js",
"hunk": "",
"resolving_sha": "a627a42b2302bbbebfe456e270971d56e6c20ab0",
"resolving_diff": "diff --git a/server/utils/BackgroundWorkers/index.js b/server/utils/BackgroundWorkers/index.js\nindex 09a25eaf5f3..9350a979be0 100644... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | 👍️ | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/.env.example b/server/.env.example
index 46536f3ed4d..35ab47f22ee 100644
--- a/server/.env.example
+++ b/server/.env.example
@@ -465,6 +465,10 @@ TTS_PROVIDER="native"
# AGENT_SKILL_RERANKER_ENABLED="true"
# AGENT_SKILL_RERANKER_TOP_N=15 # (optional) Number of top tools to keep after reranking (de... | [
"server/.env.example"
] | [
{
"comment": "👍️",
"path": "server/.env.example",
"hunk": "",
"resolving_sha": "a627a42b2302bbbebfe456e270971d56e6c20ab0",
"resolving_diff": "diff --git a/server/.env.example b/server/.env.example\nindex 46536f3ed4d..35ab47f22ee 100644\n--- a/server/.env.example\n+++ b/server/.env.example\n@@ -... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Consider surfacing similar guidance in the UI for manually created memories. Perhaps even a placeholder text with an example?
Examples fed to LLM:
```
["User's name is Sarah", "User prefers Python over JavaScript", "User works on the Phoenix project"]`;
```
<img width="671" height="525" alt="Image" src="https://githu... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "Consider surfacing similar guidance in the UI for manually created memories. Perhaps even a placeholder text with an example?\n\nExamples fed to LLM: \n```\n[\"User's name is Sarah\", \"User prefers Python over JavaScript\", \"User works on the Phoenix project\"]`;\n```\n<img width=\"671\" height=... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | The idle threshold check looks at the most recent chat across all users and workspaces. If User A is actively chatting, User B's idle workspace (which has unprocessed chats from an hour ago) will never get processed until User A also goes idle. The intent seems to be "don't extract while the user is mid-conversation," ... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "The idle threshold check looks at the most recent chat across all users and workspaces. If User A is actively chatting, User B's idle workspace (which has unprocessed chats from an hour ago) will never get processed until User A also goes idle. The intent seems to be \"don't extract while the user... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Nit: This loops up to 20 sequential await tx.memories.create() calls inside the transaction. Since each one is its own round-trip to the database, this could be simplified to a single tx.memories.createMany() call which batches all the inserts into one query. Not a blocker but it's a free perf win.
```js
// Current:... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/models/memory.js b/server/models/memory.js
new file mode 100644
index 00000000000..25edfcb6fcd
--- /dev/null
+++ b/server/models/memory.js
@@ -0,0 +1,451 @@
+const prisma = require("../utils/prisma");
+
+/**
+ * @typedef {Object} Memory
+ * @property {number} id
+ * @property {number|null} userId
+ ... | [
"server/models/memory.js"
] | [
{
"comment": "Nit: This loops up to 20 sequential await tx.memories.create() calls inside the transaction. Since each one is its own round-trip to the database, this could be simplified to a single tx.memories.createMany() call which batches all the inserts into one query. Not a blocker but it's a free perf win... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Your checking that the memory belongs to the user but you're not checking if the user has access to the workspace. A user could _technically_ demote a global memory into a workspace they don't have access to.
```js
app.post("/memories/:memoryId/demote", [...], async (request, response) => {
const user = await u... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Your checking that the memory belongs to the user but you're not checking if the user has access to the workspace. A user could _technically_ demote a global memory into a workspace they don't have access to.\n\n\n```js\n app.post(\"/memories/:memoryId/demote\", [...], async (request, response) =... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | I would suggest not using dyamic keys for i18n. It doesnt work our static analysis for finding orphaned keys and could result in keys being deleted from the locales object if not inserted in the `DYNAMIC_KEY_ALLOWLIST`in `/frontend/locales/findUnusuedTranslationKeys.js`. The simplest fix is just use hardcoded strings f... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx
new file mode 100644
index 00000000000..22a20cf41b1
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx"
] | [
{
"comment": "I would suggest not using dyamic keys for i18n. It doesnt work our static analysis for finding orphaned keys and could result in keys being deleted from the locales object if not inserted in the `DYNAMIC_KEY_ALLOWLIST`in `/frontend/locales/findUnusuedTranslationKeys.js`. The simplest fix is just u... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | be aware of i18n keys that could be pruned if not detected directly in a t() call or in the allowlist | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/MemoriesSidebar/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/MemoriesSidebar/index.jsx
new file mode 100644
index 00000000000..078adf6d3cf
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/MemoriesSidebar/index.jsx... | [
"frontend/src/components/WorkspaceChat/ChatContainer/MemoriesSidebar/index.jsx"
] | [
{
"comment": "be aware of i18n keys that could be pruned if not detected directly in a t() call or in the allowlist",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/MemoriesSidebar/index.jsx",
"hunk": "@@ -0,0 +1,189 @@\n+import { useState, useEffect } from \"react\";\n+import { X } from \... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Workspace memory reranking doesn't work on the agent chat path. `getDefinition` doesn't receive the user's prompt, so `promptWithMemories` is called without `prompt` or `rawHistory`, which causes it to skip reranking and just grab the 5 most recent workspace memories. The user's prompt is available upstream on `this.in... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/agents/defaults.js b/server/utils/agents/defaults.js
index 9d4404989e1..6160f10c68f 100644
--- a/server/utils/agents/defaults.js
+++ b/server/utils/agents/defaults.js
@@ -57,17 +57,24 @@ const WORKSPACE_AGENT = {
* @param {string} provider
* @param {import("@prisma/client").workspaces ... | [
"server/utils/agents/defaults.js"
] | [
{
"comment": "Workspace memory reranking doesn't work on the agent chat path. `getDefinition` doesn't receive the user's prompt, so `promptWithMemories` is called without `prompt` or `rawHistory`, which causes it to skip reranking and just grab the 5 most recent workspace memories. The user's prompt is availabl... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | This comment is stale, delete it. | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/memories/index.js b/server/utils/memories/index.js
new file mode 100644
index 00000000000..6a5be0eaad2
--- /dev/null
+++ b/server/utils/memories/index.js
@@ -0,0 +1,139 @@
+/**
+ * Memory Injection
+ *
+ * Used by chat handlers (streaming, sync, API) to enrich the system prompt with
+ * the us... | [
"server/utils/memories/index.js"
] | [
{
"comment": "This comment is stale, delete it.",
"path": "server/utils/memories/index.js",
"hunk": "@@ -0,0 +1,133 @@\n+const { Memory } = require(\"../../models/memory\");\n+const { SystemSettings } = require(\"../../models/systemSettings\");\n+\n+const INJECTED_WORKSPACE_LIMIT = 5;\n+\n+/**\n+ * Fetc... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | 👍️
| 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx
new file mode 100644
index 00000000000..22a20cf41b1
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.... | [
"frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx"
] | [
{
"comment": "👍️\n\n",
"path": "frontend/src/components/WorkspaceChat/ChatContainer/ChatSettingsMenu/index.jsx",
"hunk": "@@ -6,11 +6,13 @@ import System from \"@/models/system\";\n import { useTranslation } from \"react-i18next\";\n import { useMemoriesSidebar, useSourcesSidebar } from \"../ChatSideba... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | 👍️ | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "👍️",
"path": "server/jobs/extract-memories.js",
"hunk": "@@ -101,6 +91,17 @@ function parseMemoriesResponse(text) {\n for (const [, chats] of groups) {\n const { user_id: userId, workspaceId } = chats[0];\n try {\n+ // Check idle per-group so one active user doesn't... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | JSDoc all these so we have type hints in UI | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/frontend/src/models/memory.js b/frontend/src/models/memory.js
new file mode 100644
index 00000000000..737d2cb5c6c
--- /dev/null
+++ b/frontend/src/models/memory.js
@@ -0,0 +1,108 @@
+import { API_BASE } from "@/utils/constants";
+import { baseHeaders } from "@/utils/request";
+
+/**
+ * @typedef {Object} M... | [
"frontend/src/models/memory.js"
] | [
{
"comment": "JSDoc all these so we have type hints in UI",
"path": "frontend/src/models/memory.js",
"hunk": "@@ -0,0 +1,82 @@\n+import { API_BASE } from \"@/utils/constants\";\n+import { baseHeaders } from \"@/utils/request\";\n+\n+const Memory = {\n+ forWorkspace: async function (workspaceId) {\n+ ... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | We dont need these error logs since we return error anyway | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/frontend/src/models/memory.js b/frontend/src/models/memory.js
new file mode 100644
index 00000000000..737d2cb5c6c
--- /dev/null
+++ b/frontend/src/models/memory.js
@@ -0,0 +1,108 @@
+import { API_BASE } from "@/utils/constants";
+import { baseHeaders } from "@/utils/request";
+
+/**
+ * @typedef {Object} M... | [
"frontend/src/models/memory.js"
] | [
{
"comment": "We dont need these error logs since we return error anyway",
"path": "frontend/src/models/memory.js",
"hunk": "@@ -0,0 +1,82 @@\n+import { API_BASE } from \"@/utils/constants\";\n+import { baseHeaders } from \"@/utils/request\";\n+\n+const Memory = {\n+ forWorkspace: async function (works... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Rename this `memoryFeatureEnabled` and once you migrate the check for this to a method in SystemSettings like I mentioned in parent review comment you can then just call `await SystemSettings.memoriesEnabled()` and throw if not. | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Rename this `memoryFeatureEnabled` and once you migrate the check for this to a method in SystemSettings like I mentioned in parent review comment you can then just call `await SystemSettings.memoriesEnabled()` and throw if not.",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,2... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | This should _also_ just be a middleware - it should just be skipped if the system is not in MuM.
Easy to check since the first middleware is `validatedRequest` which assigns
[response.locals.multiUserMode = multiUserMode;
](https://github.com/Mintplex-Labs/anything-llm/blob/feat/memory/server/utils/middleware/validate... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "This should _also_ just be a middleware - it should just be skipped if the system is not in MuM.\n\nEasy to check since the first middleware is `validatedRequest` which assigns\n[response.locals.multiUserMode = multiUserMode;\n](https://github.com/Mintplex-Labs/anything-llm/blob/feat/memory/server... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | `return response.status(403).json({ error: "Invalid workspace." });` | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "`return response.status(403).json({ error: \"Invalid workspace.\" });`",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\"../... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Promise.all() these to run concurrent **OR** make a single method on memory if we do this a lot. | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Promise.all() these to run concurrent **OR** make a single method on memory if we do this a lot.",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { System... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | This should happen after perms check | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "This should happen after perms check",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\"../models/systemSettings\");\n+const ... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | I notice we are doing this a lot - if we can make the input body param or URL query param `:slug` you can use this middleware: https://github.com/Mintplex-Labs/anything-llm/blob/feat/memory/server/utils/middleware/validWorkspace.js#L6-L20
Would prevent a lot of code dupe | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "I notice we are doing this a lot - if we can make the input body param or URL query param `:slug` you can use this middleware: https://github.com/Mintplex-Labs/anything-llm/blob/feat/memory/server/utils/middleware/validWorkspace.js#L6-L20\n\nWould prevent a lot of code dupe",
"path": "server/e... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | `return response.status(400).json({ error: message });` | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "`return response.status(400).json({ error: message });`",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\"../models/systemSe... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Val logic after perms | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Val logic after perms",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\"../models/systemSettings\");\n+const { userFromSessi... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Should be its own middleware if we do this check a lot (already mentioned) | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Should be its own middleware if we do this check a lot (already mentioned)",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Shouldnt this just be able to take in a userid so we can query the DB directly with either `id` or `id + userId` if user.id is not invalid? | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Shouldnt this just be able to take in a userid so we can query the DB directly with either `id` or `id + userId` if user.id is not invalid?",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Good defense in depth check here. | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/endpoints/memory.js b/server/endpoints/memory.js
new file mode 100644
index 00000000000..64af4a69552
--- /dev/null
+++ b/server/endpoints/memory.js
@@ -0,0 +1,196 @@
+const { Memory } = require("../models/memory");
+const { SystemSettings } = require("../models/systemSettings");
+const { userFromSes... | [
"server/endpoints/memory.js"
] | [
{
"comment": "Good defense in depth check here.",
"path": "server/endpoints/memory.js",
"hunk": "@@ -0,0 +1,238 @@\n+const { Memory } = require(\"../models/memory\");\n+const { Workspace } = require(\"../models/workspace\");\n+const { SystemSettings } = require(\"../models/systemSettings\");\n+const { u... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | I really truly believe here we should try to have this be an actual tool call instead of a free form response output we parse.
We can use EphemeralAgent here with a local custom plugin/tool that way we can use a proper tool call when the model can call tools and still failover to `Untooled` if not.
This would almost ... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "I really truly believe here we should try to have this be an actual tool call instead of a free form response output we parse.\n\nWe can use EphemeralAgent here with a local custom plugin/tool that way we can use a proper tool call when the model can call tools and still failover to `Untooled` if ... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | We need safety limits on this. Like if a user has 20 chats - fine sure. But if it has been a long time we should only grab the last 20 chats. Otherwise we risk doing a review on like 500 chats.
We should make everything seen even if it is not explicitly summarized just to not watch it.
## 🚨This is a big problem!!!🚨... | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "We need safety limits on this. Like if a user has 20 chats - fine sure. But if it has been a long time we should only grab the last 20 chats. Otherwise we risk doing a review on like 500 chats.\n\nWe should make everything seen even if it is not explicitly summarized just to not watch it.\n\n## 🚨... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | ? Why this value (also would cause issues for some provider/models who hate temp!) | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "? Why this value (also would cause issues for some provider/models who hate temp!)",
"path": "server/jobs/extract-memories.js",
"hunk": "@@ -0,0 +1,161 @@\n+const { log, conclude } = require(\"./helpers/index.js\");\n+const { SystemSettings } = require(\"../models/systemSettings.js\");\n+c... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | If a summary workflow fails, assume it to be marked processed always - otherwise we can end up with a growing list that contains some problematic edge case.
Also, how does this handle **super long** prompts and responses? We should be truncating long user prompts or responses | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/jobs/extract-memories.js b/server/jobs/extract-memories.js
new file mode 100644
index 00000000000..3927d5349f3
--- /dev/null
+++ b/server/jobs/extract-memories.js
@@ -0,0 +1,192 @@
+const { log, conclude } = require("./helpers/index.js");
+const { SystemSettings } = require("../models/systemSettings... | [
"server/jobs/extract-memories.js"
] | [
{
"comment": "If a summary workflow fails, assume it to be marked processed always - otherwise we can end up with a growing list that contains some problematic edge case.\n\nAlso, how does this handle **super long** prompts and responses? We should be truncating long user prompts or responses",
"path": "ser... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Not just here, but all through this model you need type safety for `userId` or other fields you just do `{ field }` for since they are not done across the board and its better to have defense in depth for these things to prevent a bad implementation in the future from allowing injection at field value level | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/models/memory.js b/server/models/memory.js
new file mode 100644
index 00000000000..25edfcb6fcd
--- /dev/null
+++ b/server/models/memory.js
@@ -0,0 +1,451 @@
+const prisma = require("../utils/prisma");
+
+/**
+ * @typedef {Object} Memory
+ * @property {number} id
+ * @property {number|null} userId
+ ... | [
"server/models/memory.js"
] | [
{
"comment": "Not just here, but all through this model you need type safety for `userId` or other fields you just do `{ field }` for since they are not done across the board and its better to have defense in depth for these things to prevent a bad implementation in the future from allowing injection at field v... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | JS Doc these methods | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/models/memory.js b/server/models/memory.js
new file mode 100644
index 00000000000..25edfcb6fcd
--- /dev/null
+++ b/server/models/memory.js
@@ -0,0 +1,451 @@
+const prisma = require("../utils/prisma");
+
+/**
+ * @typedef {Object} Memory
+ * @property {number} id
+ * @property {number|null} userId
+ ... | [
"server/models/memory.js"
] | [
{
"comment": "JS Doc these methods",
"path": "server/models/memory.js",
"hunk": "@@ -0,0 +1,210 @@\n+const prisma = require(\"../utils/prisma\");\n+\n+const GLOBAL_LIMIT = 5;\n+const WORKSPACE_LIMIT = 20;\n+\n+const Memory = {\n+ forUserWorkspace: async function (userId, workspaceId) {\n+ try {\n+ ... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Can use the class method once it exists like `MultiUserMode` above it for readability | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/models/systemSettings.js b/server/models/systemSettings.js
index 601cbb86872..9b774a6a40d 100644
--- a/server/models/systemSettings.js
+++ b/server/models/systemSettings.js
@@ -61,6 +61,8 @@ const SystemSettings = {
"feature_flags",
"meta_page_title",
"meta_page_favicon",
+ "memory... | [
"server/models/systemSettings.js"
] | [
{
"comment": "Can use the class method once it exists like `MultiUserMode` above it for readability",
"path": "server/models/systemSettings.js",
"hunk": "@@ -407,6 +411,9 @@ const SystemSettings = {\n JWTSecret: !!process.env.JWT_SECRET,\n StorageDir: process.env.STORAGE_DIR,\n MultiUs... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Should also validate is array and they are Number() | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/models/workspaceChats.js b/server/models/workspaceChats.js
index 494c761f79b..2597346cc49 100644
--- a/server/models/workspaceChats.js
+++ b/server/models/workspaceChats.js
@@ -298,6 +298,33 @@ const WorkspaceChats = {
return false;
}
},
+ markMemoryProcessed: async function (ids = [... | [
"server/models/workspaceChats.js"
] | [
{
"comment": "Should also validate is array and they are Number()",
"path": "server/models/workspaceChats.js",
"hunk": "@@ -298,6 +298,31 @@ const WorkspaceChats = {\n return false;\n }\n },\n+ markMemoryProcessed: async function (ids = []) {\n+ if (!ids.length) return;",
"resolving_... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | I looked over the code and done see really any place this field even is used in a way that matters? Where is this coming from and/or how is it used? | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma
index 9ea3ecd53ac..7b160a5397f 100644
--- a/server/prisma/schema.prisma
+++ b/server/prisma/schema.prisma
@@ -86,6 +86,7 @@ model users {
prompt_history prompt_history[]
desktop_mobile_devices desktop_mobile_devices[]
wo... | [
"server/prisma/schema.prisma"
] | [
{
"comment": "I looked over the code and done see really any place this field even is used in a way that matters? Where is this coming from and/or how is it used?",
"path": "server/prisma/schema.prisma",
"hunk": "@@ -395,3 +398,21 @@ model external_communication_connectors {\n createdAt DateTime @... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Can we not just augment the prompt directly with memories in this method since we already have the user and workspace potentially in there as well? | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/agents/defaults.js b/server/utils/agents/defaults.js
index 9d4404989e1..6160f10c68f 100644
--- a/server/utils/agents/defaults.js
+++ b/server/utils/agents/defaults.js
@@ -57,17 +57,24 @@ const WORKSPACE_AGENT = {
* @param {string} provider
* @param {import("@prisma/client").workspaces ... | [
"server/utils/agents/defaults.js"
] | [
{
"comment": "Can we not just augment the prompt directly with memories in this method since we already have the user and workspace potentially in there as well?",
"path": "server/utils/agents/defaults.js",
"hunk": "@@ -57,17 +58,29 @@ const WORKSPACE_AGENT = {\n * @param {string} provider\n * @pa... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | Same here - can we augment the chat in this already async method? | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/chats/apiChatHandler.js b/server/utils/chats/apiChatHandler.js
index fac2033ee6f..a033d8e9b10 100644
--- a/server/utils/chats/apiChatHandler.js
+++ b/server/utils/chats/apiChatHandler.js
@@ -394,9 +394,13 @@ async function chatSync({
// Compress & Assemble message to ensure prompt passes ... | [
"server/utils/chats/apiChatHandler.js"
] | [
{
"comment": "Same here - can we augment the chat in this already async method?",
"path": "server/utils/chats/apiChatHandler.js",
"hunk": "@@ -388,9 +389,16 @@ async function chatSync({\n \n // Compress & Assemble message to ensure prompt passes token limit with room for response\n // and build syst... | true | ||
Mintplex-Labs/anything-llm | 5,269 | comment_to_fix | feat: Memories/Personalization | This needs a description - I did not realize what it did for a while | 0579a8681472f87719b1dbcf55ae7ede37b6693f | a627a42b2302bbbebfe456e270971d56e6c20ab0 | diff --git a/server/utils/memories/index.js b/server/utils/memories/index.js
new file mode 100644
index 00000000000..6a5be0eaad2
--- /dev/null
+++ b/server/utils/memories/index.js
@@ -0,0 +1,139 @@
+/**
+ * Memory Injection
+ *
+ * Used by chat handlers (streaming, sync, API) to enrich the system prompt with
+ * the us... | [
"server/utils/memories/index.js"
] | [
{
"comment": "This needs a description - I did not realize what it did for a while",
"path": "server/utils/memories/index.js",
"hunk": "@@ -0,0 +1,132 @@\n+const { Memory } = require(\"../../models/memory\");\n+const { SystemSettings } = require(\"../../models/systemSettings\");\n+\n+const INJECTED_WORK... | true | ||
Mintplex-Labs/anything-llm | 5,661 | issue_to_patch | Feat/memory i18n | f24aa7e258847c69fe97d12692a26bfbb31726ee | f9e21637948b66d6530141a5c11ba0a78009ca2c | diff --git a/frontend/src/locales/ar/common.js b/frontend/src/locales/ar/common.js
index e597843e4de..48ab1626560 100644
--- a/frontend/src/locales/ar/common.js
+++ b/frontend/src/locales/ar/common.js
@@ -1181,6 +1181,42 @@ const TRANSLATIONS = {
loading_mcp_servers: "تحميل خوادم MCP...",
app_integrations: "ت... | [
"frontend/src/locales/ar/common.js",
"frontend/src/locales/ca/common.js",
"frontend/src/locales/cs/common.js",
"frontend/src/locales/da/common.js",
"frontend/src/locales/de/common.js",
"frontend/src/locales/es/common.js",
"frontend/src/locales/et/common.js",
"frontend/src/locales/fa/common.js",
"fro... | [] | true | |||
Mintplex-Labs/anything-llm | 5,660 | issue_to_patch | Embed logos in docker prod build | 779b6cf3d8f1ff25c09b78e3e177d8be98612150 | 774be1caad2d3e232e36f6f5b8e5fecc444ab980 | diff --git a/server/utils/agents/aibitat/plugins/create-files/assets/anything-llm-invert.png b/server/utils/agents/aibitat/plugins/create-files/assets/anything-llm-invert.png
new file mode 100644
index 00000000000..ec14d175d35
Binary files /dev/null and b/server/utils/agents/aibitat/plugins/create-files/assets/anything... | [
"server/utils/agents/aibitat/plugins/create-files/assets/anything-llm-invert.png",
"server/utils/agents/aibitat/plugins/create-files/assets/anything-llm.png",
"server/utils/agents/aibitat/plugins/create-files/lib.js"
] | [] | true | |||
Mintplex-Labs/anything-llm | 5,658 | issue_to_patch | [FEAT]: Enable PDF generation and download via API
### What would you like to see?
Bring the PDF generation and export capability to the API. Currently, this feature seems to be exclusive to the Desktop application's UI.
Use Case: I am looking to automate workflows where I interact with AnythingLLM via the API. Bein... | Support pulling generated documents from API calls | ### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [x] ✨ feat (New feature)
- [ ] 🐛 fix (Bug fix)
- [x] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [ ] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Relevant I... | 9d714f95c124b61df00b840e36f623a2eb7e7eb4 | 351eb52a09e0ab822c40495e421a793f682752c3 | diff --git a/server/endpoints/api/document/index.js b/server/endpoints/api/document/index.js
index ca75472dc63..54b01ddc4ac 100644
--- a/server/endpoints/api/document/index.js
+++ b/server/endpoints/api/document/index.js
@@ -15,6 +15,7 @@ const fs = require("fs");
const path = require("path");
const { Document } = re... | [
"server/endpoints/api/document/index.js",
"server/swagger/openapi.json",
"server/utils/agents/ephemeral.js",
"server/utils/chats/apiChatHandler.js"
] | [] | true | |
Mintplex-Labs/anything-llm | 5,655 | issue_to_patch | Update DeviceTokens to already-admin user on MUM migration | ### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [ ] ✨ feat (New feature)
- [ ] 🐛 fix (Bug fix)
- [ ] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [x] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Relevant I... | 2d61397222acb2ed98e12151c5fcf800c33a7eee | b644ee48bb080b1d38d739bcf579e5ae5bff9fa1 | diff --git a/server/endpoints/system.js b/server/endpoints/system.js
index a1ebeff7d31..7641fcfada7 100644
--- a/server/endpoints/system.js
+++ b/server/endpoints/system.js
@@ -50,6 +50,7 @@ const {
const { SlashCommandPresets } = require("../models/slashCommandsPresets");
const { EncryptionManager } = require("../ut... | [
"server/endpoints/system.js",
"server/models/mobileDevice.js"
] | [] | true | ||
Mintplex-Labs/anything-llm | 5,630 | issue_to_patch | [BUG]: Agent chat fails too fast without trying to recover
### How are you running AnythingLLM?
Docker (local)
### What happened?
I'm asking Gemini to write an app. At some point it tries to read a file which doesn't exist, and instead of recovering trying a different path it fails the whole process.
It's easy to ... | fix: prevent gemini agent 400s from parallel tool calls | ### Pull Request Type
<!-- For change type, change [ ] to [x]. -->
- [ ] ✨ feat (New feature)
- [x] 🐛 fix (Bug fix)
- [ ] ♻️ refactor (Code refactoring without changing behavior)
- [ ] 💄 style (UI style changes)
- [ ] 🔨 chore (Build, CI, maintenance)
- [ ] 📝 docs (Documentation updates)
### Relevant I... | b5f138fe55fd56790921acc9db574a6702db94d7 | 8f03a3e3b74c874bd43efe83739aac97405656f8 | diff --git a/server/utils/agents/aibitat/providers/gemini.js b/server/utils/agents/aibitat/providers/gemini.js
index 433502e9861..699f7ab0b1b 100644
--- a/server/utils/agents/aibitat/providers/gemini.js
+++ b/server/utils/agents/aibitat/providers/gemini.js
@@ -207,7 +207,13 @@ class GeminiProvider extends Provider {
... | [
"server/utils/agents/aibitat/providers/gemini.js"
] | [] | true | |
MoiraeSoftware/Myriad | 264 | issue_to_patch | [Repo Assist] chore: prepare release v0.8.6 | 🤖 *This PR was created by Repo Assist, an automated AI assistant.*
## Summary
Prepares the v0.8.6 release. Since v0.8.5 (released 2026-03-04), `master` contains significant fixes to the publish pipeline and substantial internal refactoring that collectively deserve a new release.
## Changes
### `Directory.Build.pr... | 0f794bbbb21e9fccb0366c1a60d80b97f6ae4e36 | 6eab719257671c41799f8cf6fae6e67036193c72 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c78e68ce..3e11eeb7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
-## [0.8.6]
+## [0.8.6] - 2026-03-21
### Fixed
- Build CI workflow (`build.yml`) now uses... | [
"CHANGELOG.md"
] | [
{
"comment": "The PR description says the changelog section was renamed to `[0.8.6] - 2026-03-13`, but the changelog header here is dated `2026-03-21`. Please reconcile by updating either the changelog date or the PR description so they match.",
"path": "CHANGELOG.md",
"hunk": "@@ -6,7 +6,7 @@ and this ... | true | ||
MoiraeSoftware/Myriad | 272 | issue_to_patch | Duplicate Code: Namespace Resolution Pattern Repeated Across All Three Generators
*Analysis of commit 710bd94*
**Assignee**: `@copilot`
## Summary
The two-line pattern for reading the `"namespace"` config key and creating a `SynModuleOrNamespace` is copy-pasted identically in all three generator modules (`FieldsGen... | [Repo Assist] Refactor: extract createNamespacedModule helper, eliminate namespace resolution duplication | 🤖 *This PR was created by Repo Assist, an automated AI assistant.*
## Summary
Closes #271
Adds `GeneratorHelpers.createNamespacedModule` to consolidate the two-line namespace config lookup + `SynModuleOrNamespace.CreateNamespace` pattern that was copy-pasted identically in all three generator modules.
## Root Caus... | 0f794bbbb21e9fccb0366c1a60d80b97f6ae4e36 | d35df6ea565b1b8edb1a5e4d93bd9c480b038cf0 | diff --git a/src/Myriad.Plugins/DUCasesGenerator.fs b/src/Myriad.Plugins/DUCasesGenerator.fs
index 36f8f4bf..823fe366 100644
--- a/src/Myriad.Plugins/DUCasesGenerator.fs
+++ b/src/Myriad.Plugins/DUCasesGenerator.fs
@@ -119,8 +119,7 @@ module internal CreateDUModule =
let info = SynComponentInfo.Create reco... | [
"src/Myriad.Plugins/DUCasesGenerator.fs",
"src/Myriad.Plugins/FieldsGenerator.fs",
"src/Myriad.Plugins/GeneratorHelpers.fs",
"src/Myriad.Plugins/LensesGenerator.fs"
] | [] | true | |
MoiraeSoftware/Myriad | 270 | issue_to_patch | Duplicate Code: LensesGenerator.processTypeList duplicates GeneratorHelpers.generateModules pipeline
## Summary
`LensesGenerator` contains an inline `processTypeList` function (~14 lines) that structurally duplicates the `generateModules` pipeline helper in `GeneratorHelpers`. PR #258 already refactored `FieldsGenera... | [Repo Assist] Refactor: extract collectModulesWithAttr helper, eliminate LensesGenerator processTypeList duplication | 🤖 *This PR was created by Repo Assist, an automated AI assistant.*
## Summary
Closes #269
Adds `GeneratorHelpers.collectModulesWithAttr<'Attr>` — a variant of `generateModules` that passes the resolved `SynAttribute` to the `create` function — and uses it to eliminate the `~14-line` inline `processTypeList` functio... | 0f794bbbb21e9fccb0366c1a60d80b97f6ae4e36 | 49a9a61d3b08ec52747a84a103043a311ae5c8ac | [] | [] | true | ||
MoiraeSoftware/Myriad | 273 | issue_to_patch | Duplicate Code: Namespace Resolution Pattern Repeated Across All Three Generators
*Analysis of commit 710bd94*
**Assignee**: `@copilot`
## Summary
The two-line pattern for reading the `"namespace"` config key and creating a `SynModuleOrNamespace` is copy-pasted identically in all three generator modules (`FieldsGen... | Refactor: Extract shared namespace resolution helper across all three generators | The two-line namespace resolution pattern (`GeneratorConfig.getOrDefault "namespace" ...` + `SynModuleOrNamespace.CreateNamespace`) was copy-pasted identically in `FieldsGenerator`, `DUCasesGenerator`, and `LensesGenerator`, creating three divergence points for a single logical operation.
## Changes
- **`GeneratorHel... | 0f794bbbb21e9fccb0366c1a60d80b97f6ae4e36 | e8ae214fba12e2e5f7d36f26ec019a6ac49a6093 | diff --git a/src/Myriad.Plugins/DUCasesGenerator.fs b/src/Myriad.Plugins/DUCasesGenerator.fs
index 36f8f4bf..823fe366 100644
--- a/src/Myriad.Plugins/DUCasesGenerator.fs
+++ b/src/Myriad.Plugins/DUCasesGenerator.fs
@@ -119,8 +119,7 @@ module internal CreateDUModule =
let info = SynComponentInfo.Create reco... | [
"src/Myriad.Plugins/DUCasesGenerator.fs",
"src/Myriad.Plugins/FieldsGenerator.fs",
"src/Myriad.Plugins/GeneratorHelpers.fs",
"src/Myriad.Plugins/LensesGenerator.fs"
] | [] | true | |
MoiraeSoftware/Myriad | 275 | issue_to_patch | Duplicate Code: Repeated `SynType.App` boilerplate in AstExtensions.fs
*Analysis of recent commits*
**Assignee**: `@copilot`
## Summary
`src/Myriad.Core/AstExtensions.fs` contains 10 static extension members for generic `SynType` helpers (`Option`, `ResizeArray`, `Set`, `NativePointer`, `Dictionary`, `Map`, `List`,... | [Repo Assist] Refactor: extract mkGenericType helper, eliminate 10-fold SynType.App duplication | 🤖 *This PR was created by Repo Assist, an automated AI assistant.*
## Summary
Closes #274
Adds a private `mkGenericType` helper in `AstExtensions.fs` that consolidates the repeated `SynType.App` construction pattern across 10 extension members (`Option`, `ResizeArray`, `Set`, `NativePointer`, `Option(string)`, `Dic... | 710bd943d6c7523067e64cea4521fc9ca5227cd9 | 0b56096999f159d3e4d484a7a6ff85265e12673e | diff --git a/src/Myriad.Core/AstExtensions.fs b/src/Myriad.Core/AstExtensions.fs
index d98d7be9..c50ca725 100644
--- a/src/Myriad.Core/AstExtensions.fs
+++ b/src/Myriad.Core/AstExtensions.fs
@@ -14,6 +14,18 @@ module AstExtensions =
| [] -> []
| xs -> [ for _ in 1..xs.Length - 1 do range0 ]
+ /// Bui... | [
"src/Myriad.Core/AstExtensions.fs"
] | [] | true | |
MoiraeSoftware/Myriad | 277 | issue_to_patch | Duplicate Code: LensesGenerator.Generate manually reimplements the `generateModules` pipeline
*Analysis of commit 710bd94*
**Assignee**: `@copilot`
## Summary
`LensesGenerator.Generate` contains an 18-line custom parse→extract→filter→create→namespace pipeline that structurally duplicates the logic abstracted into `... | [Repo Assist] Refactor: migrate LensesGenerator to generateModulesWithAttr, remove dead code | 🤖 *This PR was created by Repo Assist, an automated AI assistant.*
## Summary
Closes #276
Migrates `LensesGenerator.Generate` to use a new `generateModulesWithAttr` helper in `GeneratorHelpers`, eliminating the 18-line inline `processTypeList` pipeline and making all three generators structurally uniform.
Also rem... | 710bd943d6c7523067e64cea4521fc9ca5227cd9 | bd33bed66230a018dd39574028be02f30dc7ff34 | diff --git a/src/Myriad.Plugins/GeneratorHelpers.fs b/src/Myriad.Plugins/GeneratorHelpers.fs
index f85bc0d0..80b9c826 100644
--- a/src/Myriad.Plugins/GeneratorHelpers.fs
+++ b/src/Myriad.Plugins/GeneratorHelpers.fs
@@ -51,3 +51,19 @@ module internal GeneratorHelpers =
let config = Generator.getConf... | [
"src/Myriad.Plugins/GeneratorHelpers.fs",
"src/Myriad.Plugins/LensesGenerator.fs"
] | [] | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.