Go orchestrator

This commit is contained in:
MangoPig
2026-02-21 23:52:55 +00:00
parent 6dce685906
commit 6fc84b20b6
15 changed files with 1857 additions and 46 deletions
+58 -7
View File
@@ -76,16 +76,67 @@ Rationale: De-risk unknowns (Docling OCR quality, Ollama CPU inference speed) be
- Response: `{ "response": "<json>" }` (strip `<think>...</think>` tags in post-processing)
- Note: Qwen3 includes reasoning by default; `/no_think` leaves empty tags, so strip instead
### 1c. Python Tools Service
### 1c. Python Tools Service (DONE)
- [ ] FastAPI + openpyxl service
- [ ] Endpoints: read tracker, write/update rows, get column schema
- [ ] Test with sample Tracker.xlsx
- [x] FastAPI + openpyxl service
- [x] Generic Excel API (not tracker-specific)
- [x] Test with Invoice_Schedule_2026Q1.xlsx
### 1d. Manual Integration Test
**Tools API Spec:**
- [ ] Chain test: PDF → Docling → Ollama → Tools → Excel updated
- [ ] Document any issues / adjustments needed
- Image: Custom Dockerfile (python:3.12-slim + fastapi + openpyxl)
- Port: `8000`
- Volume: `/data``/data/jingtian/BenjaminTeam`
**Endpoints:**
| Endpoint | Method | Description |
| -------------------- | ------ | ---------------------------- |
| `/health` | GET | Health check |
| `/excel/sheets` | GET | List sheet names in workbook |
| `/excel/schema` | GET | Get column headers |
| `/excel/read` | GET | Read all rows |
| `/excel/row/{n}` | GET | Get specific row (1-indexed) |
**Query Params:**
- `file_path` (required) — path relative to `/data/`
- `sheet_name` (required) — name of the sheet to read
- `header_row` (optional, default=1) — which row contains headers
**Tested:**
- Invoice_Schedule_2026Q1.xlsx with `header_row=4` — extracted 6 invoice rows ✅
- Columns: Client, Matter Ref, TM Number, Description, Amount (HKD), Due Date, Status
**Future Endpoints (Phase 2+):**
- `POST /excel/row` — Add new row
- `PUT /excel/row/{n}` — Update specific row
- `DELETE /excel/row/{n}` — Delete row
- `POST /excel/format` — Apply formatting
### 1d. Manual Integration Test (DONE)
- [x] Chain test: PDF → Docling → Ollama → JSON extraction
- [x] Chain test: PNG → Docling (Chinese OCR) → Ollama → JSON extraction
- [x] Chain test: DOCX → Docling → Ollama → JSON extraction
- [x] Chain test: XLSX → Tools API → Ollama → JSON summary
**Tested Files:**
| File | Type | Docling | Ollama | Key Extractions |
| --------------------------------- | ---- | ------- | ------ | ------------------------------------------------ |
| Filing_Receipt_307800905.pdf | PDF | ✅ | ✅ | TM#307800905, NOVA, Class 9, deadline 30-05-2026 |
| Email_Monee_...20260221.png | PNG | ✅ | ✅ | TM#306527151, 官藥坊, evidence of use |
| Letter_Re_TM306735835.docx | DOCX | ✅ | ✅ | TM#306735835, CALIFORNIA BABY, hearing 17-04-2026|
| Invoice_Schedule_2026Q1.xlsx | XLSX | ✅ | ✅ | HKD 474,000 total, 6 invoices, 3 sent/1 paid/2 draft |
**Notes:**
- Qwen3 1.7b correctly extracted Chinese trademark 官藥坊 from PNG
- All deadlines, TM numbers, client names extracted accurately
- Minor: XLSX currency guessed as USD (HKD in source) — fix with better prompting
## Phase 2: Go Orchestrator