Richer search and filter summaries

Search: show per-track breakdown (found/added per track name)
Filter: show top 5 scoring jobs with score, title, company and cost

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 13:34:21 -08:00
parent 82fa2b3697
commit c99ea10585
3 changed files with 46 additions and 10 deletions

View File

@@ -87,9 +87,20 @@ export async function replyTelegram(botToken, chatId, replyToMessageId, text) {
} catch { /* best effort */ }
}
export function formatSearchSummary(added, skipped, platforms) {
export function formatSearchSummary(added, skipped, platforms, trackCounts = {}) {
if (added === 0) return `🔍 *Job Search Complete*\nNo new jobs found this run.`;
return `🔍 *Job Search Complete*\n${added} new job${added !== 1 ? 's' : ''} added to queue (${skipped} already seen)\nPlatforms: ${platforms.join(', ')}`;
const lines = [
`🔍 *Job Search Complete*`,
`${added} new job${added !== 1 ? 's' : ''} added (${skipped} already seen)`,
`Platforms: ${platforms.join(', ')}`,
];
if (Object.keys(trackCounts).length > 0) {
lines.push('');
for (const [track, counts] of Object.entries(trackCounts)) {
lines.push(` • *${track}*: ${counts.added} new / ${counts.found} found`);
}
}
return lines.join('\n');
}
export function formatApplySummary(results) {
@@ -130,6 +141,21 @@ export function formatApplySummary(results) {
return lines.join('\n');
}
export function formatFilterSummary({ passed, filtered, errors, cost, topJobs = [] }) {
const lines = [
`🧠 *AI Filter Complete*`,
`✅ Passed: ${passed} | 🚫 Filtered: ${filtered}${errors ? ` | ⚠️ Errors: ${errors}` : ''}`,
];
if (cost != null) lines.push(`💰 Cost: $${cost.toFixed(2)}`);
if (topJobs.length > 0) {
lines.push('', '*Top scores:*');
for (const j of topJobs.slice(0, 5)) {
lines.push(`${j.score}${j.title} @ ${j.company}`);
}
}
return lines.join('\n');
}
export function formatUnknownQuestion(job, question) {
return `❓ *Unknown question while applying*\n\n*Job:* ${job.title} @ ${job.company}\n*Question:* "${question}"\n\nWhat should I answer? (Reply and I'll save it for all future runs)`;
}