mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 00:11:04 +08:00
* fix(rag): improve local pipeline compatibility * fix(rag): resolve tqdm progress at call time, not at import `show_progress: bool = should_show_progress()` is a default argument, so Python evaluated it once when the module was first imported and froze the result for the process lifetime. That defeated the fix in both directions: a server started from a terminal froze `True` and kept writing tqdm bars into the pipe whose read end can close mid-indexing (the BrokenPipeError this guards against), while a CLI launched with piped stdout froze `False` and never showed progress again. Take `show_progress: bool | None = None` and resolve inside the body of the two functions that consume the value; the pure forwarders pass `None` through so the decision is made once, at the point of use. The accompanying test was green only because pytest captures stdout, so the frozen default already read `False` — it never exercised the mechanism. It now asserts both directions and fails under `pytest -s` if the default argument comes back. --------- Co-authored-by: XZH <cto@xzh.ai> Co-authored-by: Frank <bingxizhao@novix.science>