Skip to content
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

added boilerplate for user management #123

Merged
merged 48 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
866270b
added boilerplate for user management
Vasilije1990 Jul 21, 2024
77e8c1b
add sqlalchemy engine
Vasilije1990 Jul 21, 2024
e785b30
Initial functional user auth
Vasilije1990 Jul 22, 2024
14e1eba
Fixes for user flow with group management
Vasilije1990 Jul 23, 2024
36e156e
Fixes to the model and adding the read info to the graph
Vasilije1990 Jul 23, 2024
3f5e665
Update cognee/api/client.py
Vasilije1990 Jul 24, 2024
e7b0e71
Fixes to translation services
Vasilije1990 Jul 24, 2024
a93bd53
Merge remote-tracking branch 'origin/COG-206' into COG-206
Vasilije1990 Jul 24, 2024
9616545
Exposed user management
Vasilije1990 Jul 26, 2024
218d322
Fixes to the ACL model
Vasilije1990 Jul 27, 2024
b4d1a73
Fixes to the ACL model
Vasilije1990 Jul 27, 2024
7930586
Fixes to the ACL model
Vasilije1990 Jul 27, 2024
797e7ba
Updates to searches
Vasilije1990 Jul 27, 2024
66749fa
Updates to functions
Vasilije1990 Jul 27, 2024
2717272
Merge remote-tracking branch 'origin/main' into COG-206
borisarzentar Aug 1, 2024
401167b
fix: enable sqlalchemy adapter
borisarzentar Aug 4, 2024
07e2bc1
Fixes to the pipeline
Vasilije1990 Aug 5, 2024
085ca5e
Fixes to the users
Vasilije1990 Aug 5, 2024
7d3e124
Fixes to the sqlalchemy adapter
Vasilije1990 Aug 5, 2024
b5a3b69
Fixes to the sqlalchemy adapter
Vasilije1990 Aug 5, 2024
9a2cde9
Fixes to the sqlalchemy adapter
Vasilije1990 Aug 5, 2024
6035010
Fixes to the sqlalchemy adapter
Vasilije1990 Aug 5, 2024
709a10c
fix: add dataset and data models
borisarzentar Aug 5, 2024
73dd6c2
Fix to neo4j flow
Vasilije1990 Aug 6, 2024
0519986
Merge remote-tracking branch 'origin/COG-206' into COG-206
Vasilije1990 Aug 6, 2024
cb9bfa2
fix: search results preview
borisarzentar Aug 6, 2024
4749995
Merge remote-tracking branch 'origin/COG-206' into COG-206
borisarzentar Aug 6, 2024
7846291
fix: add buildx action
borisarzentar Aug 6, 2024
acf41ff
fix: upgrade setup-buildx-action
borisarzentar Aug 6, 2024
3f35a45
fix: add setup_docker job
borisarzentar Aug 6, 2024
3e3134b
fix: fix debugpy version
borisarzentar Aug 6, 2024
0dad12c
fix: upgrade buildx action
borisarzentar Aug 6, 2024
a590c6a
fix: run tests on ubuntu
borisarzentar Aug 6, 2024
896a2ce
fix: add postgres service to tests
borisarzentar Aug 6, 2024
e492a18
fix: add env variables to test workflows
borisarzentar Aug 6, 2024
ed6e8eb
fix: wait for postgres to be ready before tests
borisarzentar Aug 6, 2024
a34acbc
fix: update neo4j lib
borisarzentar Aug 6, 2024
1c89119
fix: uuid parsing of search results
borisarzentar Aug 6, 2024
8a63aa3
fix: run buildx on all platforms
borisarzentar Aug 6, 2024
4f72eb5
fix: install buildx on all platforms
borisarzentar Aug 6, 2024
6d38bcd
fix: add QEMU
borisarzentar Aug 6, 2024
887d4e1
fix: add install_docker step in github action workflow
borisarzentar Aug 6, 2024
fd20fac
fix: add steps
borisarzentar Aug 6, 2024
8fa572a
fix: add runs-on
borisarzentar Aug 6, 2024
9927855
fix: move if
borisarzentar Aug 6, 2024
841e7b5
fix: add needs
borisarzentar Aug 6, 2024
f808cf1
fix: move install docker job
borisarzentar Aug 6, 2024
e3c3f35
fix: remove macos test
borisarzentar Aug 6, 2024
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
14 changes: 4 additions & 10 deletions .github/workflows/docker_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,22 @@ jobs:
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Build Docker images
run: |
docker-compose -f docker-compose.yml build
docker compose -f docker-compose.yml build

