update chatbox

This commit is contained in:
2026-08-08 00:39:16 +05:30
parent 90f14a73b2
commit 0cae250049
15 changed files with 1952 additions and 913 deletions

View File

@@ -11,18 +11,10 @@ import { TALENT_CAPABILITIES, respondTalent } from './capabilities/talent';
/**
* Page contexts for the Krow AI Assistant.
*
* The component is identical on every page. Only what is in this file changes:
* the supporting line, the placeholder examples, the suggested chips, the
* capabilities and the responder.
*
* Chips are phrased as things a person would actually type, because clicking one
* fills the input rather than firing an action. The user always sees the
* question before it is asked, so the assistant reads as a conversation rather
* than a menu of buttons.
*
* `capability` binds a chip to a specific capability, so a chip gets a precise
* answer while an equivalent typed question still resolves through the
* responder's keyword matching.
* Deliberately thin. What the user sees on the landing screen — the title,
* greeting, description, placeholders and suggested prompts — is computed from
* live data in `dynamic.js`, not written here. A context only declares what this
* page's assistant can *do*: its capabilities and its free-text responder.
*
* `needsWorkerProfile` gates the one query with a side effect, so employer and
* admin sessions never touch worker-profile records.
@@ -31,129 +23,42 @@ export const ASSISTANT_CONTEXTS = {
'employer.overview': {
id: 'employer.overview',
page: 'Overview',
tagline: 'Find insights from your hiring data, spot what needs attention, and ask questions about this page.',
placeholders: [
"Ask about today's hiring…",
'What should I do first?',
'Which roles are at risk?',
'How healthy is my pipeline?',
],
chips: [
{ label: "Today's Hiring", prompt: 'Give me a summary of hiring today', capability: 'hiring-summary' },
{ label: 'Pipeline Health', prompt: 'How healthy is my hiring pipeline?', capability: 'hiring-health' },
{ label: 'Pending Actions', prompt: 'What is pending and needs my attention?', capability: 'pending-actions' },
{ label: 'Hiring Risks', prompt: 'What risks should I know about?', capability: 'hiring-risks' },
],
capabilities: OVERVIEW_CAPABILITIES,
respond: respondOverview,
},
'employer.candidates': {
id: 'employer.candidates',
page: 'Candidates',
tagline: 'Analyse résumés, compare candidates, generate interview questions, and decide who to move forward.',
placeholders: [
'Compare two candidates…',
'Who should I interview next?',
'What are this candidate’s gaps?',
'Draft interview questions…',
],
chips: [
{ label: 'Top Candidates', prompt: 'Analyse my strongest candidate', capability: 'resume-analysis' },
{ label: 'Compare Candidates', prompt: 'Compare my top two candidates', capability: 'candidate-comparison' },
{ label: 'Interview Questions', prompt: 'Generate interview questions for my top candidate', capability: 'interview-questions' },
{ label: 'Skill Gap Analysis', prompt: 'What skill gaps run across my candidates?', capability: 'skill-gap' },
{ label: 'Hiring Recommendation', prompt: 'Who should I hire, interview, or pass on?', capability: 'hiring-recommendation' },
],
capabilities: CANDIDATE_CAPABILITIES,
respond: respondCandidates,
},
'employer.analytics': {
id: 'employer.analytics',
page: 'Analytics',
tagline: 'Explain the numbers on this page, forecast what your pipeline will yield, and generate reports.',
placeholders: [
'Explain this chart…',
'Generate a hiring report…',
'Where do candidates drop off?',
'How many hires can I expect?',
],
chips: [
{ label: 'Explain Charts', prompt: 'Explain the charts on this page', capability: 'explain-charts' },
{ label: 'Forecast Hiring', prompt: 'Forecast my hiring from the current pipeline', capability: 'forecast-hiring' },
{ label: 'Department Insights', prompt: 'Break down performance by role category', capability: 'department-insights' },
{ label: 'Generate Report', prompt: 'Generate a hiring report', capability: 'generate-reports' },
],
capabilities: ANALYTICS_CAPABILITIES,
respond: respondAnalytics,
},
'admin.controlCenter': {
id: 'admin.controlCenter',
page: 'Control Center',
tagline: 'Check platform health, reconcile the data, and see what needs intervention across every account.',
placeholders: [
'Is anything broken?',
'What should I fix first?',
'How is the platform performing?',
],
chips: [
{ label: 'Platform Health', prompt: 'Run a platform health check', capability: 'platform-health' },
{ label: 'Recommendations', prompt: 'What should I fix first?', capability: 'recommendations' },
],
capabilities: CONTROL_CENTER_CAPABILITIES,
respond: respondControlCenter,
},
'admin.candidates': {
id: 'admin.candidates',
page: 'Candidates Analysis',
tagline: 'Analyse talent supply across the platform and see where the risk sits in the candidate pool.',
placeholders: [
'How healthy is talent supply?',
'Any candidate risk flags?',
'What are the recruitment trends?',
],
chips: [
{ label: 'Recruitment Insights', prompt: 'Show me recruitment insights across the platform', capability: 'recruitment-insights' },
{ label: 'Candidate Risk', prompt: 'Analyse risk across the candidate pool', capability: 'candidate-risk' },
],
capabilities: ADMIN_CANDIDATE_CAPABILITIES,
respond: respondAdminCandidates,
},
'admin.activity': {
id: 'admin.activity',
page: 'Activity',
tagline: 'Summarize the audit trail, reconcile it against real records, and see how accounts are behaving.',
placeholders: [
'Summarize the audit trail…',
'Who is most active?',
'Are there any gaps in the log?',
],
chips: [
{ label: 'Audit Summary', prompt: 'Summarize the audit trail', capability: 'audit-summary' },
{ label: 'User Activity', prompt: 'Which accounts are most active?', capability: 'user-activity' },
],
capabilities: ACTIVITY_CAPABILITIES,
respond: respondActivity,
},
'talent.portal': {
id: 'talent.portal',
page: 'My Portal',
tagline: 'Understand your score, improve your profile, and find the next thing worth learning.',
placeholders: [
'How do I earn more?',
'Review my profile…',
'What should I learn next?',
],
chips: [
{ label: 'Review My Profile', prompt: 'Review my profile and tell me what is missing', capability: 'resume-review' },
{ label: 'Career Guidance', prompt: 'How do I raise my career score?', capability: 'career-guidance' },
{ label: 'What To Learn Next', prompt: 'What should I learn next?', capability: 'learning-recommendations' },
],
capabilities: TALENT_CAPABILITIES,
respond: respondTalent,
needsWorkerProfile: true,