chore: update something
Browse files- docsifer/router.py +2 -0
- docsifer/service.py +3 -2
docsifer/router.py
CHANGED
@@ -67,6 +67,7 @@ async def convert_document(
|
|
67 |
raise ValueError("Invalid JSON in 'settings' parameter.")
|
68 |
|
69 |
cleanup = settings_config.get("cleanup", True)
|
|
|
70 |
|
71 |
# If a file is provided, use it; otherwise, fetch the content from the URL.
|
72 |
if file is not None:
|
@@ -74,6 +75,7 @@ async def convert_document(
|
|
74 |
temp_path = Path(tmpdir) / file.filename
|
75 |
contents = await file.read()
|
76 |
temp_path.write_bytes(contents)
|
|
|
77 |
result, token_count = await docsifer_service.convert_file(
|
78 |
source=str(temp_path),
|
79 |
openai_config=openai_config,
|
|
|
67 |
raise ValueError("Invalid JSON in 'settings' parameter.")
|
68 |
|
69 |
cleanup = settings_config.get("cleanup", True)
|
70 |
+
print("> convert_document, file", [file, file is not None])
|
71 |
|
72 |
# If a file is provided, use it; otherwise, fetch the content from the URL.
|
73 |
if file is not None:
|
|
|
75 |
temp_path = Path(tmpdir) / file.filename
|
76 |
contents = await file.read()
|
77 |
temp_path.write_bytes(contents)
|
78 |
+
print("> convert_document, temp_path", [temp_path, temp_path.exists()])
|
79 |
result, token_count = await docsifer_service.convert_file(
|
80 |
source=str(temp_path),
|
81 |
openai_config=openai_config,
|
docsifer/service.py
CHANGED
@@ -150,14 +150,15 @@ class DocsiferService:
|
|
150 |
new_filename = f"{src.stem}{guessed_ext}"
|
151 |
tmp_path = src.parent / new_filename
|
152 |
tmp_path.write_bytes(src.read_bytes())
|
153 |
-
src.unlink()
|
154 |
|
155 |
logger.info(
|
156 |
-
"Using temp file: %s, MIME type: %s, Guessed ext: %s, Existing: %s",
|
157 |
tmp_path,
|
158 |
mime_type,
|
159 |
guessed_ext,
|
160 |
tmp_path.exists(),
|
|
|
161 |
)
|
162 |
|
163 |
# Perform HTML cleanup if requested.
|
|
|
150 |
new_filename = f"{src.stem}{guessed_ext}"
|
151 |
tmp_path = src.parent / new_filename
|
152 |
tmp_path.write_bytes(src.read_bytes())
|
153 |
+
# src.unlink()
|
154 |
|
155 |
logger.info(
|
156 |
+
"Using temp file: %s, MIME type: %s, Guessed ext: %s, Existing: %s, Source size: %s",
|
157 |
tmp_path,
|
158 |
mime_type,
|
159 |
guessed_ext,
|
160 |
tmp_path.exists(),
|
161 |
+
src.stat().st_size,
|
162 |
)
|
163 |
|
164 |
# Perform HTML cleanup if requested.
|