From 36e33261f7bc7c1ace0d0e22499d88b117ea8293 Mon Sep 17 00:00:00 2001 From: Xinyu Du Date: Fri, 1 May 2026 16:54:47 +0800 Subject: [PATCH] fix(memos-local-plugin): recognize 'memos' agent prefix in viewer SPA and server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit detectAgentPrefix() only recognized openclaw/hermes, so when the viewer was accessed through a /memos/ reverse-proxy prefix the SPA made API calls without the prefix — hitting 404. Add 'memos' to both the frontend prefix detector and the server-side AGENT_NAMES allowlist. --- apps/memos-local-plugin/server/http.ts | 2 +- apps/memos-local-plugin/web/src/api/client.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/memos-local-plugin/server/http.ts b/apps/memos-local-plugin/server/http.ts index 44159961a..8d63e45c3 100644 --- a/apps/memos-local-plugin/server/http.ts +++ b/apps/memos-local-plugin/server/http.ts @@ -135,7 +135,7 @@ async function dispatch( let pathname = url.pathname; const selfAgent = options.agent ?? null; - const AGENT_NAMES = ["openclaw", "hermes"] as const; + const AGENT_NAMES = ["openclaw", "hermes", "memos"] as const; // ── Multi-agent path routing ──────────────────────────────────────── // The first agent to bind the port acts as the hub. Subsequent diff --git a/apps/memos-local-plugin/web/src/api/client.ts b/apps/memos-local-plugin/web/src/api/client.ts index cf9e32066..3934e524e 100644 --- a/apps/memos-local-plugin/web/src/api/client.ts +++ b/apps/memos-local-plugin/web/src/api/client.ts @@ -26,7 +26,7 @@ export const AGENT_PREFIX: string = detectAgentPrefix(); function detectAgentPrefix(): string { if (typeof location === "undefined") return ""; const seg = location.pathname.split("/").filter(Boolean)[0]; - return seg === "openclaw" || seg === "hermes" ? `/${seg}` : ""; + return seg === "openclaw" || seg === "hermes" || seg === "memos" ? `/${seg}` : ""; } /**