feat: include select options in unknown field reports and Telegram messages
When a required select has no answer, the unknown field now includes the available options. Telegram notification shows them so the user knows exactly what to reply with. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -195,7 +195,8 @@ async function handleResult(job, result, results, settings, profile, apiKey) {
|
|||||||
|
|
||||||
case 'needs_answer': {
|
case 'needs_answer': {
|
||||||
const questionText = pending_question?.label || pending_question || 'Unknown question';
|
const questionText = pending_question?.label || pending_question || 'Unknown question';
|
||||||
console.log(` 💬 Unknown question — asking Claude: "${questionText}"`);
|
const questionOptions = pending_question?.options || [];
|
||||||
|
console.log(` 💬 Unknown question — asking Claude: "${questionText}"${questionOptions.length ? ` (options: ${questionOptions.join(', ')})` : ''}`);
|
||||||
|
|
||||||
const aiAnswer = await generateAnswer(questionText, profile, apiKey, { title, company });
|
const aiAnswer = await generateAnswer(questionText, profile, apiKey, { title, company });
|
||||||
|
|
||||||
@@ -209,13 +210,14 @@ async function handleResult(job, result, results, settings, profile, apiKey) {
|
|||||||
`❓ *New question* — ${company} / ${title}`,
|
`❓ *New question* — ${company} / ${title}`,
|
||||||
``,
|
``,
|
||||||
`*Question:* ${questionText}`,
|
`*Question:* ${questionText}`,
|
||||||
|
questionOptions.length ? `*Options:* ${questionOptions.join(' | ')}` : '',
|
||||||
``,
|
``,
|
||||||
aiAnswer
|
aiAnswer
|
||||||
? `*AI answer:*\n${aiAnswer}`
|
? `*AI answer:*\n${aiAnswer}`
|
||||||
: `_AI could not generate an answer._`,
|
: `_AI could not generate an answer._`,
|
||||||
``,
|
``,
|
||||||
`Reply with your answer to store it, or reply *ACCEPT* to use the AI answer.`,
|
`Reply with your answer to store it, or reply *ACCEPT* to use the AI answer.`,
|
||||||
].join('\n');
|
].filter(Boolean).join('\n');
|
||||||
|
|
||||||
await sendTelegram(settings, msg);
|
await sendTelegram(settings, msg);
|
||||||
results.needs_answer++;
|
results.needs_answer++;
|
||||||
|
|||||||
@@ -306,8 +306,14 @@ export class FormFiller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (await this.isRequired(sel)) {
|
} else if (await this.isRequired(sel)) {
|
||||||
// Non-EEO required select with no answer — report as unknown
|
// Non-EEO required select with no answer — report as unknown with options
|
||||||
unknown.push(lbl);
|
const opts = await sel.$$('option');
|
||||||
|
const options = [];
|
||||||
|
for (const opt of opts) {
|
||||||
|
const text = (await opt.textContent().catch(() => '') || '').trim();
|
||||||
|
if (text && !/^select/i.test(text)) options.push(text);
|
||||||
|
}
|
||||||
|
unknown.push({ label: lbl, type: 'select', options });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user