Pass placeholder format hints to AI for inputs and textareas
Captures placeholder from textareas in snapshot. When AI fallback is used, includes placeholder as a format hint so the AI knows expected format (dates, phone numbers, URLs, etc). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -437,7 +437,7 @@ Answer:`;
|
||||
if (!isVisible(ta)) return;
|
||||
const tag = 'ta-' + (idx++);
|
||||
ta.setAttribute('data-claw-idx', tag);
|
||||
result.textareas.push({ tag, label: _extractLabel(ta), value: ta.value || '', required: _checkRequired(ta) });
|
||||
result.textareas.push({ tag, label: _extractLabel(ta), value: ta.value || '', placeholder: ta.placeholder || '', required: _checkRequired(ta) });
|
||||
});
|
||||
|
||||
// Fieldsets
|
||||
@@ -568,9 +568,10 @@ Answer:`;
|
||||
continue;
|
||||
}
|
||||
|
||||
const formatHint = field.placeholder ? `(format: ${field.placeholder})` : '';
|
||||
let answer = this.answerFor(lbl);
|
||||
if (!answer && field.required) {
|
||||
answer = await this.aiAnswerFor(lbl);
|
||||
answer = await this.aiAnswerFor(formatHint ? `${lbl} ${formatHint}` : lbl);
|
||||
if (answer) this.saveAnswer(lbl, answer);
|
||||
}
|
||||
if (answer && answer !== this.profile.cover_letter) {
|
||||
@@ -588,9 +589,10 @@ Answer:`;
|
||||
// --- Textareas ---
|
||||
for (const field of snap.textareas) {
|
||||
if (field.value?.trim()) continue;
|
||||
const taFormatHint = field.placeholder ? `(format: ${field.placeholder})` : '';
|
||||
let answer = this.answerFor(field.label);
|
||||
if (!answer && field.required) {
|
||||
answer = await this.aiAnswerFor(field.label);
|
||||
answer = await this.aiAnswerFor(taFormatHint ? `${field.label} ${taFormatHint}` : field.label);
|
||||
if (answer) this.saveAnswer(field.label, answer);
|
||||
}
|
||||
if (answer) {
|
||||
|
||||
Reference in New Issue
Block a user