Merge pull request #500 from SuanmoSuanyangTechnology/fix/interest-distribution
[changes] Memory write completion active failure interest cache
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from app.cache.memory.interest_memory import InterestMemoryCache
|
||||||
from app.core.memory.agent.utils.llm_tools import WriteState
|
from app.core.memory.agent.utils.llm_tools import WriteState
|
||||||
from app.core.memory.agent.utils.write_tools import write
|
from app.core.memory.agent.utils.write_tools import write
|
||||||
from app.core.logging_config import get_agent_logger
|
from app.core.logging_config import get_agent_logger
|
||||||
@@ -40,6 +41,15 @@ async def write_node(state: WriteState) -> WriteState:
|
|||||||
)
|
)
|
||||||
logger.info(f"Write completed successfully! Config: {memory_config.config_name}")
|
logger.info(f"Write completed successfully! Config: {memory_config.config_name}")
|
||||||
|
|
||||||
|
# 写入 neo4j 成功后,删除该用户的兴趣分布缓存,确保下次请求重新生成
|
||||||
|
for lang in ["zh", "en"]:
|
||||||
|
deleted = await InterestMemoryCache.delete_interest_distribution(
|
||||||
|
end_user_id=end_user_id,
|
||||||
|
language=lang,
|
||||||
|
)
|
||||||
|
if deleted:
|
||||||
|
logger.info(f"Invalidated interest distribution cache: end_user_id={end_user_id}, language={lang}")
|
||||||
|
|
||||||
write_result = {
|
write_result = {
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"data": structured_messages,
|
"data": structured_messages,
|
||||||
|
|||||||
Reference in New Issue
Block a user