Enhance logging and progress handling in SSH operations

- Updated the `_log_default` function to handle messages starting with `\r` for in-place updates.
- Introduced `split_ssh_stream` to differentiate between line and progress events in SSH output.
- Implemented `feed_ssh_log` to dispatch log messages based on event type.
- Refactored `_stream_pty_output` to utilize the new logging and event handling functions.
- Enhanced the `log` function in `term.py` to support progress updates, ensuring a cleaner output experience.
- Updated `DownloadProgress` classes in `civitai_fetch.py` and `llamacpp_fetch.py` to print progress in place, improving user feedback during downloads.
This commit is contained in:
Leonid Pershin
2026-08-21 07:20:28 +03:00
parent 4186d0bcf1
commit aca8d5e990
7 changed files with 196 additions and 29 deletions
+3 -1
View File
@@ -96,7 +96,9 @@ def pull_stream(name: str, label: str) -> None:
if now - last_print >= 1.0 or done >= total:
elapsed = max(now - t0, 0.001)
speed = done / elapsed
print(progress_line(label, done, total, speed), flush=True)
line = progress_line(label, done, total, speed)
end = "\n" if done >= total else "\r"
print(line, end=end, flush=True)
last_print = now
elif status and status not in {"success"} and now - last_print >= 2.0:
print(f"{label} {status}", flush=True)