File size: 5,540 Bytes
c09f67c | 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | import type { AgentStatus } from "@/types/agents";
import type { ArtifactStage, ArtifactType } from "./artifact-config";
import {
getArtifactSectionMessage,
getArtifactStageMessage,
} from "./artifact-config";
// Generate user-friendly status messages
export const getStatusMessage = (status?: AgentStatus | null) => {
if (!status) {
return null;
}
const { agent, status: state } = status;
if (state === "routing") {
return "Thinking...";
}
if (state === "executing") {
const messages: Record<AgentStatus["agent"], string> = {
triage: "Thinking...",
orchestrator: "Coordinating your request...",
general: "Getting information for you...",
reports: "Generating your financial reports...",
transactions: "Retrieving your transaction history...",
invoices: "Checking your invoice status...",
timeTracking: "Reviewing your time entries...",
customers: "Looking up customer information...",
analytics: "Running business intelligence analysis...",
operations: "Accessing your account data...",
research: "Researching and analyzing your options...",
};
return messages[agent];
}
return null;
};
// Generate user-friendly tool messages
export const getToolMessage = (toolName: string | null) => {
if (!toolName) return null;
const toolMessages: Record<string, string> = {
// Reports tools
revenue: "Calculating your revenue metrics...",
getRevenueSummary: "Analyzing your revenue trends...",
getGrowthRate: "Calculating your growth rate...",
profitLoss: "Computing your profit & loss statement...",
getProfitAnalysis: "Computing your profit & loss statement...",
cashFlow: "Analyzing your cash flow patterns...",
getCashFlow: "Calculating your net cash flow...",
balanceSheet: "Building your balance sheet...",
getBalanceSheet: "Building your balance sheet...",
expenses: "Categorizing your expenses...",
getExpenses: "Categorizing your expenses...",
burnRate: "Computing your monthly burn rate...",
getBurnRate: "Computing your monthly burn rate...",
runway: "Calculating your cash runway...",
getRunway: "Calculating your cash runway...",
spending: "Analyzing your spending trends...",
getSpending: "Analyzing your spending patterns...",
taxSummary: "Preparing your tax summary...",
getTaxSummary: "Preparing your tax summary...",
getForecast: "Generating your revenue forecast...",
getMetricsBreakdown: "Preparing your financial breakdown...",
// Analytics tools
businessHealth: "Computing your business health score...",
getBusinessHealthScore: "Computing your business health score...",
getInsights: "Loading your insights...",
cashFlowForecast: "Projecting your future cash flow...",
stressTest: "Running financial stress scenarios...",
getCashFlowStressTest: "Running financial stress scenarios...",
// Customer tools
getCustomers: "Retrieving your customers...",
getCustomer: "Retrieving customer information...",
createCustomer: "Setting up new customer profile...",
updateCustomer: "Updating customer details...",
profitabilityAnalysis: "Analyzing customer profitability...",
// Invoice tools
getInvoices: "Retrieving your invoices...",
listInvoices: "Retrieving your invoices...",
getInvoice: "Loading invoice details...",
createInvoice: "Creating your invoice...",
updateInvoice: "Updating invoice information...",
getInvoicePaymentAnalysis: "Analyzing invoice payment patterns...",
// Transaction tools
getTransactions: "Retrieving your transactions...",
listTransactions: "Retrieving your transactions...",
getTransaction: "Loading transaction details...",
// Time tracking tools
getTimeEntries: "Retrieving your time entries...",
createTimeEntry: "Recording your time...",
updateTimeEntry: "Updating time entry...",
deleteTimeEntry: "Removing time entry...",
getProjects: "Loading your projects...",
getTrackerProjects: "Loading your projects...",
getTrackerEntries: "Retrieving your time entries...",
createTrackerEntry: "Recording your time...",
startTimer: "Starting your timer...",
stopTimer: "Stopping your timer...",
getTimerStatus: "Checking timer status...",
// Operations tools
getInbox: "Checking your inbox...",
listInbox: "Checking your inbox...",
getDocuments: "Loading your documents...",
listDocuments: "Loading your documents...",
getBalances: "Retrieving your account balances...",
getAccountBalances: "Retrieving your account balances...",
getBankAccounts: "Retrieving your bank accounts...",
exportData: "Preparing your data export...",
// Research tools
webSearch: "Searching the web...",
// Memory tools
updateWorkingMemory: "Updating working memory...",
// Handoff tools
handoff_to_agent: "Connecting you with the right specialist...",
};
return toolMessages[toolName];
};
// Generate user-friendly artifact stage messages (generic)
export const getArtifactStageMessageForStatus = (
artifactType: ArtifactType | null,
stage: ArtifactStage | null,
): string | null => {
return getArtifactStageMessage(artifactType, stage);
};
// Generate section-specific status messages (generic)
export const getArtifactSectionMessageForStatus = (
artifactType: ArtifactType | null,
section: string | null,
): string | null => {
return getArtifactSectionMessage(artifactType, section);
};
|