- name: Run Docker Compose
run: |
docker-compose -f docker-compose.yml up -d
docker compose -f docker-compose.yml up -d

- name: Wait for services to be ready
run: |
# Add any necessary health checks or wait commands
sleep 30

# - name: Run tests
# run: |
# docker-compose -f docker-compose.yml run --rm <test-service> <test-command>
# # Replace <test-service> with the name of the service running the tests
# # Replace <test-command> with the actual command to run your tests

- name: Shut down Docker Compose
if: always()
run: |
docker-compose -f docker-compose.yml down
docker compose -f docker-compose.yml down
19 changes: 19 additions & 0 deletions .github/workflows/test_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ jobs:
name: docs changes
uses: ./.github/workflows/get_docs_changes.yml

setup_docker:
name: Set up Docker Buildx
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

run_common:
name: test
needs: get_docs_changes
Expand All @@ -40,6 +47,18 @@ jobs:
run:
shell: bash

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cognee
POSTGRES_PASSWORD: cognee
POSTGRES_DB: cognee_db
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432

runs-on: ${{ matrix.os }}

steps:
Expand Down
33 changes: 32 additions & 1 deletion .github/workflows/test_neo4j.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,35 @@ jobs:
name: docs changes
uses: ./.github/workflows/get_docs_changes.yml

setup_docker:
name: Set up Docker Buildx
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

run_neo4j_integration_test:
name: test
needs: get_docs_changes
if: needs.get_docs_changes.outputs.changes_outside_docs == 'true'
runs-on: macos-latest
runs-on: ubuntu-latest

defaults:
run:
shell: bash

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cognee
POSTGRES_PASSWORD: cognee
POSTGRES_DB: cognee_db
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432

steps:
- name: Check out
uses: actions/checkout@v2
Expand All @@ -44,6 +63,13 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true

- name: Wait for PostgreSQL to be ready
run: |
echo "Waiting for PostgreSQL to be ready..."
until pg_isready -h localhost -p 5432 -U cognee; do
sleep 1
done

- name: Install dependencies
run: poetry install --no-interaction

Expand All @@ -60,4 +86,9 @@ jobs:
GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }}
GRAPH_DATABASE_USERNAME: "neo4j"
ENV: 'dev'
POSTGRES_USER: cognee
POSTGRES_PASSWORD: cognee
POSTGRES_DB: cognee_db
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
run: poetry run python ./cognee/tests/test_neo4j.py
21 changes: 20 additions & 1 deletion .github/workflows/test_qdrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,35 @@ jobs:
name: docs changes
uses: ./.github/workflows/get_docs_changes.yml

setup_docker:
name: Set up Docker Buildx
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

run_qdrant_integration_test:
name: test
needs: get_docs_changes
if: needs.get_docs_changes.outputs.changes_outside_docs == 'true'
runs-on: macos-latest
runs-on: ubuntu-latest

defaults:
run:
shell: bash

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cognee
POSTGRES_PASSWORD: cognee
POSTGRES_DB: cognee_db
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432

steps:
- name: Check out
uses: actions/checkout@v2
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/test_weaviate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,35 @@ jobs:
name: docs changes
uses: ./.github/workflows/get_docs_changes.yml

setup_docker:
name: Set up Docker Buildx
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

