Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions src/memos/graph_dbs/polardb.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,13 +899,7 @@ def get_node(
logger.info(
f" polardb [get_node] get_node completed time in {elapsed_time:.2f}s"
)
return self._parse_node(
{
"id": id,
"memory": properties.get("memory", ""),
**properties,
}
)
return self._parse_node(properties)
return None

except Exception as e:
Expand Down Expand Up @@ -976,15 +970,7 @@ def get_nodes(self, ids: list[str], user_name: str, **kwargs) -> list[dict[str,
properties["embedding"] = embedding
except (json.JSONDecodeError, TypeError):
logger.warning(f"Failed to parse embedding for node {node_id}")
nodes.append(
self._parse_node(
{
"id": properties.get("id", node_id),
"memory": properties.get("memory", ""),
"metadata": properties,
}
)
)
nodes.append(self._parse_node(properties))
return nodes

@timed
Expand Down Expand Up @@ -1534,7 +1520,7 @@ def search_by_keywords_like(
user_name_conditions = self._build_user_name_and_kb_ids_conditions_sql(
user_name=user_name,
knowledgebase_ids=knowledgebase_ids,
default_user_name=self.config.user_name,
default_user_name=self._get_config_value("user_name"),
)

# Add OR condition if we have any user_name conditions
Expand Down Expand Up @@ -1633,7 +1619,7 @@ def search_by_keywords_tfidf(
user_name_conditions = self._build_user_name_and_kb_ids_conditions_sql(
user_name=user_name,
knowledgebase_ids=knowledgebase_ids,
default_user_name=self.config.user_name,
default_user_name=self._get_config_value("user_name"),
)

# Add OR condition if we have any user_name conditions
Expand Down Expand Up @@ -1751,7 +1737,7 @@ def search_by_fulltext(
user_name_conditions = self._build_user_name_and_kb_ids_conditions_sql(
user_name=user_name,
knowledgebase_ids=knowledgebase_ids,
default_user_name=self.config.user_name,
default_user_name=self._get_config_value("user_name"),
)

if user_name_conditions:
Expand Down Expand Up @@ -1873,7 +1859,7 @@ def search_by_embedding(
user_name_conditions = self._build_user_name_and_kb_ids_conditions_sql(
user_name=user_name,
knowledgebase_ids=knowledgebase_ids,
default_user_name=self.config.user_name,
default_user_name=self._get_config_value("user_name"),
)

if user_name_conditions:
Expand Down
5 changes: 3 additions & 2 deletions src/memos/mem_reader/multi_modal_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ def _split_large_memory_item(
split_items = []

def _create_chunk_item(chunk):
# Chunk objects have a 'text' attribute
chunk_text = chunk.text
# Different chunkers are not fully consistent:
# some return Chunk-like objects with `.text`, while others return raw strings.
chunk_text = chunk.text if hasattr(chunk, "text") else chunk
if not chunk_text or not chunk_text.strip():
return None
# Create a new memory item for each chunk, preserving original metadata
Expand Down
Loading