diff --git a/Server/app/api-service/controllers/dashboard.controllers.ts b/Server/app/api-service/controllers/dashboard.controllers.ts
index 4f9d22d..73aae3a 100644
--- a/Server/app/api-service/controllers/dashboard.controllers.ts
+++ b/Server/app/api-service/controllers/dashboard.controllers.ts
@@ -23,7 +23,6 @@ export async function getAllData(req: Request, res: Response) {
return;
}
- console.log(" ----------- userId ------------ \n", userId)
const cachedData = await redisClient.get(`dashboardData:${userId}`);
diff --git a/Server/app/webhook-service/routes/github.webhook.ts b/Server/app/webhook-service/routes/github.webhook.ts
index c883b17..e74b8b2 100644
--- a/Server/app/webhook-service/routes/github.webhook.ts
+++ b/Server/app/webhook-service/routes/github.webhook.ts
@@ -34,7 +34,6 @@ router.post("/webhook/github", async (req: Request, res: Response) => {
if (!client.isOpen){
await client.connect();
}
- console.log("<====================== OWNER ==========================> \n", "\n", req.body.pull_request.user)
const event = req.headers["x-github-event"];
console.log("github event received:", event);
@@ -73,9 +72,7 @@ if (!client.isOpen){
}
if (event === "pull_request") {
- console.log("i am in")
const payload = req.body as PullRequestEvent;
- console.log(payload)
const installationId = payload.installation.id;
const owner = payload.repository.owner.login;
const repo = payload.repository.name;
@@ -111,10 +108,8 @@ if (!client.isOpen){
}
}
- console.log("running the workflowwwwww")
if (event === "workflow_run") {
const payload = req.body as any;
- console.log("payload recieved , here is its id", payload.workflow_run.id)
if (payload.workflow_run?.conclusion === "failure") {
const installationId = payload.installation?.id;
diff --git a/Server/app/worker-service/services/exampleDataToEmbeed.ts b/Server/app/worker-service/services/exampleDataToEmbeed.ts
new file mode 100644
index 0000000..7cc8525
--- /dev/null
+++ b/Server/app/worker-service/services/exampleDataToEmbeed.ts
@@ -0,0 +1,479 @@
+[
+ {
+ "path": "/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/src/App.jsx",
+ "content": "import { useState, useEffect, useRef } from 'react'\n" +
+ "import Column from './components/Column'\n" +
+ "import AddTaskModal from './components/AddTaskModal'\n" +
+ "import './App.css'\n" +
+ '\n' +
+ 'function App() {\n' +
+ ' const [tasks, setTasks] = useState([])\n' +
+ ' const [loading, setLoading] = useState(true)\n' +
+ ' const [err, setErr] = useState(null)\n' +
+ ' const [modalCol, setModalCol] = useState(null)\n' +
+ " const [boardName, setBoardName] = useState('My Board')\n" +
+ ' const [editingName, setEditingName] = useState(false)\n' +
+ ' const nameRef = useRef(null)\n' +
+ '\n' +
+ ' useEffect(() => {\n' +
+ ' loadAll()\n' +
+ ' }, [])\n' +
+ '\n' +
+ ' useEffect(() => {\n' +
+ ' if (editingName && nameRef.current) {\n' +
+ ' nameRef.current.focus()\n' +
+ ' nameRef.current.select()\n' +
+ ' }\n' +
+ ' }, [editingName])\n' +
+ '\n' +
+ ' async function loadAll() {\n' +
+ ' try {\n' +
+ " const res = await fetch('/tasks')\n" +
+ ' const data = await res.json()\n' +
+ ' setTasks(data)\n' +
+ ' } catch (e) {\n' +
+ " setErr('Could not connect to server')\n" +
+ ' } finally {\n' +
+ ' setLoading(false)\n' +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' async function addTask(title, desc, status) {\n' +
+ ' try {\n' +
+ " const res = await fetch('/tasks', {\n" +
+ " method: 'POST',\n" +
+ " headers: { 'Content-Type': 'application/json' },\n" +
+ ' body: JSON.stringify({ title, description: desc, status })\n' +
+ ' })\n' +
+ ' if (!res.ok) {\n' +
+ ' const body = await res.json()\n' +
+ ' setErr(body.error)\n' +
+ ' return\n' +
+ ' }\n' +
+ ' const created = await res.json()\n' +
+ ' setTasks(prev => [...prev, created])\n' +
+ ' } catch (e) {\n' +
+ " setErr('Failed to add task')\n" +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' async function moveTask(id, newStatus) {\n' +
+ ' try {\n' +
+ ' const res = await fetch(`/tasks/${id}`, {\n' +
+ " method: 'PUT',\n" +
+ " headers: { 'Content-Type': 'application/json' },\n" +
+ ' body: JSON.stringify({ status: newStatus })\n' +
+ ' })\n' +
+ ' const updated = await res.json()\n' +
+ ' setTasks(prev => prev.map(t => t.id === updated.id ? updated : t))\n' +
+ ' } catch (e) {\n' +
+ " setErr('Failed to move task')\n" +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' async function removeTask(id) {\n' +
+ ' try {\n' +
+ " await fetch(`/tasks/${id}`, { method: 'DELETE' })\n" +
+ ' setTasks(prev => prev.filter(t => t.id !== id))\n' +
+ ' } catch (e) {\n' +
+ " setErr('Failed to delete task')\n" +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' function saveName() {\n' +
+ " if (!boardName.trim()) setBoardName('My Board')\n" +
+ ' setEditingName(false)\n' +
+ ' }\n' +
+ '\n' +
+ ' const cols = [\n' +
+ " { label: 'To Do', type: 'todo' },\n" +
+ " { label: 'In Progress', type: 'inprogress' },\n" +
+ " { label: 'Bug', type: 'bug' },\n" +
+ " { label: 'Done', type: 'done' },\n" +
+ ' ]\n' +
+ '\n' +
+ ' return (\n' +
+ '
\n' +
+ '
\n' +
+ '\n' +
+ ' {err && (\n' +
+ '
\n' +
+ ' {err}\n' +
+ ' \n' +
+ '
\n' +
+ ' )}\n' +
+ '\n' +
+ ' {loading ? (\n' +
+ '
\n' +
+ ' ) : (\n' +
+ '
\n' +
+ ' {cols.map(col => (\n' +
+ ' t.status === col.type)}\n' +
+ ' onMove={moveTask}\n' +
+ ' onRemove={removeTask}\n' +
+ ' onAddClick={() => setModalCol(col.type)}\n' +
+ ' />\n' +
+ ' ))}\n' +
+ '
\n' +
+ ' )}\n' +
+ '\n' +
+ ' {modalCol && (\n' +
+ '
setModalCol(null)}\n' +
+ ' onAdd={addTask}\n' +
+ ' />\n' +
+ ' )}\n' +
+ ' \n' +
+ ' )\n' +
+ '}\n' +
+ '\n' +
+ 'export default App\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/src/components/AddTaskModal.jsx',
+ content: "import { useState } from 'react'\n" +
+ '\n' +
+ 'function AddTaskModal({ colStatus, onClose, onAdd }) {\n' +
+ " const [title, setTitle] = useState('')\n" +
+ " const [desc, setDesc] = useState('')\n" +
+ ' const [busy, setBusy] = useState(false)\n' +
+ '\n' +
+ ' async function submit() {\n' +
+ ' if (!title.trim()) return\n' +
+ ' setBusy(true)\n' +
+ ' await onAdd(title.trim(), desc.trim(), colStatus)\n' +
+ ' setBusy(false)\n' +
+ ' onClose()\n' +
+ ' }\n' +
+ '\n' +
+ ' function handleOverlayKey(e) {\n' +
+ " if (e.key === 'Escape') onClose()\n" +
+ ' }\n' +
+ '\n' +
+ ' return (\n' +
+ ' \n' +
+ '
e.stopPropagation()}>\n' +
+ '
\n' +
+ '
New Task
\n' +
+ ' \n' +
+ ' \n' +
+ '\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ ' setTitle(e.target.value)}\n' +
+ " onKeyDown={e => e.key === 'Enter' && submit()}\n" +
+ ' />\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '\n' +
+ '
\n' +
+ ' \n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
\n' +
+ ' )\n' +
+ '}\n' +
+ '\n' +
+ 'export default AddTaskModal\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/src/components/Column.jsx',
+ content: "import { useState } from 'react'\n" +
+ "import TaskCard from './TaskCard'\n" +
+ '\n' +
+ 'const dotColors = {\n' +
+ " todo: '#3b82f6',\n" +
+ " inprogress: '#f97316',\n" +
+ " bug: '#ef4444',\n" +
+ " done: '#22c55e'\n" +
+ '}\n' +
+ '\n' +
+ 'function Column({ label, colType, items, onMove, onRemove, onAddClick }) {\n' +
+ ' const [dragOver, setDragOver] = useState(false)\n' +
+ '\n' +
+ ' function handleDragOver(e) {\n' +
+ ' e.preventDefault()\n' +
+ ' setDragOver(true)\n' +
+ ' }\n' +
+ '\n' +
+ ' function handleDragLeave(e) {\n' +
+ ' if (!e.currentTarget.contains(e.relatedTarget)) {\n' +
+ ' setDragOver(false)\n' +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' function handleDrop(e) {\n' +
+ ' e.preventDefault()\n' +
+ ' setDragOver(false)\n' +
+ " const id = parseInt(e.dataTransfer.getData('taskId'))\n" +
+ " const from = e.dataTransfer.getData('fromStatus')\n" +
+ ' if (from !== colType) {\n' +
+ ' onMove(id, colType)\n' +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' return (\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ ' {label}\n' +
+ '
\n' +
+ '
{items.length}\n' +
+ '
\n' +
+ '\n' +
+ '
\n' +
+ ' {items.length === 0 && (\n' +
+ '
Drop tasks here
\n' +
+ ' )}\n' +
+ ' {items.map(item => (\n' +
+ '
\n' +
+ ' ))}\n' +
+ '
\n' +
+ '\n' +
+ '
\n' +
+ '
\n' +
+ ' )\n' +
+ '}\n' +
+ '\n' +
+ 'export default Column\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/src/components/TaskCard.jsx',
+ content: "import { useState } from 'react'\n" +
+ '\n' +
+ "const accents = ['#ef4444', '#f97316', '#eab308', '#22c55e', '#3b82f6', '#8b5cf6', '#ec4899']\n" +
+ '\n' +
+ 'const statusOptions = [\n' +
+ " { value: 'todo', label: 'To Do' },\n" +
+ " { value: 'inprogress', label: 'In Progress' },\n" +
+ " { value: 'bug', label: 'Bug' },\n" +
+ " { value: 'done', label: 'Done' },\n" +
+ ']\n' +
+ '\n' +
+ 'function TaskCard({ task, onMove, onRemove }) {\n' +
+ ' const [dragging, setDragging] = useState(false)\n' +
+ '\n' +
+ ' const color = accents[task.id % accents.length]\n' +
+ " const done = task.status === 'done'\n" +
+ '\n' +
+ ' function onDragStart(e) {\n' +
+ " e.dataTransfer.setData('taskId', task.id)\n" +
+ " e.dataTransfer.setData('fromStatus', task.status)\n" +
+ " e.dataTransfer.effectAllowed = 'move'\n" +
+ ' setDragging(true)\n' +
+ ' }\n' +
+ '\n' +
+ ' function onDragEnd() {\n' +
+ ' setDragging(false)\n' +
+ ' }\n' +
+ '\n' +
+ ' function handleStatusChange(e) {\n' +
+ ' const next = e.target.value\n' +
+ ' if (next !== task.status) {\n' +
+ ' onMove(task.id, next)\n' +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' return (\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ "
{task.title}
\n" +
+ ' {task.description && (\n' +
+ '
{task.description}
\n' +
+ ' )}\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ ' )\n' +
+ '}\n' +
+ '\n' +
+ 'export default TaskCard\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/src/main.jsx',
+ content: "import React from 'react'\n" +
+ "import ReactDOM from 'react-dom/client'\n" +
+ "import App from './App'\n" +
+ "import './index.css'\n" +
+ '\n' +
+ "ReactDOM.createRoot(document.getElementById('root')).render(\n" +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ')\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/client/vite.config.js',
+ content: "import { defineConfig } from 'vite'\n" +
+ "import react from '@vitejs/plugin-react'\n" +
+ '\n' +
+ 'export default defineConfig({\n' +
+ ' plugins: [react()],\n' +
+ ' server: {\n' +
+ ' port: 5173,\n' +
+ ' proxy: {\n' +
+ " '/tasks': 'http://localhost:3001'\n" +
+ ' }\n' +
+ ' }\n' +
+ '})\n'
+ },
+ {
+ path: '/tmp/AdarshVMore-Kanaban-board-task-cliperact-extracted/AdarshVMore-Kanaban-board-task-cliperact-76ccc3d/server/index.js',
+ content: "const express = require('express')\n" +
+ "const cors = require('cors')\n" +
+ '\n' +
+ 'const app = express()\n' +
+ '\n' +
+ 'app.use(cors())\n' +
+ 'app.use(express.json())\n' +
+ '\n' +
+ 'let tasks = []\n' +
+ 'let idCounter = 1\n' +
+ '\n' +
+ "app.get('/tasks', (req, res) => {\n" +
+ ' res.json(tasks)\n' +
+ '})\n' +
+ '\n' +
+ "app.post('/tasks', (req, res) => {\n" +
+ ' const title = req.body.title\n' +
+ " const description = req.body.description || ''\n" +
+ " const validStatuses = ['todo', 'inprogress', 'bug', 'done']\n" +
+ " const status = validStatuses.includes(req.body.status) ? req.body.status : 'todo'\n" +
+ '\n' +
+ " if (!title || title.trim() === '') {\n" +
+ " return res.status(400).json({ error: 'Title cannot be empty' })\n" +
+ ' }\n' +
+ '\n' +
+ ' const task = {\n' +
+ ' id: idCounter,\n' +
+ ' title: title.trim(),\n' +
+ ' description: description.trim(),\n' +
+ ' status\n' +
+ ' }\n' +
+ '\n' +
+ ' idCounter++\n' +
+ ' tasks.push(task)\n' +
+ ' res.status(201).json(task)\n' +
+ '})\n' +
+ '\n' +
+ "app.put('/tasks/:id', (req, res) => {\n" +
+ ' const id = parseInt(req.params.id)\n' +
+ ' const status = req.body.status\n' +
+ '\n' +
+ " const valid = ['todo', 'inprogress', 'bug', 'done']\n" +
+ ' if (!valid.includes(status)) {\n' +
+ " return res.status(400).json({ error: 'Invalid status value' })\n" +
+ ' }\n' +
+ '\n' +
+ ' let found = null\n' +
+ ' for (let i = 0; i < tasks.length; i++) {\n' +
+ ' if (tasks[i].id === id) {\n' +
+ ' found = tasks[i]\n' +
+ ' break\n' +
+ ' }\n' +
+ ' }\n' +
+ '\n' +
+ ' if (!found) {\n' +
+ " return res.status(404).json({ error: 'Task not found' })\n" +
+ ' }\n' +
+ '\n' +
+ ' found.status = status\n' +
+ ' res.json(found)\n' +
+ '})\n' +
+ '\n' +
+ "app.delete('/tasks/:id', (req, res) => {\n" +
+ ' const id = parseInt(req.params.id)\n' +
+ ' const idx = tasks.findIndex(t => t.id === id)\n' +
+ '\n' +
+ ' if (idx === -1) {\n' +
+ " return res.status(404).json({ error: 'Task not found' })\n" +
+ ' }\n' +
+ '\n' +
+ ' tasks.splice(idx, 1)\n' +
+ " res.json({ message: 'deleted' })\n" +
+ '})\n' +
+ '\n' +
+ 'app.listen(3001, () => {\n' +
+ " console.log('server is running on http://localhost:3001')\n" +
+ '})\n'
+ }
+]
\ No newline at end of file
diff --git a/Server/app/worker-service/services/rag.service.ts b/Server/app/worker-service/services/rag.service.ts
index 2a4cbad..8e12a7b 100644
--- a/Server/app/worker-service/services/rag.service.ts
+++ b/Server/app/worker-service/services/rag.service.ts
@@ -5,6 +5,7 @@ import {
readCodeFiles,
cleanup,
} from "./repoSetup.service.js";
+import fs from "fs";
const EMBEDDING_MODEL = "llama-text-embed-v2";
const EMBEDDING_DIMENSION = 1024;
@@ -62,7 +63,6 @@ function chunkFile(filePath: string, content: string): CodeChunk[] {
i += CHUNK_SIZE - CHUNK_OVERLAP;
chunkIndex++;
}
- console.log("<============================== chunks ================================> \n", chunks)
return chunks;
}
@@ -93,19 +93,30 @@ export async function runRAGPipeline(data: object) {
const extractedDir = extractZIP(zipPath);
const files = readCodeFiles(extractedDir);
- const chunks = files.flatMap((f) => chunkFile(f.path, f.content));
+ const filesJSONStrgified = JSON.stringify(files)
+ console.log("<<<<<<<<<<<<========== FILES JSON ============>>>>>>>>>>>>\n", files)
- const vectors = await createEmbeddings({ chunks, indexName });
- await saveToVectorDB({ vectors, indexName });
+ fs.writeFile("./data.json", filesJSONStrgified, (err) => {
+ if (err) {
+ console.error("Error writing file:", err);
+ return;
+ }
+ console.log("File created successfully!");
+ });
+
+ // const chunks = files.flatMap((f) => chunkFile(f.path, f.content));
+
+ // const vectors = await createEmbeddings({ chunks, indexName });
+ // await saveToVectorDB({ vectors, indexName });
- cleanup([zipPath, extractedDir]);
- console.log(
- `RAG pipeline complete for ${owner}/${repo}: ${chunks.length} chunks indexed`
- );
+ // cleanup([zipPath, extractedDir]);
+ // console.log(
+ // `RAG pipeline complete for ${owner}/${repo}: ${chunks.length} chunks indexed`
+ // );
}
export async function createEmbeddings(
- values: object
+ values: object,
): Promise {
const { chunks, indexName } = values as {
chunks: CodeChunk[];
diff --git a/Server/app/worker-service/services/review.service.ts b/Server/app/worker-service/services/review.service.ts
index 723e4ee..a890067 100644
--- a/Server/app/worker-service/services/review.service.ts
+++ b/Server/app/worker-service/services/review.service.ts
@@ -97,11 +97,9 @@ export async function runPRReview(data: PRReviewJobData) {
const indexName = toIndexName(owner, repo)
const DBExsists = await vectorDBExists(indexName)
let relevantCode:any
- console.log("<============= reviewType ===============> \n", reviewType)
+ const processedDiff = await getCodeDiff(difference) as any
if(reviewType === "feature" && DBExsists) {
- const processedDiff = await getCodeDiff(difference) as any
const searchQuery = await generateRelevantSearchQuery(processedDiff)
- console.log("<=================== searchQuery ===================> \n", searchQuery)
const query = {
text: searchQuery,
indexName: indexName,
@@ -110,6 +108,9 @@ export async function runPRReview(data: PRReviewJobData) {
relevantCode = await searchRelevantEmbeddings(query)
}
+ console.log("<<<<<<<========== Direct DIFF =========>>>>>>> \n", difference)
+ console.log("<<<<<<<========== Processeded DIFF =========>>>>>>> \n", processedDiff)
+
const prompt = reviewPrompt(difference, rules, relevantCode);
const aiResponse = await getAIReview(prompt);
const cleanText = aiResponse
diff --git a/Server/docker-compose.yaml b/Server/docker-compose.yaml
index f979aa6..6afc875 100644
--- a/Server/docker-compose.yaml
+++ b/Server/docker-compose.yaml
@@ -5,7 +5,6 @@ services:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ai_reviewer
- command: sh -c "npx prisma migrate deploy && node dist/app/api-service/index.js"
ports:
- "5432:5432"
volumes:
diff --git a/client/src/app/(dashboard)/repo/[owner]/[repo]/page.tsx b/client/src/app/(dashboard)/repo/[owner]/[repo]/page.tsx
index 4ef6772..3d3448b 100644
--- a/client/src/app/(dashboard)/repo/[owner]/[repo]/page.tsx
+++ b/client/src/app/(dashboard)/repo/[owner]/[repo]/page.tsx
@@ -260,30 +260,7 @@ export default function RepoPage() {
- Issues by category
-
-
-
-
-
- } />
-
-
-
+
)}