Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
Display ai review stream
Khuram Niaza5cdd5634166
diff --git a/package-lock.json b/package-lock.jsonindex a277753..e2c4af2 100644--- a/package-lock.json+++ b/package-lock.json@@ -35,6 +35,7 @@"@tiptap/react": "^2.4.0","@tiptap/starter-kit": "^2.4.0","bcryptjs": "^2.4.3",+ "best-effort-json-parser": "^1.1.2","class-variance-authority": "^0.7.0","clsx": "^2.1.1","cmdk": "^1.0.0",@@ -57,7 +58,7 @@"@testing-library/react": "^16.0.0","@testing-library/user-event": "^14.5.2","@types/bcrypt": "^5.0.2",- "@types/node": "^20",+ "@types/node": "^20.14.10","@types/react": "^18","@types/react-dom": "^18","eslint": "^8",@@ -4575,9 +4576,9 @@"dev": true},"node_modules/@types/node": {- "version": "20.12.12",- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz",- "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==",+ "version": "20.14.10",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz",+ "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==","dependencies": {"undici-types": "~5.26.4"}@@ -5349,6 +5350,11 @@"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz","integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="},+ "node_modules/best-effort-json-parser": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/best-effort-json-parser/-/best-effort-json-parser-1.1.2.tgz",+ "integrity": "sha512-RD7tyk24pNCDwEKFACauR6Lqp5m6BHUrehwyhN/pA8V3QYWq8Y+hk9vHZvKiThZsdEFTaUqN49duVsamgCd8/g=="+ },"node_modules/binary-extensions": {"version": "2.3.0","resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",diff --git a/package.json b/package.jsonindex bf52dec..258c738 100644--- a/package.json+++ b/package.json@@ -39,6 +39,7 @@"@tiptap/react": "^2.4.0","@tiptap/starter-kit": "^2.4.0","bcryptjs": "^2.4.3",+ "best-effort-json-parser": "^1.1.2","class-variance-authority": "^0.7.0","clsx": "^2.1.1","cmdk": "^1.0.0",@@ -61,7 +62,7 @@"@testing-library/react": "^16.0.0","@testing-library/user-event": "^14.5.2","@types/bcrypt": "^5.0.2",- "@types/node": "^20",+ "@types/node": "^20.14.10","@types/react": "^18","@types/react-dom": "^18","eslint": "^8",diff --git a/src/actions/ai.actions.ts b/src/actions/ai.actions.tsindex 2a1e3dd..8573667 100644--- a/src/actions/ai.actions.ts+++ b/src/actions/ai.actions.ts@@ -37,7 +37,7 @@ export const getResumeReviewByAi = async (summary: Provide a brief summary of the resume.strengths: List the strengths of the resume.weaknesses: List the weaknesses of the resume.- suggestions: Provide suggestions for improvement in a list.+ suggestions: Provide suggestions for improvement in a list of string.score: Provide a score for the resume (0-100).`,],diff --git a/src/components/AiSection.tsx b/src/components/AiSection.tsxindex 5f9b4cb..e6eb381 100644--- a/src/components/AiSection.tsx+++ b/src/components/AiSection.tsx@@ -15,21 +15,14 @@ import { useCallback, useEffect, useRef, useState } from "react";import { toast } from "./ui/use-toast";import { Resume } from "@/models/profile.model";import { ResumeReviewResponse } from "@/models/ai.model";-import { Editor, EditorContent } from "@tiptap/react";-import StarterKit from "@tiptap/starter-kit";+import { parse } from "best-effort-json-parser";interface AiSectionProps {resume: Resume;}const AiSection = ({ resume }: AiSectionProps) => {- const [aIContent, setAIContent] = useState<ResumeReviewResponse | any>({- summary: "",- strengths: [],- weaknesses: [],- suggestions: [],- score: 0,- });+ const [aIContent, setAIContent] = useState<ResumeReviewResponse | any>(" ");const [aISectionOpen, setAiSectionOpen] = useState(false);const [loading, setLoading] = useState(false);let reader: ReadableStreamDefaultReader<Uint8Array> | null = null;@@ -68,7 +61,10 @@ const AiSection = ({ resume }: AiSectionProps) => {const { value, done: doneReading } = await reader.read();done = doneReading;const chunk = decoder.decode(value, { stream: !done });- setAIContent((prev: any) => prev + chunk);+ const parsedChunk = JSON.parse(JSON.stringify(chunk));+ setAIContent((prev: any) => {+ return prev + parsedChunk;+ });}} catch (error) {const message = "Error fetching resume review";@@ -110,50 +106,68 @@ const AiSection = ({ resume }: AiSectionProps) => {) : (<><div className="pt-2">- <h2>Score: {aIContent.score}</h2>+ {aIContent.length > 3 ? (+ <>+ <h2 className="font-semibold">Summary:</h2>+ <SheetDescription>+ {parse(aIContent).summary}+ </SheetDescription>+ </>+ ) : null}</div><div className="pt-2">- <h2 className="font-semibold">Summary: </h2>- <SheetDescription>- <div>{aIContent?.summary}</div>- </SheetDescription>+ {aIContent.length > 3 && parse(aIContent).strengths ? (+ <>+ <h2 className="font-semibold">Strengths:</h2>+ <SheetDescription>+ {parse(aIContent).strengths.map(+ (s: string, i: number) => {+ return <li key={i}>{s}</li>;+ }+ )}+ </SheetDescription>+ </>+ ) : null}</div><div className="pt-2">- <h2 className="font-semibold">Strengths: </h2>- <SheetDescription>- {/* <div>- {aIContent?.strengths.map((s, i) => {- return <li key={i}>{s}</li>;- })}- </div> */}- </SheetDescription>+ {aIContent.length > 3 && parse(aIContent).weaknesses ? (+ <>+ <h2 className="font-semibold">Weaknesses: </h2>+ <SheetDescription>+ {parse(aIContent).weaknesses.map(+ (w: string, i: number) => {+ return <li key={i}>{w}</li>;+ }+ )}+ </SheetDescription>+ </>+ ) : null}</div><div className="pt-2">- <h2 className="font-semibold">Weaknesses: </h2>- <SheetDescription>- {/* <div>- {aIContent?.weaknesses.map((w, i) => {- return <li key={i}>{w}</li>;- })}- </div> */}- </SheetDescription>+ {aIContent.length > 3 && parse(aIContent).suggestions ? (+ <>+ <h2 className="font-semibold">Suggestions: </h2>+ <SheetDescription>+ {parse(aIContent).suggestions.map(+ (s: string, i: number) => {+ return <li key={i}>{s}</li>;+ }+ )}+ </SheetDescription>+ </>+ ) : null}+ <div className="pt-2">+ {aIContent.length > 3 && parse(aIContent).score ? (+ <h2>Review Score: {parse(aIContent).score}</h2>+ ) : null}+ </div></div>- <div className="pt-2">- <h2 className="font-semibold">Suggestions: </h2>- <SheetDescription>- {/* <div>- {aIContent?.suggestions.map((s, i) => {- return <li key={i}>{s}</li>;- })}- </div> */}- </SheetDescription>- </div>- <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">+ {/* <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4"><code className="text-white">- {/* {JSON.stringify(data, null, 2)} */}+ {JSON.stringify(aIContent, null, 2)}{aIContent}</code>- </pre>+ </pre> */}</>)}</SheetHeader>