Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -400,19 +400,14 @@ def _build_live_view_text(chat_id: int, mode: str = "status") -> str:
|
|
| 400 |
else:
|
| 401 |
status = compose_status_message(chat_id, include_config=False, include_logs=False)
|
| 402 |
logs = session.get('live_log_lines_user', [])
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
return (stripped[:58] + "…") if len(stripped) > 58 else stripped
|
| 406 |
-
compact_logs = [_compact_log(l) for l in logs[-5:]] if logs else ["No logs yet."]
|
| 407 |
-
log_tail = "\n".join(compact_logs)
|
| 408 |
-
pause_note = "\n<i>⏸ Paused — tap ▶️ Resume</i>" if is_paused else ""
|
| 409 |
|
| 410 |
# Only show log tail while actively streaming
|
| 411 |
if state in ("streaming", "starting", "paused", "reconnecting"):
|
| 412 |
return (
|
| 413 |
-
f"{status}
|
| 414 |
-
f"📋 <b>Logs:</b>
|
| 415 |
-
f"{pause_note}"
|
| 416 |
)
|
| 417 |
else:
|
| 418 |
return status + pause_note
|
|
@@ -909,11 +904,8 @@ def compose_status_message(chat_id: int, include_config: bool = False, include_l
|
|
| 909 |
|
| 910 |
if include_logs and state in ("streaming", "paused", "starting", "reconnecting"):
|
| 911 |
user_logs = session.get('live_log_lines_user', [])
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
return (s[:58] + "…") if len(s) > 58 else s
|
| 915 |
-
last_logs = "\n".join([_fmt_log(l) for l in user_logs[-5:]]) if user_logs else "No logs yet."
|
| 916 |
-
lines += ["", f"📋 <b>Logs:</b> <pre>{esc(last_logs)}</pre>"]
|
| 917 |
|
| 918 |
return "\n".join(lines)
|
| 919 |
|
|
|
|
| 400 |
else:
|
| 401 |
status = compose_status_message(chat_id, include_config=False, include_logs=False)
|
| 402 |
logs = session.get('live_log_lines_user', [])
|
| 403 |
+
log_tail = "\n".join(logs[-4:]) if logs else "No logs yet."
|
| 404 |
+
pause_note = " <i>⏸ paused</i>" if is_paused else ""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
|
| 406 |
# Only show log tail while actively streaming
|
| 407 |
if state in ("streaming", "starting", "paused", "reconnecting"):
|
| 408 |
return (
|
| 409 |
+
f"{status}"
|
| 410 |
+
f"\n📋 <b>Recent Logs:</b>{pause_note}\n<pre>{esc(log_tail)}</pre>"
|
|
|
|
| 411 |
)
|
| 412 |
else:
|
| 413 |
return status + pause_note
|
|
|
|
| 904 |
|
| 905 |
if include_logs and state in ("streaming", "paused", "starting", "reconnecting"):
|
| 906 |
user_logs = session.get('live_log_lines_user', [])
|
| 907 |
+
last_logs = "\n".join(user_logs[-4:]) if user_logs else "No logs yet."
|
| 908 |
+
lines += [f"\n📋 <b>Recent Logs:</b>\n<pre>{esc(last_logs)}</pre>"]
|
|
|
|
|
|
|
|
|
|
| 909 |
|
| 910 |
return "\n".join(lines)
|
| 911 |
|