Commit Graph

9 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
3ef9ee8886 Merge PR #2513: fix: pick the JSON fence when a code snippet fence comes first
Prefer explicit JSON fences over unlabeled examples, ignore other language fences, and cover both precedence and embedded JSON preservation.
2026-11-14 23:07:03 +08:00
Mohammad Hijjawi
e27aa512df fix: pick the JSON fence when a code snippet fence comes first
parse_json_response extracted only the first fenced block, so a reply
that shows a code snippet (for example a ```python block) before the
fenced JSON payload lost the payload: it returned a list literal from the
snippet or the fallback. Prefer the first fenced block that holds a JSON
object or array, and keep the first block otherwise.
2026-11-07 10:41:08 +00:00
Bingxi Zhao (Frank)
c96440d6ac fix: harden Responses stream parsing (#825) 2026-08-12 16:11:21 +08:00
Bingxi Zhao (Frank)
34ca1cb27c fix(utils): return the longest decodable JSON value, not the first (#692)
The raw_decode scan added for trailing brace-prose returned the first
decodable value in the response. DeepSeek-style reasoning preludes often
embed a small schema example (e.g. {"chapters": []}) before the real
payload, so the example shadowed the actual object and BookEngine's
SpineAgent fell back to a single Overview chapter. Scan every top-level
candidate and keep the longest decode instead.
2026-07-24 17:39:00 +08:00
Cyriellewu
b020686ced fix(json_parser): strip <think> reasoning tags before parsing (#675)
Reasoning models (Qwen, DeepSeek, etc.) emit chain-of-thought inside
<think>...</think> blocks before the JSON payload. parse_json_response()
did not account for this: a brace inside the reasoning was picked up by
the raw_decode scan and returned instead of the real object, silently
yielding wrong or empty data (e.g. empty BookEngine proposal fields).

Strip <think> blocks only on the direct-parse failure path, so a valid
JSON payload whose string values legitimately contain the substring
'<think>' is preserved exactly. Also drop an unclosed leading <think>
prelude up to the first JSON opener, and return the fallback when the
response is reasoning-only with no payload.

Fixes #673

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-24 16:04:42 +08:00
santhreal
5c3e5bf560 fix(utils): decode trailing-prose JSON before repair
json-repair wrapped a valid object plus trailing brace-prose into an array,
corrupting book/question callers that expect a single object. Prefer
raw_decode of the first JSON value before repair.
2026-07-22 22:49:04 -07:00
Bingxi Zhao (Frank)
90a2c14c81 chore: backend + frontend follow-ons for v1.4.0-beta
Wires the new memory / capability / settings / quiz subsystems into
existing surfaces and finishes the chat-pipeline follow-on work.

Backend:
- Session services pick up the cumulative source inventory + new tool
  tags (turn_runtime, sqlite_store, pocketbase_store, protocol,
  base_session_manager).
- LlamaIndex RAG pipeline config / document_loader / retrievers
  tightened; rag/service.py routed to match.
- Sessions / unified_ws / settings / notebook routers updated for
  delete-chat-turn, multi-user, and the new tool surface.
- TutorBot manager + Zulip channel + openai_compat_provider follow-on
  fixes layered on top of the v1.3.10 SSL/Zulip sweeps.
- runtime/{banner, launcher, orchestrator}, services/setup/init,
  prompt/manager, json_parser refined for the runtime-settings
  rewrite.

Frontend:
- Co-Learn pages and session-surfaces removed (folded into chat).
- Chat composer / messages / trace / session panels, sidebars,
  common modals, markdown renderers, and i18n updated for the new
  ask_user / write_note / source-inventory flow.
- Admin, agents, co-writer, playground, book pages picked up the
  shared updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:08:22 +08:00
Bingxi Zhao (Frank)
77f29cbcc7 fix lint 2026-04-23 19:29:16 +08:00
Bingxi Zhao (Frank)
9544075d60 v1.1.0-beta
URL-based chat routing, Snow theme, WebSocket heartbeat & auto-reconnect,
ChatComposer perf optimization, embedding provider registry overhaul,
Serper search provider, streaming idle timeout, and expanded test suite.

Made-with: Cursor
2026-04-14 22:11:48 +08:00