mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-15 21:11:05 +02:00
fix: empty-list scope, get_tree bool casing, md fence tracking; dedupe base URL
- local get_agent_tools: `set(doc_ids) if doc_ids is not None else None` so doc_ids=[] is a scope of nothing (reject all), not open mode. The public query path already guarded []; this hardens direct callers. - legacy get_tree: send summary=true/false (lowercase) instead of Python's capitalized True/False, matching the modern CloudBackend and the API. - markdown parser: track the opening fence character so a ```-fence isn't closed by a ~~~ line (CommonMark), keeping '#'-lines inside it out of headings. - dedupe the cloud base URL: single API_BASE in cloud_api, referenced by CloudBackend and PageIndexClient (was three independent copies). Regression tests for each.
This commit is contained in:
parent
e18ccdeaf8
commit
d97231b480
8 changed files with 83 additions and 15 deletions
|
|
@ -100,3 +100,22 @@ def test_tilde_fenced_code_blocks_are_recognized(tmp_path):
|
|||
titles = [n.title for n in result.nodes]
|
||||
assert titles == ["Real Header", "Real Sub"]
|
||||
assert "not a real header" not in " ".join(n.title for n in result.nodes)
|
||||
|
||||
|
||||
def test_backtick_fence_is_not_closed_by_a_tilde_line(tmp_path):
|
||||
"""CommonMark: a ```-opened fence is closed only by ```. A ~~~ line inside
|
||||
it is content, so a '#'-prefixed line stays inside the still-open block and
|
||||
a real heading after the real close is still recognized."""
|
||||
md = tmp_path / "mixed.md"
|
||||
md.write_text(
|
||||
"# Real Header\n"
|
||||
"```\n"
|
||||
"~~~\n" # tilde line INSIDE the backtick fence — NOT a close
|
||||
"# not a heading\n" # stays inside the still-open code block
|
||||
"```\n" # this (matching char) closes the fence
|
||||
"## Real Sub\n"
|
||||
)
|
||||
result = MarkdownParser().parse(str(md))
|
||||
titles = [n.title for n in result.nodes]
|
||||
assert titles == ["Real Header", "Real Sub"]
|
||||
assert "not a heading" not in " ".join(n.title for n in result.nodes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue