Files
DeepTutor/tests
evan188199-tech c72185aad6 fix(rag): improve local LlamaIndex pipeline compatibility (#864)
* 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>
2026-08-24 16:34:55 +08:00
..
2026-08-19 17:34:52 +08:00