AI fallback for unknown form fields: ask Claude before Telegram
Every unknown required field now goes through AI before falling back to Telegram. Claude sees the question + all saved answers + profile, and either recognizes it as a variation of a saved answer or generates a new one. AI answers are auto-saved to answers.json so the same question is a free pattern match next time. Telegram is now last resort (no API key). Flow: pattern match (free) → AI (smart) → auto-save → Telegram (human) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,11 +39,11 @@ async function main() {
|
||||
const profile = loadConfig(resolve(__dir, 'config/profile.json'));
|
||||
const answersPath = resolve(__dir, 'config/answers.json');
|
||||
const answers = existsSync(answersPath) ? loadConfig(answersPath) : [];
|
||||
const formFiller = new FormFiller(profile, answers);
|
||||
const maxApps = settings.max_applications_per_run || Infinity;
|
||||
const maxRetries = settings.max_retries ?? DEFAULT_MAX_RETRIES;
|
||||
const enabledTypes = settings.enabled_apply_types || DEFAULT_ENABLED_APPLY_TYPES;
|
||||
const apiKey = process.env.ANTHROPIC_API_KEY || settings.anthropic_api_key;
|
||||
const formFiller = new FormFiller(profile, answers, { apiKey, answersPath });
|
||||
|
||||
const startedAt = Date.now();
|
||||
const results = {
|
||||
@@ -141,6 +141,9 @@ async function main() {
|
||||
break;
|
||||
}
|
||||
|
||||
// Set job context for AI answers
|
||||
formFiller.jobContext = { title: job.title, company: job.company };
|
||||
|
||||
// Reload answers.json before each job — picks up Telegram replies between jobs
|
||||
try {
|
||||
const freshAnswers = existsSync(answersPath) ? loadConfig(answersPath) : [];
|
||||
|
||||
Reference in New Issue
Block a user