From 6136018c3095ff6fd1e9be0f5488ed75481e95f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E5=B8=83=E6=9E=97?= <11641432+heiheiyouyou@user.noreply.gitee.com> Date: Thu, 12 Feb 2026 13:20:55 +0800 Subject: [PATCH] sources with filename --- src/memos/api/handlers/formatters_handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/memos/api/handlers/formatters_handler.py b/src/memos/api/handlers/formatters_handler.py index 06c4fd223..5749a027e 100644 --- a/src/memos/api/handlers/formatters_handler.py +++ b/src/memos/api/handlers/formatters_handler.py @@ -206,7 +206,13 @@ def rerank_knowledge_mem( ) # replace memory value with source.content for LongTermMemory, WorkingMemory or UserMemory for item in reranked_knowledge_mem: - item["memory"] = item["metadata"]["sources"][0]["content"] + source_content = item["metadata"]["sources"][0]["content"] + if ( + "File URL:" not in source_content + and "File ID:" not in source_content + and "Filename:" not in source_content + ): + item["memory"] = source_content item["metadata"]["sources"] = [] for item in conversation_mem: