ci: enforce code formatting checks for backend and frontend (#1536)

This commit is contained in:
greatmengqi
2026-03-29 15:34:38 +08:00
committed by GitHub
parent 06a623f9c8
commit 084dc7e748
105 changed files with 8253 additions and 7369 deletions
@@ -71,9 +71,7 @@ class FileMemoryStorage(MemoryStorage):
if not agent_name:
raise ValueError("Agent name must be a non-empty string.")
if not AGENT_NAME_PATTERN.match(agent_name):
raise ValueError(
f"Invalid agent name {agent_name!r}: names must match {AGENT_NAME_PATTERN.pattern}"
)
raise ValueError(f"Invalid agent name {agent_name!r}: names must match {AGENT_NAME_PATTERN.pattern}")
def _get_memory_file_path(self, agent_name: str | None = None) -> Path:
"""Get the path to the memory file."""
@@ -180,18 +178,15 @@ def get_memory_storage() -> MemoryStorage:
try:
module_path, class_name = storage_class_path.rsplit(".", 1)
import importlib
module = importlib.import_module(module_path)
storage_class = getattr(module, class_name)
# Validate that the configured storage is a MemoryStorage implementation
if not isinstance(storage_class, type):
raise TypeError(
f"Configured memory storage '{storage_class_path}' is not a class: {storage_class!r}"
)
raise TypeError(f"Configured memory storage '{storage_class_path}' is not a class: {storage_class!r}")
if not issubclass(storage_class, MemoryStorage):
raise TypeError(
f"Configured memory storage '{storage_class_path}' is not a subclass of MemoryStorage"
)
raise TypeError(f"Configured memory storage '{storage_class_path}' is not a subclass of MemoryStorage")
_storage_instance = storage_class()
except Exception as e:
@@ -27,10 +27,12 @@ def _save_memory_to_file(memory_data: dict[str, Any], agent_name: str | None = N
"""Backward-compatible wrapper around the configured memory storage save path."""
return get_memory_storage().save(memory_data, agent_name)
def get_memory_data(agent_name: str | None = None) -> dict[str, Any]:
"""Get the current memory data via storage provider."""
return get_memory_storage().load(agent_name)
def reload_memory_data(agent_name: str | None = None) -> dict[str, Any]:
"""Reload memory data via storage provider."""
return get_memory_storage().reload(agent_name)