Merge pull request #27 from Gardelll/fix-memory-extract-prompt
修复记忆提取的问题
This commit is contained in:
@@ -11,6 +11,7 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import uuid
|
import uuid
|
||||||
|
import json_repair
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -186,8 +187,8 @@ class ShortTermMemoryManager:
|
|||||||
"importance": 0.7,
|
"importance": 0.7,
|
||||||
"attributes": {{
|
"attributes": {{
|
||||||
"time": "时间信息",
|
"time": "时间信息",
|
||||||
"attribute1": "其他属性1"
|
"attribute1": "其他属性1",
|
||||||
"attribute2": "其他属性2"
|
"attribute2": "其他属性2",
|
||||||
...
|
...
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
@@ -530,7 +531,7 @@ class ShortTermMemoryManager:
|
|||||||
json_str = re.sub(r"//.*", "", json_str)
|
json_str = re.sub(r"//.*", "", json_str)
|
||||||
json_str = re.sub(r"/\*.*?\*/", "", json_str, flags=re.DOTALL)
|
json_str = re.sub(r"/\*.*?\*/", "", json_str, flags=re.DOTALL)
|
||||||
|
|
||||||
data = json.loads(json_str)
|
data = json_repair.loads(json_str)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user