fix: address max-effort review findings

- clamp LLM-derived page indices in _get_text_of_pages and
  get_text_of_pdf_pages_with_labels; dedupe get_text_of_pdf_pages
- guard _normalize_tree and folders/documents iterations against
  explicit nulls in cloud API responses
- coerce cloud OCR page numbers to int before filtering in
  get_page_content
- folder cache: raise on missing folder id instead of caching None;
  stop caching name-not-found so later lookups can succeed
- defang doc_id in agent doc-context prompt
- append api-key hint to 401 errors (request, legacy and streaming
  paths)
- remove stale legacy JSON workspace sample data unreadable by the
  SQLite storage
This commit is contained in:
Ray 2026-07-13 18:48:55 +08:00
parent 9ad54122bb
commit 3ff04d501a
7 changed files with 70 additions and 323 deletions

View file

@ -65,7 +65,7 @@ def wrap_with_doc_context(docs: list[dict], question: str) -> str:
"""
lines = []
for d in docs:
line = f"- {d['doc_id']}: {_defang_delimiters(d.get('doc_name', ''))}"
line = f"- {_defang_delimiters(str(d['doc_id']))}: {_defang_delimiters(d.get('doc_name', ''))}"
desc = d.get("doc_description") or ""
if desc:
line += f"{_defang_delimiters(desc)}"