-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: fixes and updates to MCP, retrievers, general fixes #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8afbecf
7bdb2ab
b35e047
2a485f9
f072e8d
98a1b79
17a77c5
80e5edc
5aca3f0
0a9e1a4
79921f8
6109bf5
a627841
c4915a4
773752a
66ecd35
ad943d0
cd9c489
7db7422
5970d96
9729547
d417c71
5d415dc
34b95b6
a78fec3
9c131f0
f93463e
8ea0097
13bb244
966e337
e3121f5
91f3cd9
1e7b56f
0f3522e
badd73c
c058219
729cb9b
ad0bb0c
7ac5761
f9f18d1
8178b72
1dd179b
3b07f3c
4371b9d
5cf14eb
86efeee
3ed9504
a874988
f8f7877
5c36a5d
9d9ea63
4c52ef6
7eee769
94c785d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,61 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| # Define Poetry extras to install | ||
| ARG POETRY_EXTRAS="\ | ||
| # API \ | ||
| api \ | ||
| # Storage & Databases \ | ||
| postgres weaviate qdrant neo4j falkordb milvus kuzu chromadb \ | ||
| # Notebooks & Interactive Environments \ | ||
| notebook \ | ||
| # LLM & AI Frameworks \ | ||
| langchain llama-index gemini huggingface ollama mistral groq anthropic \ | ||
| # Evaluation & Monitoring \ | ||
| deepeval evals posthog \ | ||
| # Graph Processing & Code Analysis \ | ||
| codegraph graphiti \ | ||
| # Document Processing \ | ||
| docs" | ||
| # Use a Python image with uv pre-installed | ||
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv | ||
|
|
||
| # Install the project into `/app` | ||
| WORKDIR /app | ||
|
|
||
| # Enable bytecode compilation | ||
| # ENV UV_COMPILE_BYTECODE=1 | ||
|
|
||
| # Copy from the cache instead of linking since it's a mounted volume | ||
| ENV UV_LINK_MODE=copy | ||
|
|
||
| # Set build argument | ||
| ARG DEBUG | ||
|
|
||
| # Set environment variable based on the build argument | ||
| ENV DEBUG=${DEBUG} | ||
| ENV PIP_NO_CACHE_DIR=true | ||
| ENV PATH="${PATH}:/root/.poetry/bin" | ||
|
|
||
| RUN apt-get update | ||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| gcc \ | ||
| libpq-dev \ | ||
| git \ | ||
| curl \ | ||
| clang \ | ||
| build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN apt-get install -y \ | ||
| gcc \ | ||
| build-essential \ | ||
| libpq-dev | ||
| # Copy pyproject.toml and lockfile first for better caching | ||
| COPY README.md pyproject.toml uv.lock entrypoint.sh ./ | ||
|
|
||
| WORKDIR /app | ||
| COPY pyproject.toml poetry.lock /app/ | ||
|
|
||
| RUN pip install poetry | ||
| # Install the project's dependencies using the lockfile and settings | ||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
| uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra kuzu --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable | ||
|
|
||
| # Don't create virtualenv since Docker is already isolated | ||
| RUN poetry config virtualenvs.create false | ||
| # Copy Alembic configuration | ||
| COPY alembic.ini /app/alembic.ini | ||
| COPY alembic/ /app/alembic | ||
|
|
||
| # Install the dependencies using the defined extras | ||
| RUN poetry install --extras "${POETRY_EXTRAS}" --no-root | ||
| # Then, add the rest of the project source code and install it | ||
| # Installing separately from its dependencies allows optimal layer caching | ||
| COPY ./cognee /app/cognee | ||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
| uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra kuzu --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable | ||
|
|
||
| # Set the PYTHONPATH environment variable to include the /app directory | ||
| ENV PYTHONPATH=/app | ||
| FROM python:3.12-slim-bookworm | ||
|
|
||
| COPY cognee/ /app/cognee | ||
| WORKDIR /app | ||
|
|
||
| # Copy Alembic configuration | ||
| COPY alembic.ini /app/alembic.ini | ||
| COPY alembic/ /app/alembic | ||
| COPY --from=uv /app /app | ||
| # COPY --from=uv /app/.venv /app/.venv | ||
| # COPY --from=uv /root/.local /root/.local | ||
|
|
||
| COPY entrypoint.sh /app/entrypoint.sh | ||
| RUN chmod +x /app/entrypoint.sh | ||
|
|
||
| RUN sed -i 's/\r$//' /app/entrypoint.sh | ||
| # Place executables in the environment at the front of the path | ||
| ENV PATH="/app/.venv/bin:$PATH" | ||
|
|
||
| ENV PYTHONPATH=/app | ||
|
|
||
| ENTRYPOINT ["/app/entrypoint.sh"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ export default function WizardPage({ | |
| setFalse: closeSettingsModal, | ||
| } = useBoolean(false); | ||
|
|
||
| const dataset = { id: 'main' }; | ||
| const dataset = { name: 'main' }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainProperty name change is consistent with broader refactoring. Changing the property from Let's verify that all usages of 🏁 Script executed: #!/bin/bash
# Check for any remaining instances of dataset.id that might have been missed during refactoring
echo "Searching for potential missed refactoring instances:"
rg "dataset\.id" --type=typescript --type=tsxLength of output: 199 The 🏁 Script executed: #!/bin/bash
echo "Searching for any remaining `dataset.id` usages in .ts/.tsx files:"
rg "dataset\.id" -g '*.ts' -g '*.tsx'Length of output: 1298 Incomplete refactoring: remaining Several files still reference • cognee-frontend/src/modules/ingestion/useDatasets.ts
• cognee-frontend/src/modules/ingestion/addData.ts
• cognee-frontend/src/modules/ingestion/DatasetsView/DatasetsView.tsx
• cognee-frontend/src/modules/datasets/deleteDataset.ts
• cognee-frontend/src/modules/datasets/getDatasetData.ts
• cognee-frontend/src/modules/datasets/cognifyDataset.ts
• cognee-frontend/src/app/page.tsx
Example diff for one case: - status: statuses[dataset.id]
+ status: statuses[dataset.name]
🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <main className={styles.main}> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,13 @@ | ||||||||||||||||||||||||||||
| import { fetch } from '@/utils'; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| export default function cognifyDataset(dataset: { id: string, name: string }) { | ||||||||||||||||||||||||||||
| export default function cognifyDataset(dataset: { id?: string, name?: string }) { | ||||||||||||||||||||||||||||
| return fetch('/v1/cognify', { | ||||||||||||||||||||||||||||
| method: 'POST', | ||||||||||||||||||||||||||||
| headers: { | ||||||||||||||||||||||||||||
| 'Content-Type': 'application/json', | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| body: JSON.stringify({ | ||||||||||||||||||||||||||||
| datasets: [dataset.id], | ||||||||||||||||||||||||||||
| datasets: [dataset.id || dataset.name], | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveConsider handling edge case when both id and name are undefined The fallback mechanism - datasets: [dataset.id || dataset.name],
+ datasets: [dataset.id || dataset.name || ''],Alternatively, consider adding validation before making the API call: export default function cognifyDataset(dataset: { id?: string, name?: string }) {
+ if (!dataset.id && !dataset.name) {
+ throw new Error('Dataset must have either id or name');
+ }
return fetch('/v1/cognify', {Ensure Add a guard at the start of cognifyDataset and use the nullish coalescing operator: • File: cognee-frontend/src/modules/datasets/cognifyDataset.ts export default function cognifyDataset(dataset: { id?: string; name?: string }) {
+ if (!dataset.id && !dataset.name) {
+ throw new Error('cognifyDataset: dataset.id or dataset.name must be defined');
+ }
return fetch('/v1/cognify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
- datasets: [dataset.id || dataset.name],
+ datasets: [dataset.id ?? dataset.name],
}),
});
}This prevents generating 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| }).then((response) => response.json()); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
New callback function to support cognification from data view
The implementation looks good, but be cautious with non-null assertions on
dataset!.idanddataset!.name. IfselectedDatasetdoesn't match any dataset ID in thedatasetsarray, this could potentially cause runtime errors.🏁 Script executed:
Length of output: 63
Couldn’t locate any uses of
onCognifywith the first search. Let’s broaden the ripgrep command to catch TSX files without relying on--type:🏁 Script executed:
Length of output: 2484
Guard against undefined
datasetin onCognifyThe
useCallbackin page.tsx currently uses non-null assertions ondataset!.idanddataset!.name, which will throw at runtime ifselectedDatasetdoesn’t match any entry indatasets. Add an explicit guard to handle the “not found” case before invokingonDatasetCognify.• File: cognee-frontend/src/app/page.tsx
Lines: 63–69
• Suggested change (diff-style):
const onCognify = useCallback(() => { - const dataset = datasets.find((dataset) => dataset.id === selectedDataset); - return onDatasetCognify({ - id: dataset!.id, - name: dataset!.name, - }); + const dataset = datasets.find((d) => d.id === selectedDataset); + if (!dataset) { + console.warn(`No dataset found for id "${selectedDataset}"`); + return; + } + return onDatasetCognify({ + id: dataset.id, + name: dataset.name, + }); }, [datasets, onDatasetCognify, selectedDataset]);This ensures we don’t accidentally invoke
onDatasetCognifywith undefined values and provides a clear warning if the selection is invalid.📝 Committable suggestion
🤖 Prompt for AI Agents