Fix receipt parsing quality and approval endpoint
Receipt quality: replace LLM amount/date extraction with regex. LLM was hallucinating 2021/2022 dates and returning '198.40 USD' strings. Amounts now use deterministic regex (Total:/Grand Total:/Amount Due:). Dates: filename timestamp > OCR regex > today (no LLM date guessing). LLM only asked for vendor name + product category. Approval: fix GET /approval/pending 500 by using correct column name 'started_at' instead of 'created_at' (which does not exist). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,8 @@ async def list_pending():
|
||||
raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail='DB not ready')
|
||||
async with pool.acquire(timeout=10) as conn:
|
||||
rows = await conn.fetch(
|
||||
'SELECT directive_id, agent_name, action_type, description, created_at, context_data '
|
||||
'FROM ab_directive_log WHERE status = $1 ORDER BY created_at ASC',
|
||||
'SELECT directive_id, agent_name, action_type, description, started_at, context_data '
|
||||
'FROM ab_directive_log WHERE status = $1 ORDER BY started_at ASC',
|
||||
'pending_approval',
|
||||
)
|
||||
return [
|
||||
@@ -43,7 +43,7 @@ async def list_pending():
|
||||
agent=r['agent_name'] or '',
|
||||
action=r['action_type'] or '',
|
||||
description=r['description'] or '',
|
||||
created_at=str(r['created_at']),
|
||||
created_at=str(r['started_at'] or ''),
|
||||
context=r['context_data'] or {},
|
||||
)
|
||||
for r in rows
|
||||
|
||||
Reference in New Issue
Block a user