fix: correct FoJin URL format for juan paths

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)
This commit is contained in:
xianren
2026-04-05 12:11:36 +08:00
parent eb87794773
commit 1de3bb9388
+4 -3
View File
@@ -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 "" link = f"https://fojin.app/texts/{text_id}" if text_id else ""
if text_id and juan: 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 "" score_str = f" (score={score:.2f})" if isinstance(score, (int, float)) else ""
snippet = str(content).strip().replace("\n", " ")[:80] snippet = str(content).strip().replace("\n", " ")[:80]
@@ -116,9 +116,10 @@ def format_semantic_results(data: dict, brief: bool = False) -> str:
if score: if score:
lines.append(f"相似度: {score}") lines.append(f"相似度: {score}")
if text_id: if text_id:
link = f"https://fojin.app/texts/{text_id}"
if juan: 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}") lines.append(f"FoJin链接: {link}")
if content: if content:
content_str = str(content) content_str = str(content)