From fc6532c596de73f597f3ab1867f66bd32593a6e7 Mon Sep 17 00:00:00 2001 From: Analyser Date: Tue, 22 Jul 2025 12:03:55 +0800 Subject: [PATCH 1/2] `make format` for original project files. --- graphiti_core/driver/driver.py | 4 +++- graphiti_core/driver/falkordb_driver.py | 1 - graphiti_core/helpers.py | 2 ++ graphiti_core/search/search_utils.py | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/graphiti_core/driver/driver.py b/graphiti_core/driver/driver.py index 7be689b4..9c8f1642 100644 --- a/graphiti_core/driver/driver.py +++ b/graphiti_core/driver/driver.py @@ -46,7 +46,9 @@ class GraphDriverSession(ABC): class GraphDriver(ABC): provider: str - fulltext_syntax: str = '' # Neo4j (default) syntax does not require a prefix for fulltext queries + fulltext_syntax: str = ( + '' # Neo4j (default) syntax does not require a prefix for fulltext queries + ) @abstractmethod def execute_query(self, cypher_query_: str, **kwargs: Any) -> Coroutine: diff --git a/graphiti_core/driver/falkordb_driver.py b/graphiti_core/driver/falkordb_driver.py index ed7431e9..ac71c402 100644 --- a/graphiti_core/driver/falkordb_driver.py +++ b/graphiti_core/driver/falkordb_driver.py @@ -98,7 +98,6 @@ class FalkorDriver(GraphDriver): self._database = database self.fulltext_syntax = '@' # FalkorDB uses a redisearch-like syntax for fulltext queries see https://redis.io/docs/latest/develop/ai/search-and-query/query/full-text/ - def _get_graph(self, graph_name: str | None) -> FalkorGraph: # FalkorDB requires a non-None database name for multi-tenant graphs; the default is "default_db" diff --git a/graphiti_core/helpers.py b/graphiti_core/helpers.py index 855b364d..ae311a08 100644 --- a/graphiti_core/helpers.py +++ b/graphiti_core/helpers.py @@ -51,6 +51,7 @@ def parse_db_date(neo_date: neo4j_time.DateTime | str | None) -> datetime | None else None ) + def get_default_group_id(db_type: str) -> str: """ This function differentiates the default group id based on the database type. @@ -61,6 +62,7 @@ def get_default_group_id(db_type: str) -> str: else: return '' + def lucene_sanitize(query: str) -> str: # Escape special characters from a query before passing into Lucene # + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / diff --git a/graphiti_core/search/search_utils.py b/graphiti_core/search/search_utils.py index f5eab407..59feb698 100644 --- a/graphiti_core/search/search_utils.py +++ b/graphiti_core/search/search_utils.py @@ -62,7 +62,9 @@ MAX_QUERY_LENGTH = 32 def fulltext_query(query: str, group_ids: list[str] | None = None, fulltext_syntax: str = ''): group_ids_filter_list = ( - [fulltext_syntax + f"group_id:'{lucene_sanitize(g)}'" for g in group_ids] if group_ids is not None else [] + [fulltext_syntax + f"group_id:'{lucene_sanitize(g)}'" for g in group_ids] + if group_ids is not None + else [] ) group_ids_filter = '' for f in group_ids_filter_list: From a0b01245ed00bbc125e92f948a28bd971ea4a50b Mon Sep 17 00:00:00 2001 From: Analyser Date: Tue, 22 Jul 2025 17:45:29 +0800 Subject: [PATCH 2/2] change uv install prefix --- mcp_server/Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mcp_server/Dockerfile b/mcp_server/Dockerfile index e6b84c87..bcf87c8f 100644 --- a/mcp_server/Dockerfile +++ b/mcp_server/Dockerfile @@ -10,11 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Install uv using the installer script -ADD https://astral.sh/uv/install.sh /uv-installer.sh -RUN sh /uv-installer.sh && rm /uv-installer.sh - -# Add uv to PATH -ENV PATH="/root/.local/bin:${PATH}" +RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="/usr/local/bin" sh # Configure uv for optimal Docker usage ENV UV_COMPILE_BYTECODE=1 \ @@ -30,8 +26,7 @@ RUN groupadd -r app && useradd -r -d /app -g app app COPY pyproject.toml uv.lock ./ # Install dependencies first (better layer caching) -RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --frozen --no-dev +RUN --mount=type=cache,target=/app/.cache/uv uv sync --frozen --no-dev # Copy application code COPY graphiti_mcp_server.py ./