run_weaviate_integration_test:
name: test
needs: get_docs_changes
if: needs.get_docs_changes.outputs.changes_outside_docs == 'true'
runs-on: macos-latest
runs-on: ubuntu-latest

defaults:
run:
shell: bash

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cognee
POSTGRES_PASSWORD: cognee
POSTGRES_DB: cognee_db
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432

steps:
- name: Check out
uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ disable=raw-checker-failed,
use-implicit-booleaness-not-comparison-to-zero,
missing-module-docstring,
missing-function-docstring,
missing-class-docstring

missing-class-docstring,
relative-beyond-top-level


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
8 changes: 4 additions & 4 deletions cognee-frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export default function Home() {
});
}, [showNotification])

const onDatasetCognify = useCallback((dataset: { id: string }) => {
showNotification(`Cognification started for dataset "${dataset.id}".`, 5000);
const onDatasetCognify = useCallback((dataset: { id: string, name: string }) => {
showNotification(`Cognification started for dataset "${dataset.name}".`, 5000);

return cognifyDataset(dataset)
.then(() => {
showNotification(`Dataset "${dataset.id}" cognified.`, 5000);
showNotification(`Dataset "${dataset.name}" cognified.`, 5000);
})
.catch(() => {
showNotification(`Dataset "${dataset.id}" cognification failed. Please try again.`, 5000);
showNotification(`Dataset "${dataset.name}" cognification failed. Please try again.`, 5000);
});
}, [showNotification]);

Expand Down
4 changes: 2 additions & 2 deletions cognee-frontend/src/modules/datasets/cognifyDataset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function cognifyDataset(dataset: { id: string }) {
return fetch('http://0.0.0.0:8000/cognify', {
export default function cognifyDataset(dataset: { id: string, name: string }) {
return fetch('http://127.0.0.1:8000/cognify', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion cognee-frontend/src/modules/datasets/deleteDataset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function deleteDataset(dataset: { id: string }) {
return fetch(`http://0.0.0.0:8000/datasets/${dataset.id}`, {
return fetch(`http://127.0.0.1:8000/datasets/${dataset.id}`, {
method: 'DELETE',
})
}
2 changes: 1 addition & 1 deletion cognee-frontend/src/modules/datasets/getDatasetData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function getDatasetData(dataset: { id: string }) {
return fetch(`http://0.0.0.0:8000/datasets/${dataset.id}/data`)
return fetch(`http://127.0.0.1:8000/datasets/${dataset.id}/data`)
.then((response) => response.json());
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function getExplorationGraphUrl(dataset: { id: string }) {
return fetch(`http://0.0.0.0:8000/datasets/${dataset.id}/graph`)
return fetch(`http://127.0.0.1:8000/datasets/${dataset.id}/graph`)
.then(async (response) => {
if (response.status !== 200) {
throw new Error((await response.text()).replaceAll("\"", ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

.dataTable {
color: white;
border-collapse: collapse;
}
.dataTable td, .dataTable th {
Expand Down
10 changes: 5 additions & 5 deletions cognee-frontend/src/modules/ingestion/DataView/DataView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import RawDataPreview from './RawDataPreview';
export interface Data {
id: string;
name: string;
filePath: string;
mimeType: string;
extension: string;
rawDataLocation: string;
}

interface DatasetLike {
Expand All @@ -36,7 +37,7 @@ export default function DataView({ datasetId, data, onClose, onDataAdd }: DataVi
const showRawData = useCallback((dataItem: Data) => {
setSelectedData(dataItem);

fetch(`http://0.0.0.0:8000/datasets/${datasetId}/data/${dataItem.id}/raw`)
fetch(`http://127.0.0.1:8000/datasets/${datasetId}/data/${dataItem.id}/raw`)
.then((response) => response.arrayBuffer())
.then(setRawData);

Expand Down Expand Up @@ -80,7 +81,6 @@ export default function DataView({ datasetId, data, onClose, onDataAdd }: DataVi
<th>Name</th>
<th>File path</th>
<th>MIME type</th>
<th>Keywords</th>
</tr>
</thead>
<tbody>
Expand All @@ -104,10 +104,10 @@ export default function DataView({ datasetId, data, onClose, onDataAdd }: DataVi
<Text>{dataItem.id}</Text>
</td>
<td>
<Text>{dataItem.name}</Text>
<Text>{dataItem.name}.{dataItem.extension}</Text>
</td>
<td>
<Text>{dataItem.filePath}</Text>
<Text>{dataItem.rawDataLocation}</Text>
</td>
<td>
<Text>{dataItem.mimeType}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function DatasetsView({
.finally(() => enableCognifyRun());
}

const [dataset, setExplorationDataset] = useState<{ id: string } | null>(null);
const [dataset, setExplorationDataset] = useState<{ id: string, name: string } | null>(null);
const {
value: isExplorationWindowShown,
setTrue: showExplorationWindow,
Expand Down Expand Up @@ -97,7 +97,7 @@ export default function DatasetsView({
</Stack>
<Modal onClose={hideExplorationWindow} isOpen={isExplorationWindowShown} className={styles.explorerModal}>
<Spacer horizontal="2" vertical="3" wrap>
<Text>{dataset?.id}</Text>
<Text>{dataset?.name}</Text>
</Spacer>
<Explorer dataset={dataset!} />
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion cognee-frontend/src/modules/ingestion/addData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function addData(dataset: { id: string }, files: File[]) {
})
formData.append('datasetId', dataset.id);

return fetch('http://0.0.0.0:8000/add', {
return fetch('http://127.0.0.1:8000/add', {
method: 'POST',
body: formData,
}).then((response) => response.json());
Expand Down
5 changes: 2 additions & 3 deletions cognee-frontend/src/modules/ingestion/useDatasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function useDatasets() {
const statusTimeout = useRef<any>(null);

const fetchDatasetStatuses = useCallback((datasets: Dataset[]) => {
fetch(`http://0.0.0.0:8000/datasets/status?dataset=${datasets.map(d => d.id).join('&dataset=')}`)
fetch(`http://127.0.0.1:8000/datasets/status?dataset=${datasets.map(d => d.id).join('&dataset=')}`)
.then((response) => response.json())
.then((statuses) => setDatasets(
(datasets) => (
Expand Down Expand Up @@ -65,9 +65,8 @@ function useDatasets() {
}, []);

const fetchDatasets = useCallback(() => {
fetch('http://0.0.0.0:8000/datasets')
fetch('http://127.0.0.1:8000/datasets')
.then((response) => response.json())
.then((datasets) => datasets.map((dataset: string) => ({ id: dataset, name: dataset })))
.then((datasets) => {
setDatasets(datasets);

Expand Down
6 changes: 4 additions & 2 deletions cognee-frontend/src/ui/Partials/SearchView/SearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './SearchView.module.css';
interface Message {
id: string;
user: 'user' | 'system';
text: string;
text: any;
}

interface SelectOption {
Expand Down Expand Up @@ -98,7 +98,9 @@ export default function SearchView() {
[styles.userMessage]: message.user === "user",
})}
>
{message.text}
{message?.text && (
typeof(message.text) == "string" ? message.text : JSON.stringify(message.text)
)}
</Text>
))}
</Stack>
Expand Down
4 changes: 2 additions & 2 deletions cognee-frontend/src/ui/Partials/SettingsModal/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function Settings({ onDone = () => {}, submitButtonText = 'Save'

startSaving();

fetch('http://0.0.0.0:8000/settings', {
fetch('http://127.0.0.1:8000/settings', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -138,7 +138,7 @@ export default function Settings({ onDone = () => {}, submitButtonText = 'Save'

useEffect(() => {
const fetchConfig = async () => {
const response = await fetch('http://0.0.0.0:8000/settings');
const response = await fetch('http://127.0.0.1:8000/settings');
const settings = await response.json();

if (!settings.llm.model) {
Expand Down
Loading
Loading