refactor: remove scripted file intercept — LLM owns all responses

Previously ab_ai_mail.py intercepted file uploads before reaching the
LLM and responded with a hardcoded clarification template. The LLM had
no involvement in the file upload response.

Changes:
- ab_ai_mail.py: remove _post_file_clarification, _find_pending_attachments,
  _describe_zip, and the two-step pending-attachment lookup. All messages
  (text, files, or both) are dispatched to the agent service immediately.
  Files with no text pass an empty message — the LLM decides what to do.
- upload.py: default message changed from hardcoded receipt instruction
  to '' so the LLM determines intent from file content.
- master_agent._synthesize: always runs through the LLM for both single
  and multi-agent cases — no raw templates reach the user.
- master_system.txt: add FILE UPLOADS routing rule so the LLM knows to
  route receipts to expenses_agent without asking for clarification.

New flow: upload → parse → LLM classifies → agent acts → LLM synthesizes
natural response → user sees it. Zero scripted intercepts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-19 21:05:38 -04:00
parent 0bd1810405
commit 93f2a101fa
4 changed files with 36 additions and 158 deletions

View File

@@ -18,7 +18,7 @@ router = APIRouter(prefix='/upload', tags=['upload'])
async def upload(
request: Request,
user_id: str = Form(...),
message: str = Form(default='Create an employee expense report from these receipts.'),
message: str = Form(default=''),
session_id: Optional[str] = Form(default=None),
files: List[UploadFile] = File(default=[]),
):