feat: chatbot screenshot-only eligibility detect, Sun Life/DentaQuest auto-check, chatbot attachment handoff to preauth; fix TuftsSCO preauth Selenium reliability

- Chatbot: submitting with only a screenshot attached (no text) now triggers the same
  "AI Detect & Check Eligibility" flow as the Copy Agent page
- detect-eligibility-info now also extracts the visible insurance payer name and picks
  Tufts SCO auto-check when both Sun Life and DentaQuest are detected, else MassHealth
- Chatbot-attached files are now handed off to both claim and preauth forms unconditionally,
  not just claims
- TuftsSCO preauth Selenium worker: verify-and-retry the Tooth field (typing was silently
  getting reset by duplicate-procedure-code warning banners), add a final re-verification
  pass across all rows, fix acknowledgement-checkbox targeting/verification, and verify
  the "Next step" click actually advances the wizard instead of trusting a blind click
This commit is contained in:
2026-07-25 00:10:05 -04:00
parent 6b9b3c41f2
commit 870bda5950
8 changed files with 237 additions and 724 deletions
@@ -301,13 +301,14 @@ export default function AiCopyAgentPage() {
const memberId: string | null = detectResult.value?.data?.memberId ?? null;
const dob: string | null = detectResult.value?.data?.dob ?? null;
const autoCheck: string = detectResult.value?.data?.autoCheck ?? "mh";
window.dispatchEvent(
new CustomEvent("chatbot:open-eligibility-id-ready", {
detail: {
memberId,
dob,
autoCheck: "mh",
autoCheck,
patient: {
id: patient.id,
firstName: patient.firstName,
@@ -336,11 +337,11 @@ export default function AiCopyAgentPage() {
try {
const files = await itemsToFiles(items);
let detected: { memberId: string | null; dob: string | null };
let detected: { memberId: string | null; dob: string | null; autoCheck: string };
try {
const json = await detectFromFiles(files);
if (json?.error) throw new Error(json.message || "Detection failed");
detected = { memberId: json?.data?.memberId ?? null, dob: json?.data?.dob ?? null };
detected = { memberId: json?.data?.memberId ?? null, dob: json?.data?.dob ?? null, autoCheck: json?.data?.autoCheck ?? "mh" };
} catch (error) {
console.error("Error detecting Member ID/DOB:", error);
toast({
@@ -351,7 +352,7 @@ export default function AiCopyAgentPage() {
return;
}
const { memberId, dob } = detected;
const { memberId, dob, autoCheck } = detected;
if (memberId && dob) {
let tempPatient: TempPatient;
@@ -395,7 +396,7 @@ export default function AiCopyAgentPage() {
detail: {
memberId,
dob,
autoCheck: "mh",
autoCheck,
patient: {
id: tempPatient.id,
firstName: tempPatient.firstName,
@@ -424,7 +425,7 @@ export default function AiCopyAgentPage() {
window.dispatchEvent(
new CustomEvent("chatbot:open-eligibility-id-ready", {
detail: { memberId, dob, autoCheck: "mh", patient: null },
detail: { memberId, dob, autoCheck, patient: null },
})
);
}