Refactor to a helper class for the agent's history (ConversationMemory) (#7008)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Calvin Smith <email@cjsmith.io>
This commit is contained in:
Engel Nyst
2025-02-28 03:22:33 +01:00
committed by GitHub
parent 8a58e724c6
commit 0f07805a1b
7 changed files with 877 additions and 671 deletions

View File

@@ -310,7 +310,7 @@ class InvariantAnalyzer(SecurityAnalyzer):
check_result = self.monitor.check(self.input, input)
self.input.extend(input)
risk = ActionSecurityRisk.UNKNOWN
if isinstance(check_result, tuple):
result, err = check_result
if err:

View File

@@ -1,4 +1,5 @@
from typing import Any, Iterable, Tuple
from typing import Any, Iterable
from pydantic import BaseModel, Field
from pydantic.dataclasses import dataclass
@@ -31,7 +32,9 @@ class Message(Event):
content: str | None
tool_calls: list[ToolCall] | None = None
def __rich_repr__(self) -> Iterable[Any | tuple[Any] | tuple[str, Any] | tuple[str, Any, Any]]:
def __rich_repr__(
self,
) -> Iterable[Any | tuple[Any] | tuple[str, Any] | tuple[str, Any, Any]]:
# Print on separate line
yield 'role', self.role
yield 'content', self.content