mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-11 03:31:55 +00:00
fix: harden memory-context leak boundaries
This commit is contained in:
parent
3ce47677e9
commit
936ac82fe5
7 changed files with 108 additions and 6 deletions
|
|
@ -22,6 +22,8 @@ import sqlite3
|
|||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from agent.memory_manager import sanitize_context
|
||||
from hermes_constants import get_hermes_home
|
||||
from typing import Any, Callable, Dict, List, Optional, TypeVar
|
||||
|
||||
|
|
@ -1119,7 +1121,10 @@ class SessionDB:
|
|||
rows = cursor.fetchall()
|
||||
messages = []
|
||||
for row in rows:
|
||||
msg = {"role": row["role"], "content": row["content"]}
|
||||
content = row["content"]
|
||||
if row["role"] in {"user", "assistant"} and isinstance(content, str):
|
||||
content = sanitize_context(content).strip()
|
||||
msg = {"role": row["role"], "content": content}
|
||||
if row["tool_call_id"]:
|
||||
msg["tool_call_id"] = row["tool_call_id"]
|
||||
if row["tool_name"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue