Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/hr/src/actions/candidate_ai.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// Mock database interface (replace with actual ObjectStack db import)
const db = {
doc: {
get: async (object: string, id: string, options?: any) => ({}),
update: async (object: string, id: string, data: any) => ({}),
create: async (object: string, data: any) => ({ id: 'mock-id', ...data })
get: async (object: string, id: string, options?: any): Promise<any> => ({}),
update: async (object: string, id: string, data: any): Promise<any> => ({}),
create: async (object: string, data: any): Promise<any> => ({ id: 'mock-id', ...data })
},
find: async (object: string, options?: any) => []
find: async (object: string, options?: any): Promise<any[]> => []
};

// ============================================================================
Expand Down
70 changes: 59 additions & 11 deletions packages/hr/src/actions/employee_ai.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// Mock database interface
const db = {
doc: {
get: async (object: string, id: string, options?: any) => ({}),
update: async (object: string, id: string, data: any) => ({}),
create: async (object: string, data: any) => ({ id: 'mock-id', ...data })
get: async (object: string, id: string, options?: any): Promise<any> => ({}),
update: async (object: string, id: string, data: any): Promise<any> => ({}),
create: async (object: string, data: any): Promise<any> => ({ id: 'mock-id', ...data })
},
find: async (object: string, options?: any) => []
find: async (object: string, options?: any): Promise<any[]> => []
};

// ============================================================================
Expand Down Expand Up @@ -360,16 +360,27 @@ export interface SkillGapResponse {
* Analyze skill gaps and recommend training
*/
export async function analyzeSkillGaps(request: SkillGapRequest): Promise<SkillGapResponse> {
const { employeeId, targetRole } = request;
const { employeeId, teamId, targetRole } = request;

if (!employeeId) {
throw new Error('Employee ID is required');
if (!employeeId && !teamId) {
throw new Error('Employee ID or Team ID is required');
}

// Fetch employee data
const employee = await db.doc.get('employee', employeeId, {
fields: ['full_name', 'position_title', 'skills', 'certifications']
});
// Fetch employee or team data
let employee: any;
if (employeeId) {
employee = await db.doc.get('employee', employeeId, {
fields: ['full_name', 'position_title', 'skills', 'certifications']
});
} else {
// For team analysis, use a placeholder
employee = {
full_name: 'Team Analysis',
position_title: 'Various roles',
skills: [],
certifications: []
};
}

// Fetch target role requirements (if specified)
let roleRequirements = '';
Expand Down Expand Up @@ -1117,6 +1128,43 @@ async function callLLM(prompt: string): Promise<string> {
}

// Compensation benchmarking
if (prompt.includes('compensation analyst') || prompt.includes('market benchmarking')) {
return JSON.stringify({
currentCompensation: {
base_salary: 100000,
total_compensation: 120000
},
marketData: {
percentile_25: 95000,
percentile_50: 115000,
percentile_75: 135000,
percentile_90: 155000
},
marketPosition: {
percentile: 35,
status: 'below_market',
gap_amount: 15000,
gap_percentage: 13
},
recommendations: [
{
action: 'Market adjustment to P50',
timing: 'Next compensation cycle (Q1 2024)',
amount: 15000,
reasoning: 'Bring to market median for retention; high performer at risk'
},
{
action: 'Performance-based merit increase',
timing: 'Annual review',
amount: 5000,
reasoning: 'Reward consistent high performance (4.5/5 rating)'
}
],
compensationRetentionRisk: 'high'
});
}

// Default return (should not reach here in normal operation)
return JSON.stringify({
currentCompensation: {
base_salary: 100000,
Expand Down
Loading