fix: improve llmwiki search integration

This commit is contained in:
Administrator committed 2026-08-13 16:03:08 +08:00
1 parent 4809ee7db3
commit 56044d9cb7
20 files changed
+504 -66

No files matched your search

@@ -104,6 +104,82 @@ async def test_configurable_search_handles_empty_results() -> None:
assert result == {"query": "nothing", "total_results": 0, "results": []}
@pytest.mark.asyncio
async def test_configurable_search_accepts_root_array_results() -> None:
async def handler(_: httpx.Request) -> httpx.Response:
return httpx.Response(
200,
json=[
{
"recUuid": "root-array-record",
"content": "direct array content",
"title": "direct array title",
"url": "https://original.example.test/root-array",
}
],
)
result = json.loads(
await execute_search(
"array response",
_settings(result_url_template=""),
transport=httpx.MockTransport(handler),
)
)
assert result == {
"query": "array response",
"total_results": 1,
"results": [
{
"recUuid": "root-array-record",
"content": "direct array content",
"title": "direct array title",
"url": "https://original.example.test/root-array",
}
],
}
@pytest.mark.asyncio
async def test_configurable_search_normalizes_metadata_wrapped_results() -> None:
async def handler(_: httpx.Request) -> httpx.Response:
return httpx.Response(
200,
json=[
{
"page_content": "outer content",
"metadata": {
"m_title": "metadata title",
"content": "metadata content",
"source1": "https://source.example.test/article/1",
"m_publish": "2026-08-13",
},
}
],
)
result = json.loads(
await execute_search(
"metadata response",
_settings(result_url_template=""),
transport=httpx.MockTransport(handler),
)
)
assert result["results"] == [
{
"recUuid": "",
"content": "outer content",
"title": "metadata title",
"source": "https://source.example.test/article/1",
"time": "2026-08-13",
"publish_time": "2026-08-13",
"url": "https://source.example.test/article/1",
}
]
@pytest.mark.asyncio
@pytest.mark.parametrize(
("response_factory", "expected_error"),