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
Remove non llm steps of achievements and formatting
Khuram Niaza374b473f3cd
diff --git a/__tests__/ai.actions.spec.ts b/__tests__/ai.actions.spec.tsindex 6dfe773..ac0d4b8 100644--- a/__tests__/ai.actions.spec.ts+++ b/__tests__/ai.actions.spec.ts@@ -4,70 +4,13 @@*/import {- countQuantifiedAchievements,- analyzeFormatting,calculateResumeScore,calculateJobMatchScore,validateScore,} from "@/lib/ai";describe("AI Library - Analysis Tools", () => {- describe("countQuantifiedAchievements", () => {- it("should count achievements with numbers", () => {- const text =- "Increased sales by 40%. Managed $2M budget. Led team of 10 engineers.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(3);- expect(result.examples.length).toBeGreaterThan(0);- });-- it("should count achievements with percentages", () => {- const text = "Improved performance by 25%. Reduced costs by 15%.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(2);- expect(result.examples).toContain("25%");- });-- it("should return 0 for text with no quantified achievements", () => {- const text = "Worked on projects. Collaborated with team members.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(0);- expect(result.examples).toEqual([]);- });-- it("should handle empty text", () => {- const result = countQuantifiedAchievements("");- expect(result.count).toBe(0);- expect(result.examples).toEqual([]);- });- });-- // Note: extractKeywords, countActionVerbs, calculateKeywordOverlap tests removed- // These functions now use semantic AI extraction (extractSemanticKeywords, analyzeActionVerbs, etc.)- // which require AI providers and cannot be easily unit tested without mocking-- describe("analyzeFormatting", () => {- it("should detect bullet points", () => {- const text =- "- First item\n- Second item\n- Third item\n- Fourth item\n- Fifth item";- const formatting = analyzeFormatting(text);- expect(formatting.hasBulletPoints).toBe(true);- });-- it("should count sections", () => {- const text =- "EXPERIENCE\nWork history\n\nEDUCATION\nSchool info\n\nSKILLS\nTech stack";- const formatting = analyzeFormatting(text);- expect(formatting.sectionCount).toBeGreaterThan(0);- });-- it("should return false for no bullet points", () => {- const text = "Plain text without any formatting";- const formatting = analyzeFormatting(text);- expect(formatting.hasBulletPoints).toBe(false);- });- });-+ // ...existing code...// Note: extractRequiredSkills tests removed - function now uses semantic AI extraction});diff --git a/__tests__/ai.library.spec.ts b/__tests__/ai.library.spec.tsindex 6145d1a..4e84387 100644--- a/__tests__/ai.library.spec.ts+++ b/__tests__/ai.library.spec.ts@@ -9,70 +9,13 @@*/import {- countQuantifiedAchievements,- analyzeFormatting,calculateResumeScore,calculateJobMatchScore,validateScore,} from "@/lib/ai";describe("AI Library - Analysis Tools", () => {- describe("countQuantifiedAchievements", () => {- it("should count achievements with numbers", () => {- const text =- "Increased sales by 40%. Managed $2M budget. Led team of 10 engineers.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(3);- expect(result.examples.length).toBeGreaterThan(0);- });-- it("should count achievements with percentages", () => {- const text = "Improved performance by 25%. Reduced costs by 15%.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(2);- expect(result.examples).toContain("25%");- });-- it("should return 0 for text with no quantified achievements", () => {- const text = "Worked on projects. Collaborated with team members.";- const result = countQuantifiedAchievements(text);- expect(result.count).toBe(0);- expect(result.examples).toEqual([]);- });-- it("should handle empty text", () => {- const result = countQuantifiedAchievements("");- expect(result.count).toBe(0);- expect(result.examples).toEqual([]);- });- });-- // Note: extractKeywords, countActionVerbs, calculateKeywordOverlap tests removed- // These functions now use semantic AI extraction (extractSemanticKeywords, analyzeActionVerbs, etc.)- // which require AI providers and cannot be easily unit tested without mocking-- describe("analyzeFormatting", () => {- it("should detect bullet points", () => {- const text =- "- First item\n- Second item\n- Third item\n- Fourth item\n- Fifth item";- const formatting = analyzeFormatting(text);- expect(formatting.hasBulletPoints).toBe(true);- });-- it("should count sections", () => {- const text =- "EXPERIENCE\nWork history\n\nEDUCATION\nSchool info\n\nSKILLS\nTech stack";- const formatting = analyzeFormatting(text);- expect(formatting.sectionCount).toBeGreaterThan(0);- });-- it("should return false for no bullet points", () => {- const text = "Plain text without any formatting";- const formatting = analyzeFormatting(text);- expect(formatting.hasBulletPoints).toBe(false);- });- });-+ // ...existing code...// Note: extractRequiredSkills tests removed - function now uses semantic AI extraction});diff --git a/src/app/api/ai/resume/review/route.ts b/src/app/api/ai/resume/review/route.tsindex b3960a3..abb742e 100644--- a/src/app/api/ai/resume/review/route.ts+++ b/src/app/api/ai/resume/review/route.ts@@ -9,8 +9,6 @@ import {ResumeReviewSchema,RESUME_REVIEW_SYSTEM_PROMPT,buildResumeReviewPrompt,- countQuantifiedAchievements,- analyzeFormatting,extractSemanticKeywords,analyzeActionVerbs,getKeywordCountFromSemantic,@@ -38,10 +36,10 @@ export const POST = async (req: NextRequest) => {return NextResponse.json({error: `Rate limit exceeded. Try again in ${Math.ceil(- rateLimit.resetIn / 1000+ rateLimit.resetIn / 1000,)} seconds.`,},- { status: 429 }+ { status: 429 },);}@@ -53,28 +51,26 @@ export const POST = async (req: NextRequest) => {if (!resume || !selectedModel) {return NextResponse.json({ error: "Resume and model selection required" },- { status: 400 }+ { status: 400 },);}try {const resumeText = await convertResumeToText(resume);- // Extract tool data for enhanced prompting using semantic AI functions- const quantified = countQuantifiedAchievements(resumeText);- const formatting = analyzeFormatting(resumeText);+ // ...existing code...// Use semantic extraction for keywords and verbsconst [semanticKeywords, semanticVerbs] = await Promise.all([extractSemanticKeywords(resumeText,selectedModel.provider,- selectedModel.model || "llama3.2"+ selectedModel.model || "llama3.2",),analyzeActionVerbs(resumeText,selectedModel.provider,- selectedModel.model || "llama3.2"+ selectedModel.model || "llama3.2",),]);@@ -90,24 +86,14 @@ export const POST = async (req: NextRequest) => {const fullPrompt = `${basePrompt}TOOL ANALYSIS RESULTS (use these in your evaluation):-- Quantified achievements found: ${quantified.count} (Examples: ${- quantified.examples.join(", ") || "none"- })-- Technical keywords found: ${keywordCount} (${- allKeywords.slice(0, 10).join(", ") || "none"- })-- Action verbs found: ${verbCount} (${- allVerbs.slice(0, 10).join(", ") || "none"- })-- Formatting quality: ${- formatting.hasBulletPoints ? "Has bullet points" : "No bullets"- }, ${formatting.sectionCount} sections detected+- Technical keywords found: ${keywordCount} (${allKeywords.slice(0, 10).join(", ") || "none"})+- Action verbs found: ${verbCount} (${allVerbs.slice(0, 10).join(", ") || "none"})Use these concrete counts in your Step 1 (SCAN & COUNT) and scoring decisions.`;const model = getModel(selectedModel.provider,- selectedModel.model || "llama3.2"+ selectedModel.model || "llama3.2",);const result = streamText({@@ -136,7 +122,7 @@ Use these concrete counts in your Step 1 (SCAN & COUNT) and scoring decisions.`;{error: `Cannot connect to ${selectedModel.provider} service. Please ensure the service is running.`,},- { status: 503 }+ { status: 503 },);}diff --git a/src/lib/ai/index.ts b/src/lib/ai/index.tsindex 4c8fb48..473638a 100644--- a/src/lib/ai/index.ts+++ b/src/lib/ai/index.ts@@ -16,11 +16,7 @@ export {} from "./prompts";// Analysis tools-export {- countQuantifiedAchievements,- analyzeFormatting,- AIUnavailableError,-} from "./tools";+export { AIUnavailableError } from "./tools";// Semantic extraction and similarity functionsexport {diff --git a/src/lib/ai/tools/achievement.ts b/src/lib/ai/tools/achievement.tsindex 3b4a690..20be7bb 100644--- a/src/lib/ai/tools/achievement.ts+++ b/src/lib/ai/tools/achievement.ts@@ -3,32 +3,4 @@* Extract and analyze quantified achievements from text*/-/**- * Extract and count quantified achievements (numbers, percentages, metrics)- */-export function countQuantifiedAchievements(text: string): {- count: number;- examples: string[];-} {- // Match patterns like: "40%", "$2M", "5+ years", "Increased by 50%"- const patterns = [- /\d+%/g, // Percentages: 40%- /\$[\d,]+[KMB]?/g, // Money: $2M, $500K- /\d+\+?\s*(years?|months?|weeks?)/gi, // Time: 5+ years- /(increased|decreased|improved|reduced|grew|boosted)\s+by\s+\d+/gi, // Actions with numbers- /\d+x\s+(faster|better|more)/gi, // Multipliers: 2x faster- /team\s+of\s+\d+/gi, // Team size: team of 12- /\d+\s+(clients?|customers?|users?|projects?)/gi, // Quantities- ];-- const matches = new Set<string>();- patterns.forEach((pattern) => {- const found = text.match(pattern);- if (found) {- found.forEach((m) => matches.add(m));- }- });-- const examples = Array.from(matches).slice(0, 5); // Top 5 examples- return { count: matches.size, examples };-}+// ...existing code...diff --git a/src/lib/ai/tools/formatting.ts b/src/lib/ai/tools/formatting.tsindex fcf27be..b137366 100644--- a/src/lib/ai/tools/formatting.ts+++ b/src/lib/ai/tools/formatting.ts@@ -3,41 +3,4 @@* Analyze text structure and formatting quality*/-/**- * Analyze text structure and formatting quality- */-export function analyzeFormatting(text: string): {- hasBulletPoints: boolean;- hasConsistentSpacing: boolean;- averageLineLength: number;- sectionCount: number;-} {- const lines = text.split("\n");- const bulletLines = lines.filter(- (line) =>- line.trim().startsWith("•") ||- line.trim().startsWith("-") ||- line.trim().startsWith("*")- );-- const hasBulletPoints = bulletLines.length > 3;-- // Count potential sections (all caps lines or lines ending with :)- const sectionHeaders = lines.filter(- (line) =>- (line.trim().length > 0 && line === line.toUpperCase()) ||- line.trim().endsWith(":")- );-- const nonEmptyLines = lines.filter((line) => line.trim().length > 0);- const averageLineLength =- nonEmptyLines.reduce((sum, line) => sum + line.length, 0) /- Math.max(nonEmptyLines.length, 1);-- return {- hasBulletPoints,- hasConsistentSpacing: averageLineLength > 20 && averageLineLength < 100,- averageLineLength: Math.round(averageLineLength),- sectionCount: sectionHeaders.length,- };-}+// ...existing code...diff --git a/src/lib/ai/tools/index.ts b/src/lib/ai/tools/index.tsindex 3d3bc3b..70ea7ab 100644--- a/src/lib/ai/tools/index.ts+++ b/src/lib/ai/tools/index.ts@@ -13,11 +13,9 @@// Error classesexport { AIUnavailableError } from "./errors";-// Achievement analysis-export { countQuantifiedAchievements } from "./achievement";+// ...existing code...-// Formatting analysis-export { analyzeFormatting } from "./formatting";+// ...existing code...// Semantic extraction (LLM-powered)export {