Skip to content

Commit e2ea644

Browse files
authored
Merge branch 'staging' into fix-path-selection
2 parents 34d00ff + ea49177 commit e2ea644

30 files changed

+1725
-868
lines changed

.github/workflows/playwright.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, staging ]
5+
pull_request:
6+
branches: [ main, staging ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
services:
12+
falkordb:
13+
image: falkordb/falkordb:latest
14+
ports:
15+
- 6379:6379
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: lts/*
21+
- name: Install dependencies
22+
run: npm ci
23+
- name: Install Playwright Browsers
24+
run: npx playwright install --with-deps
25+
- name: Set up environment variables and run tests
26+
env:
27+
FALKORDB_URL: ${{ secrets.FALKORDB_URL }}
28+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
29+
SECRET_TOKEN: ${{ secrets.SECRET_TOKEN }}
30+
NEXT_PUBLIC_MODE: UNLIMITED
31+
BACKEND_URL: ${{ secrets.BACKEND_URL }}
32+
run: |
33+
npm install
34+
npm run build
35+
NEXTAUTH_SECRET=SECRET npm start & npx playwright test --reporter=dot,list
36+
- uses: actions/upload-artifact@v4
37+
if: ${{ !cancelled() }}
38+
with:
39+
name: playwright-report
40+
path: playwright-report/
41+
retention-days: 30

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ next-env.d.ts
3737

3838

3939
# vscode
40-
/.vscode/
40+
/.vscode/
41+
node_modules/
42+
/test-results/
43+
/playwright-report/
44+
/blob-report/
45+
/playwright/.cache/

app/api/repo/[graph]/[node]/route.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
import { NextRequest, NextResponse } from "next/server";
22

3-
export async function GET(request: NextRequest, { params }: { params: { graph: string, node: string } }) {
4-
5-
const nodeId = parseInt(params.node);
6-
const graphId = params.graph;
7-
try {
8-
9-
const result = await fetch(`${process.env.BACKEND_URL}/get_neighbors?repo=${graphId}&node_id=${nodeId}`, {
10-
method: 'GET',
11-
headers: {
12-
"Authorization": process.env.SECRET_TOKEN!,
13-
}
14-
})
15-
16-
const json = await result.json()
17-
18-
return NextResponse.json({ result: json }, { status: 200 })
19-
} catch (err) {
20-
return NextResponse.json({ massage: (err as Error).message }, { status: 400 })
21-
}
22-
}
23-
243
export async function POST(request: NextRequest, { params }: { params: { graph: string, node: string } }) {
254

265
const nodeId = params.node;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { NextRequest, NextResponse } from "next/server";
2+
3+
export async function POST(request: NextRequest, { params }: { params: { graph: string } }) {
4+
5+
const nodeIds = (await request.json()).nodeIds.map((id: string) => Number(id));
6+
const graphId = params.graph;
7+
8+
try {
9+
const result = await fetch(`${process.env.BACKEND_URL}/get_neighbors`, {
10+
method: 'POST',
11+
body: JSON.stringify({ node_ids: nodeIds, repo: graphId }),
12+
headers: {
13+
"Content-Type": 'application/json',
14+
"Authorization": process.env.SECRET_TOKEN!,
15+
}
16+
})
17+
18+
const json = await result.json()
19+
20+
return NextResponse.json({ result: json }, { status: 200 })
21+
} catch (err) {
22+
return NextResponse.json({ massage: (err as Error).message }, { status: 400 })
23+
}
24+
}

app/components/Input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default function Input({ value, onValueChange, handelSubmit, graph, icon,
121121
return (
122122
<div
123123
className={cn("w-[20dvw] relative pointer-events-none rounded-md gap-4", parentClassName)}
124+
data-name='search-bar'
124125
>
125126
<input
126127
ref={inputRef}
@@ -143,6 +144,7 @@ export default function Input({ value, onValueChange, handelSubmit, graph, icon,
143144
<div
144145
ref={containerRef}
145146
className="z-10 w-full bg-white absolute flex flex-col pointer-events-auto border rounded-md max-h-[50dvh] overflow-y-auto overflow-x-hidden p-2 gap-2"
147+
data-name='search-bar-list'
146148
style={{
147149
top: (inputRef.current?.clientHeight || 0) + 16
148150
}}
@@ -163,7 +165,6 @@ export default function Input({ value, onValueChange, handelSubmit, graph, icon,
163165
onMouseEnter={() => setSelectedOption(index)}
164166
onMouseLeave={() => setSelectedOption(-1)}
165167
onClick={() => {
166-
debugger
167168
onValueChange({ name: option.properties.name, id: option.id })
168169
handelSubmit && handelSubmit(option)
169170
setOpen(false)

app/components/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export function Chat({ repo, path, setPath, graph, chartRef, selectedPathId, isP
466466

467467
return (
468468
<div className="h-full flex flex-col justify-between px-6 pt-10 pb-4 gap-4">
469-
<main ref={containerRef} className="relative grow flex flex-col overflow-y-auto gap-6 px-4">
469+
<main data-name="main-chat" ref={containerRef} className="relative grow flex flex-col overflow-y-auto gap-6 px-4">
470470
{
471471
messages.length === 0 &&
472472
<>
@@ -495,7 +495,7 @@ export function Chat({ repo, path, setPath, graph, chartRef, selectedPathId, isP
495495
{
496496
repo &&
497497
<div className="flex gap-4 px-4">
498-
<button disabled={isSendMessage} className="p-4 border rounded-md hover:border-[#FF66B3] hover:bg-[#FFF0F7]" onClick={() => setTipOpen(prev => !prev)}>
498+
<button data-name="lightbulb" disabled={isSendMessage} className="p-4 border rounded-md hover:border-[#FF66B3] hover:bg-[#FFF0F7]" onClick={() => setTipOpen(prev => !prev)}>
499499
<Lightbulb />
500500
</button>
501501
<form className="grow flex items-center border rounded-md pr-2" onSubmit={sendQuery}>

0 commit comments

Comments
 (0)