feat: +cache

This commit is contained in:
莘权 马 2023-09-04 19:53:35 +08:00
parent 63805c87f9
commit 4dd9f7743f

View file

@ -5,8 +5,8 @@
@Author : mashenquan
@File : brain_memory.py
@Desc : Support memory for multiple tasks and multiple mainlines.
@Modified By: mashenquan, 2023/9/4. + redis memory cache.
"""
import hashlib
import json
from enum import Enum
from typing import Dict, List
@ -74,10 +74,6 @@ class BrainMemory(pydantic.BaseModel):
return None
return last_msg.content
@staticmethod
def get_md5(text: str) -> str:
return hashlib.md5(text.encode()).hexdigest()
@staticmethod
async def loads(redis_key: str, redis_conf: Dict = None) -> "BrainMemory":
redis = Redis(conf=redis_conf)