Skip to content

Commit e78d537

Browse files
authored
fix(agent): Fix long-term memory error (#2644)
# Description Closes #2642 Closes #2637 # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration # Snapshots: Include snapshots for easier review. # Checklist: - [x] My code follows the style guidelines of this project - [x] I have already rebased the commits and make the commit message conform to the project standard. - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] Any dependent changes have been merged and published in downstream modules
2 parents 3d7d522 + a059ef1 commit e78d537

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/dbgpt-core/src/dbgpt/agent/core/memory/hybrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def structure_clone(
6969
@classmethod
7070
def from_chroma(
7171
cls,
72-
vstore_name: Optional[str] = "_chroma_agent_memory_",
72+
vstore_name: Optional[str] = "agent_memory_long_term",
7373
vstore_path: Optional[str] = None,
7474
embeddings: Optional[Embeddings] = None,
7575
executor: Optional[Executor] = None,

packages/dbgpt-core/src/dbgpt/agent/resource/tool/pack.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def add_command(
102102
args: Optional[Dict[str, Any]] = None,
103103
function: Optional[Callable] = None,
104104
parse_execute_args_func: Optional[PARSE_EXECUTE_ARGS_FUNCTION] = None,
105+
overwrite: bool = False,
105106
) -> None:
106107
"""Add a command to the commands.
107108
@@ -118,6 +119,8 @@ def add_command(
118119
the command is executed. Defaults to None.
119120
parse_execute_args (callable, optional): A callable function to parse the
120121
execute arguments. Defaults to None.
122+
overwrite (bool, optional): Whether to overwrite the command if it already
123+
exists. Defaults to False.
121124
"""
122125
if args is not None:
123126
tool_args = {}
@@ -151,7 +154,7 @@ def add_command(
151154
description=command_label,
152155
parse_execute_args_func=parse_execute_args_func,
153156
)
154-
self.append(ft)
157+
self.append(ft, overwrite=overwrite)
155158

156159
def _get_execution_tool(
157160
self,
@@ -347,6 +350,7 @@ def __init__(
347350
ssl_verify: Optional[Dict[str, Union[ssl.SSLContext, str, bool]]] = None,
348351
default_ssl_verify: Union[ssl.SSLContext, str, bool] = True,
349352
default_ssl_cafile: Optional[str] = None,
353+
overwrite_same_tool: bool = True,
350354
**kwargs,
351355
):
352356
"""Create an Auto-GPT plugin tool pack."""
@@ -363,6 +367,7 @@ def __init__(
363367
self._default_ssl_verify = default_ssl_verify
364368
self._ssl_verify_map = ssl_verify or {}
365369
self.server_ssl_verify_map = {}
370+
self._overwrite_same_tool = overwrite_same_tool
366371

367372
def switch_mcp_input_schema(self, input_schema: dict):
368373
args = {}
@@ -450,5 +455,6 @@ async def call_mcp_tool(
450455
args,
451456
call_mcp_tool,
452457
parse_execute_args_func=json_parse_execute_args_func,
458+
overwrite=self._overwrite_same_tool,
453459
)
454460
self._loaded = True

packages/dbgpt-serve/src/dbgpt_serve/agent/agents/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def get_or_build_agent_memory(self, conv_id: str, dbgpts_name: str) -> AgentMemo
142142
).create()
143143

144144
storage_manager = StorageManager.get_instance(self.system_app)
145-
index_name = "_agent_memory_"
145+
index_name = "agent_memory_long_term"
146146
vector_store = storage_manager.create_vector_store(index_name=index_name)
147147
if not vector_store.vector_name_exists():
148148
vector_store.create_collection(collection_name=index_name)

0 commit comments

Comments
 (0)