All files / constants chat.ts

50% Statements 8/16
100% Branches 0/0
0% Functions 0/1
77.77% Lines 7/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133      47x                         1x               1x           1x   1x           1x                                                                             1x                                                                                                              
import type { AppRole } from "@/lib/auth/session";
import type { QuickAction } from "@/types/chat";
 
export const CHAT_COMPOSER_COPY = {
  placeholder:
    "Ask about your balance, request time off, review approvals, or cancel a request...",
  ariaLabel: "Chat input",
  defaultHelperText: "Press Enter to send. Shift + Enter adds a new line.",
  submitHint: "Sending your message...",
  sendButtonLabel: "Send",
  thinkingButtonLabel: "Thinking...",
  verifyFirstButtonLabel: "Verify first",
  verifyProviderTooltip: "Please verify your OpenAI key first.",
  stopButtonLabel: "Stop generating",
} as const;
 
export const CHAT_THREAD_COPY = {
  idPrefix: "thread",
  defaultTitle: "New chat",
  emptyPreview: "No messages yet",
  titleMaxLength: 42,
  previewMaxLength: 72,
} as const;
 
export const CHAT_EMPTY_STATE_COPY = {
  title: "Manage your leave",
  description:
    "Ask for balances, review upcoming leave, create a new request, or cancel one when your schedule changes.",
} as const;
 
export const CHAT_STREAMING_PLACEHOLDER_TEXT = "Working on it...";
 
export const CHAT_HELPER_COPY_BY_ROLE: Record<AppRole, string> = {
  user: "Review your balance or requests first; leave changes now require a quick UI confirmation.",
  manager:
    "Review the pending queue first, then approve or reject with UI confirmation.",
};
 
export const QUICK_ACTIONS_BY_ROLE: Record<AppRole, QuickAction[]> = {
  user: [
    {
      label: "Check balance",
      prompt: "How many annual, sick, and personal leave days do I have left?",
    },
    {
      label: "Review pending",
      prompt: "List my pending time-off requests first.",
    },
    {
      label: "All requests",
      prompt: "Show all my time-off requests.",
    },
  ],
  manager: [
    {
      label: "Check balance",
      prompt: "How many annual, sick, and personal leave days do I have left?",
    },
    {
      label: "Review pending",
      prompt: "List my pending time-off requests first.",
    },
    {
      label: "All requests",
      prompt: "Show all my time-off requests.",
    },
    {
      label: "Team pending",
      prompt: "Show my team's pending time-off requests.",
    },
    {
      label: "Review list employees",
      prompt: "List all members in my project.",
    },
  ],
};
 
export const CHAT_TRANSCRIPT_COPY = {
  defaultAgentName: "employee",
  userBadge: "You",
  assistantBadgeByAgent: {
    employee: "EM",
    manager: "MG",
    coordinator: "CO",
  },
  defaultAgentLabel: "Employee Agent",
  toolFallbackLabel: "Action",
  toolApproval: {
    selectedRequestFallback: "selected request",
    submitRequest: {
      title: "Confirm time-off request",
      confirmLabel: "Confirm request",
      cancelLabel: "Cancel",
    },
    cancelRequest: {
      title: "Confirm cancellation",
      descriptionPrefix: "Cancel request:",
      confirmLabel: "Confirm cancel",
      cancelLabel: "Keep request",
    },
    approveRequest: {
      title: "Confirm approval",
      descriptionPrefix: "Approve team request:",
      commentLabel: "Comment:",
      confirmLabel: "Confirm approve",
      cancelLabel: "Cancel",
    },
    rejectRequest: {
      title: "Confirm rejection",
      descriptionPrefix: "Reject team request:",
      reasonLabel: "Reason:",
      confirmLabel: "Confirm reject",
      cancelLabel: "Cancel",
    },
    default: {
      title: "Confirm action",
      description: "Please review this action before it runs.",
      confirmLabel: "Confirm",
      cancelLabel: "Cancel",
    },
  },
  toolStatus: {
    confirmedSuffix: "confirmed. Executing...",
    cancelledSuffix: "cancelled.",
    failedSuffix: "failed.",
    completedSuffix: "completed.",
  },
} as const;
 
export function getQuickActionsByRole(role: AppRole) {
  return QUICK_ACTIONS_BY_ROLE[role];
}