Spaces:
Sleeping
Sleeping
Commit History
-
Auto-form: เรียน vendor not bold + nudge รับทราบ box down a little
- Unbold the เรียน line's vendor name (the template's Vendor run was bold). - Add ~14pt space above the acknowledgement box so it sits a little lower. Re-verified against MS Word: every realistic body length still fits one page (worst realistic case 867 chars + long title stays single-page with the box gap). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>d9c9dc4 -
Auto-form: guarantee form-1 letter fits one page + drop (ครั้งแรก) label
- _fit_letter_to_one_page(): after inserting the body, compress the letter so it never overflows to page 2 — trim per-paragraph spacing to 2pt + single (font-relative, Thai-safe) line spacing, cap bottom margin at 0.5in, make the รับทราบ box atomic (cantSplit) so it never half-splits, and shrink the font a step only for unusually long bodies. The template's docDefaults (8pt after + 1.08 line) were the cause. Verified against MS Word pagination across body lengths; letterhead + box preserved, no diacritic clipping. - Remove ' (ครั้งแรก)' from the form-1 label. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>129e184 -
Auto-form: highlight "AI" in the generate button + letter date defaults to today
- generate button: ":violet[AI]" markdown span restyled via scoped CSS (.st-key-generate_btn) into a glowing white chip so the AI feature stands out. - form_logic.fill_letter_date(): the header line "วันที่ ___ เดือน ___ พ.ศ." now fills with today's date (Buddhist era) by default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>00325cf -
Auto-form: generate the body in the exact PTT 2-paragraph format
The body is now an AI-generated เนื้อความ matching the real letters: para 1 context ("ตามที่ ปตท. ได้ดำเนินการ[จัดจ้าง/จัดซื้อ] <work> โดย <vendor> เป็น[ผู้รับจ้าง/ผู้ขาย]นั้น") and para 2 instruction ("<unit> ขอแจ้งให้บริษัทของท่านเริ่มเข้าดำเนินการ[ปฏิบัติงาน/ส่งมอบสินค้า] ได้นับถัดจากวันที่ <date> เป็นต้นไป [จนกว่างานจะแล้วเสร็จ…ไม่เกิน X วัน] ตาม[ใบสั่งจ้าง/ใบสั่งซื้อ] ที่อ้างถึงนั้น"). procurementType drives the ซื้อ/จ้าง swaps. - ai_clean: generate_body() (AI primary + IDENTICAL-format deterministic compose_body fallback so it's always on-format despite free-model 429s); thai_date(); งวด-aware เรื่อง suffix kept. - form1.docx: body replaced by a single [เนื้อความ] block; form_logic inserts the 2 paragraphs (first-line indent preserved) via insert_body_paragraphs(). - streamlit: start-date picker (วันที่เริ่มดำเนินการ); unit from prCreatorUnitName; gathers fields and calls generate_body during the AI animation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropi…256df8f -
Auto-form: AI-clean กำหนดส่งมอบ into the document + งวด selector
- ai_clean.py (new): parse_nguad() lists selectable งวด (deterministic); clean_delivery() rewrites the chosen งวด's TOR clause into clean letter Thai via OpenRouter (gemma-4-31b-it:free primary, llama-3.3-70b + gpt-oss-120b free fallbacks, retry on 429, raw-text fallback so generation never hard-fails). Key from OPENROUTER_API_KEY env. - streamlit_app: งวดส่งมอบ selector (from the TOR กำหนดส่งมอบ); generate button renamed "สร้างเอกสารด้วย AI"; on generate, AI-clean the selected งวด and pass it + a "(งวดที่ N)" เรื่อง suffix to the form. - form1.docx + form_logic: new [กำหนดส่งมอบ] body block (filled or dropped if empty); fill the existing จำนวนวัน token from daySLA. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>0941280 -
Auto-form: vendor-name cleanup, real PO date, PTT/vendor swap, TOR กำหนดส่งมอบ, signer ตำแหน่ง
- streamlit_app: strip leading SAP vendor code from VendorName; convert poCreateDate Excel serial -> date; resolve SMP signers once per render and show the TOR กำหนดส่งมอบ (การส่งมอบงาน) clause in the info card; pass signer position to the form. - signer_lookup: fold a TOR delivery-clause fetch into the browser resolver (PROnline.torId -> TOROnline eager:details -> section 7 contentPreview), returned as deliveryClause; add pick_delivery(); stripHtml helper. - form_logic: clean_vendor_name(); fill signer_position; PTT/vendor swap uses the repositioned Vendor token. - form1.docx: PTT now subject of the body clause; add centered ตำแหน่งผู้ลงนาม line under the signer name. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>b5c887b
-
signer: role choice + placeholder API
145e4ee
-
Clean up form templates: remove category line, center signer, all-black text
- remove the 'category/usage' annotation line (form1 standalone; form2 full when-to-use paragraph) so the letter starts at the letterhead - center the signer (name) line on the page; form_logic no longer pads it with leading spaces (centering via paragraph alignment) - normalize all text to black (run + paragraph-mark/list-number colors) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>51e875d
-
Lock Step 2 for forms 2-5 and auto-fill PO + work title
Forms 2-5 were uses_po=False, which forced step1_done=True so Step 2 never locked before a PO lookup. They actually depend on the lookup (vendor already, plus PO + title per the reference line). Set uses_po=True for forms 2-5 so Step 2 gates on the lookup like form1, and fill the work title and PO into the 'อ้างถึง (1) สัญญา...' line. - form_logic.py: uses_po=True for forms 2-5; fill title/PO in the form2-5 branch. - templates/form2-5.docx: insert ชื่องาน / PO_No tokens into the reference line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b1eb504
-
Remove deprecated tkinter desktop app
Delete auto_form_generator.py (the tkinter desktop GUI) and drop its references from README.md and the form_logic.py docstring. The Streamlit web app is now the only entry point. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ea5abfd
-
Upload 17 files
Verified signature4584aec