From 1de3bb9388ee384a3cd69f351a4cedaee5328550 Mon Sep 17 00:00:00 2001 From: xianren Date: Sun, 5 Apr 2026 12:11:36 +0800 Subject: [PATCH] fix: correct FoJin URL format for juan paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FoJin frontend route is '/texts/:id/read?juan=N' (query param), not '/texts/{id}/juan/{N}' (path segment). Old format fell through to React router 404. Verified against FoJin frontend App.tsx route definitions: - /texts/:id → TextDetailPage - /texts/:id/read → TextReaderPage (uses ?juan= query) --- tools/rag_query.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/rag_query.py b/tools/rag_query.py index ef4d474..6efb314 100644 --- a/tools/rag_query.py +++ b/tools/rag_query.py @@ -90,7 +90,7 @@ def format_semantic_results(data: dict, brief: bool = False) -> str: link = f"https://fojin.app/texts/{text_id}" if text_id else "" if text_id and juan: - link += f"/juan/{juan}" + link = f"https://fojin.app/texts/{text_id}/read?juan={juan}" score_str = f" (score={score:.2f})" if isinstance(score, (int, float)) else "" snippet = str(content).strip().replace("\n", " ")[:80] @@ -116,9 +116,10 @@ def format_semantic_results(data: dict, brief: bool = False) -> str: if score: lines.append(f"相似度: {score}") if text_id: - link = f"https://fojin.app/texts/{text_id}" if juan: - link += f"/juan/{juan}" + link = f"https://fojin.app/texts/{text_id}/read?juan={juan}" + else: + link = f"https://fojin.app/texts/{text_id}" lines.append(f"FoJin链接: {link}") if content: content_str = str(content)