vivekchakraverty Claude Opus 4.8 commited on
Commit
8b53847
·
1 Parent(s): 1ff6e50

Surface Generate errors in the guide panel; raise LLM max_tokens to 4096

Browse files

Generate failures (missing token, LLM/provider error, no steps) now render in the
guide panel itself, not only the easy-to-miss bottom status line — the likely reason
the deployed Generate looked broken (the warning was off-screen). Also raise the
default output cap so longer guides aren't truncated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +7 -3
  2. src/config.py +1 -1
app.py CHANGED
@@ -305,15 +305,19 @@ def _generate_draft(tr, token: str, progress):
305
 
306
 
307
  def on_generate(transcript_text: str, transcript_obj, hf_token: str, progress=gr.Progress()):
 
 
308
  token = config.apply_token(hf_token)
309
  if not token:
310
- return "", None, "⚠️ Enter your HuggingFace token above to generate the guide."
 
311
  tr = _parse_timestamped_text(transcript_text) if transcript_text.strip() else transcript_obj
312
  if tr is None or not tr.segments:
313
- return "", None, "Transcribe the audio first (or paste a transcript)."
 
314
  draft, msg = _generate_draft(tr, token, progress)
315
  if draft is None:
316
- return "", None, msg
317
  return _draft_to_md(draft), draft, msg + " Review, then build the DOCX."
318
 
319
 
 
305
 
306
 
307
  def on_generate(transcript_text: str, transcript_obj, hf_token: str, progress=gr.Progress()):
308
+ # Show any failure reason in the guide panel itself (not just the bottom
309
+ # status line, which is easy to miss far down the page).
310
  token = config.apply_token(hf_token)
311
  if not token:
312
+ m = "⚠️ Enter your HuggingFace token in the 🔑 box at the **top** of the page, then click Generate again."
313
+ return m, None, m
314
  tr = _parse_timestamped_text(transcript_text) if transcript_text.strip() else transcript_obj
315
  if tr is None or not tr.segments:
316
+ m = "⚠️ Transcribe the audio first (step 2), or paste a transcript, then generate."
317
+ return m, None, m
318
  draft, msg = _generate_draft(tr, token, progress)
319
  if draft is None:
320
+ return f"⚠️ {msg}", None, msg
321
  return _draft_to_md(draft), draft, msg + " Review, then build the DOCX."
322
 
323
 
src/config.py CHANGED
@@ -103,7 +103,7 @@ def resolve_hf_token() -> str | None:
103
  # --- Text LLM (HF Inference API) --------------------------------------------
104
  LLM_MODEL = os.getenv("DOCUMAKER_LLM_MODEL", "Qwen/Qwen2.5-7B-Instruct")
105
  LLM_PROVIDER = os.getenv("DOCUMAKER_LLM_PROVIDER", "").strip() or None
106
- LLM_MAX_TOKENS = int(os.getenv("DOCUMAKER_LLM_MAX_TOKENS", "2048"))
107
  LLM_TEMPERATURE = float(os.getenv("DOCUMAKER_LLM_TEMPERATURE", "0.3"))
108
  # Approx. characters of transcript per LLM chunk (keeps prompts within context).
109
  LLM_CHUNK_CHARS = int(os.getenv("DOCUMAKER_LLM_CHUNK_CHARS", "6000"))
 
103
  # --- Text LLM (HF Inference API) --------------------------------------------
104
  LLM_MODEL = os.getenv("DOCUMAKER_LLM_MODEL", "Qwen/Qwen2.5-7B-Instruct")
105
  LLM_PROVIDER = os.getenv("DOCUMAKER_LLM_PROVIDER", "").strip() or None
106
+ LLM_MAX_TOKENS = int(os.getenv("DOCUMAKER_LLM_MAX_TOKENS", "4096"))
107
  LLM_TEMPERATURE = float(os.getenv("DOCUMAKER_LLM_TEMPERATURE", "0.3"))
108
  # Approx. characters of transcript per LLM chunk (keeps prompts within context).
109
  LLM_CHUNK_CHARS = int(os.getenv("DOCUMAKER_LLM_CHUNK_CHARS", "6000"))