-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Personal/ranxia/fix html reader (#297)
* fix html reader * fix html reader * fix html reader
- Loading branch information
1 parent
65a5a1d
commit 51dc01e
Showing
8 changed files
with
579 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
from pathlib import Path | ||
from pai_rag.core.rag_config_manager import RagConfigManager | ||
from pai_rag.core.rag_module import resolve | ||
from pai_rag.integrations.readers.pai.pai_data_reader import PaiDataReader | ||
from pai_rag.integrations.readers.pai_html_reader import PaiHtmlReader | ||
|
||
BASE_DIR = Path(__file__).parent.parent.parent | ||
|
||
|
||
def test_pai_html_reader(): | ||
config_file = os.path.join(BASE_DIR, "src/pai_rag/config/settings.toml") | ||
config = RagConfigManager.from_file(config_file).get_value() | ||
directory_reader = resolve( | ||
cls=PaiDataReader, | ||
reader_config=config.data_reader, | ||
) | ||
input_dir = "tests/testdata/data/html_data" | ||
|
||
directory_reader.file_readers[".html"] = PaiHtmlReader() | ||
|
||
documents = directory_reader.load_data(file_path_or_directory=input_dir) | ||
assert len(documents) == 5 |
97 changes: 97 additions & 0 deletions
97
tests/testdata/data/html_data/AIGC Stable Diffusion文生图Lora模型微调实现虚拟上装.html
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.