refactor: remove memory extraction functionality and update memory management protocols to ensure immediate updates for user and team interactions

This commit is contained in:
Anish Sarkar 2026-04-09 23:30:17 +05:30
parent f38ea77940
commit cd72fa9a48
7 changed files with 80 additions and 337 deletions

View file

@ -37,7 +37,6 @@ from app.agents.new_chat.llm_config import (
load_agent_config,
load_llm_config_from_yaml,
)
from app.agents.new_chat.memory_extraction import extract_and_save_memory
from app.db import (
ChatVisibility,
NewChatMessage,
@ -60,8 +59,6 @@ from app.utils.perf import get_perf_logger, log_system_snapshot, trim_native_hea
_perf_log = get_perf_logger()
_background_tasks: set[asyncio.Task] = set()
def format_mentioned_surfsense_docs_as_context(
documents: list[SurfsenseDocsDocument],
@ -1525,19 +1522,6 @@ async def stream_new_chat(
yield streaming_service.format_done()
return
if user_id and llm is not None:
_mem_task = asyncio.create_task(
extract_and_save_memory(
user_message=user_query,
user_id=user_id,
search_space_id=search_space_id,
thread_visibility=visibility,
llm=llm,
)
)
_background_tasks.add(_mem_task)
_mem_task.add_done_callback(_background_tasks.discard)
# If the title task didn't finish during streaming, await it now
if title_task is not None and not title_emitted:
generated_title = await title_task