mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
Fix chat stream recovery and PDF library indexing (#468)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_stream_render_helpers_are_visible_to_catch_block():
|
||||
source = Path("static/js/chat.js").read_text(encoding="utf-8")
|
||||
try_start = source.index(" try {\n // Re-enable auto-scroll")
|
||||
catch_start = source.index(" } catch (err) {", try_start)
|
||||
|
||||
outer_scope = source[:try_start]
|
||||
try_body = source[try_start:catch_start]
|
||||
|
||||
assert "let _renderStream = () => {};" in outer_scope
|
||||
assert "let _cancelThinkingTimer = () => {};" in outer_scope
|
||||
assert "let _removeThinkingSpinner = () => {};" in outer_scope
|
||||
|
||||
assert "_renderStream = () => {" in try_body
|
||||
assert "_cancelThinkingTimer = () => {" in try_body
|
||||
assert "_removeThinkingSpinner = () => {" in try_body
|
||||
assert "function _renderStream()" not in try_body
|
||||
@@ -0,0 +1,24 @@
|
||||
from pathlib import Path
|
||||
|
||||
from src import personal_docs
|
||||
|
||||
|
||||
def test_personal_index_includes_pdf_uploads(tmp_path, monkeypatch):
|
||||
pdf_path = tmp_path / "notes.pdf"
|
||||
pdf_path.write_bytes(b"%PDF-1.4 fake test pdf")
|
||||
|
||||
monkeypatch.setattr(
|
||||
personal_docs,
|
||||
"extract_pdf_text",
|
||||
lambda path: "readable pdf text" if Path(path) == pdf_path else "",
|
||||
)
|
||||
|
||||
files = personal_docs.load_personal_index(str(tmp_path))
|
||||
|
||||
assert [item["name"] for item in files] == ["notes.pdf"]
|
||||
assert files[0]["path"] == str(pdf_path)
|
||||
assert files[0]["chunks"] == ["readable pdf text"]
|
||||
|
||||
|
||||
def test_personal_index_default_extensions_advertise_pdf_support():
|
||||
assert ".pdf" in personal_docs.config.DEFAULT_EXTENSIONS
|
||||
Reference in New Issue
Block a user