Spaces:
Sleeping
Sleeping
Commit History
-
fix: letter lost the duration sentence when AI paraphrasing dropped the 'ภายใน X วัน' signal — (1) build_letter falls back to the raw TOR clause when cleaning loses it, (2) generate_body rejects AI bodies missing the supplied day-number
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnRb9e493a -
feat: wire ai_clean.clean_delivery into the generate path (ARCHITECTURE §13.3) — the body's delivery sentence is now งวด-aware; deterministic fallback preserved
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR903bb5c -
feat: ALLOWED_USERS allowlist authorization (require_authorized) after login — server-side enforcement; unset secret = allow all (no lockout); themed denial card + logout
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR5ec0721 -
test: pytest suite for the pure layers (data_source, ai_clean, form_logic, letter_builder) — 32 tests, no network, AI_BACKEND=off
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnRf50726e -
feat: ?health=1 query-param health check (app + data source OK), pre-gate; liveness stays on built-in /_stcore/health
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR21d12df -
refactor: extract the generate use-case into letter_builder.py (build_letter, default_doc_type, suffix_doc_type); UI keeps only widgets, validation display, and session state — verified docx-identical to pre-refactor output
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnRfda2212 -
refactor: move browser-bridge gates + signer helpers (require_desktop, require_local_network, fetch_signers_for_po, signer_from_lookup) into gates.py
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR84c98ae -
refactor: move PO data access (load_live_data, lookup_po_in_bytes) into data_source.py repository module; add check_data() health probe
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR1ea4202 -
refactor: move presentation constants (THEME_CSS, AI_CREATE_ANIM_HTML) into theme.py — verbatim, no behavior change
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnR3c1cc18 -
deps: add requests (direct dep of load_live_data), move huggingface_hub to local-helper note; add requirements-dev.txt
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQMBLPhJZUBCX7io3uwEnRbf52d18 -
Auto-form: remove the OpenRouter backend entirely (org policy) — AI Builder flow is the only AI backend
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>3f28237 -
Auto-form: gitignore local secret-push helpers and internal docs (public Space repo)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>fb9f47c -
Auto-form: AI backend via Power Automate + AI Builder (AI_BACKEND env, OpenRouter kept for rollback)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>38e26ff
-
Auto-form: unblock guide step 1 shows the new 'tune' site-info icon, not just a lock
Modern Chrome/Edge replaced the address-bar padlock with the two-sliders site-info icon, so 'tap the 🔒' misled users. Step-1 visual now shows that icon (+ the real URL) and reads 'the icon in front of the site name — this, or a 🔒'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>7295b0e -
Auto-form: simpler, visual Local Network unblock guide for non-technical users
The old recovery line was a jargon wall ('กดไอคอน 🔒 → Local network → Allow → รีโหลด'). Replace with two clear options + images: วิธีที่ 1 = the Allow-popup image; วิธีที่ 2 = a new 3-step infographic (assets/lna_unblock.png: tap 🔒 → set Local network to Allow → reload). Retry button now does a real page reload (more reliable after a setting change). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>f5d1780 -
Auto-form: show the Local Network 'Allow' prompt image on the gate page
Add assets/lna_allow.png (LFS-tracked) and display it on the require_local_network 'click Allow' warning so users know exactly which button to press. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>a9dc2e6 -
Auto-form: same-model failover across accounts (seamless key rotation)
Reorder _complete to model-outer / key-inner: for the preferred model, rotate across ALL accounts before downgrading to the next model, and switch accounts immediately on a 429 (no wait). So a rate-limited account fails over to the other account on the SAME model, keeping output consistent; errors stay caught (caller falls back to deterministic text). Verified ordering with stubbed calls. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>18b092a -
Auto-form: rotate across multiple OpenRouter API keys on rate limit
Support more than one OpenRouter account and auto-switch when one is limited: - _api_keys(): collect keys from OPENROUTER_API_KEY (may hold several, comma/ whitespace separated) + OPENROUTER_API_KEY_2.._5, deduped, order preserved. - _complete(): shared key x model x retry loop; rotates to the NEXT key as soon as the current account stays 429 after retries (free-tier limits are account- wide), still trying other models for transient errors. generate_body and clean_delivery now use it; deterministic/raw fallback when all keys exhausted. Verified: key parsing (multi-in-one-secret, _2.._5, dedupe) and rotation (account A 429 -> account B serves; all-limited -> None -> deterministic). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>9879d74 -
Auto-form: add 'ขออภัยในความไม่สะดวก' to the mobile blocker
Add the apology line to both the CSS .mobile-block overlay and the _mobile_notice fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>513fc8e -
Auto-form: soften body verb -> 'ได้มีข้อตกลงในการจัดซื้อ/จัดจ้างกับ'
'ได้ตกลงซื้อ <vendor>' read too blunt. Use the procurement-style phrasing 'ได้มีข้อตกลงในการจัดซื้อกับ <vendor>' (งานซื้อ) and the parallel 'ได้มีข้อตกลงในการจัดจ้างกับ <vendor>' (งานจ้าง), in both the deterministic compose_body and the AI prompt template. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>b462261 -
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: block mobile/phone users (desktop-only)
The wide two-column form is not usable on a phone. Two layers: - CSS .mobile-block overlay covers narrow viewports (<=820px) instantly, no flash, reacting to rotation/resize — shown over login and the app. - require_desktop(): server-side st.stop() once the browser reports a real mobile device (mobile/tablet UA, or coarse-pointer + no-hover + narrow), so a phone cannot progress past the gate (runs before login). Detection via streamlit_js_eval, cached once per session. Message: 'ปัจจุบัน ยังไม่รองรับการใช้งานในมือถือ'. Verified: detection logic (iPhone/Android blocked, desktop + narrow-desktop-window not hard-blocked) and the overlay render at 390px. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>d15c294 -
Auto-form: fix invisible AI label (out-specify the white-label rule)
The dark-blue AI chip rule tied on specificity with the later '.stButton button[kind="primary"] … span { color:#fff }' rule, which won by source order -> white text on a white chip. Raised the AI rule's specificity (html body + [kind="primary"] + container chain) so the dark blue wins. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>f0b6eee -
Auto-form: งวด 'อื่นๆ' manual entry + dark-blue AI label
- งวดส่งมอบ dropdown gains an 'อื่นๆ (ระบุเอง)' option; choosing it reveals a text input so the user can type a custom งวด. A typed 'งวดที่ N' still parses to a number; any other free text is appended to the document type verbatim. - Recolor the 'AI' highlight (generate button) and the 'AI กำลังเรียบเรียง' loading label to dark blue (#1E3A8A). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>01672fa -
Auto-form: robust กำหนดส่งมอบ extraction (no wrong-section pulls)
The browser TOR fetch picked the FIRST detail part whose title+content merely contained 'การส่งมอบงาน', so a passing mention in an earlier section (e.g. 'หลักฐานการส่งมอบงาน' in คุณสมบัติผู้ยื่นข้อเสนอ) or a look-alike heading (สถานที่ส่งมอบ / การจ่ายเงิน / ค่าปรับ) could be pulled instead of the real delivery clause. Section position is not fixed across TOR types either. - signer_lookup.py: score every TOR section — title is a delivery heading wins, look-alike sections are excluded, and a content-only match must carry a real duration/งวด signal (ภายใน X วัน / งวดที่ N / งวดเดียว / นับถัดจาก). Broadened the accepted headings (ระยะเวลาส่งมอบ / กำหนดส่งมอบ / ระยะเวลาดำเนินงาน …). - ai_clean.py: _duration_from_tor tolerates a spelled-out คำอ่าน between the number and วัน, e.g. 'ภายใน 160 (หนึ่งร้อยหกสิบ) วัน'. Verified: real selection logic (extracted from the file) picks the correct section for both sample TORs (1191001682 งวดเดียว 160 วัน, 1141000533 4 งวด) over the trap/look-…24f2f2e -
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: lock coming-soon options, soft-orange arrows, always-show extra data, smart doc-type default
- Grey out + disable (unclickable) the coming-soon form options in the dropdown via a DOM MutationObserver (matched by the lock marker). - Dropdown arrows -> soft orange (#F58A52, deepen on hover) with a pointer cursor. - Replace the 'ดูข้อมูลอื่น ๆ' expander with an always-visible section. - Default ประเภทเอกสาร from the PO's procurement type via _is_jang: งานจ้าง -> แจ้งให้เริ่มเข้าทำงาน, งานซื้อ -> แจ้งให้เริ่มส่งมอบสินค้า (applied once per looked-up PO; user can still override). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>2becdbf -
Auto-form: enlarge login lock icon (58->78px tile, 26->36px glyph)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>59262ca -
Auto-form: demote login lock icon so it doesn't read as a button
Flat peach-tinted tile with an orange glyph (was a solid orange-gradient tile with a drop shadow, which competed with the real Microsoft CTA). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>f523c9f -
Auto-form: switch to warm peach light theme + reshape hero header
- Convert dark ember theme to light warm-peach/orange palette across config.toml, streamlit_app.py and auth_gate.py (login + topbar). - Reshape hero to the reference: PTT pill, DOCUMENT GENERATOR eyebrow, two-tone Auto Form wordmark, and a highlighted subtitle (ระบบสร้าง[หนังสือแจ้งเข้าเริ่มงาน]อัตโนมัติ). - Drop the description paragraph and feature line from the hero. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>4e06d98 -
Auto-form: declutter the login card (remove redundant text)
Drop the two description lines, the Entra-ID/'เฉพาะบัญชีองค์กร' footer badges, and the 'ปุ่มไม่ทำงาน? เปิดแบบเต็มหน้าจอ' hint, plus their orphaned CSS. Login card is now just header + lock + 'เข้าสู่ระบบ' + the Microsoft button. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>ea6ec06 -
Auto-form: add the รับทราบ acknowledgement box (bottom-left) to form1
Bordered 1-cell box with 'รับทราบ' + signature line + ( ) name + ตำแหน่ง.. + วันที่.., for the vendor to sign on receipt, matching the real letters. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>c6994c8 -
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: remove the หมายเหตุ note block from form1 template
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>9b33109 -
Auto-form: switch body to the "ตกลงว่าจ้าง…ให้ดำเนินการ" format, TOR-driven duration
Per the user's example: para 1 = "ตามที่ <unit> บริษัท ปตท. จำกัด (มหาชน) (ปตท.) ได้ตกลง [ว่าจ้าง/ซื้อ] <vendor> ให้ดำเนินการ <work> โดยกำหนดให้แล้วเสร็จภายใน X วัน [(วันหยุด)] นับถัดจาก <เหตุ> ทั้งนี้ไม่นับรวมระยะเวลาที่ ปตท. ไม่อนุญาตให้เข้าดำเนินงาน/สั่งหยุดงาน"; para 2 = "<unit> จึงขอแจ้งให้ <vendor> เริ่มเข้าดำเนินการได้นับถัดจากวันที่ <date> เป็นต้นไป". The "ภายใน X วัน … นับถัดจาก <เหตุ>" duration is now lifted from the TOR delivery clause (_duration_from_tor), falling back to daySLA + the standard event. Work keeps its full title. unit ← prCreatorUnitName leads para 1 and is the subject of para 2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>fce7fb0 -
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 "creating" animation during generation
Replace the plain spinner with a themed pure-CSS animation (pulsing ember orb + sparkle, shimmering "writing" lines, animated label "AI กำลังเรียบเรียงเอกสาร…") shown in a placeholder while the OpenRouter call + docx render run; cleared on success or error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>143187f -
Auto-form: always show งวด selector (single-งวด had no dropdown)
Single-งวด TORs previously showed only a caption, so there was no งวด to select. Now the งวด selector is always a selectbox: TOR-enumerated งวด when several exist, otherwise งวดเดียว + manual งวดที่ 1..12 (for On call / per-งวด letters). The AI prompt handles a manually-picked งวดที่ N over a งวดเดียว clause by reusing the overall timing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>83ce937 -
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: lock forms 2–5 as "coming soon"
Only form 1 is live. Forms 2–5 show a 🔒 เร็ว ๆ นี้ suffix in the selector and, when chosen, disable PO lookup + all of Step 2 and show a coming-soon notice. Single source of truth: COMING_SOON_IDS in streamlit_app.py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1c8255f -
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: silent background LNA check; notify only when not allowed
Replace the upfront "เปิดใช้งาน" card with a background probe that auto-fires on load (which itself triggers the one-time Allow prompt). Granted -> seamless, zero UI. Only if the user did NOT allow (Block / off-network) do we show a notification + recovery steps + Retry. App stays gated until allowed. Fresh probe key per attempt so Retry actually re-fetches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>8433a01 -
signer: hard Local Network Access entry gate (no manual fallback)
Per product decision: the app is unusable until the browser can reach the SMP gateway — the user must click the one-time "Allow" (Local Network Access). No skip / no manual entry. - require_local_network(): entry gate after login. Shows an "เปิดใช้งาน" card that primes and triggers the native Allow prompt (preflighted probe via signer_lookup.build_probe_js), confirms reachability, then unlocks the app. Blocked/off-network → recovery steps (PTT network/VPN; re-enable via lock icon → Local network → Allow) + Retry, st.stop() otherwise. No bypass. - build_probe_js(): tiny preflighted reachability fetch that triggers LNA + confirms access. - signer step: removed the manual ชื่อผู้ลงนาม text box; not-found now offers a Retry only. Tradeoff (accepted): off-network users and Block-clickers can't use the app until they grant/connect — by design. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>adf9eeb -
signer: revive browser-side fetch via Local Network Access (Chrome/Edge 142+)
Research + live testing (2026-06-30) overturned the earlier "browser can't reach it" verdict: Chrome 142 replaced the hard PNA block with a user-grantable Local Network Access permission. Verified on Edge 149: a fetch from the public HF origin to the private 10.x gateway returns HTTP 401 (reachable), and `localNetworkAccess` is a grantable permission — i.e. the user's one-time "Allow" click unblocks it. No IT, no PC component. - signer_lookup.py: restore build_signers_js (PO→PR→approver→chairman chain, per-fetch AbortController timeout + Report retry-on-empty + JSON.stringify result). Keep role_kind/ pick_signer/pick_position/SIGNER_COLUMN. - streamlit_app.py: resolve the signer from (1) DATA_URL columns if present, else (2) a live browser fetch via streamlit-js-eval (swapped in for the broken streamlit-javascript), else (3) manual box. Loading state nudges the user to click "Allow" once. - requirements.txt: streamlit-js-eval (replaces the abandoned streamlit-javascript). Nee…234b73f -
signer: read names from the data file (Power BI via on-prem gateway), drop the browser fetch
Root cause of the production failure: the browser-side signer fetch is fundamentally blocked. The SMP gateway is a private 10.x host with no public DNS, and Chrome's Private Network Access blocks a public webpage (the HF Space) from calling it (console: "blocked by CORS policy: ... access the `local` address space"). streamlit-javascript was also broken on the current Streamlit ("handleSetComponentValue: missing 'value' prop"). No client-side bridge can fix this — a public app cannot reach the private network. New design: the names ride the OneDrive DATA_URL file the app already reads. The Power BI model fetches them during its scheduled refresh THROUGH an on-premises data gateway (personal mode), adding approverName / chairmanName columns. The app just reads them. - streamlit_app.py: replace fetch_signers_for_po/fetch_signer_name (browser fetch) with signer_from_lookup() reading approverName/chairmanName from lookup_data; remove the streamlit-javascript import, the SMP_TOKEN env…5c120b3 -
signer: retry the PO->PR Report on transient empty responses
Organization_Tracking_Report intermittently returns 200 + [] for valid POs (observed live 2026-06-30: an all-POs-empty window that self-cleared minutes later; same PO went 0 -> 8/8 on retry, no-reply and personal token identical). The resolver did a single fetch and treated [] as "PO not found", so a transient blip falsely showed "ไม่พบ PO นี้ในระบบ" and forced manual entry. - Retry the Report up to 3x (0.6s*n backoff) before giving up; an empty array is not proof the PO is absent. - Soften the give-up message to name the transient cause. - Bump the overall chain ceiling 14s -> 16s to fit the retries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>051f27f -
signer: stop the infinite "กำลังดึงชื่อผู้ลงนาม…" spinner
Root cause: the browser-side resolver had no fetch timeout, so a hung request (e.g. a corporate proxy blackholing the socket) left the IIFE Promise unsettled — streamlit-javascript never posted a value, st_javascript stayed at its 0/None default, and fetch_signers_for_po returned None forever. The loading branch had no manual fallback, so the whole form was blocked. - signer_lookup.py: every fetch now has an AbortController timeout (9s) plus an overall 14s race-guard; the IIFE always resolves to a JSON string (starts with "{"), making the Python parse deterministic and removing the dependency on streamlit-javascript returning a real object. - streamlit_app.py: the loading branch now also renders the manual ชื่อผู้ลงนาม text box (same widget key) so the user is never fully blocked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>ab55d2f -
signer: resolve ผู้มีอำนาจอนุมัติ / ประธานกรรมการตรวจรับ live via browser-side fetch
The HF server can't reach the PTT-internal SMP gateway, but the user's PTT-wifi browser can (gateway sends CORS *). signer_lookup.py builds a client-side fetch (PO -> SAP PR -> approver + receiving-committee chairman); streamlit-javascript runs it and returns the names; fetch_signer_name picks by role, with a manual text-box fallback when off-network. Uses the read-only no-reply token (SMP_TOKEN Space secret), injected into client JS — Entra-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>99146e1 -
signer: role choice + placeholder API
145e4ee -
Login: add full-screen escape hatch for embedded (iframe) case
When the app is opened from the HF Space page it runs in an iframe, where st.login()'s redirect is blocked by Microsoft's frame-busting ("nothing happens"). Add a host-agnostic link (href="/" target="_blank") to reopen the app top-level where sign-in works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>3c3b156