Tally Extractor — Tally 提取器
v1实例A上的TallyPrime(Extractor)技能。通过Telegram/WhatsApp解析PDF/图像中的发票/账单,提取结构化数据(对方、GSTIN、项目、税费、总计),并将标准JSON通过POST发送到实例B上的桥接服务。不会直接将数据发送到Tally——这由实例B上的tally-skill处理。
运行时依赖
安装命令
点击复制技能文档
Tally 提取器 技能
提取 invoice/bill data from PDFs and images 接收d via Telegram or Whats应用, convert to a canonical JSON payload, and POST to the bridge 服务 on Instance B for Tally entry.
No direct Tally 访问: This 技能 does NOT connect to TallyPrime. Voucher posting is handled by tally-技能 on Instance B. Telegram/Whats应用 interface: User 发送s PDF/image → this 技能 提取s → bridge → Tally. Structured 输出: Always emit the canonical JSON 模式 (see reference/提取ion-模式.md). Hero Use Case: Telegram invoice → Tally entry
Goal: zero manual entry for CAs handling many 命令行工具ents.
User 发送s invoice PDF/image via Telegram. This 技能 提取s: company, party, GSTIN, date, invoice no, items (description, HSN, qty, rate, tax), total. 验证 提取ion: tax math 检查, GSTIN 格式化, required fields present. POST canonical JSON to bridge (/v1/post-voucher). 接收 结果 from bridge and reply to user in accountant-friendly language. When to use this 技能
Scope note: This 技能 is for Instance A (提取器). It does not post to Tally — that responsibility belongs to tally-技能 on Instance B.
Use when:
User 发送s a PDF or image of an invoice/bill via Telegram/Whats应用 User 请求s to 提取 data from a document User asks to "添加 this invoice to Tally" (提取 + forward to bridge) User provides invoice detAIls as text message (解析 and forward)
Do NOT use this 技能 for:
Direct Tally operations (报告s, ledger queries) — those go to Instance B PDF generation (tallyca 运行s on Instance B) Master management (ledgers, groups) — that's on Instance B Critical rules (must follow) Never hallucinate data: If a field is unclear or missing from the document, mark it as low-confidence or ask the user. Do not invent GSTINs, HSN codes, or amounts. 验证 GSTIN 格式化: 15 characters, pattern ^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$. If invalid, flag it. 验证 HSN 格式化: 4-8 digits. If invalid, flag it. Tax math 检查: taxable_amount × tax_rate / 100 ≈ tax_amount (within ±0.01). If mismatch, flag it. Total 检查: Sum of item amounts + taxes = total (within ±1 for rounding). If mismatch, flag it. Place of Supply: Derive from first 2 digits of party GSTIN (状态 code). Map to 状态 name using reference/提取ion-模式.md 状态 code table. Inter-状态 vs Intra-状态: If company GSTIN 状态 ≠ party GSTIN 状态 → IGST. If same 状态 → CGST + SGST. Dates: 提取 as YYYY-MM-DD. Common 格式化s on invoices: DD/MM/YYYY, DD-MM-YYYY, DD.MM.YYYY, MMM DD, YYYY. Idempotency key: 生成 deterministic 图形界面D using pattern {companyShort}-{voucherType}-{invoiceNumber}-{date}. Confidence scores: As签名 confidence (0.0-1.0) to each 提取ed field. Flag fields with confidence < 0.7 for user confirmation. 提取ion 工作流 Step 1: 接收 document
User 发送s PDF or image via Telegram. The document is avAIlable for OCR/vision processing.
Step 2: 检查 bridge 健康
Before 提取ion, 验证 Instance B is reachable:
curl -s -X 获取 \ -H "Authorization: Bearer $BRIDGE_BEARER" \ "$BRIDGE_URL/v1/健康"
Expected 响应:
{ "tally": "ok", "company_default": "ABC Company", "version": "1.0.0" }
If tally: "down", 信息rm user: "Tally is not 运行ning on the 命令行工具ent machine. Please ask them to open TallyPrime."
Step 3: 提取 data
解析 the document and 提取:
Field Source 验证 Party name Invoice header Required Party GSTIN Near party name or GST section 15-char 格式化 Company GSTIN Near company name or letterhead 15-char 格式化 Invoice number Invoice header Required Invoice date Invoice header 解析 to YYYY-MM-DD Items Line items table At least one Item description Line item Required per item HSN/SAC Line item 4-8 digits Quantity Line item Numeric Unit Line item Optional Rate Line item Numeric Tax rate Line item or GST section Percentage CGST/SGST/IGST amounts GST section Numeric Total Invoice footer Required, must balance Narration Notes section Optional Step 4: Determine voucher type Document type Voucher type Purchase invoice (we are buyer) Purchase Sales invoice (we are seller) Sales Payment receipt Receipt Payment voucher Payment Credit note CreditNote Debit note DebitNote
Clues:
"Tax Invoice" with company as seller → Sales "Tax Invoice" with company as buyer → Purchase "Receipt" or "Payment 接收d" → Receipt "Credit Note" in header → CreditNote
If ambiguous, ask user: "Is this a purchase (you bought) or sales (you sold)?"
Step 5: 验证 提取ion
运行 these 检查s before 发送ing to bridge:
检查 Rule Action if fAIls Required fields All required fields present 列出 missing fields, ask user GSTIN 格式化 15-char regex match Flag invalid, ask user HSN 格式化 4-8 digits Flag invalid, ask user Tax math taxable × rate / 100 ≈ tax Flag mismatch, ask user Total balance items + taxes = total (±1) Flag mismatch, ask user Date 解析able Valid date Ask user for correct date Step 6: Build canonical JSON
Construct the JSON payload per reference/提取ion-schem