Skip to content

Commit daca1bf

Browse files
authored
Merge branch 'staging' into add-capture-image-in-canvas
2 parents 97ad576 + 1d3cd5c commit daca1bf

18 files changed

Lines changed: 408 additions & 137 deletions

.github/workflows/playwright.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@ jobs:
3333
npm install
3434
npm run build
3535
NEXTAUTH_SECRET=SECRET npm start & npx playwright test --reporter=dot,list
36+
- name: Ensure required directories exist
37+
run: |
38+
mkdir -p playwright-report
39+
mkdir -p playwright-report/artifacts
3640
- uses: actions/upload-artifact@v4
37-
if: ${{ !cancelled() }}
41+
if: always()
3842
with:
3943
name: playwright-report
4044
path: playwright-report/
4145
retention-days: 30
46+
- name: Upload failed test screenshots
47+
if: always()
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: failed-test-screenshots
51+
path: playwright-report/artifacts/
52+
retention-days: 30
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release image to DockerHub
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags: ["v*.*.*"]
7+
branches:
8+
- main
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set tags
18+
run: |
19+
if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}; then
20+
echo "TAGS=falkordb/code-graph-frontend:latest,falkordb/code-graph-frontend:${{ github.ref_name }}" >> $GITHUB_ENV
21+
else
22+
echo "TAGS=falkordb/code-graph-frontend:edge" >> $GITHUB_ENV
23+
fi
24+
25+
- name: Login to DockerHub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKER_USERNAME }}
29+
password: ${{ secrets.DOCKER_PASSWORD }}
30+
31+
- name: Build image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
tags: ${{ env.TAGS }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use a Node.js base image
2-
FROM node:20
2+
FROM node:22
33

44
# Set working directory
55
WORKDIR /app

README.md

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,80 @@
88
## Getting Started
99
[Live Demo](https://code-graph.falkordb.com/)
1010

11+
## Run locally
12+
This project is composed of three pieces:
13+
14+
1. FalkorDB Graph DB - this is where your graphs are stored and queried
15+
2. Code-Graph-Backend - backend logic
16+
3. Code-Graph-Frontend - website
17+
18+
You'll need to start all three components:
19+
1120
### Run FalkorDB
1221

1322
```bash
1423
docker run -p 6379:6379 -it --rm falkordb/falkordb
1524
```
1625

17-
### Install node packages
26+
### Run Code-Graph-Backend
27+
28+
#### Clone the Backend
1829

1930
```bash
20-
npm install
31+
git clone https://github.com/FalkorDB/code-graph-backend.git
2132
```
2233

23-
### Set your OpenAI key
34+
#### Setup environment variables
35+
36+
`SECRET_TOKEN` - user defined token used to authorize the request
2437

38+
```bash
39+
export FALKORDB_HOST=localhost FALKORDB_PORT=6379 \
40+
OPENAI_API_KEY=<YOUR OPENAI_API_KEY> SECRET_TOKEN=<YOUR_SECRECT_TOKEN> \
41+
FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=5000
2542
```
26-
export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
43+
44+
#### Install dependencies & run
45+
46+
```bash
47+
cd code-graph-backend
48+
49+
pip install --no-cache-dir -r requirements.txt
50+
51+
flask --app api/index.py run --debug > flask.log 2>&1 &
52+
2753
```
2854

29-
### Run the development server
55+
### Run Code-Graph-Frontend
56+
57+
#### Clone the Frontend
3058

3159
```bash
60+
git clone https://github.com/FalkorDB/code-graph.git
61+
```
62+
63+
#### Setup environment variables
64+
65+
```bash
66+
export BACKEND_URL=http://${FLASK_RUN_HOST}:${FLASK_RUN_PORT} \
67+
SECRET_TOKEN=<YOUR_SECRECT_TOKEN> OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
68+
```
69+
70+
#### Install dependencies & run
71+
72+
```bash
73+
cd code-graph
74+
npm install
3275
npm run dev
3376
```
3477

35-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
78+
### Process a local repository
79+
```bash
80+
curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "<PATH_TO_LOCAL_REPO>", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}' -H "Authorization: <YOUR_SECRECT_TOKEN>"
81+
```
82+
83+
Note: At the moment code-graph can analyze both the C & Python source files.
84+
Support for additional languages e.g. JavaScript, Go, Java is planned to be added
85+
in the future.
86+
87+
Browse to [http://localhost:3000](http://localhost:3000)

app/components/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ export function Chat({ repo, path, setPath, graph, selectedPathId, isPathRespons
387387
parentClassName="w-full"
388388
graph={graph}
389389
onValueChange={({ name, id }) => setPath(prev => ({ start: { name, id }, end: prev?.end }))}
390-
value={path?.start?.name}
390+
value={path?.start?.name || ""}
391391
placeholder="Start typing starting point"
392392
type="text"
393393
icon={<ChevronDown color="gray" />}
@@ -397,7 +397,7 @@ export function Chat({ repo, path, setPath, graph, selectedPathId, isPathRespons
397397
<Input
398398
parentClassName="w-full"
399399
graph={graph}
400-
value={path?.end?.name}
400+
value={path?.end?.name || ""}
401401
onValueChange={({ name, id }) => setPath(prev => ({ end: { name, id }, start: prev?.start }))}
402402
placeholder="Start typing end point"
403403
type="text"

app/components/code-graph.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export function CodeGraph({
298298
<div className='flex gap-4'>
299299
<Input
300300
graph={graph}
301-
value={searchNode.name}
301+
value={searchNode.name || ""}
302302
onValueChange={({ name }) => setSearchNode({ name })}
303303
icon={<Search />}
304304
handleSubmit={handleSearchSubmit}

app/components/elementMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default function ElementMenu({ obj, objects, setPath, handleRemove, posit
4545
left: Math.max(-34, Math.min(position.x - 33 - containerWidth / 2, (parentRef?.current?.clientWidth || 0) + 32 - containerWidth)),
4646
top: Math.min(position.y - 153, (parentRef?.current?.clientHeight || 0) - 9),
4747
}}
48+
id="elementMenu"
4849
>
4950
{
5051
objects.some(o => o.id === obj.id) && objects.length > 1 ?

docker-compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: "3.9"
2+
3+
services:
4+
falkordb:
5+
image: falkordb/falkordb:latest
6+
ports:
7+
- "6379:6379"
8+
- "3001:3000"
9+
volumes:
10+
- ./:/data/
11+
stdin_open: true # Keep the container's STDIN open
12+
tty: true # Allocate a pseudo-TTY
13+
14+
code-graph-frontend:
15+
image: falkordb/code-graph-frontend:latest
16+
ports:
17+
- "3000:3000"
18+
depends_on:
19+
- code-graph-backend
20+
environment:
21+
- BACKEND_URL=http://code-graph-backend:5000 # Backend service URL
22+
- SECRET_TOKEN=Vespa
23+
24+
code-graph-backend:
25+
image: falkordb/code-graph-backend:latest
26+
ports:
27+
- "4000:5000"
28+
depends_on:
29+
- falkordb
30+
environment:
31+
- FALKORDB_HOST=falkordb
32+
- FALKORDB_PORT=6379
33+
- OPENAI_API_KEY=YOUR_OPENAI_API_KEY
34+
- SECRET_TOKEN=Vespa
35+
- FLASK_RUN_HOST=0.0.0.0
36+
- FLASK_RUN_PORT=5000

e2e/config/testData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const nodesPath: { firstNode: string; secondNode: string }[] = [
2020
];
2121

2222
export const nodes: { nodeName: string; }[] = [
23-
{ nodeName: "import_data"},
23+
{ nodeName: "ask"},
2424
{ nodeName: "add_edge" },
2525
{ nodeName: "test_kg_delete"},
2626
{ nodeName: "list_graphs"}

0 commit comments

Comments
 (0)