Improve automation worker error messages and inbox AI multi-bubble replies

- automation.ts: distinguish network/timeout errors from generic failures
- aiAutoReply.ts: upgrade to multi-bubble reply system with female particle enforcement
- codex-runtime.mjs: revert default model to gpt-4.1-mini

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Loma Bot Ops
2026-11-26 09:26:54 +07:00
parent 89d46ab141
commit 0ba3a5486c
3 changed files with 87 additions and 12 deletions
+7 -1
View File
@@ -39,6 +39,12 @@ export async function runAutomation(body: Record<string, unknown>, options: { wa
} catch (error) {
if (error instanceof UserFacingError) throw error;
console.error("[ai:automation] worker failed", error);
throw new UserFacingError("Automation ทำงานไม่สำเร็จหรือกำลังติดงานอื่น — ตรวจ worker และการ login แล้วลองใหม่");
if (error instanceof DOMException && error.name === "AbortError") {
throw new UserFacingError("Worker ไม่ตอบกลับภายในเวลาที่กำหนด — ตรวจว่า worker กำลังทำงานอยู่แล้วลองใหม่");
}
if (error instanceof TypeError && /fetch|connect|ECONNREFUSED/i.test(error.message)) {
throw new UserFacingError("เชื่อมต่อ worker ไม่ได้ — ตรวจว่า worker กำลังทำงานอยู่และ AI_AUTOMATION_URL ถูกต้อง");
}
throw new UserFacingError("Automation ทำงานไม่สำเร็จ — ตรวจ worker และการ login แล้วลองใหม่");
}
}