remove date from OCR, use today's date instead
This commit is contained in:
parent
388069d8da
commit
6d6baa79fa
2 changed files with 7 additions and 7 deletions
|
|
@ -16,13 +16,13 @@ Log receipt images and expense details into the `wip.work_expenses` collection i
|
|||
|
||||
## Steps
|
||||
|
||||
1. **Extract receipt info** — If the user sent an image, run the OCR script to read the date, vendor, and amount:
|
||||
1. **Extract receipt info** — If the user sent an image, run the OCR script to read the merchant and amount:
|
||||
|
||||
```bash
|
||||
uv run --with requests python3 scripts/ocr_receipt.py /path/to/image.jpg
|
||||
```
|
||||
|
||||
The script is located at `~/notes/skills/log-work-expense/scripts/ocr_receipt.py`. It returns JSON with `date`, `vendor`, and `amount` fields. If the output doesn't contain a confident date, **ask the user** — never guess. If they only provided text, use that.
|
||||
The script is located at `~/notes/skills/log-work-expense/scripts/ocr_receipt.py`. It returns JSON with `merchant` and `amount` fields. If they only provided text, use that.
|
||||
|
||||
2. **Upload the receipt image to S2** — If the user provided an image, upload it to S2 and get the public URL. If they only provided a file or no image, skip this step.
|
||||
|
||||
|
|
@ -39,12 +39,12 @@ The script is located at `~/notes/skills/log-work-expense/scripts/ocr_receipt.py
|
|||
```
|
||||
|
||||
- **file**: The S2 URL of the uploaded receipt image. Omit if no image was provided.
|
||||
- **date**: The date from the receipt, formatted as YYYY-MM-DD. If you cannot confidently read the date from the receipt, ask the user — do not guess.
|
||||
- **merchant**: Extracted from the OCR result or the receipt image.
|
||||
- **date**: Always use today's date (the date you receive the message), formatted as YYYY-MM-DD.
|
||||
- **merchant**: Extracted from the OCR result.
|
||||
- **description**: What the user told you about the expense (e.g. "travel meal during LTISD onsite"). If they didn't provide context, ask.
|
||||
- **status**: Always set to `"todo"` when inserting.
|
||||
|
||||
4. **Confirm** — Reply with a brief confirmation showing what was logged (date, note, and file link if applicable).
|
||||
4. **Confirm** — Reply with a brief confirmation showing what was logged (date, merchant, and file link if applicable).
|
||||
|
||||
## Notes
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ resp = requests.post(
|
|||
{
|
||||
"type": "text",
|
||||
"text": (
|
||||
"Extract from this receipt: date, vendor/restaurant name, and total amount. "
|
||||
"Return ONLY a JSON object with keys: date (YYYY-MM-DD format), vendor, amount. "
|
||||
"Extract from this receipt: merchant/restaurant name and total amount. "
|
||||
"Return ONLY a JSON object with keys: merchant, amount. "
|
||||
"No other text."
|
||||
),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue